aboutsummaryrefslogtreecommitdiff
path: root/src/ui/cursor.cpp
blob: 91b94b16551f9d4dde747b38a5494a75adfedf8a (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
25
26
27
28
29
30
31
32
#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);
        }
    }
}