| 30 #include "container.h" |
30 #include "container.h" |
| 31 #include "toolkit.h" |
31 #include "toolkit.h" |
| 32 #include "ui/display.h" |
32 #include "ui/display.h" |
| 33 |
33 |
| 34 |
34 |
| 35 UIWIDGET ui_label_create(UiObject* obj, UiLabelArgs args) { |
35 UIWIDGET ui_label_create(UiObject* obj, UiLabelArgs *args) { |
| 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 |
38 |
| 39 QString str = QString::fromUtf8(args.label); |
39 QString str = QString::fromUtf8(args->label); |
| 40 QLabel *widget = new QLabel(str); |
40 QLabel *widget = new QLabel(str); |
| 41 |
41 |
| 42 Qt::AlignmentFlag align = Qt::AlignCenter; |
42 Qt::AlignmentFlag align = Qt::AlignCenter; |
| 43 if(args.align == UI_ALIGN_LEFT) { |
43 if(args->align == UI_ALIGN_LEFT) { |
| 44 align = Qt::AlignLeft; |
44 align = Qt::AlignLeft; |
| 45 } else if(args.align == UI_ALIGN_RIGHT) { |
45 } else if(args->align == UI_ALIGN_RIGHT) { |
| 46 align = Qt::AlignRight; |
46 align = Qt::AlignRight; |
| 47 } |
47 } |
| 48 widget->setAlignment(align); |
48 widget->setAlignment(align); |
| 49 |
49 |
| 50 ctn->add(widget, false); |
50 ctn->add(widget); |
| 51 |
51 |
| 52 return widget; |
52 return widget; |
| 53 } |
53 } |
| 54 |
54 |
| 55 UIWIDGET ui_llabel_create(UiObject* obj, UiLabelArgs args) { |
55 UIWIDGET ui_llabel_create(UiObject* obj, UiLabelArgs *args) { |
| 56 args.align = UI_ALIGN_LEFT; |
56 args->align = UI_ALIGN_LEFT; |
| 57 return ui_label_create(obj, args); |
57 return ui_label_create(obj, args); |
| 58 } |
58 } |
| 59 |
59 |
| 60 UIWIDGET ui_rlabel_create(UiObject* obj, UiLabelArgs args) { |
60 UIWIDGET ui_rlabel_create(UiObject* obj, UiLabelArgs *args) { |
| 61 args.align = UI_ALIGN_RIGHT; |
61 args->align = UI_ALIGN_RIGHT; |
| 62 return ui_label_create(obj, args); |
62 return ui_label_create(obj, args); |
| 63 } |
63 } |