Sun, 17 Jan 2016 19:19:28 +0100
improved gtk2 implementation of grid container
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | using System; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | using System.Collections.Generic; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | using System.Linq; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | using System.Text; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | using System.Threading.Tasks; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | using System.Windows; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | using System.Windows.Controls; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | namespace UI |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | public interface Container |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | { |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
13 | Layout Layout { get; set; } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
14 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | void Add(UIElement control, bool fill); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
18 | public class Layout |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
19 | { |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
20 | public bool? Fill { get; set; } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
21 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
22 | public Layout() |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
23 | { |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
24 | Fill = null; |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
25 | } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
26 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
27 | public bool IsFill(bool fill) |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
28 | { |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
29 | if (Fill != null) |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
30 | { |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
31 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
32 | return (bool)Fill; |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
33 | } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
34 | return fill; |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
35 | } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
36 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
37 | public void Reset() |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
38 | { |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
39 | Fill = null; |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
40 | } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
41 | } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
42 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | public enum BoxOrientation |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | VERTICAL, |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | HORIZONTAL |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
49 | public class BoxContainer : Grid, Container |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | { |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
51 | public Layout Layout { get; set; } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
52 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
53 | private BoxOrientation Orientation; |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | private int x = 0; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | private int y = 0; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | private bool filled = false; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
60 | public BoxContainer(BoxOrientation orientation) : base() |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | { |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
62 | Layout = new Layout(); |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
63 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | Orientation = orientation; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | if(Orientation == BoxOrientation.HORIZONTAL) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | RowDefinition row = new RowDefinition(); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | row.Height = new GridLength(1, GridUnitType.Star); |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
69 | RowDefinitions.Add(row); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | else |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | ColumnDefinition col = new ColumnDefinition(); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | col.Width = new GridLength(1, GridUnitType.Star); |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
75 | ColumnDefinitions.Add(col); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | } |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
78 | |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
79 | public BoxContainer(Container parent, BoxOrientation orientation) : this(orientation) |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
80 | { |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
81 | parent.Add(this, true); |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
82 | } |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | public void Add(UIElement control, bool fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | { |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
86 | fill = Layout.IsFill(fill); |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
87 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | if(Orientation == BoxOrientation.HORIZONTAL) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | ColumnDefinition col = new ColumnDefinition(); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | if(filled && fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | fill = false; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | Console.WriteLine("BoxContainer can only contain one filled control"); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | if(fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | col.Width = new GridLength(1, GridUnitType.Star); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | filled = true; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | else |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | col.Width = GridLength.Auto; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | } |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
105 | ColumnDefinitions.Add(col); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | else |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | RowDefinition row = new RowDefinition(); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | if (filled && fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | fill = false; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | Console.WriteLine("BoxContainer can only contain one filled control"); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | if(fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | row.Height = new GridLength(1, GridUnitType.Star); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | filled = true; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | else |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | row.Height = GridLength.Auto; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | } |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
124 | RowDefinitions.Add(row); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | Grid.SetColumn(control, x); |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | Grid.SetRow(control, y); |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
129 | Children.Add(control); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | if(Orientation == BoxOrientation.HORIZONTAL) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | x++; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | else |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | y++; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | } |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
139 | |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
140 | Layout.Reset(); |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | } |
84
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
142 | |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
143 | public static BoxContainer CreateBoxContainer(Container parent, BoxOrientation orientation) |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
144 | { |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
145 | return Application.GetInstance().Exec<BoxContainer>(() => new BoxContainer(parent, orientation)); |
a56c2baa9429
added vbox,hbox function (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
83
diff
changeset
|
146 | } |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | public class GridContainer : Container |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | { |
85
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
151 | public Layout Layout { get; set; } |
91f45354d1e2
added ui_layout_fill (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
84
diff
changeset
|
152 | |
83
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | public Grid Grid; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | public GridContainer(System.Windows.Controls.Grid grid) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | Grid = grid; |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | public void Add(UIElement control, bool fill) |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | { |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | } |
a38aec91bd66
added box layout and button (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | } |