]>
Commit | Line | Data |
---|---|---|
5279a24d | 1 | ///////////////////////////////////////////////////////////////////////////// |
ce7208d4 | 2 | // Name: wx/sizer.h |
a4ab8ed5 | 3 | // Purpose: provide wxSizer class for layout |
5279a24d | 4 | // Author: Robert Roebling and Robin Dunn |
5f813ad6 | 5 | // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags) |
0c0d686f | 6 | // Created: |
5279a24d | 7 | // RCS-ID: $Id$ |
a4ab8ed5 | 8 | // Copyright: (c) Robin Dunn, Robert Roebling |
65571936 | 9 | // Licence: wxWindows licence |
5279a24d RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __WXSIZER_H__ | |
13 | #define __WXSIZER_H__ | |
14 | ||
5279a24d RR |
15 | #include "wx/defs.h" |
16 | ||
17 | #include "wx/window.h" | |
5279a24d RR |
18 | |
19 | //--------------------------------------------------------------------------- | |
20 | // classes | |
21 | //--------------------------------------------------------------------------- | |
22 | ||
ca8d899f VZ |
23 | class WXDLLEXPORT wxButton; |
24 | class WXDLLEXPORT wxBoxSizer; | |
446e5259 VS |
25 | class WXDLLEXPORT wxSizerItem; |
26 | class WXDLLEXPORT wxSizer; | |
5f813ad6 | 27 | |
97ebfd54 VZ |
28 | #ifndef wxUSE_BORDER_BY_DEFAULT |
29 | #ifdef __SMARTPHONE__ | |
30 | // no borders by default on limited size screen | |
31 | #define wxUSE_BORDER_BY_DEFAULT 0 | |
32 | #else | |
33 | #define wxUSE_BORDER_BY_DEFAULT 1 | |
34 | #endif | |
35 | #endif | |
36 | ||
5f813ad6 VZ |
37 | // ---------------------------------------------------------------------------- |
38 | // wxSizerFlags: flags used for an item in the sizer | |
39 | // ---------------------------------------------------------------------------- | |
40 | ||
41 | class WXDLLEXPORT wxSizerFlags | |
42 | { | |
43 | public: | |
44 | // construct the flags object initialized with the given proportion (0 by | |
45 | // default) | |
46 | wxSizerFlags(int proportion = 0) : m_proportion(proportion) | |
47 | { | |
48 | m_flags = 0; | |
49 | m_borderInPixels = 0; | |
50 | } | |
51 | ||
52 | // setters for all sizer flags, they all return the object itself so that | |
53 | // calls to them can be chained | |
54 | ||
55 | wxSizerFlags& Proportion(int proportion) | |
56 | { | |
57 | m_proportion = proportion; | |
58 | return *this; | |
59 | } | |
60 | ||
61 | wxSizerFlags& Align(int alignment) // combination of wxAlignment values | |
62 | { | |
ddfcd9aa | 63 | m_flags &= ~wxALIGN_MASK; |
5f813ad6 VZ |
64 | m_flags |= alignment; |
65 | ||
66 | return *this; | |
67 | } | |
68 | ||
00dc67b8 VZ |
69 | wxSizerFlags& Expand() |
70 | { | |
71 | m_flags |= wxEXPAND; | |
72 | return *this; | |
73 | } | |
74 | ||
5f813ad6 | 75 | // some shortcuts for Align() |
5f813ad6 VZ |
76 | wxSizerFlags& Centre() { return Align(wxCENTRE); } |
77 | wxSizerFlags& Center() { return Centre(); } | |
ccee328e | 78 | wxSizerFlags& Top() { return Align(wxALIGN_TOP); } |
e72ac082 VZ |
79 | wxSizerFlags& Left() { return Align(wxALIGN_LEFT); } |
80 | wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); } | |
ccee328e | 81 | wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); } |
5f813ad6 | 82 | |
2be7beda VZ |
83 | // default border size used by Border() below |
84 | static int GetDefaultBorder() | |
85 | { | |
97ebfd54 | 86 | #if wxUSE_BORDER_BY_DEFAULT |
2be7beda VZ |
87 | // FIXME: default border size shouldn't be hardcoded and at the very |
88 | // least they should depend on the current font size | |
89 | return 5; | |
97ebfd54 VZ |
90 | #else |
91 | return 0; | |
92 | #endif | |
2be7beda VZ |
93 | } |
94 | ||
5f813ad6 VZ |
95 | |
96 | wxSizerFlags& Border(int direction, int borderInPixels) | |
97 | { | |
98 | m_flags &= ~wxALL; | |
99 | m_flags |= direction; | |
100 | ||
101 | m_borderInPixels = borderInPixels; | |
102 | ||
103 | return *this; | |
104 | } | |
105 | ||
106 | wxSizerFlags& Border(int direction = wxALL) | |
107 | { | |
97ebfd54 VZ |
108 | #if wxUSE_BORDER_BY_DEFAULT |
109 | return Border(direction, GetDefaultBorder()); | |
110 | #else | |
92b0cd9e VZ |
111 | // no borders by default on limited size screen |
112 | wxUnusedVar(direction); | |
113 | ||
114 | return *this; | |
97ebfd54 VZ |
115 | #endif |
116 | } | |
117 | ||
118 | wxSizerFlags& DoubleBorder(int direction = wxALL) | |
119 | { | |
120 | #if wxUSE_BORDER_BY_DEFAULT | |
121 | return Border(direction, 2*GetDefaultBorder()); | |
92b0cd9e | 122 | #else |
97ebfd54 VZ |
123 | wxUnusedVar(direction); |
124 | ||
125 | return *this; | |
92b0cd9e | 126 | #endif |
5f813ad6 VZ |
127 | } |
128 | ||
97ebfd54 VZ |
129 | wxSizerFlags& TripleBorder(int direction = wxALL) |
130 | { | |
131 | #if wxUSE_BORDER_BY_DEFAULT | |
132 | return Border(direction, 3*GetDefaultBorder()); | |
133 | #else | |
134 | wxUnusedVar(direction); | |
135 | ||
136 | return *this; | |
137 | #endif | |
138 | } | |
139 | ||
140 | wxSizerFlags& HorzBorder() | |
141 | { | |
142 | #if wxUSE_BORDER_BY_DEFAULT | |
143 | return Border(wxLEFT | wxRIGHT, GetDefaultBorder()); | |
144 | #else | |
145 | return *this; | |
146 | #endif | |
147 | } | |
148 | ||
149 | wxSizerFlags& DoubleHorzBorder() | |
150 | { | |
151 | #if wxUSE_BORDER_BY_DEFAULT | |
152 | return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder()); | |
153 | #else | |
154 | return *this; | |
155 | #endif | |
156 | } | |
5f813ad6 | 157 | |
d95527de VZ |
158 | // setters for the others flags |
159 | wxSizerFlags& Shaped() | |
160 | { | |
161 | m_flags |= wxSHAPED; | |
162 | ||
163 | return *this; | |
164 | } | |
165 | ||
166 | wxSizerFlags& FixedMinSize() | |
167 | { | |
168 | m_flags |= wxFIXED_MINSIZE; | |
169 | ||
170 | return *this; | |
171 | } | |
d95527de | 172 | |
5f813ad6 VZ |
173 | // accessors for wxSizer only |
174 | int GetProportion() const { return m_proportion; } | |
175 | int GetFlags() const { return m_flags; } | |
176 | int GetBorderInPixels() const { return m_borderInPixels; } | |
177 | ||
178 | private: | |
179 | int m_proportion; | |
180 | int m_flags; | |
181 | int m_borderInPixels; | |
182 | }; | |
183 | ||
184 | ||
50c06297 VZ |
185 | // ---------------------------------------------------------------------------- |
186 | // wxSizerSpacer: used by wxSizerItem to represent a spacer | |
187 | // ---------------------------------------------------------------------------- | |
5279a24d | 188 | |
50c06297 | 189 | class WXDLLEXPORT wxSizerSpacer |
5279a24d RR |
190 | { |
191 | public: | |
50c06297 | 192 | wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { } |
5f813ad6 | 193 | |
50c06297 VZ |
194 | void SetSize(const wxSize& size) { m_size = size; } |
195 | const wxSize& GetSize() const { return m_size; } | |
5f813ad6 | 196 | |
50c06297 VZ |
197 | void Show(bool show) { m_isShown = show; } |
198 | bool IsShown() const { return m_isShown; } | |
5f813ad6 | 199 | |
50c06297 VZ |
200 | private: |
201 | // the size, in pixel | |
202 | wxSize m_size; | |
df5ddbca | 203 | |
50c06297 VZ |
204 | // is the spacer currently shown? |
205 | bool m_isShown; | |
206 | }; | |
207 | ||
208 | // ---------------------------------------------------------------------------- | |
209 | // wxSizerItem | |
210 | // ---------------------------------------------------------------------------- | |
211 | ||
212 | class WXDLLEXPORT wxSizerItem : public wxObject | |
213 | { | |
214 | public: | |
df5ddbca | 215 | // window |
12a3f227 RL |
216 | wxSizerItem( wxWindow *window, |
217 | int proportion, | |
218 | int flag, | |
219 | int border, | |
220 | wxObject* userData ); | |
df5ddbca | 221 | |
50c06297 VZ |
222 | // window with flags |
223 | wxSizerItem(wxWindow *window, const wxSizerFlags& flags) | |
224 | { | |
225 | Init(flags); | |
226 | ||
4dd10327 | 227 | DoSetWindow(window); |
50c06297 VZ |
228 | } |
229 | ||
df5ddbca | 230 | // subsizer |
12a3f227 RL |
231 | wxSizerItem( wxSizer *sizer, |
232 | int proportion, | |
233 | int flag, | |
234 | int border, | |
235 | wxObject* userData ); | |
df5ddbca | 236 | |
50c06297 VZ |
237 | // sizer with flags |
238 | wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags) | |
239 | { | |
240 | Init(flags); | |
241 | ||
4dd10327 | 242 | DoSetSizer(sizer); |
50c06297 VZ |
243 | } |
244 | ||
5f813ad6 VZ |
245 | // spacer |
246 | wxSizerItem( int width, | |
247 | int height, | |
248 | int proportion, | |
249 | int flag, | |
250 | int border, | |
251 | wxObject* userData); | |
252 | ||
50c06297 VZ |
253 | // spacer with flags |
254 | wxSizerItem(int width, int height, const wxSizerFlags& flags) | |
255 | { | |
256 | Init(flags); | |
257 | ||
4dd10327 | 258 | DoSetSpacer(wxSize(width, height)); |
50c06297 VZ |
259 | } |
260 | ||
20b35a69 RD |
261 | wxSizerItem(); |
262 | virtual ~wxSizerItem(); | |
dc259b79 | 263 | |
84f7908b | 264 | virtual void DeleteWindows(); |
df5ddbca | 265 | |
96fdbb60 | 266 | // Enable deleting the SizerItem without destroying the contained sizer. |
50c06297 | 267 | void DetachSizer() { m_sizer = NULL; } |
96fdbb60 | 268 | |
9cbee2ce | 269 | virtual wxSize GetSize() const; |
df5ddbca | 270 | virtual wxSize CalcMin(); |
fbfb8bcc | 271 | virtual void SetDimension( const wxPoint& pos, const wxSize& size ); |
df5ddbca | 272 | |
9cbee2ce | 273 | wxSize GetMinSize() const |
df5ddbca | 274 | { return m_minSize; } |
ba763a45 RD |
275 | wxSize GetMinSizeWithBorder() const; |
276 | ||
1eba2193 | 277 | void SetMinSize(const wxSize& size) |
50c06297 VZ |
278 | { |
279 | if ( IsWindow() ) | |
280 | m_window->SetMinSize(size); | |
281 | m_minSize = size; | |
282 | } | |
1eba2193 | 283 | void SetMinSize( int x, int y ) |
8b2bac62 | 284 | { SetMinSize(wxSize(x, y)); } |
12a3f227 | 285 | void SetInitSize( int x, int y ) |
1eba2193 | 286 | { SetMinSize(wxSize(x, y)); } |
df5ddbca | 287 | |
50c06297 VZ |
288 | // if either of dimensions is zero, ratio is assumed to be 1 |
289 | // to avoid "divide by zero" errors | |
290 | void SetRatio(int width, int height) | |
df5ddbca | 291 | { m_ratio = (width && height) ? ((float) width / (float) height) : 1; } |
50c06297 VZ |
292 | void SetRatio(const wxSize& size) |
293 | { SetRatio(size.x, size.y); } | |
294 | void SetRatio(float ratio) | |
df5ddbca | 295 | { m_ratio = ratio; } |
2aab8f16 | 296 | float GetRatio() const |
df5ddbca RR |
297 | { return m_ratio; } |
298 | ||
50c06297 | 299 | virtual wxRect GetRect() { return m_rect; } |
56eee37f | 300 | |
50c06297 VZ |
301 | bool IsWindow() const { return m_kind == Item_Window; } |
302 | bool IsSizer() const { return m_kind == Item_Sizer; } | |
303 | bool IsSpacer() const { return m_kind == Item_Spacer; } | |
2aab8f16 | 304 | |
6a9e54bd | 305 | #if WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
306 | // Deprecated in 2.6, use {G,S}etProportion instead. |
307 | wxDEPRECATED( void SetOption( int option ) ); | |
308 | wxDEPRECATED( int GetOption() const ); | |
6a9e54bd | 309 | #endif // WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
310 | |
311 | void SetProportion( int proportion ) | |
312 | { m_proportion = proportion; } | |
313 | int GetProportion() const | |
314 | { return m_proportion; } | |
df5ddbca RR |
315 | void SetFlag( int flag ) |
316 | { m_flag = flag; } | |
12a3f227 RL |
317 | int GetFlag() const |
318 | { return m_flag; } | |
df5ddbca RR |
319 | void SetBorder( int border ) |
320 | { m_border = border; } | |
12a3f227 RL |
321 | int GetBorder() const |
322 | { return m_border; } | |
df5ddbca RR |
323 | |
324 | wxWindow *GetWindow() const | |
50c06297 | 325 | { return m_kind == Item_Window ? m_window : NULL; } |
df5ddbca | 326 | wxSizer *GetSizer() const |
50c06297 VZ |
327 | { return m_kind == Item_Sizer ? m_sizer : NULL; } |
328 | wxSize GetSpacer() const; | |
12a3f227 | 329 | |
c86fd3a7 VZ |
330 | // this function behaves obviously for the windows and spacers but for the |
331 | // sizers it returns true if any sizer element is shown and only returns | |
332 | // false if all of them are hidden | |
333 | bool IsShown() const; | |
50c06297 | 334 | void Show(bool show); |
12a3f227 | 335 | |
e8c1be04 | 336 | void SetUserData(wxObject* userData) |
1737dac2 | 337 | { delete m_userData; m_userData = userData; } |
9cbee2ce | 338 | wxObject* GetUserData() const |
df5ddbca | 339 | { return m_userData; } |
9cbee2ce | 340 | wxPoint GetPosition() const |
df5ddbca | 341 | { return m_pos; } |
0c0d686f | 342 | |
4dd10327 VZ |
343 | // these functions delete the current contents of the item if it's a sizer |
344 | // or a spacer but not if it is a window | |
345 | void AssignWindow(wxWindow *window) | |
346 | { | |
347 | Free(); | |
348 | DoSetWindow(window); | |
349 | } | |
350 | ||
351 | void AssignSizer(wxSizer *sizer) | |
352 | { | |
353 | Free(); | |
354 | DoSetSizer(sizer); | |
355 | } | |
356 | ||
357 | void AssignSpacer(const wxSize& size) | |
358 | { | |
359 | Free(); | |
360 | DoSetSpacer(size); | |
361 | } | |
362 | ||
363 | void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } | |
50c06297 | 364 | |
4dd10327 VZ |
365 | #if WXWIN_COMPATIBILITY_2_8 |
366 | // these functions do not free the old sizer/spacer and so can easily | |
367 | // provoke the memory leaks and so shouldn't be used, use Assign() instead | |
368 | wxDEPRECATED( void SetWindow(wxWindow *window) ); | |
369 | wxDEPRECATED( void SetSizer(wxSizer *sizer) ); | |
370 | wxDEPRECATED( void SetSpacer(const wxSize& size) ); | |
371 | wxDEPRECATED( void SetSpacer(int width, int height) ); | |
372 | #endif // WXWIN_COMPATIBILITY_2_8 | |
50c06297 | 373 | |
c62ac5b6 | 374 | protected: |
5f813ad6 | 375 | // common part of several ctors |
4dd10327 | 376 | void Init() { m_userData = NULL; m_kind = Item_None; } |
5f813ad6 VZ |
377 | |
378 | // common part of ctors taking wxSizerFlags | |
379 | void Init(const wxSizerFlags& flags); | |
380 | ||
4dd10327 VZ |
381 | // free current contents |
382 | void Free(); | |
383 | ||
384 | // common parts of Set/AssignXXX() | |
385 | void DoSetWindow(wxWindow *window); | |
386 | void DoSetSizer(wxSizer *sizer); | |
387 | void DoSetSpacer(const wxSize& size); | |
f303d69f VZ |
388 | |
389 | // discriminated union: depending on m_kind one of the fields is valid | |
50c06297 VZ |
390 | enum |
391 | { | |
392 | Item_None, | |
393 | Item_Window, | |
394 | Item_Sizer, | |
395 | Item_Spacer, | |
396 | Item_Max | |
397 | } m_kind; | |
398 | union | |
399 | { | |
400 | wxWindow *m_window; | |
401 | wxSizer *m_sizer; | |
402 | wxSizerSpacer *m_spacer; | |
403 | }; | |
5f813ad6 | 404 | |
df5ddbca RR |
405 | wxPoint m_pos; |
406 | wxSize m_minSize; | |
12a3f227 | 407 | int m_proportion; |
df5ddbca RR |
408 | int m_border; |
409 | int m_flag; | |
2b5f62a0 | 410 | |
50c06297 VZ |
411 | // on screen rectangle of this item (not including borders) |
412 | wxRect m_rect; | |
12a3f227 RL |
413 | |
414 | // Aspect ratio can always be calculated from m_size, | |
415 | // but this would cause precision loss when the window | |
416 | // is shrunk. It is safer to preserve the initial value. | |
df5ddbca | 417 | float m_ratio; |
2b5f62a0 | 418 | |
df5ddbca | 419 | wxObject *m_userData; |
2aab8f16 | 420 | |
9cbee2ce | 421 | private: |
4393b50c | 422 | DECLARE_CLASS(wxSizerItem) |
22f3361e | 423 | DECLARE_NO_COPY_CLASS(wxSizerItem) |
c62ac5b6 | 424 | }; |
5279a24d | 425 | |
12a3f227 RL |
426 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); |
427 | ||
5f813ad6 | 428 | |
5279a24d | 429 | //--------------------------------------------------------------------------- |
3417c2cd | 430 | // wxSizer |
5279a24d RR |
431 | //--------------------------------------------------------------------------- |
432 | ||
2aab8f16 | 433 | class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer |
5279a24d RR |
434 | { |
435 | public: | |
e8cfff87 | 436 | wxSizer() { m_containingWindow = NULL; } |
d3c7fc99 | 437 | virtual ~wxSizer(); |
f6bcfd97 | 438 | |
436ae7cf VZ |
439 | // methods for adding elements to the sizer: there are Add/Insert/Prepend |
440 | // overloads for each of window/sizer/spacer/wxSizerItem | |
ca8d899f VZ |
441 | wxSizerItem* Add(wxWindow *window, |
442 | int proportion = 0, | |
443 | int flag = 0, | |
444 | int border = 0, | |
445 | wxObject* userData = NULL); | |
446 | wxSizerItem* Add(wxSizer *sizer, | |
447 | int proportion = 0, | |
448 | int flag = 0, | |
449 | int border = 0, | |
450 | wxObject* userData = NULL); | |
451 | wxSizerItem* Add(int width, | |
452 | int height, | |
453 | int proportion = 0, | |
454 | int flag = 0, | |
455 | int border = 0, | |
456 | wxObject* userData = NULL); | |
457 | wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); | |
458 | wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); | |
459 | wxSizerItem* Add( wxSizerItem *item); | |
460 | ||
461 | wxSizerItem* AddSpacer(int size); | |
462 | wxSizerItem* AddStretchSpacer(int prop = 1); | |
463 | ||
464 | wxSizerItem* Insert(size_t index, | |
465 | wxWindow *window, | |
466 | int proportion = 0, | |
467 | int flag = 0, | |
468 | int border = 0, | |
469 | wxObject* userData = NULL); | |
470 | wxSizerItem* Insert(size_t index, | |
471 | wxSizer *sizer, | |
472 | int proportion = 0, | |
473 | int flag = 0, | |
474 | int border = 0, | |
475 | wxObject* userData = NULL); | |
476 | wxSizerItem* Insert(size_t index, | |
477 | int width, | |
478 | int height, | |
479 | int proportion = 0, | |
480 | int flag = 0, | |
481 | int border = 0, | |
482 | wxObject* userData = NULL); | |
483 | wxSizerItem* Insert(size_t index, | |
484 | wxWindow *window, | |
485 | const wxSizerFlags& flags); | |
486 | wxSizerItem* Insert(size_t index, | |
487 | wxSizer *sizer, | |
488 | const wxSizerFlags& flags); | |
489 | virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); | |
490 | ||
491 | wxSizerItem* InsertSpacer(size_t index, int size); | |
492 | wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); | |
493 | ||
494 | wxSizerItem* Prepend(wxWindow *window, | |
495 | int proportion = 0, | |
496 | int flag = 0, | |
497 | int border = 0, | |
498 | wxObject* userData = NULL); | |
499 | wxSizerItem* Prepend(wxSizer *sizer, | |
500 | int proportion = 0, | |
501 | int flag = 0, | |
502 | int border = 0, | |
503 | wxObject* userData = NULL); | |
504 | wxSizerItem* Prepend(int width, | |
505 | int height, | |
506 | int proportion = 0, | |
507 | int flag = 0, | |
508 | int border = 0, | |
509 | wxObject* userData = NULL); | |
510 | wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); | |
511 | wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); | |
512 | wxSizerItem* Prepend(wxSizerItem *item); | |
513 | ||
514 | wxSizerItem* PrependSpacer(int size); | |
515 | wxSizerItem* PrependStretchSpacer(int prop = 1); | |
8e32ea1c | 516 | |
e8cfff87 | 517 | // set (or possibly unset if window is NULL) or get the window this sizer |
ce7208d4 | 518 | // is used in |
e8cfff87 VZ |
519 | void SetContainingWindow(wxWindow *window); |
520 | wxWindow *GetContainingWindow() const { return m_containingWindow; } | |
749bb9f1 | 521 | |
6a9e54bd | 522 | #if WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
523 | // Deprecated in 2.6 since historically it does not delete the window, |
524 | // use Detach instead. | |
525 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
6a9e54bd WS |
526 | #endif // WXWIN_COMPATIBILITY_2_6 |
527 | ||
f6bcfd97 | 528 | virtual bool Remove( wxSizer *sizer ); |
e0d8fb45 | 529 | virtual bool Remove( int index ); |
00976fe5 | 530 | |
12a3f227 | 531 | virtual bool Detach( wxWindow *window ); |
00976fe5 | 532 | virtual bool Detach( wxSizer *sizer ); |
e0d8fb45 | 533 | virtual bool Detach( int index ); |
00976fe5 | 534 | |
ce7208d4 WS |
535 | virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); |
536 | virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); | |
537 | virtual bool Replace( size_t index, wxSizerItem *newitem ); | |
eae0338f | 538 | |
e0d8fb45 | 539 | virtual void Clear( bool delete_windows = false ); |
84f7908b | 540 | virtual void DeleteWindows(); |
f6bcfd97 BP |
541 | |
542 | void SetMinSize( int width, int height ) | |
543 | { DoSetMinSize( width, height ); } | |
fbfb8bcc | 544 | void SetMinSize( const wxSize& size ) |
f6bcfd97 | 545 | { DoSetMinSize( size.x, size.y ); } |
1e6feb95 | 546 | |
50c06297 | 547 | // Searches recursively |
f6bcfd97 BP |
548 | bool SetItemMinSize( wxWindow *window, int width, int height ) |
549 | { return DoSetItemMinSize( window, width, height ); } | |
fbfb8bcc | 550 | bool SetItemMinSize( wxWindow *window, const wxSize& size ) |
f6bcfd97 | 551 | { return DoSetItemMinSize( window, size.x, size.y ); } |
1e6feb95 | 552 | |
50c06297 | 553 | // Searches recursively |
f6bcfd97 BP |
554 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) |
555 | { return DoSetItemMinSize( sizer, width, height ); } | |
fbfb8bcc | 556 | bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) |
f6bcfd97 | 557 | { return DoSetItemMinSize( sizer, size.x, size.y ); } |
1e6feb95 | 558 | |
12a3f227 RL |
559 | bool SetItemMinSize( size_t index, int width, int height ) |
560 | { return DoSetItemMinSize( index, width, height ); } | |
fbfb8bcc | 561 | bool SetItemMinSize( size_t index, const wxSize& size ) |
12a3f227 | 562 | { return DoSetItemMinSize( index, size.x, size.y ); } |
1e6feb95 | 563 | |
9cbee2ce | 564 | wxSize GetSize() const |
f6bcfd97 | 565 | { return m_size; } |
9cbee2ce | 566 | wxPoint GetPosition() const |
f6bcfd97 | 567 | { return m_position; } |
1e6feb95 | 568 | |
50c06297 | 569 | // Calculate the minimal size or return m_minSize if bigger. |
f6bcfd97 BP |
570 | wxSize GetMinSize(); |
571 | ||
572 | virtual void RecalcSizes() = 0; | |
573 | virtual wxSize CalcMin() = 0; | |
574 | ||
575 | virtual void Layout(); | |
576 | ||
e5251d4f | 577 | wxSize Fit( wxWindow *window ); |
566d84a7 | 578 | void FitInside( wxWindow *window ); |
f6bcfd97 | 579 | void SetSizeHints( wxWindow *window ); |
566d84a7 | 580 | void SetVirtualSizeHints( wxWindow *window ); |
f6bcfd97 | 581 | |
12a3f227 | 582 | wxSizerItemList& GetChildren() |
f6bcfd97 | 583 | { return m_children; } |
f9b5691a VZ |
584 | const wxSizerItemList& GetChildren() const |
585 | { return m_children; } | |
f6bcfd97 BP |
586 | |
587 | void SetDimension( int x, int y, int width, int height ); | |
0c0d686f | 588 | |
9f13661f WS |
589 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); |
590 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
591 | wxSizerItem* GetItem( size_t index ); | |
592 | ||
12a3f227 | 593 | // Manage whether individual scene items are considered |
2b5f62a0 | 594 | // in the layout calculations or not. |
8b2bac62 WS |
595 | bool Show( wxWindow *window, bool show = true, bool recursive = false ); |
596 | bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); | |
597 | bool Show( size_t index, bool show = true ); | |
12a3f227 | 598 | |
8b2bac62 WS |
599 | bool Hide( wxSizer *sizer, bool recursive = false ) |
600 | { return Show( sizer, false, recursive ); } | |
601 | bool Hide( wxWindow *window, bool recursive = false ) | |
602 | { return Show( window, false, recursive ); } | |
603 | bool Hide( size_t index ) | |
604 | { return Show( index, false ); } | |
2b5f62a0 | 605 | |
9cbee2ce RL |
606 | bool IsShown( wxWindow *window ) const; |
607 | bool IsShown( wxSizer *sizer ) const; | |
608 | bool IsShown( size_t index ) const; | |
dc259b79 | 609 | |
2b5f62a0 | 610 | // Recursively call wxWindow::Show () on all sizer items. |
eb2a7883 | 611 | virtual void ShowItems (bool show); |
2b5f62a0 | 612 | |
f303d69f | 613 | void Show(bool show) { ShowItems(show); } |
50c06297 | 614 | |
f6bcfd97 | 615 | protected: |
12a3f227 RL |
616 | wxSize m_size; |
617 | wxSize m_minSize; | |
618 | wxPoint m_position; | |
619 | wxSizerItemList m_children; | |
f6bcfd97 | 620 | |
e8cfff87 VZ |
621 | // the window this sizer is used in, can be NULL |
622 | wxWindow *m_containingWindow; | |
623 | ||
9cbee2ce | 624 | wxSize GetMaxWindowSize( wxWindow *window ) const; |
f6bcfd97 | 625 | wxSize GetMinWindowSize( wxWindow *window ); |
9cbee2ce | 626 | wxSize GetMaxClientSize( wxWindow *window ) const; |
566d84a7 | 627 | wxSize GetMinClientSize( wxWindow *window ); |
566d84a7 | 628 | wxSize VirtualFitSize( wxWindow *window ); |
65ba4113 | 629 | |
f6bcfd97 BP |
630 | virtual void DoSetMinSize( int width, int height ); |
631 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
632 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
12a3f227 | 633 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); |
1e6feb95 | 634 | |
9cbee2ce | 635 | private: |
4393b50c | 636 | DECLARE_CLASS(wxSizer) |
f6bcfd97 | 637 | }; |
c62ac5b6 | 638 | |
f6bcfd97 BP |
639 | //--------------------------------------------------------------------------- |
640 | // wxGridSizer | |
641 | //--------------------------------------------------------------------------- | |
0c0d686f | 642 | |
f6bcfd97 BP |
643 | class WXDLLEXPORT wxGridSizer: public wxSizer |
644 | { | |
645 | public: | |
646 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
647 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
1e6feb95 | 648 | |
5d76f462 VZ |
649 | virtual void RecalcSizes(); |
650 | virtual wxSize CalcMin(); | |
f6bcfd97 BP |
651 | |
652 | void SetCols( int cols ) { m_cols = cols; } | |
653 | void SetRows( int rows ) { m_rows = rows; } | |
654 | void SetVGap( int gap ) { m_vgap = gap; } | |
655 | void SetHGap( int gap ) { m_hgap = gap; } | |
9cbee2ce RL |
656 | int GetCols() const { return m_cols; } |
657 | int GetRows() const { return m_rows; } | |
658 | int GetVGap() const { return m_vgap; } | |
659 | int GetHGap() const { return m_hgap; } | |
1e6feb95 | 660 | |
f6bcfd97 BP |
661 | protected: |
662 | int m_rows; | |
663 | int m_cols; | |
664 | int m_vgap; | |
665 | int m_hgap; | |
1e6feb95 | 666 | |
0ca5105b VZ |
667 | // return the number of total items and the number of columns and rows |
668 | int CalcRowsCols(int& rows, int& cols) const; | |
669 | ||
f6bcfd97 | 670 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); |
1e6feb95 | 671 | |
9cbee2ce | 672 | private: |
4393b50c | 673 | DECLARE_CLASS(wxGridSizer) |
f6bcfd97 | 674 | }; |
5279a24d | 675 | |
f6bcfd97 BP |
676 | //--------------------------------------------------------------------------- |
677 | // wxFlexGridSizer | |
678 | //--------------------------------------------------------------------------- | |
0c0d686f | 679 | |
5d76f462 VZ |
680 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" |
681 | // direction | |
682 | enum wxFlexSizerGrowMode | |
683 | { | |
684 | // don't resize the cells in non-flexible direction at all | |
685 | wxFLEX_GROWMODE_NONE, | |
686 | ||
687 | // uniformly resize only the specified ones (default) | |
688 | wxFLEX_GROWMODE_SPECIFIED, | |
689 | ||
690 | // uniformly resize all cells | |
691 | wxFLEX_GROWMODE_ALL | |
692 | }; | |
693 | ||
f6bcfd97 BP |
694 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer |
695 | { | |
696 | public: | |
5d76f462 | 697 | // ctors/dtor |
f6bcfd97 BP |
698 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); |
699 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
5d76f462 | 700 | virtual ~wxFlexGridSizer(); |
1e6feb95 | 701 | |
1e6feb95 | 702 | |
5d76f462 VZ |
703 | // set the rows/columns which will grow (the others will remain of the |
704 | // constant initial size) | |
e8800dcf | 705 | void AddGrowableRow( size_t idx, int proportion = 0 ); |
f6bcfd97 | 706 | void RemoveGrowableRow( size_t idx ); |
e8800dcf | 707 | void AddGrowableCol( size_t idx, int proportion = 0 ); |
f6bcfd97 | 708 | void RemoveGrowableCol( size_t idx ); |
0c0d686f | 709 | |
1e6feb95 | 710 | |
5d76f462 VZ |
711 | // the sizer cells may grow in both directions, not grow at all or only |
712 | // grow in one direction but not the other | |
713 | ||
714 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
715 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
716 | int GetFlexibleDirection() const { return m_flexDirection; } | |
717 | ||
718 | // note that the grow mode only applies to the direction which is not | |
719 | // flexible | |
720 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
721 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
722 | ||
fc1fcd0e RD |
723 | // Read-only access to the row heights and col widths arrays |
724 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
725 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
8b2bac62 | 726 | |
5d76f462 VZ |
727 | // implementation |
728 | virtual void RecalcSizes(); | |
729 | virtual wxSize CalcMin(); | |
730 | ||
731 | protected: | |
20b35a69 RD |
732 | void AdjustForFlexDirection(); |
733 | void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, | |
734 | int nrows, int ncols); | |
8b2bac62 | 735 | |
5d76f462 VZ |
736 | // the heights/widths of all rows/columns |
737 | wxArrayInt m_rowHeights, | |
738 | m_colWidths; | |
739 | ||
740 | // indices of the growable columns and rows | |
741 | wxArrayInt m_growableRows, | |
742 | m_growableCols; | |
743 | ||
e8800dcf VZ |
744 | // proportion values of the corresponding growable rows and columns |
745 | wxArrayInt m_growableRowsProportions, | |
746 | m_growableColsProportions; | |
747 | ||
5d76f462 VZ |
748 | // parameters describing whether the growable cells should be resized in |
749 | // both directions or only one | |
750 | int m_flexDirection; | |
751 | wxFlexSizerGrowMode m_growMode; | |
1e6feb95 | 752 | |
ba763a45 RD |
753 | // saves CalcMin result to optimize RecalcSizes |
754 | wxSize m_calculatedMinSize; | |
755 | ||
9cbee2ce | 756 | private: |
4393b50c | 757 | DECLARE_CLASS(wxFlexGridSizer) |
22f3361e | 758 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) |
c62ac5b6 RR |
759 | }; |
760 | ||
761 | //--------------------------------------------------------------------------- | |
92afa2b1 | 762 | // wxBoxSizer |
c62ac5b6 RR |
763 | //--------------------------------------------------------------------------- |
764 | ||
92afa2b1 | 765 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
766 | { |
767 | public: | |
f6bcfd97 | 768 | wxBoxSizer( int orient ); |
0c0d686f | 769 | |
f6bcfd97 BP |
770 | void RecalcSizes(); |
771 | wxSize CalcMin(); | |
0c0d686f | 772 | |
9cbee2ce | 773 | int GetOrientation() const |
f6bcfd97 | 774 | { return m_orient; } |
0c0d686f | 775 | |
b657b4c9 JS |
776 | void SetOrientation(int orient) |
777 | { m_orient = orient; } | |
778 | ||
61d514bb RR |
779 | protected: |
780 | int m_orient; | |
781 | int m_stretchable; | |
782 | int m_minWidth; | |
783 | int m_minHeight; | |
784 | int m_fixedWidth; | |
785 | int m_fixedHeight; | |
1e6feb95 | 786 | |
9cbee2ce | 787 | private: |
4393b50c | 788 | DECLARE_CLASS(wxBoxSizer) |
61d514bb | 789 | }; |
0c0d686f | 790 | |
27ea1d8a RR |
791 | //--------------------------------------------------------------------------- |
792 | // wxStaticBoxSizer | |
793 | //--------------------------------------------------------------------------- | |
794 | ||
1e6feb95 VZ |
795 | #if wxUSE_STATBOX |
796 | ||
649cfca1 | 797 | class WXDLLEXPORT wxStaticBox; |
1e6feb95 | 798 | |
27ea1d8a RR |
799 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer |
800 | { | |
801 | public: | |
6c1635b5 | 802 | wxStaticBoxSizer(wxStaticBox *box, int orient); |
450a1593 | 803 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); |
649cfca1 | 804 | virtual ~wxStaticBoxSizer(); |
0c0d686f | 805 | |
f6bcfd97 BP |
806 | void RecalcSizes(); |
807 | wxSize CalcMin(); | |
0c0d686f | 808 | |
9cbee2ce | 809 | wxStaticBox *GetStaticBox() const |
f6bcfd97 | 810 | { return m_staticBox; } |
0c0d686f | 811 | |
eb2a7883 VZ |
812 | // override to hide/show the static box as well |
813 | virtual void ShowItems (bool show); | |
7e2b7860 | 814 | |
e978011a | 815 | virtual bool Detach( wxWindow *window ); |
7e2b7860 VZ |
816 | virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } |
817 | virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } | |
eb2a7883 | 818 | |
27ea1d8a | 819 | protected: |
f6bcfd97 | 820 | wxStaticBox *m_staticBox; |
1e6feb95 | 821 | |
9cbee2ce | 822 | private: |
4393b50c | 823 | DECLARE_CLASS(wxStaticBoxSizer) |
22f3361e | 824 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) |
27ea1d8a RR |
825 | }; |
826 | ||
1e6feb95 VZ |
827 | #endif // wxUSE_STATBOX |
828 | ||
974c2a59 WS |
829 | #if wxUSE_BUTTON |
830 | ||
acf2ac37 RR |
831 | class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer |
832 | { | |
833 | public: | |
acf2ac37 RR |
834 | // Constructor just creates a new wxBoxSizer, not much else. |
835 | // Box sizer orientation is automatically determined here: | |
836 | // vertical for PDAs, horizontal for everything else? | |
b181a505 | 837 | wxStdDialogButtonSizer(); |
acf2ac37 | 838 | |
acf2ac37 | 839 | // Checks button ID against system IDs and sets one of the pointers below |
b181a505 RR |
840 | // to this button. Does not do any sizer-related things here. |
841 | void AddButton(wxButton *button); | |
acf2ac37 | 842 | |
b181a505 RR |
843 | // Use these if no standard ID can/should be used |
844 | void SetAffirmativeButton( wxButton *button ); | |
845 | void SetNegativeButton( wxButton *button ); | |
846 | void SetCancelButton( wxButton *button ); | |
acf2ac37 | 847 | |
acf2ac37 RR |
848 | // All platform-specific code here, checks which buttons exist and add |
849 | // them to the sizer accordingly. | |
850 | // Note - one potential hack on Mac we could use here, | |
851 | // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE | |
852 | // is set to _("Save") and m_buttonNegative is set to _("Don't Save") | |
853 | // I wouldn't add any other hacks like that into here, | |
854 | // but this one I can see being useful. | |
718903fe | 855 | void Realize(); |
974c2a59 | 856 | |
acf2ac37 RR |
857 | wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } |
858 | wxButton *GetApplyButton() const { return m_buttonApply; } | |
859 | wxButton *GetNegativeButton() const { return m_buttonNegative; } | |
860 | wxButton *GetCancelButton() const { return m_buttonCancel; } | |
861 | wxButton *GetHelpButton() const { return m_buttonHelp; } | |
862 | ||
863 | protected: | |
b181a505 | 864 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here |
acf2ac37 | 865 | wxButton *m_buttonApply; |
b181a505 | 866 | wxButton *m_buttonNegative; // wxID_NO |
acf2ac37 RR |
867 | wxButton *m_buttonCancel; |
868 | wxButton *m_buttonHelp; | |
974c2a59 | 869 | |
acf2ac37 RR |
870 | private: |
871 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
b181a505 | 872 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) |
acf2ac37 | 873 | }; |
adbf2d73 | 874 | |
6b5c4761 | 875 | #endif // wxUSE_BUTTON |
974c2a59 | 876 | |
adbf2d73 | 877 | |
8e32ea1c VZ |
878 | // ---------------------------------------------------------------------------- |
879 | // inline functions implementation | |
880 | // ---------------------------------------------------------------------------- | |
881 | ||
4dd10327 VZ |
882 | #if WXWIN_COMPATIBILITY_2_8 |
883 | ||
884 | inline void wxSizerItem::SetWindow(wxWindow *window) | |
885 | { | |
886 | DoSetWindow(window); | |
887 | } | |
888 | ||
889 | inline void wxSizerItem::SetSizer(wxSizer *sizer) | |
890 | { | |
891 | DoSetSizer(sizer); | |
892 | } | |
893 | ||
894 | inline void wxSizerItem::SetSpacer(const wxSize& size) | |
895 | { | |
896 | DoSetSpacer(size); | |
897 | } | |
898 | ||
899 | inline void wxSizerItem::SetSpacer(int width, int height) | |
900 | { | |
901 | DoSetSpacer(wxSize(width, height)); | |
902 | } | |
903 | ||
904 | #endif // WXWIN_COMPATIBILITY_2_8 | |
905 | ||
906 | ||
50961a35 PC |
907 | inline wxSizerItem* |
908 | wxSizer::Add( wxSizerItem *item ) | |
909 | { | |
910 | return Insert( m_children.GetCount(), item ); | |
911 | } | |
912 | ||
56eee37f | 913 | inline wxSizerItem* |
8e32ea1c VZ |
914 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
915 | { | |
56eee37f | 916 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
917 | } |
918 | ||
56eee37f | 919 | inline wxSizerItem* |
8e32ea1c VZ |
920 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
921 | { | |
56eee37f | 922 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
923 | } |
924 | ||
56eee37f | 925 | inline wxSizerItem* |
8e32ea1c VZ |
926 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
927 | { | |
56eee37f | 928 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
929 | } |
930 | ||
56eee37f | 931 | inline wxSizerItem* |
5f813ad6 VZ |
932 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) |
933 | { | |
56eee37f | 934 | return Add( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
935 | } |
936 | ||
56eee37f | 937 | inline wxSizerItem* |
5f813ad6 VZ |
938 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) |
939 | { | |
56eee37f | 940 | return Add( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
941 | } |
942 | ||
56eee37f | 943 | inline wxSizerItem* |
8e32ea1c VZ |
944 | wxSizer::AddSpacer(int size) |
945 | { | |
56eee37f | 946 | return Add(size, size); |
8e32ea1c VZ |
947 | } |
948 | ||
56eee37f | 949 | inline wxSizerItem* |
8e32ea1c VZ |
950 | wxSizer::AddStretchSpacer(int prop) |
951 | { | |
56eee37f | 952 | return Add(0, 0, prop); |
8e32ea1c VZ |
953 | } |
954 | ||
50961a35 PC |
955 | inline wxSizerItem* |
956 | wxSizer::Prepend( wxSizerItem *item ) | |
957 | { | |
958 | return Insert( 0, item ); | |
959 | } | |
960 | ||
56eee37f | 961 | inline wxSizerItem* |
8e32ea1c VZ |
962 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
963 | { | |
56eee37f | 964 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
965 | } |
966 | ||
56eee37f | 967 | inline wxSizerItem* |
8e32ea1c VZ |
968 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
969 | { | |
56eee37f | 970 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
971 | } |
972 | ||
56eee37f | 973 | inline wxSizerItem* |
8e32ea1c VZ |
974 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
975 | { | |
56eee37f | 976 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
977 | } |
978 | ||
56eee37f | 979 | inline wxSizerItem* |
8e32ea1c VZ |
980 | wxSizer::PrependSpacer(int size) |
981 | { | |
56eee37f | 982 | return Prepend(size, size); |
8e32ea1c VZ |
983 | } |
984 | ||
56eee37f | 985 | inline wxSizerItem* |
8e32ea1c VZ |
986 | wxSizer::PrependStretchSpacer(int prop) |
987 | { | |
56eee37f | 988 | return Prepend(0, 0, prop); |
8e32ea1c VZ |
989 | } |
990 | ||
56eee37f | 991 | inline wxSizerItem* |
5f813ad6 VZ |
992 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) |
993 | { | |
56eee37f | 994 | return Prepend( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
995 | } |
996 | ||
56eee37f | 997 | inline wxSizerItem* |
5f813ad6 VZ |
998 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) |
999 | { | |
56eee37f | 1000 | return Prepend( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1001 | } |
1002 | ||
56eee37f | 1003 | inline wxSizerItem* |
8e32ea1c | 1004 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1005 | wxWindow *window, |
1006 | int proportion, | |
1007 | int flag, | |
1008 | int border, | |
1009 | wxObject* userData ) | |
8e32ea1c | 1010 | { |
56eee37f | 1011 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1012 | } |
1013 | ||
56eee37f | 1014 | inline wxSizerItem* |
8e32ea1c | 1015 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1016 | wxSizer *sizer, |
1017 | int proportion, | |
1018 | int flag, | |
1019 | int border, | |
1020 | wxObject* userData ) | |
8e32ea1c | 1021 | { |
56eee37f | 1022 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1023 | } |
1024 | ||
56eee37f | 1025 | inline wxSizerItem* |
8e32ea1c | 1026 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1027 | int width, |
1028 | int height, | |
1029 | int proportion, | |
1030 | int flag, | |
1031 | int border, | |
1032 | wxObject* userData ) | |
8e32ea1c | 1033 | { |
56eee37f | 1034 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1035 | } |
1036 | ||
56eee37f | 1037 | inline wxSizerItem* |
5f813ad6 VZ |
1038 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) |
1039 | { | |
56eee37f | 1040 | return Insert( index, new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1041 | } |
1042 | ||
56eee37f | 1043 | inline wxSizerItem* |
5f813ad6 VZ |
1044 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) |
1045 | { | |
56eee37f | 1046 | return Insert( index, new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1047 | } |
1048 | ||
56eee37f | 1049 | inline wxSizerItem* |
8e32ea1c VZ |
1050 | wxSizer::InsertSpacer(size_t index, int size) |
1051 | { | |
56eee37f | 1052 | return Insert(index, size, size); |
8e32ea1c VZ |
1053 | } |
1054 | ||
56eee37f | 1055 | inline wxSizerItem* |
8e32ea1c VZ |
1056 | wxSizer::InsertStretchSpacer(size_t index, int prop) |
1057 | { | |
56eee37f | 1058 | return Insert(index, 0, 0, prop); |
8e32ea1c VZ |
1059 | } |
1060 | ||
ade4eb65 | 1061 | #endif // __WXSIZER_H__ |