| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <QObject> |
| 4 |
|
| 5 |
class UkuiGolbalCursor; |
| 6 |
class UkuiGolbalCursorPrivate; |
| 7 |
|
| 8 |
UkuiGolbalCursor *ukuiGolbalCursor(); |
| 9 |
|
| 10 |
class UkuiGolbalCursor |
| 11 |
{ |
| 12 |
public: |
| 13 |
~UkuiGolbalCursor(); |
| 14 |
|
| 15 |
/** \brief cursor entered a frame |
| 16 |
|
| 17 |
This event indicates that when a cursor enters the frame. It shall be |
| 18 |
generated before the "position" and "hotspot" events. |
| 19 |
|
| 20 |
If the pointer object referenced by the seat does not exist, this event |
| 21 |
will not be triggered. |
| 22 |
*/ |
| 23 |
std::function<void()> &on_enter(); |
| 24 |
|
| 25 |
/** \brief cursor left frame |
| 26 |
|
| 27 |
This event indicates that when a cursor leaves the frame. No "position" |
| 28 |
or "hotspot" event is generated for the cursor until the cursor enters the |
| 29 |
frame again. |
| 30 |
|
| 31 |
If the pointer object referenced by the seat is removed, this event will |
| 32 |
be sent. |
| 33 |
*/ |
| 34 |
std::function<void()> &on_leave(); |
| 35 |
|
| 36 |
/** \brief informs cursor position |
| 37 |
\param x position x coordinates |
| 38 |
\param y position y coordinates |
| 39 |
|
| 40 |
This event informs the cursor position. The given position is |
| 41 |
relative to the frame's top left corner in transformed buffer |
| 42 |
pixel coordinates. |
| 43 |
|
| 44 |
Note, if the frame parameter is set to null in the capture_cursor |
| 45 |
request, the given position coordinates are global. |
| 46 |
*/ |
| 47 |
std::function<void(int32_t, int32_t)> &on_position(); |
| 48 |
|
| 49 |
/** \brief informs cursor hotspot |
| 50 |
\param x hotspot x coordinates |
| 51 |
\param y hotspot y coordinates |
| 52 |
|
| 53 |
This event informs the cursor hotspot. The hotspot describes the offset |
| 54 |
between the cursor image and the position of the input device. |
| 55 |
|
| 56 |
The parameters x and y represent the offset of the new hotspot relative |
| 57 |
to the origin of the cursor image, which is typically the top-left |
| 58 |
corner of the image. |
| 59 |
*/ |
| 60 |
std::function<void(int32_t, int32_t)> &on_hotspot(); |
| 61 |
|
| 62 |
private: |
| 63 |
UkuiGolbalCursorPrivate *m_ukuiGolbalCursorPrivate = nullptr; |
| 64 |
|
| 65 |
explicit UkuiGolbalCursor(); |
| 66 |
friend UkuiGolbalCursor *ukuiGolbalCursor(); |
| 67 |
}; |