rute 0.0.4

UI library implemented on top of Qt
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// This file is auto-generated by rute_gen. DO NOT EDIT
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "../rute_base.h"
#include "../rute_manual.h"
#include <QCursor>
#include "cursor_ffi.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_swap(struct RUBase* self_c, struct RUBase* other) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->swap(*((QCursor*)other));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static int cursor_shape(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->shape();
    return s_cursor_shape_lookup[(int)ret_value];
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_set_shape(struct RUBase* self_c, int new_shape) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->setShape((Qt::CursorShape)s_cursor_shape_lookup[new_shape]);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUBitmap cursor_bitmap(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->bitmap();
    struct RUBitmap ctl;
    ctl.qt_data = (struct RUBase*)ret_value;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)ret_value];
    ctl.all_funcs = &s_bitmap_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUBitmap cursor_mask(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->mask();
    struct RUBitmap ctl;
    ctl.qt_data = (struct RUBase*)ret_value;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)ret_value];
    ctl.all_funcs = &s_bitmap_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPixmap cursor_pixmap(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->pixmap();
    WRPixmap* new_val = new WRPixmap();
    *new_val = ret_value;
    struct RUPixmap ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_pixmap_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPoint cursor_hot_spot(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->hotSpot();
    WRPoint* new_val = new WRPoint();
    *new_val = ret_value;
    struct RUPoint ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_point_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPoint cursor_pos(struct RUBase* self_c) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->pos();
    WRPoint* new_val = new WRPoint();
    *new_val = ret_value;
    struct RUPoint ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_point_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUPoint cursor_pos_2(struct RUBase* self_c, struct RUBase* screen) {
    WRCursor* qt_value = (WRCursor*)self_c;
    auto ret_value = qt_value->pos((QScreen*)screen);
    WRPoint* new_val = new WRPoint();
    *new_val = ret_value;
    struct RUPoint ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_point_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_set_pos(struct RUBase* self_c, int x, int y) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->setPos(x, y);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_set_pos_2(struct RUBase* self_c, struct RUBase* screen, int x, int y) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->setPos((QScreen*)screen, x, y);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_set_pos_3(struct RUBase* self_c, struct RUBase* p) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->setPos(*((QPoint*)p));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void cursor_set_pos_4(struct RUBase* self_c, struct RUBase* screen, struct RUBase* p) {
    WRCursor* qt_value = (WRCursor*)self_c;
    qt_value->setPos((QScreen*)screen, *((QPoint*)p));
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUCursor create_cursor(
    struct RUBase* priv_data,
    RUDeleteCallback delete_callback,
    void* private_user_data)
{
    auto ctl = generic_create_func_with_delete<struct RUCursor, WRCursor>(priv_data, delete_callback, private_user_data);
    ctl.all_funcs = &s_cursor_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void destroy_cursor(struct RUBase* priv_data) {
    destroy_generic<WRCursor>(priv_data);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static struct RUCursor get_cursor(struct RUBase* priv_data) {
    (void)priv_data;
    RUCursor ctl;
    ctl.qt_data = nullptr;
    ctl.host_data = nullptr;
    ctl.all_funcs = &s_cursor_all_funcs;
    return ctl;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RUCursorFuncs s_cursor_funcs = {
    destroy_cursor,
    cursor_swap,
    cursor_shape,
    cursor_set_shape,
    cursor_bitmap,
    cursor_mask,
    cursor_pixmap,
    cursor_hot_spot,
    cursor_pos,
    cursor_pos_2,
    cursor_set_pos,
    cursor_set_pos_2,
    cursor_set_pos_3,
    cursor_set_pos_4,
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

struct RUCursorAllFuncs s_cursor_all_funcs = {
    &s_cursor_funcs,
};