2 summary:: CompositeView with a FlowLayout as decorator
4 related:: Classes/FlowLayout, Classes/CompositeView
7 In the simplest respect this is a lazy contraction of this:
10 w.view.decorator = FlowLayout.new(w.bounds);
14 link::Classes/FlowView:: add some features to this setup.
19 GUI.slider.new(f, Rect(0,0,100,100));
20 GUI.slider.new(f, Rect(0,0,100,100));
22 // the StartRow will be fixed at this point in the children array
25 GUI.slider.new(f, Rect(0,0,100,100));
28 GUI.slider.new(f, Rect(0,0,100,100));
41 An instance of link::Classes/Rect::, or a link::Classes/Point:: indicating width@height.
47 argument:: windowTitle
56 METHOD:: indentedRemaining
57 The maximum space that is left, starting at the current cursor position.
62 GUI.slider.new(f, Rect(0,0,100,100));
63 GUI.slider.new(f, Rect(0,0,100,100));
65 GUI.slider.new(f, f.indentedRemaining)
66 .background = Color.blue(alpha:0.2)
72 GUI.slider.new(f, Rect(0,0,100,100));
73 GUI.slider.new(f, Rect(0,0,100,100));
75 f.startRow; // new row
77 GUI.slider.new(f, f.indentedRemaining)
78 .background = Color.blue(alpha:0.2)
84 GUI.slider.new(f, Rect(0,0,100,100));
85 GUI.slider.new(f, Rect(0,0,100,100));
86 GUI.slider.new(f, Rect(0,0,100,100));
87 GUI.slider.new(f, Rect(0,0,100,100));
89 GUI.slider.new(f, f.indentedRemaining)
90 .background = Color.blue(alpha:0.2)
95 The area used so far, rounded up to the nearest rectangle plus margin.
101 f.background = Color.blue(alpha:0.1);
103 GUI.slider.new(f, Rect(0,0,100,100));
104 GUI.slider.new(f, Rect(0,0,100,100));
109 GUI.compositeView.new(w,f.used)
110 .background = Color.red(alpha: 0.1);
117 f.background = Color.blue(alpha:0.1);
119 GUI.slider.new(f, Rect(0,0,100,100));
120 GUI.slider.new(f, Rect(0,0,100,100));
122 f.startRow; // new row
124 GUI.slider.new(f, Rect(0,0,100,100));
129 GUI.compositeView.new(w,f.used)
130 .background = Color.red(alpha: 0.1);
135 Insert a sub flow view into the current view.
140 GUI.slider.new(f, Rect(0,0,100,100));
142 // flow within a flow
145 GUI.slider.new(g,Rect(0,0,100,100)).background_(Color.rand);
146 }).background_(Color.black); // shrinks to fit the contents afterwards
151 (describe argument here)
154 (describe argument here)
157 Insert a sub composite view into the current view.
162 GUI.slider.new(f, Rect(0,0,100,100));
166 GUI.slider.new(g, Rect(50,30,50,100)).background_(Color.rand);
167 GUI.slider.new(g, Rect(120,30,50,100)).background_(Color.rand);
168 },Rect(0, 0, 200, 200)).background_(Color.black);
171 "Back to flowing".gui(f);
176 (describe argument here)
179 (describe argument here)
185 // note: some of the following examples use ActionButton from the crucialib
189 FlowView.new.flow({ arg f;
190 // b = ActionButton(f,"hi",minWidth:140)
191 }).background_(Color.grey)
196 FlowView.new.flow({ arg f;
197 b = ActionButton(f,"hi",minWidth:140);
198 }).background_(Color.grey)
203 FlowView.new.flow({ arg f;
204 b = GUI.slider.new(f,Rect(0,0,100,100));
205 }).background_(Color.grey)
210 FlowView.new.flow({ arg f;
213 //b = ActionButton(f,"hi",minWidth:140)
214 }).background_(Color.white)
215 }).background_(Color.grey)
220 FlowView.new.flow({ arg f;
223 b = ActionButton(f,"hi",minWidth:140)
224 }).background_(Color.white)
225 }).background_(Color.grey)
230 FlowView.new.flow({ arg f;
234 ActionButton(f,"hello",minWidth:100);
235 }).background_(Color.blue);
236 b = ActionButton(f,"hi",minWidth:140);
237 }).background_(Color.white)
238 }).background_(Color.grey)
243 FlowView.new.flow({ arg f;
247 ActionButton(f,"hello",minWidth:100);
248 }).background_(Color.blue);
249 b = ActionButton(f,"hi",minWidth:140);
250 }).background_(Color.white)
251 }).background_(Color.grey)
256 FlowView.new.flow({ arg f;
259 b = ActionButton(f,"hi",minWidth:140);
261 ActionButton(f,"hello",minWidth:100);
262 }).background_(Color.blue);
263 }).background_(Color.white)
264 }).background_(Color.grey)
268 FlowView.new.flow({ arg f;
271 b = GUI.slider.new(f,Rect(0,0,140,20));
273 ActionButton(f,"hello",minWidth:100);
274 }).background_(Color.blue);
275 }).background_(Color.white)
276 }).background_(Color.grey)
281 FlowView.new.flow({ arg f;
282 b = GUI.slider.new(f,Rect(0,0,140,20));
284 ActionButton(f,"hello",minWidth:100);
285 }).background_(Color.blue);
286 }).background_(Color.grey)
291 a = FlowView.new.flow({ arg f;
295 ActionButton(f,"hello",minWidth:100);
296 }).background_(Color.blue);
297 ActionButton(f,"hi",minWidth:140);
298 }).background_(Color.white)
299 }).background_(Color.grey)
304 w.resizeToFit(true,true);
307 // add something big back in
308 ActionButton(w,"i'm back",minWidth: 200);
309 w.resizeToFit(true,true);
310 // slightly wrong size at the bottom