]>
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 | ||
227 | SetWindow(window); | |
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 | ||
242 | SetSizer(sizer); | |
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 | ||
258 | SetSpacer(width, height); | |
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 | |
50c06297 VZ |
343 | |
344 | // these functions do not free old sizer/spacer | |
345 | void SetWindow(wxWindow *window); | |
346 | void SetSizer(wxSizer *sizer); | |
347 | void SetSpacer(const wxSize& size); | |
348 | void SetSpacer(int width, int height) { SetSpacer(wxSize(width, height)); } | |
349 | ||
c62ac5b6 | 350 | protected: |
5f813ad6 | 351 | // common part of several ctors |
50c06297 | 352 | void Init() { m_userData = NULL; } |
5f813ad6 VZ |
353 | |
354 | // common part of ctors taking wxSizerFlags | |
355 | void Init(const wxSizerFlags& flags); | |
356 | ||
f303d69f VZ |
357 | |
358 | // discriminated union: depending on m_kind one of the fields is valid | |
50c06297 VZ |
359 | enum |
360 | { | |
361 | Item_None, | |
362 | Item_Window, | |
363 | Item_Sizer, | |
364 | Item_Spacer, | |
365 | Item_Max | |
366 | } m_kind; | |
367 | union | |
368 | { | |
369 | wxWindow *m_window; | |
370 | wxSizer *m_sizer; | |
371 | wxSizerSpacer *m_spacer; | |
372 | }; | |
5f813ad6 | 373 | |
df5ddbca RR |
374 | wxPoint m_pos; |
375 | wxSize m_minSize; | |
12a3f227 | 376 | int m_proportion; |
df5ddbca RR |
377 | int m_border; |
378 | int m_flag; | |
2b5f62a0 | 379 | |
50c06297 VZ |
380 | // on screen rectangle of this item (not including borders) |
381 | wxRect m_rect; | |
12a3f227 RL |
382 | |
383 | // Aspect ratio can always be calculated from m_size, | |
384 | // but this would cause precision loss when the window | |
385 | // is shrunk. It is safer to preserve the initial value. | |
df5ddbca | 386 | float m_ratio; |
2b5f62a0 | 387 | |
df5ddbca | 388 | wxObject *m_userData; |
2aab8f16 | 389 | |
9cbee2ce | 390 | private: |
4393b50c | 391 | DECLARE_CLASS(wxSizerItem) |
22f3361e | 392 | DECLARE_NO_COPY_CLASS(wxSizerItem) |
c62ac5b6 | 393 | }; |
5279a24d | 394 | |
12a3f227 RL |
395 | WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList ); |
396 | ||
5f813ad6 | 397 | |
5279a24d | 398 | //--------------------------------------------------------------------------- |
3417c2cd | 399 | // wxSizer |
5279a24d RR |
400 | //--------------------------------------------------------------------------- |
401 | ||
2aab8f16 | 402 | class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer |
5279a24d RR |
403 | { |
404 | public: | |
e8cfff87 | 405 | wxSizer() { m_containingWindow = NULL; } |
d3c7fc99 | 406 | virtual ~wxSizer(); |
f6bcfd97 | 407 | |
436ae7cf VZ |
408 | // methods for adding elements to the sizer: there are Add/Insert/Prepend |
409 | // overloads for each of window/sizer/spacer/wxSizerItem | |
ca8d899f VZ |
410 | wxSizerItem* Add(wxWindow *window, |
411 | int proportion = 0, | |
412 | int flag = 0, | |
413 | int border = 0, | |
414 | wxObject* userData = NULL); | |
415 | wxSizerItem* Add(wxSizer *sizer, | |
416 | int proportion = 0, | |
417 | int flag = 0, | |
418 | int border = 0, | |
419 | wxObject* userData = NULL); | |
420 | wxSizerItem* Add(int width, | |
421 | int height, | |
422 | int proportion = 0, | |
423 | int flag = 0, | |
424 | int border = 0, | |
425 | wxObject* userData = NULL); | |
426 | wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags); | |
427 | wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags); | |
428 | wxSizerItem* Add( wxSizerItem *item); | |
429 | ||
430 | wxSizerItem* AddSpacer(int size); | |
431 | wxSizerItem* AddStretchSpacer(int prop = 1); | |
432 | ||
433 | wxSizerItem* Insert(size_t index, | |
434 | wxWindow *window, | |
435 | int proportion = 0, | |
436 | int flag = 0, | |
437 | int border = 0, | |
438 | wxObject* userData = NULL); | |
439 | wxSizerItem* Insert(size_t index, | |
440 | wxSizer *sizer, | |
441 | int proportion = 0, | |
442 | int flag = 0, | |
443 | int border = 0, | |
444 | wxObject* userData = NULL); | |
445 | wxSizerItem* Insert(size_t index, | |
446 | int width, | |
447 | int height, | |
448 | int proportion = 0, | |
449 | int flag = 0, | |
450 | int border = 0, | |
451 | wxObject* userData = NULL); | |
452 | wxSizerItem* Insert(size_t index, | |
453 | wxWindow *window, | |
454 | const wxSizerFlags& flags); | |
455 | wxSizerItem* Insert(size_t index, | |
456 | wxSizer *sizer, | |
457 | const wxSizerFlags& flags); | |
458 | virtual wxSizerItem* Insert( size_t index, wxSizerItem *item); | |
459 | ||
460 | wxSizerItem* InsertSpacer(size_t index, int size); | |
461 | wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1); | |
462 | ||
463 | wxSizerItem* Prepend(wxWindow *window, | |
464 | int proportion = 0, | |
465 | int flag = 0, | |
466 | int border = 0, | |
467 | wxObject* userData = NULL); | |
468 | wxSizerItem* Prepend(wxSizer *sizer, | |
469 | int proportion = 0, | |
470 | int flag = 0, | |
471 | int border = 0, | |
472 | wxObject* userData = NULL); | |
473 | wxSizerItem* Prepend(int width, | |
474 | int height, | |
475 | int proportion = 0, | |
476 | int flag = 0, | |
477 | int border = 0, | |
478 | wxObject* userData = NULL); | |
479 | wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags); | |
480 | wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags); | |
481 | wxSizerItem* Prepend(wxSizerItem *item); | |
482 | ||
483 | wxSizerItem* PrependSpacer(int size); | |
484 | wxSizerItem* PrependStretchSpacer(int prop = 1); | |
8e32ea1c | 485 | |
e8cfff87 | 486 | // set (or possibly unset if window is NULL) or get the window this sizer |
ce7208d4 | 487 | // is used in |
e8cfff87 VZ |
488 | void SetContainingWindow(wxWindow *window); |
489 | wxWindow *GetContainingWindow() const { return m_containingWindow; } | |
749bb9f1 | 490 | |
6a9e54bd | 491 | #if WXWIN_COMPATIBILITY_2_6 |
12a3f227 RL |
492 | // Deprecated in 2.6 since historically it does not delete the window, |
493 | // use Detach instead. | |
494 | wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); | |
6a9e54bd WS |
495 | #endif // WXWIN_COMPATIBILITY_2_6 |
496 | ||
f6bcfd97 | 497 | virtual bool Remove( wxSizer *sizer ); |
e0d8fb45 | 498 | virtual bool Remove( int index ); |
00976fe5 | 499 | |
12a3f227 | 500 | virtual bool Detach( wxWindow *window ); |
00976fe5 | 501 | virtual bool Detach( wxSizer *sizer ); |
e0d8fb45 | 502 | virtual bool Detach( int index ); |
00976fe5 | 503 | |
ce7208d4 WS |
504 | virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ); |
505 | virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ); | |
506 | virtual bool Replace( size_t index, wxSizerItem *newitem ); | |
eae0338f | 507 | |
e0d8fb45 | 508 | virtual void Clear( bool delete_windows = false ); |
84f7908b | 509 | virtual void DeleteWindows(); |
f6bcfd97 BP |
510 | |
511 | void SetMinSize( int width, int height ) | |
512 | { DoSetMinSize( width, height ); } | |
fbfb8bcc | 513 | void SetMinSize( const wxSize& size ) |
f6bcfd97 | 514 | { DoSetMinSize( size.x, size.y ); } |
1e6feb95 | 515 | |
50c06297 | 516 | // Searches recursively |
f6bcfd97 BP |
517 | bool SetItemMinSize( wxWindow *window, int width, int height ) |
518 | { return DoSetItemMinSize( window, width, height ); } | |
fbfb8bcc | 519 | bool SetItemMinSize( wxWindow *window, const wxSize& size ) |
f6bcfd97 | 520 | { return DoSetItemMinSize( window, size.x, size.y ); } |
1e6feb95 | 521 | |
50c06297 | 522 | // Searches recursively |
f6bcfd97 BP |
523 | bool SetItemMinSize( wxSizer *sizer, int width, int height ) |
524 | { return DoSetItemMinSize( sizer, width, height ); } | |
fbfb8bcc | 525 | bool SetItemMinSize( wxSizer *sizer, const wxSize& size ) |
f6bcfd97 | 526 | { return DoSetItemMinSize( sizer, size.x, size.y ); } |
1e6feb95 | 527 | |
12a3f227 RL |
528 | bool SetItemMinSize( size_t index, int width, int height ) |
529 | { return DoSetItemMinSize( index, width, height ); } | |
fbfb8bcc | 530 | bool SetItemMinSize( size_t index, const wxSize& size ) |
12a3f227 | 531 | { return DoSetItemMinSize( index, size.x, size.y ); } |
1e6feb95 | 532 | |
9cbee2ce | 533 | wxSize GetSize() const |
f6bcfd97 | 534 | { return m_size; } |
9cbee2ce | 535 | wxPoint GetPosition() const |
f6bcfd97 | 536 | { return m_position; } |
1e6feb95 | 537 | |
50c06297 | 538 | // Calculate the minimal size or return m_minSize if bigger. |
f6bcfd97 BP |
539 | wxSize GetMinSize(); |
540 | ||
541 | virtual void RecalcSizes() = 0; | |
542 | virtual wxSize CalcMin() = 0; | |
543 | ||
544 | virtual void Layout(); | |
545 | ||
e5251d4f | 546 | wxSize Fit( wxWindow *window ); |
566d84a7 | 547 | void FitInside( wxWindow *window ); |
f6bcfd97 | 548 | void SetSizeHints( wxWindow *window ); |
566d84a7 | 549 | void SetVirtualSizeHints( wxWindow *window ); |
f6bcfd97 | 550 | |
12a3f227 | 551 | wxSizerItemList& GetChildren() |
f6bcfd97 | 552 | { return m_children; } |
f9b5691a VZ |
553 | const wxSizerItemList& GetChildren() const |
554 | { return m_children; } | |
f6bcfd97 BP |
555 | |
556 | void SetDimension( int x, int y, int width, int height ); | |
0c0d686f | 557 | |
9f13661f WS |
558 | wxSizerItem* GetItem( wxWindow *window, bool recursive = false ); |
559 | wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false ); | |
560 | wxSizerItem* GetItem( size_t index ); | |
561 | ||
12a3f227 | 562 | // Manage whether individual scene items are considered |
2b5f62a0 | 563 | // in the layout calculations or not. |
8b2bac62 WS |
564 | bool Show( wxWindow *window, bool show = true, bool recursive = false ); |
565 | bool Show( wxSizer *sizer, bool show = true, bool recursive = false ); | |
566 | bool Show( size_t index, bool show = true ); | |
12a3f227 | 567 | |
8b2bac62 WS |
568 | bool Hide( wxSizer *sizer, bool recursive = false ) |
569 | { return Show( sizer, false, recursive ); } | |
570 | bool Hide( wxWindow *window, bool recursive = false ) | |
571 | { return Show( window, false, recursive ); } | |
572 | bool Hide( size_t index ) | |
573 | { return Show( index, false ); } | |
2b5f62a0 | 574 | |
9cbee2ce RL |
575 | bool IsShown( wxWindow *window ) const; |
576 | bool IsShown( wxSizer *sizer ) const; | |
577 | bool IsShown( size_t index ) const; | |
dc259b79 | 578 | |
2b5f62a0 | 579 | // Recursively call wxWindow::Show () on all sizer items. |
eb2a7883 | 580 | virtual void ShowItems (bool show); |
2b5f62a0 | 581 | |
f303d69f | 582 | void Show(bool show) { ShowItems(show); } |
50c06297 | 583 | |
f6bcfd97 | 584 | protected: |
12a3f227 RL |
585 | wxSize m_size; |
586 | wxSize m_minSize; | |
587 | wxPoint m_position; | |
588 | wxSizerItemList m_children; | |
f6bcfd97 | 589 | |
e8cfff87 VZ |
590 | // the window this sizer is used in, can be NULL |
591 | wxWindow *m_containingWindow; | |
592 | ||
9cbee2ce | 593 | wxSize GetMaxWindowSize( wxWindow *window ) const; |
f6bcfd97 | 594 | wxSize GetMinWindowSize( wxWindow *window ); |
9cbee2ce | 595 | wxSize GetMaxClientSize( wxWindow *window ) const; |
566d84a7 | 596 | wxSize GetMinClientSize( wxWindow *window ); |
566d84a7 | 597 | wxSize VirtualFitSize( wxWindow *window ); |
65ba4113 | 598 | |
f6bcfd97 BP |
599 | virtual void DoSetMinSize( int width, int height ); |
600 | virtual bool DoSetItemMinSize( wxWindow *window, int width, int height ); | |
601 | virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height ); | |
12a3f227 | 602 | virtual bool DoSetItemMinSize( size_t index, int width, int height ); |
1e6feb95 | 603 | |
9cbee2ce | 604 | private: |
4393b50c | 605 | DECLARE_CLASS(wxSizer) |
f6bcfd97 | 606 | }; |
c62ac5b6 | 607 | |
f6bcfd97 BP |
608 | //--------------------------------------------------------------------------- |
609 | // wxGridSizer | |
610 | //--------------------------------------------------------------------------- | |
0c0d686f | 611 | |
f6bcfd97 BP |
612 | class WXDLLEXPORT wxGridSizer: public wxSizer |
613 | { | |
614 | public: | |
615 | wxGridSizer( int rows, int cols, int vgap, int hgap ); | |
616 | wxGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
1e6feb95 | 617 | |
5d76f462 VZ |
618 | virtual void RecalcSizes(); |
619 | virtual wxSize CalcMin(); | |
f6bcfd97 BP |
620 | |
621 | void SetCols( int cols ) { m_cols = cols; } | |
622 | void SetRows( int rows ) { m_rows = rows; } | |
623 | void SetVGap( int gap ) { m_vgap = gap; } | |
624 | void SetHGap( int gap ) { m_hgap = gap; } | |
9cbee2ce RL |
625 | int GetCols() const { return m_cols; } |
626 | int GetRows() const { return m_rows; } | |
627 | int GetVGap() const { return m_vgap; } | |
628 | int GetHGap() const { return m_hgap; } | |
1e6feb95 | 629 | |
f6bcfd97 BP |
630 | protected: |
631 | int m_rows; | |
632 | int m_cols; | |
633 | int m_vgap; | |
634 | int m_hgap; | |
1e6feb95 | 635 | |
0ca5105b VZ |
636 | // return the number of total items and the number of columns and rows |
637 | int CalcRowsCols(int& rows, int& cols) const; | |
638 | ||
f6bcfd97 | 639 | void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); |
1e6feb95 | 640 | |
9cbee2ce | 641 | private: |
4393b50c | 642 | DECLARE_CLASS(wxGridSizer) |
f6bcfd97 | 643 | }; |
5279a24d | 644 | |
f6bcfd97 BP |
645 | //--------------------------------------------------------------------------- |
646 | // wxFlexGridSizer | |
647 | //--------------------------------------------------------------------------- | |
0c0d686f | 648 | |
5d76f462 VZ |
649 | // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible" |
650 | // direction | |
651 | enum wxFlexSizerGrowMode | |
652 | { | |
653 | // don't resize the cells in non-flexible direction at all | |
654 | wxFLEX_GROWMODE_NONE, | |
655 | ||
656 | // uniformly resize only the specified ones (default) | |
657 | wxFLEX_GROWMODE_SPECIFIED, | |
658 | ||
659 | // uniformly resize all cells | |
660 | wxFLEX_GROWMODE_ALL | |
661 | }; | |
662 | ||
f6bcfd97 BP |
663 | class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer |
664 | { | |
665 | public: | |
5d76f462 | 666 | // ctors/dtor |
f6bcfd97 BP |
667 | wxFlexGridSizer( int rows, int cols, int vgap, int hgap ); |
668 | wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 ); | |
5d76f462 | 669 | virtual ~wxFlexGridSizer(); |
1e6feb95 | 670 | |
1e6feb95 | 671 | |
5d76f462 VZ |
672 | // set the rows/columns which will grow (the others will remain of the |
673 | // constant initial size) | |
e8800dcf | 674 | void AddGrowableRow( size_t idx, int proportion = 0 ); |
f6bcfd97 | 675 | void RemoveGrowableRow( size_t idx ); |
e8800dcf | 676 | void AddGrowableCol( size_t idx, int proportion = 0 ); |
f6bcfd97 | 677 | void RemoveGrowableCol( size_t idx ); |
0c0d686f | 678 | |
1e6feb95 | 679 | |
5d76f462 VZ |
680 | // the sizer cells may grow in both directions, not grow at all or only |
681 | // grow in one direction but not the other | |
682 | ||
683 | // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default) | |
684 | void SetFlexibleDirection(int direction) { m_flexDirection = direction; } | |
685 | int GetFlexibleDirection() const { return m_flexDirection; } | |
686 | ||
687 | // note that the grow mode only applies to the direction which is not | |
688 | // flexible | |
689 | void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; } | |
690 | wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; } | |
691 | ||
fc1fcd0e RD |
692 | // Read-only access to the row heights and col widths arrays |
693 | const wxArrayInt& GetRowHeights() const { return m_rowHeights; } | |
694 | const wxArrayInt& GetColWidths() const { return m_colWidths; } | |
8b2bac62 | 695 | |
5d76f462 VZ |
696 | // implementation |
697 | virtual void RecalcSizes(); | |
698 | virtual wxSize CalcMin(); | |
699 | ||
700 | protected: | |
20b35a69 RD |
701 | void AdjustForFlexDirection(); |
702 | void AdjustForGrowables(const wxSize& sz, const wxSize& minsz, | |
703 | int nrows, int ncols); | |
8b2bac62 | 704 | |
5d76f462 VZ |
705 | // the heights/widths of all rows/columns |
706 | wxArrayInt m_rowHeights, | |
707 | m_colWidths; | |
708 | ||
709 | // indices of the growable columns and rows | |
710 | wxArrayInt m_growableRows, | |
711 | m_growableCols; | |
712 | ||
e8800dcf VZ |
713 | // proportion values of the corresponding growable rows and columns |
714 | wxArrayInt m_growableRowsProportions, | |
715 | m_growableColsProportions; | |
716 | ||
5d76f462 VZ |
717 | // parameters describing whether the growable cells should be resized in |
718 | // both directions or only one | |
719 | int m_flexDirection; | |
720 | wxFlexSizerGrowMode m_growMode; | |
1e6feb95 | 721 | |
ba763a45 RD |
722 | // saves CalcMin result to optimize RecalcSizes |
723 | wxSize m_calculatedMinSize; | |
724 | ||
9cbee2ce | 725 | private: |
4393b50c | 726 | DECLARE_CLASS(wxFlexGridSizer) |
22f3361e | 727 | DECLARE_NO_COPY_CLASS(wxFlexGridSizer) |
c62ac5b6 RR |
728 | }; |
729 | ||
730 | //--------------------------------------------------------------------------- | |
92afa2b1 | 731 | // wxBoxSizer |
c62ac5b6 RR |
732 | //--------------------------------------------------------------------------- |
733 | ||
92afa2b1 | 734 | class WXDLLEXPORT wxBoxSizer: public wxSizer |
61d514bb RR |
735 | { |
736 | public: | |
f6bcfd97 | 737 | wxBoxSizer( int orient ); |
0c0d686f | 738 | |
f6bcfd97 BP |
739 | void RecalcSizes(); |
740 | wxSize CalcMin(); | |
0c0d686f | 741 | |
9cbee2ce | 742 | int GetOrientation() const |
f6bcfd97 | 743 | { return m_orient; } |
0c0d686f | 744 | |
b657b4c9 JS |
745 | void SetOrientation(int orient) |
746 | { m_orient = orient; } | |
747 | ||
61d514bb RR |
748 | protected: |
749 | int m_orient; | |
750 | int m_stretchable; | |
751 | int m_minWidth; | |
752 | int m_minHeight; | |
753 | int m_fixedWidth; | |
754 | int m_fixedHeight; | |
1e6feb95 | 755 | |
9cbee2ce | 756 | private: |
4393b50c | 757 | DECLARE_CLASS(wxBoxSizer) |
61d514bb | 758 | }; |
0c0d686f | 759 | |
27ea1d8a RR |
760 | //--------------------------------------------------------------------------- |
761 | // wxStaticBoxSizer | |
762 | //--------------------------------------------------------------------------- | |
763 | ||
1e6feb95 VZ |
764 | #if wxUSE_STATBOX |
765 | ||
649cfca1 | 766 | class WXDLLEXPORT wxStaticBox; |
1e6feb95 | 767 | |
27ea1d8a RR |
768 | class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer |
769 | { | |
770 | public: | |
6c1635b5 | 771 | wxStaticBoxSizer(wxStaticBox *box, int orient); |
450a1593 | 772 | wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); |
649cfca1 | 773 | virtual ~wxStaticBoxSizer(); |
0c0d686f | 774 | |
f6bcfd97 BP |
775 | void RecalcSizes(); |
776 | wxSize CalcMin(); | |
0c0d686f | 777 | |
9cbee2ce | 778 | wxStaticBox *GetStaticBox() const |
f6bcfd97 | 779 | { return m_staticBox; } |
0c0d686f | 780 | |
eb2a7883 VZ |
781 | // override to hide/show the static box as well |
782 | virtual void ShowItems (bool show); | |
7e2b7860 | 783 | |
e978011a | 784 | virtual bool Detach( wxWindow *window ); |
7e2b7860 VZ |
785 | virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } |
786 | virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } | |
eb2a7883 | 787 | |
27ea1d8a | 788 | protected: |
f6bcfd97 | 789 | wxStaticBox *m_staticBox; |
1e6feb95 | 790 | |
9cbee2ce | 791 | private: |
4393b50c | 792 | DECLARE_CLASS(wxStaticBoxSizer) |
22f3361e | 793 | DECLARE_NO_COPY_CLASS(wxStaticBoxSizer) |
27ea1d8a RR |
794 | }; |
795 | ||
1e6feb95 VZ |
796 | #endif // wxUSE_STATBOX |
797 | ||
974c2a59 WS |
798 | #if wxUSE_BUTTON |
799 | ||
acf2ac37 RR |
800 | class WXDLLEXPORT wxStdDialogButtonSizer: public wxBoxSizer |
801 | { | |
802 | public: | |
acf2ac37 RR |
803 | // Constructor just creates a new wxBoxSizer, not much else. |
804 | // Box sizer orientation is automatically determined here: | |
805 | // vertical for PDAs, horizontal for everything else? | |
b181a505 | 806 | wxStdDialogButtonSizer(); |
acf2ac37 | 807 | |
acf2ac37 | 808 | // Checks button ID against system IDs and sets one of the pointers below |
b181a505 RR |
809 | // to this button. Does not do any sizer-related things here. |
810 | void AddButton(wxButton *button); | |
acf2ac37 | 811 | |
b181a505 RR |
812 | // Use these if no standard ID can/should be used |
813 | void SetAffirmativeButton( wxButton *button ); | |
814 | void SetNegativeButton( wxButton *button ); | |
815 | void SetCancelButton( wxButton *button ); | |
acf2ac37 | 816 | |
acf2ac37 RR |
817 | // All platform-specific code here, checks which buttons exist and add |
818 | // them to the sizer accordingly. | |
819 | // Note - one potential hack on Mac we could use here, | |
820 | // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE | |
821 | // is set to _("Save") and m_buttonNegative is set to _("Don't Save") | |
822 | // I wouldn't add any other hacks like that into here, | |
823 | // but this one I can see being useful. | |
718903fe | 824 | void Realize(); |
974c2a59 | 825 | |
acf2ac37 RR |
826 | wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; } |
827 | wxButton *GetApplyButton() const { return m_buttonApply; } | |
828 | wxButton *GetNegativeButton() const { return m_buttonNegative; } | |
829 | wxButton *GetCancelButton() const { return m_buttonCancel; } | |
830 | wxButton *GetHelpButton() const { return m_buttonHelp; } | |
831 | ||
832 | protected: | |
b181a505 | 833 | wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here |
acf2ac37 | 834 | wxButton *m_buttonApply; |
b181a505 | 835 | wxButton *m_buttonNegative; // wxID_NO |
acf2ac37 RR |
836 | wxButton *m_buttonCancel; |
837 | wxButton *m_buttonHelp; | |
974c2a59 | 838 | |
acf2ac37 RR |
839 | private: |
840 | DECLARE_CLASS(wxStdDialogButtonSizer) | |
b181a505 | 841 | DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer) |
acf2ac37 | 842 | }; |
adbf2d73 | 843 | |
6b5c4761 | 844 | #endif // wxUSE_BUTTON |
974c2a59 | 845 | |
adbf2d73 VS |
846 | #if WXWIN_COMPATIBILITY_2_4 |
847 | // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they | |
61c083e7 | 848 | // don't do anything. wxBookCtrlBase::DoGetBestSize does the job now. |
adbf2d73 | 849 | |
ade4eb65 VZ |
850 | // ---------------------------------------------------------------------------- |
851 | // wxBookCtrlSizer | |
852 | // ---------------------------------------------------------------------------- | |
83edc0a5 | 853 | |
ade4eb65 | 854 | #if wxUSE_BOOKCTRL |
65e4f9b9 | 855 | |
8e32ea1c | 856 | // this sizer works with wxNotebook/wxListbook/... and sizes the control to |
ade4eb65 | 857 | // fit its pages |
61c083e7 | 858 | class WXDLLEXPORT wxBookCtrlBase; |
1e6feb95 | 859 | |
ade4eb65 | 860 | class WXDLLEXPORT wxBookCtrlSizer : public wxSizer |
83edc0a5 | 861 | { |
83edc0a5 | 862 | public: |
6a9e54bd | 863 | #if WXWIN_COMPATIBILITY_2_6 |
61c083e7 | 864 | wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) ); |
6a9e54bd | 865 | #endif // WXWIN_COMPATIBILITY_2_6 |
83edc0a5 | 866 | |
61c083e7 | 867 | wxBookCtrlBase *GetControl() const { return m_bookctrl; } |
8b2bac62 | 868 | |
ade4eb65 VZ |
869 | virtual void RecalcSizes(); |
870 | virtual wxSize CalcMin(); | |
83edc0a5 | 871 | |
83edc0a5 | 872 | protected: |
adbf2d73 | 873 | // this protected ctor lets us mark the real one above as deprecated |
749bb9f1 | 874 | // and still have warning-free build of the library itself: |
adbf2d73 | 875 | wxBookCtrlSizer() {} |
8b2bac62 | 876 | |
61c083e7 | 877 | wxBookCtrlBase *m_bookctrl; |
ade4eb65 VZ |
878 | |
879 | private: | |
880 | DECLARE_CLASS(wxBookCtrlSizer) | |
881 | DECLARE_NO_COPY_CLASS(wxBookCtrlSizer) | |
882 | }; | |
883 | ||
884 | ||
885 | #if wxUSE_NOTEBOOK | |
886 | ||
61c083e7 | 887 | // before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards |
ade4eb65 VZ |
888 | // compatibility |
889 | class WXDLLEXPORT wxNotebook; | |
890 | ||
891 | class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer | |
892 | { | |
893 | public: | |
6a9e54bd | 894 | #if WXWIN_COMPATIBILITY_2_6 |
adbf2d73 | 895 | wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) ); |
6a9e54bd | 896 | #endif // WXWIN_COMPATIBILITY_2_6 |
ade4eb65 VZ |
897 | |
898 | wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; } | |
1e6feb95 | 899 | |
9cbee2ce | 900 | private: |
4393b50c | 901 | DECLARE_CLASS(wxNotebookSizer) |
22f3361e | 902 | DECLARE_NO_COPY_CLASS(wxNotebookSizer) |
83edc0a5 RR |
903 | }; |
904 | ||
1e6feb95 | 905 | #endif // wxUSE_NOTEBOOK |
65e4f9b9 | 906 | |
ade4eb65 VZ |
907 | #endif // wxUSE_BOOKCTRL |
908 | ||
adbf2d73 VS |
909 | #endif // WXWIN_COMPATIBILITY_2_4 |
910 | ||
8e32ea1c VZ |
911 | // ---------------------------------------------------------------------------- |
912 | // inline functions implementation | |
913 | // ---------------------------------------------------------------------------- | |
914 | ||
50961a35 PC |
915 | inline wxSizerItem* |
916 | wxSizer::Add( wxSizerItem *item ) | |
917 | { | |
918 | return Insert( m_children.GetCount(), item ); | |
919 | } | |
920 | ||
56eee37f | 921 | inline wxSizerItem* |
8e32ea1c VZ |
922 | wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
923 | { | |
56eee37f | 924 | return Add( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
925 | } |
926 | ||
56eee37f | 927 | inline wxSizerItem* |
8e32ea1c VZ |
928 | wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
929 | { | |
56eee37f | 930 | return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
931 | } |
932 | ||
56eee37f | 933 | inline wxSizerItem* |
8e32ea1c VZ |
934 | wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
935 | { | |
56eee37f | 936 | return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
937 | } |
938 | ||
56eee37f | 939 | inline wxSizerItem* |
5f813ad6 VZ |
940 | wxSizer::Add( wxWindow *window, const wxSizerFlags& flags ) |
941 | { | |
56eee37f | 942 | return Add( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
943 | } |
944 | ||
56eee37f | 945 | inline wxSizerItem* |
5f813ad6 VZ |
946 | wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags ) |
947 | { | |
56eee37f | 948 | return Add( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
949 | } |
950 | ||
56eee37f | 951 | inline wxSizerItem* |
8e32ea1c VZ |
952 | wxSizer::AddSpacer(int size) |
953 | { | |
56eee37f | 954 | return Add(size, size); |
8e32ea1c VZ |
955 | } |
956 | ||
56eee37f | 957 | inline wxSizerItem* |
8e32ea1c VZ |
958 | wxSizer::AddStretchSpacer(int prop) |
959 | { | |
56eee37f | 960 | return Add(0, 0, prop); |
8e32ea1c VZ |
961 | } |
962 | ||
50961a35 PC |
963 | inline wxSizerItem* |
964 | wxSizer::Prepend( wxSizerItem *item ) | |
965 | { | |
966 | return Insert( 0, item ); | |
967 | } | |
968 | ||
56eee37f | 969 | inline wxSizerItem* |
8e32ea1c VZ |
970 | wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) |
971 | { | |
56eee37f | 972 | return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
973 | } |
974 | ||
56eee37f | 975 | inline wxSizerItem* |
8e32ea1c VZ |
976 | wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData ) |
977 | { | |
56eee37f | 978 | return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
979 | } |
980 | ||
56eee37f | 981 | inline wxSizerItem* |
8e32ea1c VZ |
982 | wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData ) |
983 | { | |
56eee37f | 984 | return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
985 | } |
986 | ||
56eee37f | 987 | inline wxSizerItem* |
8e32ea1c VZ |
988 | wxSizer::PrependSpacer(int size) |
989 | { | |
56eee37f | 990 | return Prepend(size, size); |
8e32ea1c VZ |
991 | } |
992 | ||
56eee37f | 993 | inline wxSizerItem* |
8e32ea1c VZ |
994 | wxSizer::PrependStretchSpacer(int prop) |
995 | { | |
56eee37f | 996 | return Prepend(0, 0, prop); |
8e32ea1c VZ |
997 | } |
998 | ||
56eee37f | 999 | inline wxSizerItem* |
5f813ad6 VZ |
1000 | wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags ) |
1001 | { | |
56eee37f | 1002 | return Prepend( new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1003 | } |
1004 | ||
56eee37f | 1005 | inline wxSizerItem* |
5f813ad6 VZ |
1006 | wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags ) |
1007 | { | |
56eee37f | 1008 | return Prepend( new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1009 | } |
1010 | ||
56eee37f | 1011 | inline wxSizerItem* |
8e32ea1c | 1012 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1013 | wxWindow *window, |
1014 | int proportion, | |
1015 | int flag, | |
1016 | int border, | |
1017 | wxObject* userData ) | |
8e32ea1c | 1018 | { |
56eee37f | 1019 | return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1020 | } |
1021 | ||
56eee37f | 1022 | inline wxSizerItem* |
8e32ea1c | 1023 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1024 | wxSizer *sizer, |
1025 | int proportion, | |
1026 | int flag, | |
1027 | int border, | |
1028 | wxObject* userData ) | |
8e32ea1c | 1029 | { |
56eee37f | 1030 | return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1031 | } |
1032 | ||
56eee37f | 1033 | inline wxSizerItem* |
8e32ea1c | 1034 | wxSizer::Insert( size_t index, |
5f813ad6 VZ |
1035 | int width, |
1036 | int height, | |
1037 | int proportion, | |
1038 | int flag, | |
1039 | int border, | |
1040 | wxObject* userData ) | |
8e32ea1c | 1041 | { |
56eee37f | 1042 | return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) ); |
8e32ea1c VZ |
1043 | } |
1044 | ||
56eee37f | 1045 | inline wxSizerItem* |
5f813ad6 VZ |
1046 | wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags ) |
1047 | { | |
56eee37f | 1048 | return Insert( index, new wxSizerItem(window, flags) ); |
5f813ad6 VZ |
1049 | } |
1050 | ||
56eee37f | 1051 | inline wxSizerItem* |
5f813ad6 VZ |
1052 | wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags ) |
1053 | { | |
56eee37f | 1054 | return Insert( index, new wxSizerItem(sizer, flags) ); |
5f813ad6 VZ |
1055 | } |
1056 | ||
56eee37f | 1057 | inline wxSizerItem* |
8e32ea1c VZ |
1058 | wxSizer::InsertSpacer(size_t index, int size) |
1059 | { | |
56eee37f | 1060 | return Insert(index, size, size); |
8e32ea1c VZ |
1061 | } |
1062 | ||
56eee37f | 1063 | inline wxSizerItem* |
8e32ea1c VZ |
1064 | wxSizer::InsertStretchSpacer(size_t index, int prop) |
1065 | { | |
56eee37f | 1066 | return Insert(index, 0, 0, prop); |
8e32ea1c VZ |
1067 | } |
1068 | ||
adbf2d73 | 1069 | |
ade4eb65 | 1070 | #endif // __WXSIZER_H__ |