#pragma once

#include <QObject>

class UkuiGolbalCursor;
class UkuiGolbalCursorPrivate;

UkuiGolbalCursor *ukuiGolbalCursor();

class UkuiGolbalCursor
{
public:
    ~UkuiGolbalCursor();

    /** \brief cursor entered a frame

          This event indicates that when a cursor enters the frame. It shall be
          generated before the "position" and "hotspot" events.

          If the pointer object referenced by the seat does not exist, this event
          will not be triggered.
    */
    std::function<void()> &on_enter();

    /** \brief cursor left frame

          This event indicates that when a cursor leaves the frame. No "position"
       or "hotspot" event is generated for the cursor until the cursor enters the
          frame again.

          If the pointer object referenced by the seat is removed, this event will
       be sent.
    */
    std::function<void()> &on_leave();

    /** \brief informs cursor position
        \param x position x coordinates
        \param y position y coordinates

          This event informs the cursor position. The given position is
          relative to the frame's top left corner in transformed buffer
          pixel coordinates.

          Note, if the frame parameter is set to null in the capture_cursor
       request, the given position coordinates are global.
    */
    std::function<void(int32_t, int32_t)> &on_position();

    /** \brief informs cursor hotspot
        \param x hotspot x coordinates
        \param y hotspot y coordinates

          This event informs the cursor hotspot. The hotspot describes the offset
          between the cursor image and the position of the input device.

          The parameters x and y represent the offset of the new hotspot relative
          to the origin of the cursor image, which is typically the top-left
       corner of the image.
    */
    std::function<void(int32_t, int32_t)> &on_hotspot();

private:
    UkuiGolbalCursorPrivate *m_ukuiGolbalCursorPrivate = nullptr;

    explicit UkuiGolbalCursor();
    friend UkuiGolbalCursor *ukuiGolbalCursor();
};
