Sun, 01 Oct 2023 17:22:17 +0200
add toggle switch (WinUI3)
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2023 Olaf Wintermann. All rights reserved. |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include "container.h" |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
31 | #include "../common/context.h" |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
32 | #include "../common/object.h" |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
33 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
34 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
35 | void ui_container_begin_close(UiObject* obj) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
36 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
37 | ct->close = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
38 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
39 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
40 | int ui_container_finish(UiObject* obj) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
41 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
42 | if (ct->close) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
43 | ui_end(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
44 | return 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
45 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
46 | return 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
47 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
48 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
49 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
50 | // --------------------- UiBoxContainer --------------------- |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
52 | static UIWIDGET ui_box(UiObject* obj, UiContainerArgs args, UiBoxContainerType type) { |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
53 | UiObject* current = uic_current_obj(obj); |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
54 | UI_APPLY_LAYOUT1(current, args); |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
55 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
56 | Grid grid = Grid(); |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
57 | current->container->Add(grid, true); |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
58 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
59 | UIElement elm = grid; |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
60 | UiWidget* widget = new UiWidget(elm); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
61 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
62 | UiObject* newobj = uic_object_new(obj, widget); |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
63 | newobj->container = new UiBoxContainer(grid, type, args.margin, args.spacing); |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
64 | uic_obj_add(obj, newobj); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
65 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
66 | return widget; |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
67 | } |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
68 | |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
69 | UIWIDGET ui_vbox_create(UiObject* obj, UiContainerArgs args) { |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
70 | return ui_box(obj, args, UI_CONTAINER_VBOX); |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
71 | } |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
72 | |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
73 | UIWIDGET ui_hbox_create(UiObject* obj, UiContainerArgs args) { |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
74 | return ui_box(obj, args, UI_CONTAINER_HBOX); |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
75 | } |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
76 | |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
77 | UiBoxContainer::UiBoxContainer(Grid grid, enum UiBoxContainerType type, int margin, int spacing) { |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | this->grid = grid; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | this->type = type; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
81 | GridLength gl; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
82 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
83 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
84 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | // hbox needs one row def, vbox needs one col def |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | // all other col/row defs are created when elements are added |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | if (type == UI_CONTAINER_HBOX) { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
88 | boxRowDef = RowDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
89 | boxRowDef.Height(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
90 | grid.RowDefinitions().Append(boxRowDef); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | } else { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
92 | boxColDef = ColumnDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
93 | boxColDef.Width(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
94 | grid.ColumnDefinitions().Append(boxColDef); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | } |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
96 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
97 | ui_reset_layout(layout); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
100 | void UiBoxContainer::Add(FrameworkElement control, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
101 | if (this->layout.fill != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
102 | fill = ui_lb2bool(this->layout.fill); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
103 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
104 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | GridLength gl; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | if (fill) { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | gl.Value = 1; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | gl.GridUnitType = GridUnitType::Star; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | else { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | gl.Value = 0; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | gl.GridUnitType = GridUnitType::Auto; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
115 | control.HorizontalAlignment(HorizontalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
116 | control.VerticalAlignment(VerticalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
117 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | if (type == UI_CONTAINER_HBOX) { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | ColumnDefinition coldef = ColumnDefinition(); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | coldef.Width(gl); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | grid.ColumnDefinitions().Append(coldef); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | grid.SetColumn(control, grid.Children().Size()); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
123 | grid.SetRow(control, 0); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | } else { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | RowDefinition rowdef = RowDefinition(); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | rowdef.Height(gl); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | grid.RowDefinitions().Append(rowdef); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | grid.SetRow(control, grid.Children().Size()); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
129 | grid.SetColumn(control, 0); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | grid.Children().Append(control); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
133 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
134 | ui_reset_layout(layout); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
135 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
136 | |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
137 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
138 | // --------------------- UiGridContainer --------------------- |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
139 | |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
140 | UIWIDGET ui_grid_create(UiObject* obj, UiContainerArgs args) { |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
141 | UiObject* current = uic_current_obj(obj); |
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
142 | UI_APPLY_LAYOUT1(current, args); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
143 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
144 | Grid grid = Grid(); |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
145 | current->container->Add(grid, true); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
146 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
147 | UIElement elm = grid; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
148 | UiWidget* widget = new UiWidget(elm); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
149 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
150 | UiObject* newobj = uic_object_new(obj, widget); |
190
70fd1b24e395
implement new api style for box and grid containers (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
188
diff
changeset
|
151 | newobj->container = new UiGridContainer(grid, args.margin, args.columnspacing, args.rowspacing); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
152 | uic_obj_add(obj, newobj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
153 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
154 | return widget; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
155 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
156 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
157 | UiGridContainer::UiGridContainer(Grid grid, int margin, int columnspacing, int rowspacing) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
158 | this->grid = grid; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
159 | Thickness t = { (double)margin, (double)margin, (double)margin, (double)margin }; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
160 | grid.Margin(t); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
161 | grid.ColumnSpacing((double)columnspacing); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
162 | grid.RowSpacing((double)rowspacing); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
163 | ui_reset_layout(layout); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
166 | void UiGridContainer::Add(FrameworkElement control, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
167 | GridLength gl; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
168 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
169 | int hexpand = FALSE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
170 | int vexpand = FALSE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
171 | if (layout.hexpand != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
172 | hexpand = layout.hexpand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
173 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
174 | if (layout.vexpand != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
175 | vexpand = layout.vexpand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
176 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
177 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
178 | // create new RowDefinition for the new line |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
179 | if (layout.newline || y == -1) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
180 | x = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
181 | y++; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
182 | RowDefinition rowdef = RowDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
183 | if (vexpand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
184 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
185 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
186 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
187 | else { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
188 | gl.GridUnitType = GridUnitType::Auto; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
189 | gl.Value = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
190 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
191 | rowdef.Height(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
192 | grid.RowDefinitions().Append(rowdef); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
193 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
194 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
195 | // create new columndefinition, if a new column is added |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
196 | if (x == cols) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
197 | if (hexpand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
198 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
199 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
200 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
201 | else { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
202 | gl.GridUnitType = GridUnitType::Auto; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
203 | gl.Value = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
204 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
205 | ColumnDefinition coldef = ColumnDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
206 | coldef.Width(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
207 | grid.ColumnDefinitions().Append(coldef); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
208 | cols++; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
209 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
210 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
211 | // add control |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
212 | control.HorizontalAlignment(HorizontalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
213 | control.VerticalAlignment(VerticalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
214 | |
186
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
215 | if (layout.colspan > 0) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
216 | grid.SetColumnSpan(control, layout.colspan); |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
217 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
218 | if (layout.rowspan > 0) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
219 | grid.SetRowSpan(control, layout.rowspan); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
220 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
221 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
222 | grid.SetRow(control, y); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
223 | grid.SetColumn(control, x); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
224 | grid.Children().Append(control); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
225 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
226 | x++; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
227 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
228 | ui_reset_layout(layout); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
229 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
230 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
231 | /* |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
232 | * -------------------- Layout Functions -------------------- |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
233 | * |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
234 | * functions for setting layout attributes for the current container |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
235 | * |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
236 | */ |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
237 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
238 | void ui_layout_fill(UiObject* obj, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
239 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
240 | ct->layout.fill = ui_bool2lb(fill); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
241 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
242 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
243 | void ui_layout_hexpand(UiObject* obj, UiBool expand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
244 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
245 | ct->layout.hexpand = expand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
246 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
247 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
248 | void ui_layout_vexpand(UiObject* obj, UiBool expand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
249 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
250 | ct->layout.vexpand = expand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
251 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
252 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
253 | void ui_layout_width(UiObject* obj, int width) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
254 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
255 | ct->layout.width = width; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
256 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
257 | |
186
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
258 | void ui_layout_height(UiObject* obj, int height) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
259 | UiContainer* ct = uic_get_current_container(obj); |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
260 | ct->layout.height = height; |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
261 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
262 | |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
263 | void ui_layout_colspan(UiObject* obj, int cols) { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
264 | UiContainer* ct = uic_get_current_container(obj); |
186
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
265 | ct->layout.colspan = cols; |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
266 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
267 | |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
268 | void ui_layout_rowspan(UiObject* obj, int rows) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
269 | UiContainer* ct = uic_get_current_container(obj); |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
270 | ct->layout.rowspan = rows; |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
271 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
272 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
273 | void ui_newline(UiObject* obj) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
274 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
275 | ct->layout.newline = TRUE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
276 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
277 |