#include "widget.h"
#include "container.h"
#include "../common/object.h"
void ui_widget_size_request(
UIWIDGET w,
int width,
int height) {
if(width >
0 || height >
0) {
if(width ==
0) {
width =
-1;
}
if(height ==
0) {
height =
-1;
}
gtk_widget_set_size_request(w, width, height);
}
}
UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget,
void *userdata, UiWidgetArgs *args) {
UIWIDGET widget = create_widget(obj, args, userdata);
UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end;
UiLayout layout =
UI_ARGS2LAYOUT(args);
ct->add(ct, widget, &layout);
return widget;
}
UIWIDGET ui_separator_create(UiObject *obj, UiWidgetArgs *args) {
GtkWidget *widget = gtk_separator_new(
GTK_ORIENTATION_HORIZONTAL);
ui_set_name_and_style(widget, args->name, args->style_class);
UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end;
UiLayout layout =
UI_ARGS2LAYOUT(args);
ct->add(ct, widget, &layout);
return widget;
}
void ui_widget_set_size(
UIWIDGET w,
int width,
int height) {
gtk_widget_set_size_request(w, width, height);
}
void ui_widget_redraw(
UIWIDGET w) {
gtk_widget_queue_draw(w);
}