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