ui/gtk/container.c

branch
newapi
changeset 378
d41b1ffc5f77
parent 354
baf9bcc98d87
equal deleted inserted replaced
377:3a60db9ebb5d 378:d41b1ffc5f77
178 ct->layout.newline = FALSE; 178 ct->layout.newline = FALSE;
179 } 179 }
180 180
181 int hexpand = FALSE; 181 int hexpand = FALSE;
182 int vexpand = FALSE; 182 int vexpand = FALSE;
183 int hfill = FALSE;
184 int vfill = FALSE;
185 if(ct->layout.fill != UI_LAYOUT_UNDEFINED) {
186 fill = ui_lb2bool(ct->layout.fill);
187 }
183 if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) { 188 if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) {
184 hexpand = ct->layout.hexpand; 189 hexpand = ct->layout.hexpand;
190 hfill = TRUE;
185 } 191 }
186 if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) { 192 if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) {
187 vexpand = ct->layout.vexpand; 193 vexpand = ct->layout.vexpand;
194 vfill = TRUE;
195 }
196 if(fill) {
197 hfill = TRUE;
198 vfill = TRUE;
199 }
200
201 if(!hfill) {
202 gtk_widget_set_halign(widget, GTK_ALIGN_START);
203 }
204 if(!vfill) {
205 gtk_widget_set_valign(widget, GTK_ALIGN_START);
188 } 206 }
189 207
190 gtk_widget_set_hexpand(widget, hexpand); 208 gtk_widget_set_hexpand(widget, hexpand);
191 gtk_widget_set_vexpand(widget, vexpand); 209 gtk_widget_set_vexpand(widget, vexpand);
192 210
915 void ui_layout_vexpand(UiObject *obj, UiBool expand) { 933 void ui_layout_vexpand(UiObject *obj, UiBool expand) {
916 UiContainer *ct = uic_get_current_container(obj); 934 UiContainer *ct = uic_get_current_container(obj);
917 ct->layout.vexpand = expand; 935 ct->layout.vexpand = expand;
918 } 936 }
919 937
938 void ui_layout_hfill(UiObject *obj, UiBool fill) {
939 UiContainer *ct = uic_get_current_container(obj);
940 ct->layout.hfill = fill;
941 }
942
943 void ui_layout_vfill(UiObject *obj, UiBool fill) {
944 UiContainer *ct = uic_get_current_container(obj);
945 ct->layout.vfill = fill;
946 }
947
920 void ui_layout_colspan(UiObject* obj, int cols) { 948 void ui_layout_colspan(UiObject* obj, int cols) {
921 UiContainer* ct = uic_get_current_container(obj); 949 UiContainer* ct = uic_get_current_container(obj);
922 ct->layout.colspan = cols; 950 ct->layout.colspan = cols;
923 } 951 }
924 952

mercurial