ui/winui/container.cpp

changeset 103
6606616eca9f
parent 76
641dcc79e0ef
child 108
77254bd6dccb
equal deleted inserted replaced
102:64ded9f6a6c6 103:6606616eca9f
49 } 49 }
50 return 1; 50 return 1;
51 } 51 }
52 52
53 53
54 UIEXPORT UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget, void *userdata, UiWidgetArgs args) {
55 UiObject* current = uic_current_obj(obj);
56
57 UIWIDGET widget = create_widget(obj, args, userdata);
58 FrameworkElement w = widget->uielement.as<FrameworkElement>();
59
60 UI_APPLY_LAYOUT1(current, args);
61
62 current->container->Add(w, false);
63
64 return widget;
65 }
66
54 // --------------------- UiBoxContainer --------------------- 67 // --------------------- UiBoxContainer ---------------------
55 68
56 static UIWIDGET ui_box(UiObject* obj, UiContainerArgs args, UiBoxContainerType type) { 69 static UIWIDGET ui_box(UiObject* obj, UiContainerArgs args, UiBoxContainerType type) {
57 UiObject* current = uic_current_obj(obj); 70 UiObject* current = uic_current_obj(obj);
58 UI_APPLY_LAYOUT1(current, args); 71 UI_APPLY_LAYOUT1(current, args);
871 boxargs.fill = UI_OFF; 884 boxargs.fill = UI_OFF;
872 ui_hbox_create(obj, boxargs); 885 ui_hbox_create(obj, boxargs);
873 } 886 }
874 887
875 888
889
876 /* 890 /*
877 * -------------------- Layout Functions -------------------- 891 * -------------------- Layout Functions --------------------
878 * 892 *
879 * functions for setting layout attributes for the current container 893 * functions for setting layout attributes for the current container
880 * 894 *
903 void ui_layout_vfill(UiObject* obj, UiBool fill) { 917 void ui_layout_vfill(UiObject* obj, UiBool fill) {
904 UiContainer* ct = uic_get_current_container(obj); 918 UiContainer* ct = uic_get_current_container(obj);
905 ct->layout.vfill = fill; 919 ct->layout.vfill = fill;
906 } 920 }
907 921
922 void ui_layout_override_defaults(UiObject* obj, UiBool def) {
923 UiContainer* ct = uic_get_current_container(obj);
924 ct->layout.override_defaults = def;
925 }
926
908 void ui_layout_width(UiObject* obj, int width) { 927 void ui_layout_width(UiObject* obj, int width) {
909 UiContainer* ct = uic_get_current_container(obj); 928 UiContainer* ct = uic_get_current_container(obj);
910 ct->layout.width = width; 929 ct->layout.width = width;
911 } 930 }
912 931

mercurial