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 <QIcon>
#include "icon_ffi.h"

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

static void icon_swap(struct RUBase* self_c, struct RUBase* other) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->swap(*((QIcon*)other));
}

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

static struct RUPixmap icon_pixmap(struct RUBase* self_c, struct RUBase* size, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->pixmap(*((QSize*)size), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    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 RUPixmap icon_pixmap_2(struct RUBase* self_c, int w, int h, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->pixmap(w, h, (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    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 RUPixmap icon_pixmap_3(struct RUBase* self_c, int extent, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->pixmap(extent, (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    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 RUPixmap icon_pixmap_4(struct RUBase* self_c, struct RUBase* window, struct RUBase* size, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->pixmap((QWindow*)window, *((QSize*)size), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    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 RUSize icon_actual_size(struct RUBase* self_c, struct RUBase* size, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->actualSize(*((QSize*)size), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    WRSize* new_val = new WRSize();
    *new_val = ret_value;
    struct RUSize ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_size_all_funcs;
    return ctl;
}

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

static struct RUSize icon_actual_size_2(struct RUBase* self_c, struct RUBase* window, struct RUBase* size, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->actualSize((QWindow*)window, *((QSize*)size), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
    WRSize* new_val = new WRSize();
    *new_val = ret_value;
    struct RUSize ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_size_all_funcs;
    return ctl;
}

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

static const char* icon_name(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->name();
    return q_string_to_const_char(ret_value);
}

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

static void icon_paint(struct RUBase* self_c, struct RUBase* painter, struct RUBase* rect, int alignment, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->paint((QPainter*)painter, *((QRect*)rect), (Qt::Alignment)s_alignment_lookup[alignment], (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
}

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

static void icon_paint_2(struct RUBase* self_c, struct RUBase* painter, int x, int y, int w, int h, int alignment, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->paint((QPainter*)painter, x, y, w, h, (Qt::Alignment)s_alignment_lookup[alignment], (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
}

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

static bool icon_is_null(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->isNull();
    return ret_value;
}

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

static bool icon_is_detached(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->isDetached();
    return ret_value;
}

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

static void icon_detach(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->detach();
}

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

static int64_t icon_cache_key(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->cacheKey();
    return ret_value;
}

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

static void icon_add_pixmap(struct RUBase* self_c, struct RUBase* pixmap, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->addPixmap(*((QPixmap*)pixmap), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
}

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

static void icon_add_file(struct RUBase* self_c, const char* file_name, struct RUBase* size, int mode, int state) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->addFile(QString::fromUtf8(file_name), *((QSize*)size), (QIcon::Mode)s_mode_lookup[mode], (QIcon::State)s_state_lookup[state]);
}

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

static void icon_set_is_mask(struct RUBase* self_c, bool is_mask) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->setIsMask(is_mask);
}

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

static bool icon_is_mask(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->isMask();
    return ret_value;
}

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

static struct RUIcon icon_from_theme(struct RUBase* self_c, const char* name) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->fromTheme(QString::fromUtf8(name));
    WRIcon* new_val = new WRIcon();
    *new_val = ret_value;
    struct RUIcon ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_icon_all_funcs;
    return ctl;
}

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

static struct RUIcon icon_from_theme_2(struct RUBase* self_c, const char* name, struct RUBase* fallback) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->fromTheme(QString::fromUtf8(name), *((QIcon*)fallback));
    WRIcon* new_val = new WRIcon();
    *new_val = ret_value;
    struct RUIcon ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_icon_all_funcs;
    return ctl;
}

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

static bool icon_has_theme_icon(struct RUBase* self_c, const char* name) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->hasThemeIcon(QString::fromUtf8(name));
    return ret_value;
}

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

static const char* icon_theme_name(struct RUBase* self_c) {
    WRIcon* qt_value = (WRIcon*)self_c;
    auto ret_value = qt_value->themeName();
    return q_string_to_const_char(ret_value);
}

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

static void icon_set_theme_name(struct RUBase* self_c, const char* path) {
    WRIcon* qt_value = (WRIcon*)self_c;
    qt_value->setThemeName(QString::fromUtf8(path));
}

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

static struct RUIcon create_icon(
    struct RUBase* priv_data,
    RUDeleteCallback delete_callback,
    void* private_user_data)
{
    auto ctl = generic_create_func_with_delete<struct RUIcon, WRIcon>(priv_data, delete_callback, private_user_data);
    ctl.all_funcs = &s_icon_all_funcs;
    return ctl;
}

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

static void destroy_icon(struct RUBase* priv_data) {
    destroy_generic<WRIcon>(priv_data);
}

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

static struct RUIcon get_icon(struct RUBase* priv_data) {
    (void)priv_data;
    RUIcon ctl;
    ctl.qt_data = nullptr;
    ctl.host_data = nullptr;
    ctl.all_funcs = &s_icon_all_funcs;
    return ctl;
}

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

struct RUIconFuncs s_icon_funcs = {
    destroy_icon,
    icon_swap,
    icon_pixmap,
    icon_pixmap_2,
    icon_pixmap_3,
    icon_pixmap_4,
    icon_actual_size,
    icon_actual_size_2,
    icon_name,
    icon_paint,
    icon_paint_2,
    icon_is_null,
    icon_is_detached,
    icon_detach,
    icon_cache_key,
    icon_add_pixmap,
    icon_add_file,
    icon_set_is_mask,
    icon_is_mask,
    icon_from_theme,
    icon_from_theme_2,
    icon_has_theme_icon,
    icon_theme_name,
    icon_set_theme_name,
};

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

struct RUIconAllFuncs s_icon_all_funcs = {
    &s_icon_funcs,
};