]> git.saurik.com Git - wxWidgets.git/blob - include/wx/sizer.h
use MSWAlwaysDrawBg() to fix the problem with black background; rewrote/cleaned up...
[wxWidgets.git] / include / wx / sizer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sizer.h
3 // Purpose: provide wxSizer class for layout
4 // Author: Robert Roebling and Robin Dunn
5 // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags)
6 // Created:
7 // RCS-ID: $Id$
8 // Copyright: (c) Robin Dunn, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WXSIZER_H__
13 #define __WXSIZER_H__
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "sizer.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #include "wx/window.h"
22 #include "wx/frame.h"
23 #include "wx/dialog.h"
24 #include "wx/bookctrl.h"
25
26 //---------------------------------------------------------------------------
27 // classes
28 //---------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxSizerItem;
31 class WXDLLEXPORT wxSizer;
32 class WXDLLEXPORT wxBoxSizer;
33
34
35 // ----------------------------------------------------------------------------
36 // wxSizerFlags: flags used for an item in the sizer
37 // ----------------------------------------------------------------------------
38
39 class WXDLLEXPORT wxSizerFlags
40 {
41 public:
42 // construct the flags object initialized with the given proportion (0 by
43 // default)
44 wxSizerFlags(int proportion = 0) : m_proportion(proportion)
45 {
46 m_flags = 0;
47 m_borderInPixels = 0;
48 }
49
50 // setters for all sizer flags, they all return the object itself so that
51 // calls to them can be chained
52
53 wxSizerFlags& Proportion(int proportion)
54 {
55 m_proportion = proportion;
56 return *this;
57 }
58
59 wxSizerFlags& Align(int alignment) // combination of wxAlignment values
60 {
61 m_flags &= wxALL;
62 m_flags |= alignment;
63
64 return *this;
65 }
66
67 // some shortcuts for Align()
68 wxSizerFlags& Expand() { return Align(wxEXPAND); }
69 wxSizerFlags& Centre() { return Align(wxCENTRE); }
70 wxSizerFlags& Center() { return Centre(); }
71
72
73 wxSizerFlags& Border(int direction, int borderInPixels)
74 {
75 m_flags &= ~wxALL;
76 m_flags |= direction;
77
78 m_borderInPixels = borderInPixels;
79
80 return *this;
81 }
82
83 wxSizerFlags& Border(int direction = wxALL)
84 {
85 // FIXME: default border size shouldn't be hardcoded
86 return Border(direction, 5);
87 }
88
89
90 // accessors for wxSizer only
91 int GetProportion() const { return m_proportion; }
92 int GetFlags() const { return m_flags; }
93 int GetBorderInPixels() const { return m_borderInPixels; }
94
95 private:
96 int m_proportion;
97 int m_flags;
98 int m_borderInPixels;
99 };
100
101
102 //---------------------------------------------------------------------------
103 // wxSizerItem
104 //---------------------------------------------------------------------------
105
106 class WXDLLEXPORT wxSizerItem: public wxObject
107 {
108 public:
109 // window with flags
110 wxSizerItem(wxWindow *window, const wxSizerFlags& flags)
111 {
112 Init(flags);
113
114 m_window = window;
115 }
116
117 // sizer with flags
118 wxSizerItem(wxSizer *sizer, const wxSizerFlags& flags)
119 {
120 Init(flags);
121
122 m_sizer = sizer;
123 }
124
125 // window
126 wxSizerItem( wxWindow *window,
127 int proportion,
128 int flag,
129 int border,
130 wxObject* userData );
131
132 // subsizer
133 wxSizerItem( wxSizer *sizer,
134 int proportion,
135 int flag,
136 int border,
137 wxObject* userData );
138
139 // spacer
140 wxSizerItem( int width,
141 int height,
142 int proportion,
143 int flag,
144 int border,
145 wxObject* userData);
146
147 wxSizerItem();
148 virtual ~wxSizerItem();
149
150 virtual void DeleteWindows();
151
152 // Enable deleting the SizerItem without destroying the contained sizer.
153 void DetachSizer()
154 { m_sizer = 0; }
155
156 virtual wxSize GetSize() const;
157 virtual wxSize CalcMin();
158 virtual void SetDimension( wxPoint pos, wxSize size );
159
160 wxSize GetMinSize() const
161 { return m_minSize; }
162 wxSize GetMinSizeWithBorder() const;
163
164 void SetMinSize(const wxSize& size)
165 {
166 if (IsWindow()) m_window->SetMinSize(size);
167 m_minSize = size;
168 }
169 void SetMinSize( int x, int y )
170 { SetMinSize(wxSize(x, y)); }
171 void SetInitSize( int x, int y )
172 { SetMinSize(wxSize(x, y)); }
173
174 void SetRatio( int width, int height )
175 // if either of dimensions is zero, ratio is assumed to be 1
176 // to avoid "divide by zero" errors
177 { m_ratio = (width && height) ? ((float) width / (float) height) : 1; }
178 void SetRatio( wxSize size )
179 { m_ratio = (size.x && size.y) ? ((float) size.x / (float) size.y) : 1; }
180 void SetRatio( float ratio )
181 { m_ratio = ratio; }
182 float GetRatio() const
183 { return m_ratio; }
184
185 virtual wxRect GetRect() { return m_zoneRect; }
186
187 bool IsWindow() const;
188 bool IsSizer() const;
189 bool IsSpacer() const;
190
191 // Deprecated in 2.6, use {G,S}etProportion instead.
192 wxDEPRECATED( void SetOption( int option ) );
193 wxDEPRECATED( int GetOption() const );
194
195 void SetProportion( int proportion )
196 { m_proportion = proportion; }
197 int GetProportion() const
198 { return m_proportion; }
199 void SetFlag( int flag )
200 { m_flag = flag; }
201 int GetFlag() const
202 { return m_flag; }
203 void SetBorder( int border )
204 { m_border = border; }
205 int GetBorder() const
206 { return m_border; }
207
208 wxWindow *GetWindow() const
209 { return m_window; }
210 void SetWindow( wxWindow *window )
211 { m_window = window; m_minSize = window->GetSize(); }
212 wxSizer *GetSizer() const
213 { return m_sizer; }
214 void SetSizer( wxSizer *sizer )
215 { m_sizer = sizer; }
216 const wxSize &GetSpacer() const
217 { return m_size; }
218 void SetSpacer( const wxSize &size )
219 { m_size = size; m_minSize = size; }
220
221 void Show ( bool show );
222 bool IsShown() const
223 { return m_show; }
224
225 wxObject* GetUserData() const
226 { return m_userData; }
227 wxPoint GetPosition() const
228 { return m_pos; }
229
230 protected:
231 // common part of several ctors
232 void Init();
233
234 // common part of ctors taking wxSizerFlags
235 void Init(const wxSizerFlags& flags);
236
237
238 wxWindow *m_window;
239 wxSizer *m_sizer;
240 wxSize m_size;
241 wxPoint m_pos;
242 wxSize m_minSize;
243 int m_proportion;
244 int m_border;
245 int m_flag;
246 wxRect m_zoneRect; // Rectangle for window or item (not including borders)
247
248 // If true, then this item is considered in the layout
249 // calculation. Otherwise, it is skipped over.
250 bool m_show;
251
252 // Aspect ratio can always be calculated from m_size,
253 // but this would cause precision loss when the window
254 // is shrunk. It is safer to preserve the initial value.
255 float m_ratio;
256
257 wxObject *m_userData;
258
259 private:
260 DECLARE_CLASS(wxSizerItem)
261 DECLARE_NO_COPY_CLASS(wxSizerItem)
262 };
263
264 WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
265
266
267 //---------------------------------------------------------------------------
268 // wxSizer
269 //---------------------------------------------------------------------------
270
271 class WXDLLEXPORT wxSizer: public wxObject, public wxClientDataContainer
272 {
273 public:
274 wxSizer();
275 ~wxSizer();
276
277 // methods for adding elements to the sizer: there are Add/Insert/Prepend
278 // overloads for each of window/sizer/spacer/wxSizerItem
279 inline wxSizerItem* Add( wxWindow *window,
280 int proportion = 0,
281 int flag = 0,
282 int border = 0,
283 wxObject* userData = NULL );
284 inline wxSizerItem* Add( wxSizer *sizer,
285 int proportion = 0,
286 int flag = 0,
287 int border = 0,
288 wxObject* userData = NULL );
289 inline wxSizerItem* Add( int width,
290 int height,
291 int proportion = 0,
292 int flag = 0,
293 int border = 0,
294 wxObject* userData = NULL );
295 inline wxSizerItem* Add( wxWindow *window, const wxSizerFlags& flags );
296 inline wxSizerItem* Add( wxSizer *sizer, const wxSizerFlags& flags );
297 inline wxSizerItem* Add( wxSizerItem *item );
298
299 inline wxSizerItem* AddSpacer(int size);
300 inline wxSizerItem* AddStretchSpacer(int prop = 1);
301
302 inline wxSizerItem* Insert( size_t index,
303 wxWindow *window,
304 int proportion = 0,
305 int flag = 0,
306 int border = 0,
307 wxObject* userData = NULL );
308 inline wxSizerItem* Insert( size_t index,
309 wxSizer *sizer,
310 int proportion = 0,
311 int flag = 0,
312 int border = 0,
313 wxObject* userData = NULL );
314 inline wxSizerItem* Insert( size_t index,
315 int width,
316 int height,
317 int proportion = 0,
318 int flag = 0,
319 int border = 0,
320 wxObject* userData = NULL );
321 inline wxSizerItem* Insert( size_t index,
322 wxWindow *window,
323 const wxSizerFlags& flags );
324 inline wxSizerItem* Insert( size_t index,
325 wxSizer *sizer,
326 const wxSizerFlags& flags );
327 virtual wxSizerItem* Insert( size_t index, wxSizerItem *item );
328
329 inline wxSizerItem* InsertSpacer(size_t index, int size);
330 inline wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
331
332 inline wxSizerItem* Prepend( wxWindow *window,
333 int proportion = 0,
334 int flag = 0,
335 int border = 0,
336 wxObject* userData = NULL );
337 inline wxSizerItem* Prepend( wxSizer *sizer,
338 int proportion = 0,
339 int flag = 0,
340 int border = 0,
341 wxObject* userData = NULL );
342 inline wxSizerItem* Prepend( int width,
343 int height,
344 int proportion = 0,
345 int flag = 0,
346 int border = 0,
347 wxObject* userData = NULL );
348 inline wxSizerItem* Prepend( wxWindow *window, const wxSizerFlags& flags );
349 inline wxSizerItem* Prepend( wxSizer *sizer, const wxSizerFlags& flags );
350 inline wxSizerItem* Prepend( wxSizerItem *item );
351
352 inline wxSizerItem* PrependSpacer(int size);
353 inline wxSizerItem* PrependStretchSpacer(int prop = 1);
354
355
356 // Deprecated in 2.6 since historically it does not delete the window,
357 // use Detach instead.
358 wxDEPRECATED( virtual bool Remove( wxWindow *window ) );
359 virtual bool Remove( wxSizer *sizer );
360 virtual bool Remove( int index );
361
362 virtual bool Detach( wxWindow *window );
363 virtual bool Detach( wxSizer *sizer );
364 virtual bool Detach( int index );
365
366 virtual void Clear( bool delete_windows = false );
367 virtual void DeleteWindows();
368
369 void SetMinSize( int width, int height )
370 { DoSetMinSize( width, height ); }
371 void SetMinSize( wxSize size )
372 { DoSetMinSize( size.x, size.y ); }
373
374 /* Searches recursively */
375 bool SetItemMinSize( wxWindow *window, int width, int height )
376 { return DoSetItemMinSize( window, width, height ); }
377 bool SetItemMinSize( wxWindow *window, wxSize size )
378 { return DoSetItemMinSize( window, size.x, size.y ); }
379
380 /* Searches recursively */
381 bool SetItemMinSize( wxSizer *sizer, int width, int height )
382 { return DoSetItemMinSize( sizer, width, height ); }
383 bool SetItemMinSize( wxSizer *sizer, wxSize size )
384 { return DoSetItemMinSize( sizer, size.x, size.y ); }
385
386 bool SetItemMinSize( size_t index, int width, int height )
387 { return DoSetItemMinSize( index, width, height ); }
388 bool SetItemMinSize( size_t index, wxSize size )
389 { return DoSetItemMinSize( index, size.x, size.y ); }
390
391 wxSize GetSize() const
392 { return m_size; }
393 wxPoint GetPosition() const
394 { return m_position; }
395
396 /* Calculate the minimal size or return m_minSize if bigger. */
397 wxSize GetMinSize();
398
399 virtual void RecalcSizes() = 0;
400 virtual wxSize CalcMin() = 0;
401
402 virtual void Layout();
403
404 wxSize Fit( wxWindow *window );
405 void FitInside( wxWindow *window );
406 void SetSizeHints( wxWindow *window );
407 void SetVirtualSizeHints( wxWindow *window );
408
409 wxSizerItemList& GetChildren()
410 { return m_children; }
411
412 void SetDimension( int x, int y, int width, int height );
413
414 wxSizerItem* GetItem( wxWindow *window, bool recursive = false );
415 wxSizerItem* GetItem( wxSizer *sizer, bool recursive = false );
416 wxSizerItem* GetItem( size_t index );
417
418 // Manage whether individual scene items are considered
419 // in the layout calculations or not.
420 bool Show( wxWindow *window, bool show = true, bool recursive = false );
421 bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
422 bool Show( size_t index, bool show = true );
423
424 bool Hide( wxSizer *sizer, bool recursive = false )
425 { return Show( sizer, false, recursive ); }
426 bool Hide( wxWindow *window, bool recursive = false )
427 { return Show( window, false, recursive ); }
428 bool Hide( size_t index )
429 { return Show( index, false ); }
430
431 bool IsShown( wxWindow *window ) const;
432 bool IsShown( wxSizer *sizer ) const;
433 bool IsShown( size_t index ) const;
434
435 // Recursively call wxWindow::Show () on all sizer items.
436 virtual void ShowItems (bool show);
437
438 protected:
439 wxSize m_size;
440 wxSize m_minSize;
441 wxPoint m_position;
442 wxSizerItemList m_children;
443
444 wxSize GetMaxWindowSize( wxWindow *window ) const;
445 wxSize GetMinWindowSize( wxWindow *window );
446 wxSize GetMaxClientSize( wxWindow *window ) const;
447 wxSize GetMinClientSize( wxWindow *window );
448 wxSize FitSize( wxWindow *window );
449 wxSize VirtualFitSize( wxWindow *window );
450
451 virtual void DoSetMinSize( int width, int height );
452 virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
453 virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
454 virtual bool DoSetItemMinSize( size_t index, int width, int height );
455
456 private:
457 DECLARE_CLASS(wxSizer)
458 };
459
460 //---------------------------------------------------------------------------
461 // wxGridSizer
462 //---------------------------------------------------------------------------
463
464 class WXDLLEXPORT wxGridSizer: public wxSizer
465 {
466 public:
467 wxGridSizer( int rows, int cols, int vgap, int hgap );
468 wxGridSizer( int cols, int vgap = 0, int hgap = 0 );
469
470 virtual void RecalcSizes();
471 virtual wxSize CalcMin();
472
473 void SetCols( int cols ) { m_cols = cols; }
474 void SetRows( int rows ) { m_rows = rows; }
475 void SetVGap( int gap ) { m_vgap = gap; }
476 void SetHGap( int gap ) { m_hgap = gap; }
477 int GetCols() const { return m_cols; }
478 int GetRows() const { return m_rows; }
479 int GetVGap() const { return m_vgap; }
480 int GetHGap() const { return m_hgap; }
481
482 protected:
483 int m_rows;
484 int m_cols;
485 int m_vgap;
486 int m_hgap;
487
488 // return the number of total items and the number of columns and rows
489 int CalcRowsCols(int& rows, int& cols) const;
490
491 void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h );
492
493 private:
494 DECLARE_CLASS(wxGridSizer)
495 };
496
497 //---------------------------------------------------------------------------
498 // wxFlexGridSizer
499 //---------------------------------------------------------------------------
500
501 // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible"
502 // direction
503 enum wxFlexSizerGrowMode
504 {
505 // don't resize the cells in non-flexible direction at all
506 wxFLEX_GROWMODE_NONE,
507
508 // uniformly resize only the specified ones (default)
509 wxFLEX_GROWMODE_SPECIFIED,
510
511 // uniformly resize all cells
512 wxFLEX_GROWMODE_ALL
513 };
514
515 class WXDLLEXPORT wxFlexGridSizer: public wxGridSizer
516 {
517 public:
518 // ctors/dtor
519 wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
520 wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
521 virtual ~wxFlexGridSizer();
522
523
524 // set the rows/columns which will grow (the others will remain of the
525 // constant initial size)
526 void AddGrowableRow( size_t idx, int proportion = 0 );
527 void RemoveGrowableRow( size_t idx );
528 void AddGrowableCol( size_t idx, int proportion = 0 );
529 void RemoveGrowableCol( size_t idx );
530
531
532 // the sizer cells may grow in both directions, not grow at all or only
533 // grow in one direction but not the other
534
535 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
536 void SetFlexibleDirection(int direction) { m_flexDirection = direction; }
537 int GetFlexibleDirection() const { return m_flexDirection; }
538
539 // note that the grow mode only applies to the direction which is not
540 // flexible
541 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode) { m_growMode = mode; }
542 wxFlexSizerGrowMode GetNonFlexibleGrowMode() const { return m_growMode; }
543
544 // Read-only access to the row heights and col widths arrays
545 const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
546 const wxArrayInt& GetColWidths() const { return m_colWidths; }
547
548 // implementation
549 virtual void RecalcSizes();
550 virtual wxSize CalcMin();
551
552 protected:
553 void AdjustForFlexDirection();
554 void AdjustForGrowables(const wxSize& sz, const wxSize& minsz,
555 int nrows, int ncols);
556
557 // the heights/widths of all rows/columns
558 wxArrayInt m_rowHeights,
559 m_colWidths;
560
561 // indices of the growable columns and rows
562 wxArrayInt m_growableRows,
563 m_growableCols;
564
565 // proportion values of the corresponding growable rows and columns
566 wxArrayInt m_growableRowsProportions,
567 m_growableColsProportions;
568
569 // parameters describing whether the growable cells should be resized in
570 // both directions or only one
571 int m_flexDirection;
572 wxFlexSizerGrowMode m_growMode;
573
574 // saves CalcMin result to optimize RecalcSizes
575 wxSize m_calculatedMinSize;
576
577 private:
578 DECLARE_CLASS(wxFlexGridSizer)
579 DECLARE_NO_COPY_CLASS(wxFlexGridSizer)
580 };
581
582 //---------------------------------------------------------------------------
583 // wxBoxSizer
584 //---------------------------------------------------------------------------
585
586 class WXDLLEXPORT wxBoxSizer: public wxSizer
587 {
588 public:
589 wxBoxSizer( int orient );
590
591 void RecalcSizes();
592 wxSize CalcMin();
593
594 int GetOrientation() const
595 { return m_orient; }
596
597 void SetOrientation(int orient)
598 { m_orient = orient; }
599
600 protected:
601 int m_orient;
602 int m_stretchable;
603 int m_minWidth;
604 int m_minHeight;
605 int m_fixedWidth;
606 int m_fixedHeight;
607
608 private:
609 DECLARE_CLASS(wxBoxSizer)
610 };
611
612 //---------------------------------------------------------------------------
613 // wxStaticBoxSizer
614 //---------------------------------------------------------------------------
615
616 #if wxUSE_STATBOX
617
618 class WXDLLEXPORT wxStaticBox;
619
620 class WXDLLEXPORT wxStaticBoxSizer: public wxBoxSizer
621 {
622 public:
623 wxStaticBoxSizer( wxStaticBox *box, int orient );
624
625 void RecalcSizes();
626 wxSize CalcMin();
627
628 wxStaticBox *GetStaticBox() const
629 { return m_staticBox; }
630
631 // override to hide/show the static box as well
632 virtual void ShowItems (bool show);
633
634 protected:
635 wxStaticBox *m_staticBox;
636
637 private:
638 DECLARE_CLASS(wxStaticBoxSizer)
639 DECLARE_NO_COPY_CLASS(wxStaticBoxSizer)
640 };
641
642 #endif // wxUSE_STATBOX
643
644
645 #if WXWIN_COMPATIBILITY_2_4
646 // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
647 // don't do anything. wxBookCtrlBase::DoGetBestSize does the job now.
648
649 // ----------------------------------------------------------------------------
650 // wxBookCtrlSizer
651 // ----------------------------------------------------------------------------
652
653 #if wxUSE_BOOKCTRL
654
655 // this sizer works with wxNotebook/wxListbook/... and sizes the control to
656 // fit its pages
657 class WXDLLEXPORT wxBookCtrlBase;
658
659 class WXDLLEXPORT wxBookCtrlSizer : public wxSizer
660 {
661 public:
662 wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) );
663
664 wxBookCtrlBase *GetControl() const { return m_bookctrl; }
665
666 virtual void RecalcSizes();
667 virtual wxSize CalcMin();
668
669 protected:
670 // this protected ctor lets us mark the real one above as deprecated
671 // and still have warning-free build of the library itself:
672 wxBookCtrlSizer() {}
673
674 wxBookCtrlBase *m_bookctrl;
675
676 private:
677 DECLARE_CLASS(wxBookCtrlSizer)
678 DECLARE_NO_COPY_CLASS(wxBookCtrlSizer)
679 };
680
681
682 #if wxUSE_NOTEBOOK
683
684 // before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards
685 // compatibility
686 class WXDLLEXPORT wxNotebook;
687
688 class WXDLLEXPORT wxNotebookSizer : public wxBookCtrlSizer
689 {
690 public:
691 wxDEPRECATED( wxNotebookSizer(wxNotebook *nb) );
692
693 wxNotebook *GetNotebook() const { return (wxNotebook *)m_bookctrl; }
694
695 private:
696 DECLARE_CLASS(wxNotebookSizer)
697 DECLARE_NO_COPY_CLASS(wxNotebookSizer)
698 };
699
700 #endif // wxUSE_NOTEBOOK
701
702 #endif // wxUSE_BOOKCTRL
703
704 #endif // WXWIN_COMPATIBILITY_2_4
705
706 // ----------------------------------------------------------------------------
707 // inline functions implementation
708 // ----------------------------------------------------------------------------
709
710 inline wxSizerItem*
711 wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
712 {
713 return Add( new wxSizerItem( window, proportion, flag, border, userData ) );
714 }
715
716 inline wxSizerItem*
717 wxSizer::Add( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
718 {
719 return Add( new wxSizerItem( sizer, proportion, flag, border, userData ) );
720 }
721
722 inline wxSizerItem*
723 wxSizer::Add( int width, int height, int proportion, int flag, int border, wxObject* userData )
724 {
725 return Add( new wxSizerItem( width, height, proportion, flag, border, userData ) );
726 }
727
728 inline wxSizerItem*
729 wxSizer::Add( wxWindow *window, const wxSizerFlags& flags )
730 {
731 return Add( new wxSizerItem(window, flags) );
732 }
733
734 inline wxSizerItem*
735 wxSizer::Add( wxSizer *sizer, const wxSizerFlags& flags )
736 {
737 return Add( new wxSizerItem(sizer, flags) );
738 }
739
740 inline wxSizerItem*
741 wxSizer::Add( wxSizerItem *item )
742 {
743 return Insert( m_children.GetCount(), item );
744 }
745
746 inline wxSizerItem*
747 wxSizer::AddSpacer(int size)
748 {
749 return Add(size, size);
750 }
751
752 inline wxSizerItem*
753 wxSizer::AddStretchSpacer(int prop)
754 {
755 return Add(0, 0, prop);
756 }
757
758 inline wxSizerItem*
759 wxSizer::Prepend( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
760 {
761 return Prepend( new wxSizerItem( window, proportion, flag, border, userData ) );
762 }
763
764 inline wxSizerItem*
765 wxSizer::Prepend( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData )
766 {
767 return Prepend( new wxSizerItem( sizer, proportion, flag, border, userData ) );
768 }
769
770 inline wxSizerItem*
771 wxSizer::Prepend( int width, int height, int proportion, int flag, int border, wxObject* userData )
772 {
773 return Prepend( new wxSizerItem( width, height, proportion, flag, border, userData ) );
774 }
775
776 inline wxSizerItem*
777 wxSizer::Prepend( wxSizerItem *item )
778 {
779 return Insert( 0, item );
780 }
781
782 inline wxSizerItem*
783 wxSizer::PrependSpacer(int size)
784 {
785 return Prepend(size, size);
786 }
787
788 inline wxSizerItem*
789 wxSizer::PrependStretchSpacer(int prop)
790 {
791 return Prepend(0, 0, prop);
792 }
793
794 inline wxSizerItem*
795 wxSizer::Prepend( wxWindow *window, const wxSizerFlags& flags )
796 {
797 return Prepend( new wxSizerItem(window, flags) );
798 }
799
800 inline wxSizerItem*
801 wxSizer::Prepend( wxSizer *sizer, const wxSizerFlags& flags )
802 {
803 return Prepend( new wxSizerItem(sizer, flags) );
804 }
805
806 inline wxSizerItem*
807 wxSizer::Insert( size_t index,
808 wxWindow *window,
809 int proportion,
810 int flag,
811 int border,
812 wxObject* userData )
813 {
814 return Insert( index, new wxSizerItem( window, proportion, flag, border, userData ) );
815 }
816
817 inline wxSizerItem*
818 wxSizer::Insert( size_t index,
819 wxSizer *sizer,
820 int proportion,
821 int flag,
822 int border,
823 wxObject* userData )
824 {
825 return Insert( index, new wxSizerItem( sizer, proportion, flag, border, userData ) );
826 }
827
828 inline wxSizerItem*
829 wxSizer::Insert( size_t index,
830 int width,
831 int height,
832 int proportion,
833 int flag,
834 int border,
835 wxObject* userData )
836 {
837 return Insert( index, new wxSizerItem( width, height, proportion, flag, border, userData ) );
838 }
839
840 inline wxSizerItem*
841 wxSizer::Insert( size_t index, wxWindow *window, const wxSizerFlags& flags )
842 {
843 return Insert( index, new wxSizerItem(window, flags) );
844 }
845
846 inline wxSizerItem*
847 wxSizer::Insert( size_t index, wxSizer *sizer, const wxSizerFlags& flags )
848 {
849 return Insert( index, new wxSizerItem(sizer, flags) );
850 }
851
852 inline wxSizerItem*
853 wxSizer::InsertSpacer(size_t index, int size)
854 {
855 return Insert(index, size, size);
856 }
857
858 inline wxSizerItem*
859 wxSizer::InsertStretchSpacer(size_t index, int prop)
860 {
861 return Insert(index, 0, 0, prop);
862 }
863
864
865 #endif // __WXSIZER_H__
866