Sun, 01 Oct 2023 16:39:03 +0200
add onchange event for toggle buttons (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 | |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
52 | static UIWIDGET ui_box(UiObject* obj, UiBoxContainerType type) { |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
53 | UiContainer* ct = uic_get_current_container(obj); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
54 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
55 | Grid grid = Grid(); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
56 | ct->Add(grid, true); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
57 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
58 | UIElement elm = grid; |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
59 | UiWidget* widget = new UiWidget(elm); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
60 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
61 | UiObject* newobj = uic_object_new(obj, widget); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
62 | newobj->container = new UiBoxContainer(grid, type); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
63 | uic_obj_add(obj, newobj); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
64 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
65 | return widget; |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
66 | } |
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 | UIWIDGET ui_vbox(UiObject* obj) { |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
69 | return ui_box(obj, UI_CONTAINER_VBOX); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
70 | } |
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 | UIWIDGET ui_hbox(UiObject* obj) { |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
73 | return ui_box(obj, UI_CONTAINER_HBOX); |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
74 | } |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
75 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | UiBoxContainer::UiBoxContainer(Grid grid, enum UiBoxContainerType type) { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | this->grid = grid; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | this->type = type; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
80 | GridLength gl; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
81 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
82 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
83 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | // hbox needs one row def, vbox needs one col def |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | // 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
|
86 | if (type == UI_CONTAINER_HBOX) { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
87 | boxRowDef = RowDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
88 | boxRowDef.Height(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
89 | grid.RowDefinitions().Append(boxRowDef); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | } else { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
91 | boxColDef = ColumnDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
92 | boxColDef.Width(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
93 | grid.ColumnDefinitions().Append(boxColDef); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | } |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
95 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
96 | ui_reset_layout(layout); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
99 | void UiBoxContainer::Add(FrameworkElement control, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
100 | if (this->layout.fill != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
101 | fill = ui_lb2bool(this->layout.fill); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
102 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
103 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | GridLength gl; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | if (fill) { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | gl.Value = 1; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | gl.GridUnitType = GridUnitType::Star; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | else { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | gl.Value = 0; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | gl.GridUnitType = GridUnitType::Auto; |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
114 | control.HorizontalAlignment(HorizontalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
115 | control.VerticalAlignment(VerticalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
116 | |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | if (type == UI_CONTAINER_HBOX) { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | ColumnDefinition coldef = ColumnDefinition(); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | coldef.Width(gl); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | grid.ColumnDefinitions().Append(coldef); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | grid.SetColumn(control, grid.Children().Size()); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
122 | grid.SetRow(control, 0); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | } else { |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | RowDefinition rowdef = RowDefinition(); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | rowdef.Height(gl); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | grid.RowDefinitions().Append(rowdef); |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | grid.SetRow(control, grid.Children().Size()); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
128 | grid.SetColumn(control, 0); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | } |
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 | grid.Children().Append(control); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
132 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
133 | ui_reset_layout(layout); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
134 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
135 | |
188
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
136 | |
fbbae6738252
implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
186
diff
changeset
|
137 | // --------------------- UiGridContainer --------------------- |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
138 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
139 | UIWIDGET ui_grid(UiObject* obj) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
140 | return ui_grid_sp(obj, 0, 0, 0); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
141 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
142 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
143 | UIWIDGET ui_grid_sp(UiObject* obj, int margin, int columnspacing, int rowspacing) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
144 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
145 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
146 | Grid grid = Grid(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
147 | ct->Add(grid, true); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
148 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
149 | UIElement elm = grid; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
150 | UiWidget* widget = new UiWidget(elm); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
151 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
152 | UiObject* newobj = uic_object_new(obj, widget); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
153 | newobj->container = new UiGridContainer(grid, margin, columnspacing, rowspacing); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
154 | uic_obj_add(obj, newobj); |
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 | return widget; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
157 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
158 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
159 | 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
|
160 | this->grid = grid; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
161 | 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
|
162 | grid.Margin(t); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
163 | grid.ColumnSpacing((double)columnspacing); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
164 | grid.RowSpacing((double)rowspacing); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
165 | ui_reset_layout(layout); |
182
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | } |
6cf690e042bd
add window container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
168 | void UiGridContainer::Add(FrameworkElement control, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
169 | GridLength gl; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
170 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
171 | int hexpand = FALSE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
172 | int vexpand = FALSE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
173 | if (layout.hexpand != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
174 | hexpand = layout.hexpand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
175 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
176 | if (layout.vexpand != UI_LAYOUT_UNDEFINED) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
177 | vexpand = layout.vexpand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
178 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
179 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
180 | // create new RowDefinition for the new line |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
181 | if (layout.newline || y == -1) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
182 | x = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
183 | y++; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
184 | RowDefinition rowdef = RowDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
185 | if (vexpand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
186 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
187 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
188 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
189 | else { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
190 | gl.GridUnitType = GridUnitType::Auto; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
191 | gl.Value = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
192 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
193 | rowdef.Height(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
194 | grid.RowDefinitions().Append(rowdef); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
195 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
196 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
197 | // create new columndefinition, if a new column is added |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
198 | if (x == cols) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
199 | if (hexpand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
200 | gl.GridUnitType = GridUnitType::Star; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
201 | gl.Value = 1; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
202 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
203 | else { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
204 | gl.GridUnitType = GridUnitType::Auto; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
205 | gl.Value = 0; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
206 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
207 | ColumnDefinition coldef = ColumnDefinition(); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
208 | coldef.Width(gl); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
209 | grid.ColumnDefinitions().Append(coldef); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
210 | cols++; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
211 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
212 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
213 | // add control |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
214 | control.HorizontalAlignment(HorizontalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
215 | control.VerticalAlignment(VerticalAlignment::Stretch); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
216 | |
186
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
217 | if (layout.colspan > 0) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
218 | grid.SetColumnSpan(control, layout.colspan); |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
219 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
220 | if (layout.rowspan > 0) { |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
221 | grid.SetRowSpan(control, layout.rowspan); |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
222 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
223 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
224 | grid.SetRow(control, y); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
225 | grid.SetColumn(control, x); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
226 | grid.Children().Append(control); |
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 | x++; |
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 | ui_reset_layout(layout); |
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 | |
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 | * -------------------- Layout Functions -------------------- |
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 | * functions for setting layout attributes for the current container |
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 | */ |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
239 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
240 | void ui_layout_fill(UiObject* obj, UiBool fill) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
241 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
242 | ct->layout.fill = ui_bool2lb(fill); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
243 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
244 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
245 | void ui_layout_hexpand(UiObject* obj, UiBool expand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
246 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
247 | ct->layout.hexpand = expand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
248 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
249 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
250 | void ui_layout_vexpand(UiObject* obj, UiBool expand) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
251 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
252 | ct->layout.vexpand = expand; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
253 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
254 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
255 | void ui_layout_width(UiObject* obj, int width) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
256 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
257 | ct->layout.width = width; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
258 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
259 | |
186
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
260 | 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
|
261 | 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
|
262 | ct->layout.height = height; |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
263 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
264 | |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
265 | void ui_layout_colspan(UiObject* obj, int cols) { |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
266 | 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
|
267 | ct->layout.colspan = cols; |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
268 | } |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
269 | |
5db4979bf482
implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
185
diff
changeset
|
270 | 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
|
271 | 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
|
272 | ct->layout.rowspan = rows; |
185
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
273 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
274 | |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
275 | void ui_newline(UiObject* obj) { |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
276 | UiContainer* ct = uic_get_current_container(obj); |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
277 | ct->layout.newline = TRUE; |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
278 | } |
4a8b1a748f09
implement grid container (WinUI)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
182
diff
changeset
|
279 |