Sun, 22 Jan 2017 18:02:45 +0100
adds gridwidth layout option (WPF)
--- a/.hgignore Sun Jan 22 17:23:20 2017 +0100 +++ b/.hgignore Sun Jan 22 18:02:45 2017 +0100 @@ -3,7 +3,8 @@ relre:^core$ relre:^ui/wpf/UIcore/obj relre:^ui/wpf/UIWrapper/.vs -relre:^ui/wpf/UIWrapper/Debug -relre:^ui/wpf/UIWrapper/Release -relre:^ui/wpf/UIWrapper/x64 -relre:^ui/wpf/UIWrapper/UIwrapper.VC \ No newline at end of file +relre:^ui/wpf/UIWrapper/UIwrapper.VC +relre:^ui/wpf/UIWrapper/UIWrapper/Debug +relre:^ui/wpf/UIWrapper/UIWrapper/Release +relre:^ui/wpf/UIWrapper/UIWrapper/x64 +relre:^ui/wpf/UIwrapper/ipch \ No newline at end of file
--- a/application/main.c Sun Jan 22 17:23:20 2017 +0100 +++ b/application/main.c Sun Jan 22 18:02:45 2017 +0100 @@ -44,7 +44,25 @@ void application_startup(UiEvent *event, void *data) { UiObject *obj = ui_window("Test", NULL); + + ui_grid_sp(obj, 10, 10, 10); + + ui_label(obj, "Test2"); + ui_layout_hexpand(obj, TRUE); + ui_button(obj, "OK", NULL, NULL); + ui_button(obj, "------------------------", NULL, NULL); + ui_newline(obj); + + ui_label(obj, "Test2"); + ui_layout_hexpand(obj, TRUE); + ui_layout_vexpand(obj, TRUE); + ui_layout_gridwidth(obj, 2); ui_textarea(obj, NULL); + + ui_newline(obj); + + ui_end(obj); + ui_show(obj); } @@ -64,8 +82,8 @@ ui_menuitem("item4", action_menu, NULL); // toolbar - ui_toolitem("button1", "Test", action_button, NULL); - ui_toolitem("button2", "OK", action_button, NULL); + ui_toolitem("button1", "Test1", action_button, NULL); + ui_toolitem("button2", "Test2", action_button, NULL); ui_toolbar_add_default("button1"); ui_toolbar_add_default("button2");
--- a/ui/wpf/UIcore/Container.cs Sun Jan 22 17:23:20 2017 +0100 +++ b/ui/wpf/UIcore/Container.cs Sun Jan 22 18:02:45 2017 +0100 @@ -21,6 +21,7 @@ public bool Hexpand { get; set; } public bool Vexpand { get; set; } public bool NewLine { get; set; } + public int GridWidth { get; set; } public Layout() { @@ -43,6 +44,7 @@ Hexpand = false; Vexpand = false; NewLine = false; + GridWidth = 1; } } @@ -240,12 +242,19 @@ row.Height = new GridLength(1, GridUnitType.Star); } + int gridwidth = Layout.GridWidth; + if(gridwidth > 1) + { + gridwidth++; + } + Grid.SetColumn(control, X); Grid.SetRow(control, Y); + Grid.SetColumnSpan(control, gridwidth); Children.Add(control); Layout.Reset(); - X++; + X += gridwidth; } } }
--- a/ui/wpf/UIwrapper/UIwrapper/container.cpp Sun Jan 22 17:23:20 2017 +0100 +++ b/ui/wpf/UIwrapper/UIwrapper/container.cpp Sun Jan 22 18:02:45 2017 +0100 @@ -47,6 +47,11 @@ ct->Layout->Vexpand = expand != 0; } +UI_EXPORT void __stdcall UIlayout_gridwidth(gcroot<UI::Container^> *container, int width) { + UI::Container ^ct = *container; + ct->Layout->GridWidth = width; +} + UI_EXPORT void __stdcall UIlayout_newline(gcroot<UI::Container^> *container) { UI::Container ^ct = *container; ct->Layout->NewLine = true;
--- a/ui/wpf/container.c Sun Jan 22 17:23:20 2017 +0100 +++ b/ui/wpf/container.c Sun Jan 22 18:02:45 2017 +0100 @@ -94,6 +94,11 @@ UIlayout_vexpand(ct, expand); } +void ui_layout_gridwidth(UiObject *obj, int width) { + UiContainer *ct = uic_get_current_container(obj); + UIlayout_gridwidth(ct, width); +} + void ui_newline(UiObject *obj) { UiContainer *ct = uic_get_current_container(obj); UIlayout_newline(ct);
--- a/ui/wpf/container.h Sun Jan 22 17:23:20 2017 +0100 +++ b/ui/wpf/container.h Sun Jan 22 18:02:45 2017 +0100 @@ -43,6 +43,7 @@ UI_IMPORT void __stdcall UIlayout_fill(UiContainer *container, int fill); UI_IMPORT void __stdcall UIlayout_hexpand(UiContainer *container, int expand); UI_IMPORT void __stdcall UIlayout_vexpand(UiContainer *container, int expand); +UI_IMPORT void __stdcall UIlayout_gridwidth(UiContainer *container, int width); UI_IMPORT void __stdcall UIlayout_newline(UiContainer *container);