| 29 #include "widget.h" |
29 #include "widget.h" |
| 30 |
30 |
| 31 #include "container.h" |
31 #include "container.h" |
| 32 #include "../common/context.h" |
32 #include "../common/context.h" |
| 33 |
33 |
| 34 UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget, void *userdata, UiWidgetArgs args) { |
34 UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget, void *userdata, UiWidgetArgs *args) { |
| 35 UIWIDGET widget = create_widget(obj, args, userdata); |
35 UIWIDGET widget = create_widget(obj, args, userdata); |
| 36 UiContainerPrivate *ctn = ui_obj_container(obj); |
36 UiContainerPrivate *ctn = ui_obj_container(obj); |
| 37 UI_APPLY_LAYOUT(ctn->layout, args); |
37 UI_APPLY_LAYOUT(ctn->layout, args); |
| 38 ctn->add(widget, false); |
38 ctn->add(widget); |
| 39 return widget; |
39 return widget; |
| 40 } |
40 } |
| 41 |
41 |
| 42 UIWIDGET ui_separator_create(UiObject *obj, UiWidgetArgs *args) { |
42 UIWIDGET ui_separator_create(UiObject *obj, UiWidgetArgs *args) { |
| 43 QFrame *separator = new QFrame(); |
43 QFrame *separator = new QFrame(); |
| 44 separator->setFrameShape(QFrame::HLine); |
44 separator->setFrameShape(QFrame::HLine); |
| 45 separator->setFrameShadow(QFrame::Sunken); |
45 separator->setFrameShadow(QFrame::Sunken); |
| 46 |
46 |
| 47 UiContainerPrivate *ctn = ui_obj_container(obj); |
47 UiContainerPrivate *ctn = ui_obj_container(obj); |
| 48 UI_APPLY_LAYOUT(ctn->layout, (*args)); |
48 UI_APPLY_LAYOUT(ctn->layout, args); |
| 49 |
49 |
| 50 ctn->add(separator, false); |
50 ctn->add(separator); |
| 51 |
51 |
| 52 return separator; |
52 return separator; |
| 53 } |
53 } |
| 54 |
54 |
| 55 void ui_widget_set_size(UIWIDGET w, int width, int height) { |
55 void ui_widget_set_size(UIWIDGET w, int width, int height) { |