# HG changeset patch # User Olaf Wintermann # Date 1422790651 -3600 # Node ID 91f45354d1e2d87f77e6bb1f21183792e27e16f5 # Parent a56c2baa94297642aad6e04a90411aed492c3889 added ui_layout_fill (WPF) diff -r a56c2baa9429 -r 91f45354d1e2 application/main.c --- a/application/main.c Sun Feb 01 10:35:07 2015 +0100 +++ b/application/main.c Sun Feb 01 12:37:31 2015 +0100 @@ -117,9 +117,12 @@ ui_menuitem("item4", NULL, NULL); UiObject *obj = ui_window("Test", NULL); + ui_layout_fill(obj, FALSE); ui_hbox(obj); ui_button(obj, "HELLO", NULL, NULL); ui_button(obj, "WORLD", NULL, NULL); + ui_layout_fill(obj, TRUE); + ui_button(obj, "BUTTON", NULL, NULL); ui_end(obj); ui_button(obj, "Test1", action_button, NULL); ui_button(obj, "Test2", action_button, NULL); diff -r a56c2baa9429 -r 91f45354d1e2 ui/wpf/UIcore/Container.cs --- a/ui/wpf/UIcore/Container.cs Sun Feb 01 10:35:07 2015 +0100 +++ b/ui/wpf/UIcore/Container.cs Sun Feb 01 12:37:31 2015 +0100 @@ -10,9 +10,36 @@ { public interface Container { + Layout Layout { get; set; } + void Add(UIElement control, bool fill); } + public class Layout + { + public bool? Fill { get; set; } + + public Layout() + { + Fill = null; + } + + public bool IsFill(bool fill) + { + if (Fill != null) + { + + return (bool)Fill; + } + return fill; + } + + public void Reset() + { + Fill = null; + } + } + public enum BoxOrientation { VERTICAL, @@ -21,7 +48,9 @@ public class BoxContainer : Grid, Container { - public BoxOrientation Orientation; + public Layout Layout { get; set; } + + private BoxOrientation Orientation; private int x = 0; private int y = 0; @@ -30,6 +59,8 @@ public BoxContainer(BoxOrientation orientation) : base() { + Layout = new Layout(); + Orientation = orientation; if(Orientation == BoxOrientation.HORIZONTAL) { @@ -52,6 +83,8 @@ public void Add(UIElement control, bool fill) { + fill = Layout.IsFill(fill); + if(Orientation == BoxOrientation.HORIZONTAL) { ColumnDefinition col = new ColumnDefinition(); @@ -103,6 +136,8 @@ { y++; } + + Layout.Reset(); } public static BoxContainer CreateBoxContainer(Container parent, BoxOrientation orientation) @@ -113,6 +148,8 @@ public class GridContainer : Container { + public Layout Layout { get; set; } + public Grid Grid; public GridContainer(System.Windows.Controls.Grid grid) diff -r a56c2baa9429 -r 91f45354d1e2 ui/wpf/UIcore/Window.cs --- a/ui/wpf/UIcore/Window.cs Sun Feb 01 10:35:07 2015 +0100 +++ b/ui/wpf/UIcore/Window.cs Sun Feb 01 12:37:31 2015 +0100 @@ -11,6 +11,18 @@ { public class MainWindow : Window, Container { + public Layout Layout + { + get + { + return Container.Layout; + } + set + { + Container.Layout = value; + } + } + public IntPtr Object; public Container Container; diff -r a56c2baa9429 -r 91f45354d1e2 ui/wpf/UIwrapper/UIwrapper/container.cpp --- a/ui/wpf/UIwrapper/UIwrapper/container.cpp Sun Feb 01 10:35:07 2015 +0100 +++ b/ui/wpf/UIwrapper/UIwrapper/container.cpp Sun Feb 01 12:37:31 2015 +0100 @@ -20,3 +20,12 @@ *container = hbox; return container; } + + + +/* ------------------- layout functions ------------------- */ + +UI_EXPORT void __stdcall UIlayout_fill(gcroot *container, int fill) { + UI::Container ^ct = *container; + ct->Layout->Fill = fill; +} diff -r a56c2baa9429 -r 91f45354d1e2 ui/wpf/container.c --- a/ui/wpf/container.c Sun Feb 01 10:35:07 2015 +0100 +++ b/ui/wpf/container.c Sun Feb 01 12:37:31 2015 +0100 @@ -28,3 +28,20 @@ return hbox; } + +/* + * -------------------- Layout Functions -------------------- + * + * functions for setting layout attributes for the current container + * + */ + +void ui_layout_fill(UiObject *obj, UiBool fill) { + UiContainer *ct = uic_get_current_container(obj); + UIlayout_fill(ct, fill); +} + +void ui_newline(UiObject *obj) { + UiContainer *ct = uic_get_current_container(obj); + +} \ No newline at end of file diff -r a56c2baa9429 -r 91f45354d1e2 ui/wpf/container.h --- a/ui/wpf/container.h Sun Feb 01 10:35:07 2015 +0100 +++ b/ui/wpf/container.h Sun Feb 01 12:37:31 2015 +0100 @@ -18,6 +18,8 @@ UI_IMPORT void* __stdcall UIhbox(UiContainer *parent); +UI_IMPORT void __stdcall UIlayout_fill(UiContainer *container, int fill); + #ifdef __cplusplus } #endif