aboutsummaryrefslogtreecommitdiff
path: root/src/ui/cursor.cpp
blob: d8c362ed4604a8cb7311a9cf2dc8ea085539ebba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "cursor.hpp"

#include "exception.hpp"

namespace cru::ui {
Cursor::Cursor(HCURSOR handle, const bool auto_release)
    : handle_(handle), auto_release_(auto_release) {}

Cursor::~Cursor() {
  if (auto_release_) ::DestroyCursor(handle_);
}

namespace cursors {
Cursor::Ptr arrow{};
Cursor::Ptr hand{};
Cursor::Ptr i_beam{};

void LoadSystemCursors() {
  arrow = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_ARROW), false);
  hand = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_HAND), false);
  i_beam = std::make_shared<Cursor>(::LoadCursorW(nullptr, IDC_IBEAM), false);
}
}  // namespace cursors
}  // namespace cru::ui