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