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