]> git.saurik.com Git - wxWidgets.git/blame - include/wx/sizer.h
removing outdated code
[wxWidgets.git] / include / wx / sizer.h
CommitLineData
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
23class WXDLLIMPEXP_FWD_CORE wxButton;
24class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
25class WXDLLIMPEXP_FWD_CORE wxSizerItem;
26class 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
53a2db12 41class WXDLLIMPEXP_CORE wxSizerFlags
5f813ad6
VZ
42{
43public:
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
30a56ea8 61 wxSizerFlags& Expand()
5f813ad6 62 {
30a56ea8 63 m_flags |= wxEXPAND;
5f813ad6
VZ
64 return *this;
65 }
66
30a56ea8
VZ
67 // notice that Align() replaces the current alignment flags, use specific
68 // methods below such as Top(), Left() &c if you want to set just the
69 // vertical or horizontal alignment
70 wxSizerFlags& Align(int alignment) // combination of wxAlignment values
00dc67b8 71 {
30a56ea8
VZ
72 m_flags &= ~wxALIGN_MASK;
73 m_flags |= alignment;
74
00dc67b8
VZ
75 return *this;
76 }
77
5f813ad6 78 // some shortcuts for Align()
89064717 79 wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); }
5f813ad6 80 wxSizerFlags& Center() { return Centre(); }
30a56ea8 81
2f39b5a3
VZ
82 wxSizerFlags& Top()
83 {
84 m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL);
85 return *this;
30a56ea8
VZ
86 }
87
2f39b5a3
VZ
88 wxSizerFlags& Left()
89 {
90 m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL);
91 return *this;
30a56ea8
VZ
92 }
93
2f39b5a3
VZ
94 wxSizerFlags& Right()
95 {
96 m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT;
97 return *this;
30a56ea8
VZ
98 }
99
2f39b5a3
VZ
100 wxSizerFlags& Bottom()
101 {
102 m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM;
103 return *this;
30a56ea8
VZ
104 }
105
5f813ad6 106
2be7beda
VZ
107 // default border size used by Border() below
108 static int GetDefaultBorder()
109 {
97ebfd54 110#if wxUSE_BORDER_BY_DEFAULT
43c5fff8
VS
111 #ifdef __WXGTK20__
112 // GNOME HIG says to use 6px as the base unit:
113 // http://library.gnome.org/devel/hig-book/stable/design-window.html.en
114 return 6;
115 #else
2be7beda
VZ
116 // FIXME: default border size shouldn't be hardcoded and at the very
117 // least they should depend on the current font size
118 return 5;
43c5fff8 119 #endif
97ebfd54
VZ
120#else
121 return 0;
122#endif
2be7beda
VZ
123 }
124
5f813ad6
VZ
125
126 wxSizerFlags& Border(int direction, int borderInPixels)
127 {
71c36202 128 wxCHECK_MSG( !(direction & ~wxALL), *this,
e60165f7
VZ
129 wxS("direction must be a combination of wxDirection ")
130 wxS("enum values.") );
71c36202 131
5f813ad6
VZ
132 m_flags &= ~wxALL;
133 m_flags |= direction;
134
135 m_borderInPixels = borderInPixels;
136
137 return *this;
138 }
139
140 wxSizerFlags& Border(int direction = wxALL)
141 {
97ebfd54
VZ
142#if wxUSE_BORDER_BY_DEFAULT
143 return Border(direction, GetDefaultBorder());
144#else
92b0cd9e
VZ
145 // no borders by default on limited size screen
146 wxUnusedVar(direction);
147
148 return *this;
97ebfd54
VZ
149#endif
150 }
151
152 wxSizerFlags& DoubleBorder(int direction = wxALL)
153 {
154#if wxUSE_BORDER_BY_DEFAULT
155 return Border(direction, 2*GetDefaultBorder());
92b0cd9e 156#else
97ebfd54
VZ
157 wxUnusedVar(direction);
158
159 return *this;
92b0cd9e 160#endif
5f813ad6
VZ
161 }
162
97ebfd54
VZ
163 wxSizerFlags& TripleBorder(int direction = wxALL)
164 {
165#if wxUSE_BORDER_BY_DEFAULT
166 return Border(direction, 3*GetDefaultBorder());
167#else
168 wxUnusedVar(direction);
169
170 return *this;
171#endif
172 }
173
174 wxSizerFlags& HorzBorder()
175 {
176#if wxUSE_BORDER_BY_DEFAULT
177 return Border(wxLEFT | wxRIGHT, GetDefaultBorder());
178#else
179 return *this;
180#endif
181 }
182
183 wxSizerFlags& DoubleHorzBorder()
184 {
185#if wxUSE_BORDER_BY_DEFAULT
186 return Border(wxLEFT | wxRIGHT, 2*GetDefaultBorder());
187#else
188 return *this;
189#endif
190 }
5f813ad6 191
d95527de
VZ
192 // setters for the others flags
193 wxSizerFlags& Shaped()
194 {
195 m_flags |= wxSHAPED;
196
197 return *this;
198 }
199
200 wxSizerFlags& FixedMinSize()
201 {
202 m_flags |= wxFIXED_MINSIZE;
203
204 return *this;
205 }
d95527de 206
0ba6faae
VS
207 // makes the item ignore window's visibility status
208 wxSizerFlags& ReserveSpaceEvenIfHidden()
209 {
210 m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN;
211 return *this;
212 }
213
5f813ad6
VZ
214 // accessors for wxSizer only
215 int GetProportion() const { return m_proportion; }
216 int GetFlags() const { return m_flags; }
217 int GetBorderInPixels() const { return m_borderInPixels; }
218
219private:
220 int m_proportion;
221 int m_flags;
222 int m_borderInPixels;
223};
224
225
50c06297
VZ
226// ----------------------------------------------------------------------------
227// wxSizerSpacer: used by wxSizerItem to represent a spacer
228// ----------------------------------------------------------------------------
5279a24d 229
53a2db12 230class WXDLLIMPEXP_CORE wxSizerSpacer
5279a24d
RR
231{
232public:
50c06297 233 wxSizerSpacer(const wxSize& size) : m_size(size), m_isShown(true) { }
5f813ad6 234
50c06297
VZ
235 void SetSize(const wxSize& size) { m_size = size; }
236 const wxSize& GetSize() const { return m_size; }
5f813ad6 237
50c06297
VZ
238 void Show(bool show) { m_isShown = show; }
239 bool IsShown() const { return m_isShown; }
5f813ad6 240
50c06297
VZ
241private:
242 // the size, in pixel
243 wxSize m_size;
df5ddbca 244
50c06297
VZ
245 // is the spacer currently shown?
246 bool m_isShown;
247};
248
249// ----------------------------------------------------------------------------
250// wxSizerItem
251// ----------------------------------------------------------------------------
252
53a2db12 253class WXDLLIMPEXP_CORE wxSizerItem : public wxObject
50c06297
VZ
254{
255public:
df5ddbca 256 // window
12a3f227 257 wxSizerItem( wxWindow *window,
5eb16fe2
RD
258 int proportion=0,
259 int flag=0,
260 int border=0,
261 wxObject* userData=NULL );
df5ddbca 262
50c06297
VZ
263 // window with flags
264 wxSizerItem(wxWindow *window, const wxSizerFlags& flags)
265 {
266 Init(flags);
267
4dd10327 268 DoSetWindow(window);
50c06297
VZ
269 }
270
df5ddbca 271 // subsizer
12a3f227 272 wxSizerItem( wxSizer *sizer,
5eb16fe2
RD
273 int proportion=0,
274 int flag=0,
275 int border=0,
276 wxObject* userData=NULL );
df5ddbca 277
50c06297
VZ
278 // sizer with flags
279 wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags)
280 {
281 Init(flags);
282
4dd10327 283 DoSetSizer(sizer);
50c06297
VZ
284 }
285
5f813ad6
VZ
286 // spacer
287 wxSizerItem( int width,
288 int height,
5eb16fe2
RD
289 int proportion=0,
290 int flag=0,
291 int border=0,
292 wxObject* userData=NULL);
5f813ad6 293
50c06297
VZ
294 // spacer with flags
295 wxSizerItem(int width, int height, const wxSizerFlags& flags)
296 {
297 Init(flags);
298
4dd10327 299 DoSetSpacer(wxSize(width, height));
50c06297
VZ
300 }
301
20b35a69
RD
302 wxSizerItem();
303 virtual ~wxSizerItem();
dc259b79 304
84f7908b 305 virtual void DeleteWindows();
df5ddbca 306
96fdbb60 307 // Enable deleting the SizerItem without destroying the contained sizer.
50c06297 308 void DetachSizer() { m_sizer = NULL; }
96fdbb60 309
9cbee2ce 310 virtual wxSize GetSize() const;
df5ddbca 311 virtual wxSize CalcMin();
fbfb8bcc 312 virtual void SetDimension( const wxPoint& pos, const wxSize& size );
df5ddbca 313
9cbee2ce 314 wxSize GetMinSize() const
df5ddbca 315 { return m_minSize; }
ba763a45
RD
316 wxSize GetMinSizeWithBorder() const;
317
93b87dd9
VZ
318 wxSize GetMaxSize() const
319 { return IsWindow() ? m_window->GetMaxSize() : wxDefaultSize; }
320 wxSize GetMaxSizeWithBorder() const;
321
1eba2193 322 void SetMinSize(const wxSize& size)
50c06297
VZ
323 {
324 if ( IsWindow() )
325 m_window->SetMinSize(size);
326 m_minSize = size;
327 }
1eba2193 328 void SetMinSize( int x, int y )
8b2bac62 329 { SetMinSize(wxSize(x, y)); }
12a3f227 330 void SetInitSize( int x, int y )
1eba2193 331 { SetMinSize(wxSize(x, y)); }
df5ddbca 332
50c06297
VZ
333 // if either of dimensions is zero, ratio is assumed to be 1
334 // to avoid "divide by zero" errors
335 void SetRatio(int width, int height)
df5ddbca 336 { m_ratio = (width && height) ? ((float) width / (float) height) : 1; }
50c06297
VZ
337 void SetRatio(const wxSize& size)
338 { SetRatio(size.x, size.y); }
339 void SetRatio(float ratio)
df5ddbca 340 { m_ratio = ratio; }
2aab8f16 341 float GetRatio() const
df5ddbca
RR
342 { return m_ratio; }
343
50c06297 344 virtual wxRect GetRect() { return m_rect; }
56eee37f 345
86909f4c
VZ
346 // set a sizer item id (different from a window id, all sizer items,
347 // including spacers, can have an associated id)
348 void SetId(int id) { m_id = id; }
349 int GetId() const { return m_id; }
350
50c06297
VZ
351 bool IsWindow() const { return m_kind == Item_Window; }
352 bool IsSizer() const { return m_kind == Item_Sizer; }
353 bool IsSpacer() const { return m_kind == Item_Spacer; }
2aab8f16 354
6a9e54bd 355#if WXWIN_COMPATIBILITY_2_6
12a3f227
RL
356 // Deprecated in 2.6, use {G,S}etProportion instead.
357 wxDEPRECATED( void SetOption( int option ) );
358 wxDEPRECATED( int GetOption() const );
6a9e54bd 359#endif // WXWIN_COMPATIBILITY_2_6
12a3f227
RL
360
361 void SetProportion( int proportion )
362 { m_proportion = proportion; }
363 int GetProportion() const
364 { return m_proportion; }
df5ddbca
RR
365 void SetFlag( int flag )
366 { m_flag = flag; }
12a3f227
RL
367 int GetFlag() const
368 { return m_flag; }
df5ddbca
RR
369 void SetBorder( int border )
370 { m_border = border; }
12a3f227
RL
371 int GetBorder() const
372 { return m_border; }
df5ddbca
RR
373
374 wxWindow *GetWindow() const
50c06297 375 { return m_kind == Item_Window ? m_window : NULL; }
df5ddbca 376 wxSizer *GetSizer() const
50c06297
VZ
377 { return m_kind == Item_Sizer ? m_sizer : NULL; }
378 wxSize GetSpacer() const;
12a3f227 379
0ba6faae 380 // This function behaves obviously for the windows and spacers but for the
c86fd3a7 381 // sizers it returns true if any sizer element is shown and only returns
0ba6faae
VS
382 // false if all of them are hidden. Also, it always returns true if
383 // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used.
c86fd3a7 384 bool IsShown() const;
0ba6faae 385
50c06297 386 void Show(bool show);
12a3f227 387
e8c1be04 388 void SetUserData(wxObject* userData)
1737dac2 389 { delete m_userData; m_userData = userData; }
9cbee2ce 390 wxObject* GetUserData() const
df5ddbca 391 { return m_userData; }
9cbee2ce 392 wxPoint GetPosition() const
df5ddbca 393 { return m_pos; }
0c0d686f 394
2f39b5a3
VZ
395 // Called once the first component of an item has been decided. This is
396 // used in algorithms that depend on knowing the size in one direction
397 // before the min size in the other direction can be known.
15f7c305
RR
398 // Returns true if it made use of the information (and min size was changed).
399 bool InformFirstDirection( int direction, int size, int availableOtherDir=-1 );
400
4dd10327
VZ
401 // these functions delete the current contents of the item if it's a sizer
402 // or a spacer but not if it is a window
403 void AssignWindow(wxWindow *window)
404 {
405 Free();
406 DoSetWindow(window);
407 }
408
409 void AssignSizer(wxSizer *sizer)
410 {
411 Free();
412 DoSetSizer(sizer);
413 }
414
415 void AssignSpacer(const wxSize& size)
416 {
417 Free();
418 DoSetSpacer(size);
419 }
420
421 void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); }
50c06297 422
4dd10327
VZ
423#if WXWIN_COMPATIBILITY_2_8
424 // these functions do not free the old sizer/spacer and so can easily
425 // provoke the memory leaks and so shouldn't be used, use Assign() instead
426 wxDEPRECATED( void SetWindow(wxWindow *window) );
427 wxDEPRECATED( void SetSizer(wxSizer *sizer) );
428 wxDEPRECATED( void SetSpacer(const wxSize& size) );
429 wxDEPRECATED( void SetSpacer(int width, int height) );
430#endif // WXWIN_COMPATIBILITY_2_8
50c06297 431
c62ac5b6 432protected:
5f813ad6 433 // common part of several ctors
4dd10327 434 void Init() { m_userData = NULL; m_kind = Item_None; }
5f813ad6
VZ
435
436 // common part of ctors taking wxSizerFlags
437 void Init(const wxSizerFlags& flags);
438
4dd10327
VZ
439 // free current contents
440 void Free();
441
442 // common parts of Set/AssignXXX()
443 void DoSetWindow(wxWindow *window);
444 void DoSetSizer(wxSizer *sizer);
445 void DoSetSpacer(const wxSize& size);
f303d69f 446
465de0be
VZ
447 // Add the border specified for this item to the given size
448 // if it's != wxDefaultSize, just return wxDefaultSize otherwise.
449 wxSize AddBorderToSize(const wxSize& size) const;
450
f303d69f 451 // discriminated union: depending on m_kind one of the fields is valid
50c06297
VZ
452 enum
453 {
454 Item_None,
455 Item_Window,
456 Item_Sizer,
457 Item_Spacer,
458 Item_Max
459 } m_kind;
460 union
461 {
462 wxWindow *m_window;
463 wxSizer *m_sizer;
464 wxSizerSpacer *m_spacer;
465 };
5f813ad6 466
df5ddbca
RR
467 wxPoint m_pos;
468 wxSize m_minSize;
12a3f227 469 int m_proportion;
df5ddbca
RR
470 int m_border;
471 int m_flag;
86909f4c 472 int m_id;
2b5f62a0 473
50c06297
VZ
474 // on screen rectangle of this item (not including borders)
475 wxRect m_rect;
12a3f227
RL
476
477 // Aspect ratio can always be calculated from m_size,
478 // but this would cause precision loss when the window
479 // is shrunk. It is safer to preserve the initial value.
df5ddbca 480 float m_ratio;
2b5f62a0 481
df5ddbca 482 wxObject *m_userData;
2aab8f16 483
9cbee2ce 484private:
4393b50c 485 DECLARE_CLASS(wxSizerItem)
c0c133e1 486 wxDECLARE_NO_COPY_CLASS(wxSizerItem);
c62ac5b6 487};
5279a24d 488
12a3f227
RL
489WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
490
5f813ad6 491
5279a24d 492//---------------------------------------------------------------------------
3417c2cd 493// wxSizer
5279a24d
RR
494//---------------------------------------------------------------------------
495
53a2db12 496class WXDLLIMPEXP_CORE wxSizer: public wxObject, public wxClientDataContainer
5279a24d
RR
497{
498public:
e8cfff87 499 wxSizer() { m_containingWindow = NULL; }
d3c7fc99 500 virtual ~wxSizer();
f6bcfd97 501
436ae7cf
VZ
502 // methods for adding elements to the sizer: there are Add/Insert/Prepend
503 // overloads for each of window/sizer/spacer/wxSizerItem
ca8d899f
VZ
504 wxSizerItem* Add(wxWindow *window,
505 int proportion = 0,
506 int flag = 0,
507 int border = 0,
508 wxObject* userData = NULL);
509 wxSizerItem* Add(wxSizer *sizer,
510 int proportion = 0,
511 int flag = 0,
512 int border = 0,
513 wxObject* userData = NULL);
514 wxSizerItem* Add(int width,
515 int height,
516 int proportion = 0,
517 int flag = 0,
518 int border = 0,
519 wxObject* userData = NULL);
520 wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags);
521 wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags);
b701f995 522 wxSizerItem* Add( int width, int height, const wxSizerFlags& flags);
ca8d899f
VZ
523 wxSizerItem* Add( wxSizerItem *item);
524
1a2df6a7 525 virtual wxSizerItem *AddSpacer(int size);
ca8d899f
VZ
526 wxSizerItem* AddStretchSpacer(int prop = 1);
527
528 wxSizerItem* Insert(size_t index,
529 wxWindow *window,
530 int proportion = 0,
531 int flag = 0,
532 int border = 0,
533 wxObject* userData = NULL);
534 wxSizerItem* Insert(size_t index,
535 wxSizer *sizer,
536 int proportion = 0,
537 int flag = 0,
538 int border = 0,
539 wxObject* userData = NULL);
540 wxSizerItem* Insert(size_t index,
541 int width,
542 int height,
543 int proportion = 0,
544 int flag = 0,
545 int border = 0,
546 wxObject* userData = NULL);
547 wxSizerItem* Insert(size_t index,
548 wxWindow *window,
549 const wxSizerFlags& flags);
550 wxSizerItem* Insert(size_t index,
551 wxSizer *sizer,
552 const wxSizerFlags& flags);
b701f995
VZ
553 wxSizerItem* Insert(size_t index,
554 int width,
555 int height,
2f39b5a3 556 const wxSizerFlags& flags);
e556b612
VZ
557
558 // NB: do _not_ override this function in the derived classes, this one is
559 // virtual for compatibility reasons only to allow old code overriding
560 // it to continue to work, override DoInsert() instead in the new code
561 virtual wxSizerItem* Insert(size_t index, wxSizerItem *item);
ca8d899f
VZ
562
563 wxSizerItem* InsertSpacer(size_t index, int size);
564 wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
565
566 wxSizerItem* Prepend(wxWindow *window,
567 int proportion = 0,
568 int flag = 0,
569 int border = 0,
570 wxObject* userData = NULL);
571 wxSizerItem* Prepend(wxSizer *sizer,
572 int proportion = 0,
573 int flag = 0,
574 int border = 0,
575 wxObject* userData = NULL);
576 wxSizerItem* Prepend(int width,
577 int height,
578 int proportion = 0,
579 int flag = 0,
580 int border = 0,
581 wxObject* userData = NULL);
582 wxSizerItem* Prepend(wxWindow *window, const wxSizerFlags& flags);
583 wxSizerItem* Prepend(wxSizer *sizer, const wxSizerFlags& flags);
b701f995 584 wxSizerItem* Prepend(int width, int height, const wxSizerFlags& flags);
ca8d899f
VZ
585 wxSizerItem* Prepend(wxSizerItem *item);
586
587 wxSizerItem* PrependSpacer(int size);
588 wxSizerItem* PrependStretchSpacer(int prop = 1);
8e32ea1c 589
e8cfff87 590 // set (or possibly unset if window is NULL) or get the window this sizer
ce7208d4 591 // is used in
e8cfff87
VZ
592 void SetContainingWindow(wxWindow *window);
593 wxWindow *GetContainingWindow() const { return m_containingWindow; }
749bb9f1 594
6a9e54bd 595#if WXWIN_COMPATIBILITY_2_6
12a3f227
RL
596 // Deprecated in 2.6 since historically it does not delete the window,
597 // use Detach instead.
598 wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
6a9e54bd
WS
599#endif // WXWIN_COMPATIBILITY_2_6
600
f6bcfd97 601 virtual bool Remove( wxSizer *sizer );
e0d8fb45 602 virtual bool Remove( int index );
00976fe5 603
12a3f227 604 virtual bool Detach( wxWindow *window );
00976fe5 605 virtual bool Detach( wxSizer *sizer );
e0d8fb45 606 virtual bool Detach( int index );
00976fe5 607
ce7208d4
WS
608 virtual bool Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false );
609 virtual bool Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false );
610 virtual bool Replace( size_t index, wxSizerItem *newitem );
eae0338f 611
e0d8fb45 612 virtual void Clear( bool delete_windows = false );
84f7908b 613 virtual void DeleteWindows();
f6bcfd97 614
15f7c305 615 // Inform sizer about the first direction that has been decided (by parent item)
1582a1db 616 // Returns true if it made use of the information (and recalculated min size)
15f7c305
RR
617 virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) )
618 { return false; }
2f39b5a3 619
f6bcfd97
BP
620 void SetMinSize( int width, int height )
621 { DoSetMinSize( width, height ); }
fbfb8bcc 622 void SetMinSize( const wxSize& size )
f6bcfd97 623 { DoSetMinSize( size.x, size.y ); }
1e6feb95 624
50c06297 625 // Searches recursively
f6bcfd97
BP
626 bool SetItemMinSize( wxWindow *window, int width, int height )
627 { return DoSetItemMinSize( window, width, height ); }
fbfb8bcc 628 bool SetItemMinSize( wxWindow *window, const wxSize& size )
f6bcfd97 629 { return DoSetItemMinSize( window, size.x, size.y ); }
1e6feb95 630
50c06297 631 // Searches recursively
f6bcfd97
BP
632 bool SetItemMinSize( wxSizer *sizer, int width, int height )
633 { return DoSetItemMinSize( sizer, width, height ); }
fbfb8bcc 634 bool SetItemMinSize( wxSizer *sizer, const wxSize& size )
f6bcfd97 635 { return DoSetItemMinSize( sizer, size.x, size.y ); }
1e6feb95 636
12a3f227
RL
637 bool SetItemMinSize( size_t index, int width, int height )
638 { return DoSetItemMinSize( index, width, height ); }
fbfb8bcc 639 bool SetItemMinSize( size_t index, const wxSize& size )
12a3f227 640 { return DoSetItemMinSize( index, size.x, size.y ); }
1e6feb95 641
9cbee2ce 642 wxSize GetSize() const
f6bcfd97 643 { return m_size; }
9cbee2ce 644 wxPoint GetPosition() const
f6bcfd97 645 { return m_position; }
1e6feb95 646
50c06297 647 // Calculate the minimal size or return m_minSize if bigger.
f6bcfd97
BP
648 wxSize GetMinSize();
649
89064717
VZ
650 // These virtual functions are used by the layout algorithm: first
651 // CalcMin() is called to calculate the minimal size of the sizer and
652 // prepare for laying it out and then RecalcSizes() is called to really
653 // update all the sizer items
f6bcfd97 654 virtual wxSize CalcMin() = 0;
89064717 655 virtual void RecalcSizes() = 0;
f6bcfd97
BP
656
657 virtual void Layout();
658
32013b47
VS
659 wxSize ComputeFittingClientSize(wxWindow *window);
660 wxSize ComputeFittingWindowSize(wxWindow *window);
661
e5251d4f 662 wxSize Fit( wxWindow *window );
566d84a7 663 void FitInside( wxWindow *window );
f6bcfd97 664 void SetSizeHints( wxWindow *window );
f944aec0
VS
665#if WXWIN_COMPATIBILITY_2_8
666 // This only calls FitInside() since 2.9
667 wxDEPRECATED( void SetVirtualSizeHints( wxWindow *window ) );
668#endif
f6bcfd97 669
12a3f227 670 wxSizerItemList& GetChildren()
f6bcfd97 671 { return m_children; }
f9b5691a
VZ
672 const wxSizerItemList& GetChildren() const
673 { return m_children; }
f6bcfd97 674
49dcc246
VZ
675 void SetDimension(const wxPoint& pos, const wxSize& size)
676 {
677 m_position = pos;
678 m_size = size;
679 Layout();
e4c903b2
VZ
680
681 // This call is required for wxWrapSizer to be able to calculate its
682 // minimal size correctly.
683 InformFirstDirection(wxHORIZONTAL, size.x, size.y);
49dcc246
VZ
684 }
685 void SetDimension(int x, int y, int width, int height)
686 { SetDimension(wxPoint(x, y), wxSize(width, height)); }
0c0d686f 687
2f39b5a3 688 size_t GetItemCount() const { return m_children.GetCount(); }
6e1f851b 689 bool IsEmpty() const { return m_children.IsEmpty(); }
6b527e15 690
9f13661f
WS
691 wxSizerItem* GetItem( wxWindow *window, bool recursive = false );
692 wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false );
693 wxSizerItem* GetItem( size_t index );
86909f4c 694 wxSizerItem* GetItemById( int id, bool recursive = false );
9f13661f 695
12a3f227 696 // Manage whether individual scene items are considered
2b5f62a0 697 // in the layout calculations or not.
8b2bac62
WS
698 bool Show( wxWindow *window, bool show = true, bool recursive = false );
699 bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
700 bool Show( size_t index, bool show = true );
12a3f227 701
8b2bac62
WS
702 bool Hide( wxSizer *sizer, bool recursive = false )
703 { return Show( sizer, false, recursive ); }
704 bool Hide( wxWindow *window, bool recursive = false )
705 { return Show( window, false, recursive ); }
706 bool Hide( size_t index )
707 { return Show( index, false ); }
2b5f62a0 708
9cbee2ce
RL
709 bool IsShown( wxWindow *window ) const;
710 bool IsShown( wxSizer *sizer ) const;
711 bool IsShown( size_t index ) const;
dc259b79 712
2b5f62a0 713 // Recursively call wxWindow::Show () on all sizer items.
eb2a7883 714 virtual void ShowItems (bool show);
2b5f62a0 715
f303d69f 716 void Show(bool show) { ShowItems(show); }
50c06297 717
f6bcfd97 718protected:
12a3f227
RL
719 wxSize m_size;
720 wxSize m_minSize;
721 wxPoint m_position;
722 wxSizerItemList m_children;
f6bcfd97 723
e8cfff87
VZ
724 // the window this sizer is used in, can be NULL
725 wxWindow *m_containingWindow;
726
9cbee2ce 727 wxSize GetMaxClientSize( wxWindow *window ) const;
566d84a7 728 wxSize GetMinClientSize( wxWindow *window );
566d84a7 729 wxSize VirtualFitSize( wxWindow *window );
65ba4113 730
f6bcfd97
BP
731 virtual void DoSetMinSize( int width, int height );
732 virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
733 virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
12a3f227 734 virtual bool DoSetItemMinSize( size_t index, int width, int height );
1e6feb95 735
e556b612
VZ
736 // insert a new item into m_children at given index and return the item
737 // itself
738 virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item);
739
9cbee2ce 740private:
4393b50c 741 DECLARE_CLASS(wxSizer)
f6bcfd97 742};
c62ac5b6 743
f6bcfd97
BP
744//---------------------------------------------------------------------------
745// wxGridSizer
746//---------------------------------------------------------------------------
0c0d686f 747
53a2db12 748class WXDLLIMPEXP_CORE wxGridSizer: public wxSizer
f6bcfd97
BP
749{
750public:
7e6edd27
VZ
751 // ctors specifying the number of columns only: number of rows will be
752 // deduced automatically depending on the number of sizer elements
753 wxGridSizer( int cols, int vgap, int hgap );
754 wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
755
756 // ctors specifying the number of rows and columns
f6bcfd97 757 wxGridSizer( int rows, int cols, int vgap, int hgap );
4a00e77c 758 wxGridSizer( int rows, int cols, const wxSize& gap );
1e6feb95 759
5d76f462
VZ
760 virtual void RecalcSizes();
761 virtual wxSize CalcMin();
f6bcfd97 762
4f671eeb
VZ
763 void SetCols( int cols )
764 {
0be3080a 765 wxASSERT_MSG( cols >= 0, "Number of columns must be non-negative");
4f671eeb
VZ
766 m_cols = cols;
767 }
768
769 void SetRows( int rows )
770 {
0be3080a 771 wxASSERT_MSG( rows >= 0, "Number of rows must be non-negative");
4f671eeb
VZ
772 m_rows = rows;
773 }
774
f6bcfd97
BP
775 void SetVGap( int gap ) { m_vgap = gap; }
776 void SetHGap( int gap ) { m_hgap = gap; }
9cbee2ce
RL
777 int GetCols() const { return m_cols; }
778 int GetRows() const { return m_rows; }
779 int GetVGap() const { return m_vgap; }
780 int GetHGap() const { return m_hgap; }
1e6feb95 781
0274a797
VZ
782 int GetEffectiveColsCount() const { return m_cols ? m_cols : CalcCols(); }
783 int GetEffectiveRowsCount() const { return m_rows ? m_rows : CalcRows(); }
784
afc0db8c
VS
785 // return the number of total items and the number of columns and rows
786 // (for internal use only)
787 int CalcRowsCols(int& rows, int& cols) const;
788
f6bcfd97 789protected:
0274a797
VZ
790 // the number of rows/columns in the sizer, if 0 then it is determined
791 // dynamically depending on the total number of items
f6bcfd97
BP
792 int m_rows;
793 int m_cols;
0274a797
VZ
794
795 // gaps between rows and columns
f6bcfd97
BP
796 int m_vgap;
797 int m_hgap;
1e6feb95 798
e556b612
VZ
799 virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item);
800
f6bcfd97 801 void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
1e6feb95 802
0274a797
VZ
803 // returns the number of columns/rows needed for the current total number
804 // of children (and the fixed number of rows/columns)
805 int CalcCols() const
806 {
807 wxCHECK_MSG
808 (
809 m_rows, 0,
810 "Can't calculate number of cols if number of rows is not specified"
811 );
812
813 return (m_children.GetCount() + m_rows - 1) / m_rows;
814 }
815
816 int CalcRows() const
817 {
818 wxCHECK_MSG
819 (
820 m_cols, 0,
821 "Can't calculate number of cols if number of rows is not specified"
822 );
823
824 return (m_children.GetCount() + m_cols - 1) / m_cols;
825 }
826
9cbee2ce 827private:
4393b50c 828 DECLARE_CLASS(wxGridSizer)
f6bcfd97 829};
5279a24d 830
f6bcfd97
BP
831//---------------------------------------------------------------------------
832// wxFlexGridSizer
833//---------------------------------------------------------------------------
0c0d686f 834
52ceb90e
FM
835// values which define the behaviour for resizing wxFlexGridSizer cells in the
836// "non-flexible" direction
5d76f462
VZ
837enum wxFlexSizerGrowMode
838{
839 // don't resize the cells in non-flexible direction at all
840 wxFLEX_GROWMODE_NONE,
841
842 // uniformly resize only the specified ones (default)
843 wxFLEX_GROWMODE_SPECIFIED,
844
845 // uniformly resize all cells
846 wxFLEX_GROWMODE_ALL
847};
848
53a2db12 849class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer
f6bcfd97
BP
850{
851public:
4a00e77c
VZ
852 // ctors specifying the number of columns only: number of rows will be
853 // deduced automatically depending on the number of sizer elements
d7bb2926 854 wxFlexGridSizer( int cols, int vgap, int hgap );
4a00e77c
VZ
855 wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
856
857 // ctors specifying the number of rows and columns
f6bcfd97 858 wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
4a00e77c 859 wxFlexGridSizer( int rows, int cols, const wxSize& gap );
1e6feb95 860
4a00e77c
VZ
861 // dtor
862 virtual ~wxFlexGridSizer();
1e6feb95 863
5d76f462
VZ
864 // set the rows/columns which will grow (the others will remain of the
865 // constant initial size)
e8800dcf 866 void AddGrowableRow( size_t idx, int proportion = 0 );
f6bcfd97 867 void RemoveGrowableRow( size_t idx );
e8800dcf 868 void AddGrowableCol( size_t idx, int proportion = 0 );
f6bcfd97 869 void RemoveGrowableCol( size_t idx );
0c0d686f 870
67ef83eb
VZ
871 bool IsRowGrowable( size_t idx );
872 bool IsColGrowable( size_t idx );
1e6feb95 873
5d76f462
VZ
874 // the sizer cells may grow in both directions, not grow at all or only
875 // grow in one direction but not the other
876
877 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
878 void SetFlexibleDirection(int direction) { m_flexDirection = direction; }
879 int GetFlexibleDirection() const { return m_flexDirection; }
880
881 // note that the grow mode only applies to the direction which is not
882 // flexible
883 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; }
884 wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; }
885
fc1fcd0e
RD
886 // Read-only access to the row heights and col widths arrays
887 const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
888 const wxArrayInt& GetColWidths() const { return m_colWidths; }
8b2bac62 889
5d76f462
VZ
890 // implementation
891 virtual void RecalcSizes();
892 virtual wxSize CalcMin();
893
894protected:
20b35a69 895 void AdjustForFlexDirection();
97800f66 896 void AdjustForGrowables(const wxSize& sz);
15f7c305 897 void FindWidthsAndHeights(int nrows, int ncols);
8b2bac62 898
5d76f462
VZ
899 // the heights/widths of all rows/columns
900 wxArrayInt m_rowHeights,
901 m_colWidths;
902
903 // indices of the growable columns and rows
904 wxArrayInt m_growableRows,
905 m_growableCols;
906
e8800dcf
VZ
907 // proportion values of the corresponding growable rows and columns
908 wxArrayInt m_growableRowsProportions,
909 m_growableColsProportions;
910
5d76f462
VZ
911 // parameters describing whether the growable cells should be resized in
912 // both directions or only one
913 int m_flexDirection;
914 wxFlexSizerGrowMode m_growMode;
1e6feb95 915
ba763a45
RD
916 // saves CalcMin result to optimize RecalcSizes
917 wxSize m_calculatedMinSize;
918
9cbee2ce 919private:
4393b50c 920 DECLARE_CLASS(wxFlexGridSizer)
c0c133e1 921 wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer);
c62ac5b6
RR
922};
923
924//---------------------------------------------------------------------------
92afa2b1 925// wxBoxSizer
c62ac5b6
RR
926//---------------------------------------------------------------------------
927
53a2db12 928class WXDLLIMPEXP_CORE wxBoxSizer: public wxSizer
61d514bb
RR
929{
930public:
89064717
VZ
931 wxBoxSizer(int orient)
932 {
933 m_orient = orient;
2a818b7a 934 m_totalProportion = 0;
89064717
VZ
935
936 wxASSERT_MSG( m_orient == wxHORIZONTAL || m_orient == wxVERTICAL,
9a83f860 937 wxT("invalid value for wxBoxSizer orientation") );
89064717
VZ
938 }
939
1a2df6a7
VZ
940 virtual wxSizerItem *AddSpacer(int size);
941
89064717 942 int GetOrientation() const { return m_orient; }
0c0d686f 943
89064717 944 bool IsVertical() const { return m_orient == wxVERTICAL; }
0c0d686f 945
89064717 946 void SetOrientation(int orient) { m_orient = orient; }
0c0d686f 947
89064717
VZ
948 // implementation of our resizing logic
949 virtual wxSize CalcMin();
950 virtual void RecalcSizes();
b657b4c9 951
61d514bb 952protected:
89064717
VZ
953 // helpers for our code: this returns the component of the given wxSize in
954 // the direction of the sizer and in the other direction, respectively
3d2085a4 955 int GetSizeInMajorDir(const wxSize& sz) const
89064717
VZ
956 {
957 return m_orient == wxHORIZONTAL ? sz.x : sz.y;
958 }
959
960 int& SizeInMajorDir(wxSize& sz)
961 {
962 return m_orient == wxHORIZONTAL ? sz.x : sz.y;
963 }
964
965 int& PosInMajorDir(wxPoint& pt)
966 {
967 return m_orient == wxHORIZONTAL ? pt.x : pt.y;
968 }
969
3d2085a4 970 int GetSizeInMinorDir(const wxSize& sz) const
89064717
VZ
971 {
972 return m_orient == wxHORIZONTAL ? sz.y : sz.x;
973 }
974
975 int& SizeInMinorDir(wxSize& sz)
976 {
977 return m_orient == wxHORIZONTAL ? sz.y : sz.x;
978 }
979
980 int& PosInMinorDir(wxPoint& pt)
981 {
982 return m_orient == wxHORIZONTAL ? pt.y : pt.x;
983 }
984
985 // another helper: creates wxSize from major and minor components
986 wxSize SizeFromMajorMinor(int major, int minor) const
987 {
988 if ( m_orient == wxHORIZONTAL )
989 {
990 return wxSize(major, minor);
991 }
992 else // wxVERTICAL
993 {
994 return wxSize(minor, major);
995 }
996 }
997
998
999 // either wxHORIZONTAL or wxVERTICAL
61d514bb 1000 int m_orient;
89064717
VZ
1001
1002 // the sum of proportion of all of our elements
1003 int m_totalProportion;
1004
1005 // the minimal size needed for this sizer as calculated by the last call to
1006 // our CalcMin()
1007 wxSize m_minSize;
1e6feb95 1008
9cbee2ce 1009private:
4393b50c 1010 DECLARE_CLASS(wxBoxSizer)
61d514bb 1011};
0c0d686f 1012
27ea1d8a
RR
1013//---------------------------------------------------------------------------
1014// wxStaticBoxSizer
1015//---------------------------------------------------------------------------
1016
1e6feb95
VZ
1017#if wxUSE_STATBOX
1018
b5dbe15d 1019class WXDLLIMPEXP_FWD_CORE wxStaticBox;
1e6feb95 1020
53a2db12 1021class WXDLLIMPEXP_CORE wxStaticBoxSizer: public wxBoxSizer
27ea1d8a
RR
1022{
1023public:
6c1635b5 1024 wxStaticBoxSizer(wxStaticBox *box, int orient);
450a1593 1025 wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString);
649cfca1 1026 virtual ~wxStaticBoxSizer();
0c0d686f 1027
f6bcfd97
BP
1028 void RecalcSizes();
1029 wxSize CalcMin();
0c0d686f 1030
9cbee2ce 1031 wxStaticBox *GetStaticBox() const
f6bcfd97 1032 { return m_staticBox; }
0c0d686f 1033
eb2a7883
VZ
1034 // override to hide/show the static box as well
1035 virtual void ShowItems (bool show);
7e2b7860 1036
e978011a 1037 virtual bool Detach( wxWindow *window );
7e2b7860
VZ
1038 virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); }
1039 virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); }
eb2a7883 1040
27ea1d8a 1041protected:
f6bcfd97 1042 wxStaticBox *m_staticBox;
1e6feb95 1043
9cbee2ce 1044private:
4393b50c 1045 DECLARE_CLASS(wxStaticBoxSizer)
c0c133e1 1046 wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer);
27ea1d8a
RR
1047};
1048
1e6feb95
VZ
1049#endif // wxUSE_STATBOX
1050
9b494057
FM
1051//---------------------------------------------------------------------------
1052// wxStdDialogButtonSizer
1053//---------------------------------------------------------------------------
1054
974c2a59
WS
1055#if wxUSE_BUTTON
1056
53a2db12 1057class WXDLLIMPEXP_CORE wxStdDialogButtonSizer: public wxBoxSizer
acf2ac37
RR
1058{
1059public:
acf2ac37
RR
1060 // Constructor just creates a new wxBoxSizer, not much else.
1061 // Box sizer orientation is automatically determined here:
1062 // vertical for PDAs, horizontal for everything else?
b181a505 1063 wxStdDialogButtonSizer();
acf2ac37 1064
acf2ac37 1065 // Checks button ID against system IDs and sets one of the pointers below
b181a505
RR
1066 // to this button. Does not do any sizer-related things here.
1067 void AddButton(wxButton *button);
acf2ac37 1068
b181a505
RR
1069 // Use these if no standard ID can/should be used
1070 void SetAffirmativeButton( wxButton *button );
1071 void SetNegativeButton( wxButton *button );
1072 void SetCancelButton( wxButton *button );
acf2ac37 1073
acf2ac37
RR
1074 // All platform-specific code here, checks which buttons exist and add
1075 // them to the sizer accordingly.
1076 // Note - one potential hack on Mac we could use here,
1077 // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE
1078 // is set to _("Save") and m_buttonNegative is set to _("Don't Save")
1079 // I wouldn't add any other hacks like that into here,
1080 // but this one I can see being useful.
718903fe 1081 void Realize();
974c2a59 1082
acf2ac37
RR
1083 wxButton *GetAffirmativeButton() const { return m_buttonAffirmative; }
1084 wxButton *GetApplyButton() const { return m_buttonApply; }
1085 wxButton *GetNegativeButton() const { return m_buttonNegative; }
1086 wxButton *GetCancelButton() const { return m_buttonCancel; }
1087 wxButton *GetHelpButton() const { return m_buttonHelp; }
1088
1089protected:
b181a505 1090 wxButton *m_buttonAffirmative; // wxID_OK, wxID_YES, wxID_SAVE go here
57d7f988 1091 wxButton *m_buttonApply; // wxID_APPLY
b181a505 1092 wxButton *m_buttonNegative; // wxID_NO
57d7f988
VZ
1093 wxButton *m_buttonCancel; // wxID_CANCEL, wxID_CLOSE
1094 wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP
974c2a59 1095
acf2ac37
RR
1096private:
1097 DECLARE_CLASS(wxStdDialogButtonSizer)
c0c133e1 1098 wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer);
acf2ac37 1099};
adbf2d73 1100
6b5c4761 1101#endif // wxUSE_BUTTON
974c2a59 1102
adbf2d73 1103
8e32ea1c
VZ
1104// ----------------------------------------------------------------------------
1105// inline functions implementation
1106// ----------------------------------------------------------------------------
1107
4dd10327
VZ
1108#if WXWIN_COMPATIBILITY_2_8
1109
1110inline void wxSizerItem::SetWindow(wxWindow *window)
1111{
1112 DoSetWindow(window);
1113}
1114
1115inline void wxSizerItem::SetSizer(wxSizer *sizer)
1116{
1117 DoSetSizer(sizer);
1118}
1119
1120inline void wxSizerItem::SetSpacer(const wxSize& size)
1121{
1122 DoSetSpacer(size);
1123}
1124
1125inline void wxSizerItem::SetSpacer(int width, int height)
2f39b5a3
VZ
1126{
1127 DoSetSpacer(wxSize(width, height));
1128}
4dd10327
VZ
1129
1130#endif // WXWIN_COMPATIBILITY_2_8
1131
54d61068
VZ
1132inline wxSizerItem*
1133wxSizer::Insert(size_t index, wxSizerItem *item)
1134{
1135 return DoInsert(index, item);
1136}
1137
4dd10327 1138
50961a35
PC
1139inline wxSizerItem*
1140wxSizer::Add( wxSizerItem *item )
1141{
1142 return Insert( m_children.GetCount(), item );
1143}
1144
56eee37f 1145inline wxSizerItem*
8e32ea1c
VZ
1146wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
1147{
56eee37f 1148 return Add( new wxSizerItem( window, proportion, flag, border, userData ) );
8e32ea1c
VZ
1149}
1150
56eee37f 1151inline wxSizerItem*
8e32ea1c
VZ
1152wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
1153{
56eee37f 1154 return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
8e32ea1c
VZ
1155}
1156
56eee37f 1157inline wxSizerItem*
8e32ea1c
VZ
1158wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
1159{
56eee37f 1160 return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
8e32ea1c
VZ
1161}
1162
56eee37f 1163inline wxSizerItem*
5f813ad6
VZ
1164wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
1165{
56eee37f 1166 return Add( new wxSizerItem(window, flags) );
5f813ad6
VZ
1167}
1168
56eee37f 1169inline wxSizerItem*
5f813ad6
VZ
1170wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
1171{
56eee37f 1172 return Add( new wxSizerItem(sizer, flags) );
5f813ad6
VZ
1173}
1174
b701f995
VZ
1175inline wxSizerItem*
1176wxSizer::Add( int width, int height, const wxSizerFlags& flags )
1177{
1178 return Add( new wxSizerItem(width, height, flags) );
1179}
1180
56eee37f 1181inline wxSizerItem*
8e32ea1c
VZ
1182wxSizer::AddSpacer(int size)
1183{
56eee37f 1184 return Add(size, size);
8e32ea1c
VZ
1185}
1186
56eee37f 1187inline wxSizerItem*
8e32ea1c
VZ
1188wxSizer::AddStretchSpacer(int prop)
1189{
56eee37f 1190 return Add(0, 0, prop);
8e32ea1c
VZ
1191}
1192
50961a35
PC
1193inline wxSizerItem*
1194wxSizer::Prepend( wxSizerItem *item )
1195{
1196 return Insert( 0, item );
1197}
1198
56eee37f 1199inline wxSizerItem*
8e32ea1c
VZ
1200wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
1201{
56eee37f 1202 return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
8e32ea1c
VZ
1203}
1204
56eee37f 1205inline wxSizerItem*
8e32ea1c
VZ
1206wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
1207{
56eee37f 1208 return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
8e32ea1c
VZ
1209}
1210
56eee37f 1211inline wxSizerItem*
8e32ea1c
VZ
1212wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
1213{
56eee37f 1214 return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
8e32ea1c
VZ
1215}
1216
56eee37f 1217inline wxSizerItem*
8e32ea1c
VZ
1218wxSizer::PrependSpacer(int size)
1219{
56eee37f 1220 return Prepend(size, size);
8e32ea1c
VZ
1221}
1222
56eee37f 1223inline wxSizerItem*
8e32ea1c
VZ
1224wxSizer::PrependStretchSpacer(int prop)
1225{
56eee37f 1226 return Prepend(0, 0, prop);
8e32ea1c
VZ
1227}
1228
56eee37f 1229inline wxSizerItem*
5f813ad6
VZ
1230wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
1231{
56eee37f 1232 return Prepend( new wxSizerItem(window, flags) );
5f813ad6
VZ
1233}
1234
56eee37f 1235inline wxSizerItem*
5f813ad6
VZ
1236wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
1237{
56eee37f 1238 return Prepend( new wxSizerItem(sizer, flags) );
5f813ad6
VZ
1239}
1240
b701f995
VZ
1241inline wxSizerItem*
1242wxSizer::Prepend( int width, int height, const wxSizerFlags& flags )
1243{
1244 return Prepend( new wxSizerItem(width, height, flags) );
1245}
1246
56eee37f 1247inline wxSizerItem*
8e32ea1c 1248wxSizer::Insert( size_t index,
5f813ad6
VZ
1249 wxWindow *window,
1250 int proportion,
1251 int flag,
1252 int border,
1253 wxObject* userData )
8e32ea1c 1254{
56eee37f 1255 return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
8e32ea1c
VZ
1256}
1257
56eee37f 1258inline wxSizerItem*
8e32ea1c 1259wxSizer::Insert( size_t index,
5f813ad6
VZ
1260 wxSizer *sizer,
1261 int proportion,
1262 int flag,
1263 int border,
1264 wxObject* userData )
8e32ea1c 1265{
56eee37f 1266 return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
8e32ea1c
VZ
1267}
1268
56eee37f 1269inline wxSizerItem*
8e32ea1c 1270wxSizer::Insert( size_t index,
5f813ad6
VZ
1271 int width,
1272 int height,
1273 int proportion,
1274 int flag,
1275 int border,
1276 wxObject* userData )
8e32ea1c 1277{
56eee37f 1278 return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
8e32ea1c
VZ
1279}
1280
56eee37f 1281inline wxSizerItem*
5f813ad6
VZ
1282wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
1283{
56eee37f 1284 return Insert( index, new wxSizerItem(window, flags) );
5f813ad6
VZ
1285}
1286
56eee37f 1287inline wxSizerItem*
5f813ad6
VZ
1288wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
1289{
56eee37f 1290 return Insert( index, new wxSizerItem(sizer, flags) );
5f813ad6
VZ
1291}
1292
b701f995
VZ
1293inline wxSizerItem*
1294wxSizer::Insert( size_t index, int width, int height, const wxSizerFlags& flags )
1295{
1296 return Insert( index, new wxSizerItem(width, height, flags) );
1297}
1298
56eee37f 1299inline wxSizerItem*
8e32ea1c
VZ
1300wxSizer::InsertSpacer(size_t index, int size)
1301{
56eee37f 1302 return Insert(index, size, size);
8e32ea1c
VZ
1303}
1304
56eee37f 1305inline wxSizerItem*
8e32ea1c
VZ
1306wxSizer::InsertStretchSpacer(size_t index, int prop)
1307{
56eee37f 1308 return Insert(index, 0, 0, prop);
8e32ea1c
VZ
1309}
1310
ade4eb65 1311#endif // __WXSIZER_H__