AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ACursor.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 Alex2772 and Contributors
    4 *
    5 * SPDX-License-Identifier: MPL-2.0
    6 *
    7 * This Source Code Form is subject to the terms of the Mozilla Public
    8 * License, v. 2.0. If a copy of the MPL was not distributed with this
    9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   10 */
   11
   12#pragma once
   13
   14
   15#include <variant>
   16#include <AUI/Image/AImage.h>
   17#include "AUI/Image/IDrawable.h"
   18
   19class AWindow;
   20
   25class API_AUI_VIEWS ACursor
   26{
   27private:
   28    struct Custom;
   29
   30public:
   31    enum System {
   37        DEFAULT,
   38
   44        POINTER,
   45
   51        TEXT,
   52
   58        MOVE,
   59
   65        EW_RESIZE,
   66
   72        NS_RESIZE,
   73    };
   74
   75    ACursor(System systemCursor): mValue(systemCursor) {}
   76    explicit ACursor(aui::no_escape<AImage> image, int size = 16);
   77    explicit ACursor(aui::non_null<_<IDrawable>> drawable, int size = 16);
   78    explicit ACursor(AUrl imageUrl, int size = 16);
   79
   80    ~ACursor();
   81
   82    void applyNativeCursor(AWindow* pWindow) const;
   83
   84private:
   85    std::variant<System, _<Custom>, _<IDrawable>> mValue;
   86    int mSize;
   87};
Represents cursor type.
Definition ACursor.h:26
System
Definition ACursor.h:31
@ MOVE
Something to be moved. Crosshair-like cursor.
Definition ACursor.h:58
@ TEXT
'I' beam.
Definition ACursor.h:51
@ DEFAULT
Default arrow.
Definition ACursor.h:37
@ NS_RESIZE
Bidirectional resize cursor north-south.
Definition ACursor.h:72
@ EW_RESIZE
Bidirectional resize cursor east-west. <->
Definition ACursor.h:65
@ POINTER
Pointing finger.
Definition ACursor.h:44
Represents a window in the underlying windowing system.
Definition AWindow.h:45