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 <QPolygon>
#include "polygon_ffi.h"

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

static void polygon_swap(struct RUBase* self_c, struct RUBase* other) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->swap(*((QPolygon*)other));
}

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

static struct RURect polygon_bounding_rect(struct RUBase* self_c) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->boundingRect();
    WRRect* new_val = new WRRect();
    *new_val = ret_value;
    struct RURect ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_rect_all_funcs;
    return ctl;
}

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

static struct RUPoint polygon_point_2(struct RUBase* self_c, int i) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->point(i);
    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 polygon_set_point(struct RUBase* self_c, int index, int x, int y) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->setPoint(index, x, y);
}

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

static void polygon_set_point_2(struct RUBase* self_c, int index, struct RUBase* p) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->setPoint(index, *((QPoint*)p));
}

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

static void polygon_set_points_2(struct RUBase* self_c, int n_points, int firstx, int firsty) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->setPoints(n_points, firstx, firsty);
}

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

static void polygon_put_points_2(struct RUBase* self_c, int index, int n_points, int firstx, int firsty) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->putPoints(index, n_points, firstx, firsty);
}

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

static void polygon_put_points_3(struct RUBase* self_c, int index, int n_points, struct RUBase* from, int from_index) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    qt_value->putPoints(index, n_points, *((QPolygon*)from), from_index);
}

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

static bool polygon_contains_point(struct RUBase* self_c, struct RUBase* pt, int fill_rule) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->containsPoint(*((QPoint*)pt), (Qt::FillRule)s_fill_rule_lookup[fill_rule]);
    return ret_value;
}

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

static struct RUPolygon polygon_united(struct RUBase* self_c, struct RUBase* r) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->united(*((QPolygon*)r));
    WRPolygon* new_val = new WRPolygon();
    *new_val = ret_value;
    struct RUPolygon ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_polygon_all_funcs;
    return ctl;
}

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

static struct RUPolygon polygon_intersected(struct RUBase* self_c, struct RUBase* r) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->intersected(*((QPolygon*)r));
    WRPolygon* new_val = new WRPolygon();
    *new_val = ret_value;
    struct RUPolygon ctl;
    ctl.qt_data = (struct RUBase*)new_val;
    ctl.host_data = (struct RUBase*)s_host_data_lookup[(void*)new_val];
    ctl.all_funcs = &s_polygon_all_funcs;
    return ctl;
}

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

static bool polygon_intersects(struct RUBase* self_c, struct RUBase* r) {
    WRPolygon* qt_value = (WRPolygon*)self_c;
    auto ret_value = qt_value->intersects(*((QPolygon*)r));
    return ret_value;
}

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

static struct RUPolygon create_polygon(
    struct RUBase* priv_data,
    RUDeleteCallback delete_callback,
    void* private_user_data)
{
    auto ctl = generic_create_func_with_delete<struct RUPolygon, WRPolygon>(priv_data, delete_callback, private_user_data);
    ctl.all_funcs = &s_polygon_all_funcs;
    return ctl;
}

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

static void destroy_polygon(struct RUBase* priv_data) {
    destroy_generic<WRPolygon>(priv_data);
}

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

struct RUPolygonFuncs s_polygon_funcs = {
    destroy_polygon,
    polygon_swap,
    polygon_bounding_rect,
    polygon_point_2,
    polygon_set_point,
    polygon_set_point_2,
    polygon_set_points_2,
    polygon_put_points_2,
    polygon_put_points_3,
    polygon_contains_point,
    polygon_united,
    polygon_intersected,
    polygon_intersects,
};

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

struct RUPolygonAllFuncs s_polygon_all_funcs = {
    &s_point_funcs,
    &s_polygon_funcs,
};