1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: provide wxSizer class for layout
4 // Author: Robert Roebling and Robin Dunn
5 // Modified by: Ron Lee, Vadim Zeitlin (wxSizerFlags)
8 // Copyright: (c) Robin Dunn, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/window.h"
19 //---------------------------------------------------------------------------
21 //---------------------------------------------------------------------------
23 class WXDLLEXPORT wxButton
;
24 class WXDLLEXPORT wxBoxSizer
;
25 class WXDLLEXPORT wxSizerItem
;
26 class WXDLLEXPORT wxSizer
;
28 #ifndef wxUSE_BORDER_BY_DEFAULT
30 // no borders by default on limited size screen
31 #define wxUSE_BORDER_BY_DEFAULT 0
33 #define wxUSE_BORDER_BY_DEFAULT 1
37 // ----------------------------------------------------------------------------
38 // wxSizerFlags: flags used for an item in the sizer
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxSizerFlags
44 // construct the flags object initialized with the given proportion (0 by
46 wxSizerFlags(int proportion
= 0) : m_proportion(proportion
)
52 // setters for all sizer flags, they all return the object itself so that
53 // calls to them can be chained
55 wxSizerFlags
& Proportion(int proportion
)
57 m_proportion
= proportion
;
61 wxSizerFlags
& Align(int alignment
) // combination of wxAlignment values
63 m_flags
&= ~wxALIGN_MASK
;
69 wxSizerFlags
& Expand()
75 // some shortcuts for Align()
76 wxSizerFlags
& Centre() { return Align(wxCENTRE
); }
77 wxSizerFlags
& Center() { return Centre(); }
78 wxSizerFlags
& Left() { return Align(wxALIGN_LEFT
); }
79 wxSizerFlags
& Right() { return Align(wxALIGN_RIGHT
); }
81 // default border size used by Border() below
82 static int GetDefaultBorder()
84 #if wxUSE_BORDER_BY_DEFAULT
85 // FIXME: default border size shouldn't be hardcoded and at the very
86 // least they should depend on the current font size
94 wxSizerFlags
& Border(int direction
, int borderInPixels
)
99 m_borderInPixels
= borderInPixels
;
104 wxSizerFlags
& Border(int direction
= wxALL
)
106 #if wxUSE_BORDER_BY_DEFAULT
107 return Border(direction
, GetDefaultBorder());
109 // no borders by default on limited size screen
110 wxUnusedVar(direction
);
116 wxSizerFlags
& DoubleBorder(int direction
= wxALL
)
118 #if wxUSE_BORDER_BY_DEFAULT
119 return Border(direction
, 2*GetDefaultBorder());
121 wxUnusedVar(direction
);
127 wxSizerFlags
& TripleBorder(int direction
= wxALL
)
129 #if wxUSE_BORDER_BY_DEFAULT
130 return Border(direction
, 3*GetDefaultBorder());
132 wxUnusedVar(direction
);
138 wxSizerFlags
& HorzBorder()
140 #if wxUSE_BORDER_BY_DEFAULT
141 return Border(wxLEFT
| wxRIGHT
, GetDefaultBorder());
147 wxSizerFlags
& DoubleHorzBorder()
149 #if wxUSE_BORDER_BY_DEFAULT
150 return Border(wxLEFT
| wxRIGHT
, 2*GetDefaultBorder());
156 #if wxABI_VERSION >= 20802
157 // setters for the others flags
158 wxSizerFlags
& Shaped()
165 wxSizerFlags
& FixedMinSize()
167 m_flags
|= wxFIXED_MINSIZE
;
173 // accessors for wxSizer only
174 int GetProportion() const { return m_proportion
; }
175 int GetFlags() const { return m_flags
; }
176 int GetBorderInPixels() const { return m_borderInPixels
; }
181 int m_borderInPixels
;
185 // ----------------------------------------------------------------------------
186 // wxSizerSpacer: used by wxSizerItem to represent a spacer
187 // ----------------------------------------------------------------------------
189 class WXDLLEXPORT wxSizerSpacer
192 wxSizerSpacer(const wxSize
& size
) : m_size(size
), m_isShown(true) { }
194 void SetSize(const wxSize
& size
) { m_size
= size
; }
195 const wxSize
& GetSize() const { return m_size
; }
197 void Show(bool show
) { m_isShown
= show
; }
198 bool IsShown() const { return m_isShown
; }
201 // the size, in pixel
204 // is the spacer currently shown?
208 // ----------------------------------------------------------------------------
210 // ----------------------------------------------------------------------------
212 class WXDLLEXPORT wxSizerItem
: public wxObject
216 wxSizerItem( wxWindow
*window
,
220 wxObject
* userData
);
223 wxSizerItem(wxWindow
*window
, const wxSizerFlags
& flags
)
231 wxSizerItem( wxSizer
*sizer
,
235 wxObject
* userData
);
238 wxSizerItem(wxSizer
*sizer
, const wxSizerFlags
& flags
)
246 wxSizerItem( int width
,
254 wxSizerItem(int width
, int height
, const wxSizerFlags
& flags
)
258 SetSpacer(width
, height
);
262 virtual ~wxSizerItem();
264 virtual void DeleteWindows();
266 // Enable deleting the SizerItem without destroying the contained sizer.
267 void DetachSizer() { m_sizer
= NULL
; }
269 virtual wxSize
GetSize() const;
270 virtual wxSize
CalcMin();
271 virtual void SetDimension( const wxPoint
& pos
, const wxSize
& size
);
273 wxSize
GetMinSize() const
274 { return m_minSize
; }
275 wxSize
GetMinSizeWithBorder() const;
277 void SetMinSize(const wxSize
& size
)
280 m_window
->SetMinSize(size
);
283 void SetMinSize( int x
, int y
)
284 { SetMinSize(wxSize(x
, y
)); }
285 void SetInitSize( int x
, int y
)
286 { SetMinSize(wxSize(x
, y
)); }
288 // if either of dimensions is zero, ratio is assumed to be 1
289 // to avoid "divide by zero" errors
290 void SetRatio(int width
, int height
)
291 { m_ratio
= (width
&& height
) ? ((float) width
/ (float) height
) : 1; }
292 void SetRatio(const wxSize
& size
)
293 { SetRatio(size
.x
, size
.y
); }
294 void SetRatio(float ratio
)
296 float GetRatio() const
299 virtual wxRect
GetRect() { return m_rect
; }
301 bool IsWindow() const { return m_kind
== Item_Window
; }
302 bool IsSizer() const { return m_kind
== Item_Sizer
; }
303 bool IsSpacer() const { return m_kind
== Item_Spacer
; }
305 #if WXWIN_COMPATIBILITY_2_6
306 // Deprecated in 2.6, use {G,S}etProportion instead.
307 wxDEPRECATED( void SetOption( int option
) );
308 wxDEPRECATED( int GetOption() const );
309 #endif // WXWIN_COMPATIBILITY_2_6
311 void SetProportion( int proportion
)
312 { m_proportion
= proportion
; }
313 int GetProportion() const
314 { return m_proportion
; }
315 void SetFlag( int flag
)
319 void SetBorder( int border
)
320 { m_border
= border
; }
321 int GetBorder() const
324 wxWindow
*GetWindow() const
325 { return m_kind
== Item_Window
? m_window
: NULL
; }
326 wxSizer
*GetSizer() const
327 { return m_kind
== Item_Sizer
? m_sizer
: NULL
; }
328 wxSize
GetSpacer() const;
330 // this function behaves obviously for the windows and spacers but for the
331 // sizers it returns true if any sizer element is shown and only returns
332 // false if all of them are hidden
333 bool IsShown() const;
334 void Show(bool show
);
336 void SetUserData(wxObject
* userData
)
337 { delete m_userData
; m_userData
= userData
; }
338 wxObject
* GetUserData() const
339 { return m_userData
; }
340 wxPoint
GetPosition() const
344 // these functions do not free old sizer/spacer
345 void SetWindow(wxWindow
*window
);
346 void SetSizer(wxSizer
*sizer
);
347 void SetSpacer(const wxSize
& size
);
348 void SetSpacer(int width
, int height
) { SetSpacer(wxSize(width
, height
)); }
351 // common part of several ctors
352 void Init() { m_userData
= NULL
; }
354 // common part of ctors taking wxSizerFlags
355 void Init(const wxSizerFlags
& flags
);
358 // discriminated union: depending on m_kind one of the fields is valid
371 wxSizerSpacer
*m_spacer
;
380 // on screen rectangle of this item (not including borders)
383 // Aspect ratio can always be calculated from m_size,
384 // but this would cause precision loss when the window
385 // is shrunk. It is safer to preserve the initial value.
388 wxObject
*m_userData
;
391 DECLARE_CLASS(wxSizerItem
)
392 DECLARE_NO_COPY_CLASS(wxSizerItem
)
395 WX_DECLARE_EXPORTED_LIST( wxSizerItem
, wxSizerItemList
);
398 //---------------------------------------------------------------------------
400 //---------------------------------------------------------------------------
402 class WXDLLEXPORT wxSizer
: public wxObject
, public wxClientDataContainer
405 wxSizer() { m_containingWindow
= NULL
; }
408 // methods for adding elements to the sizer: there are Add/Insert/Prepend
409 // overloads for each of window/sizer/spacer/wxSizerItem
410 wxSizerItem
* Add(wxWindow
*window
,
414 wxObject
* userData
= NULL
);
415 wxSizerItem
* Add(wxSizer
*sizer
,
419 wxObject
* userData
= NULL
);
420 wxSizerItem
* Add(int width
,
425 wxObject
* userData
= NULL
);
426 wxSizerItem
* Add( wxWindow
*window
, const wxSizerFlags
& flags
);
427 wxSizerItem
* Add( wxSizer
*sizer
, const wxSizerFlags
& flags
);
428 wxSizerItem
* Add( wxSizerItem
*item
);
430 wxSizerItem
* AddSpacer(int size
);
431 wxSizerItem
* AddStretchSpacer(int prop
= 1);
433 wxSizerItem
* Insert(size_t index
,
438 wxObject
* userData
= NULL
);
439 wxSizerItem
* Insert(size_t index
,
444 wxObject
* userData
= NULL
);
445 wxSizerItem
* Insert(size_t index
,
451 wxObject
* userData
= NULL
);
452 wxSizerItem
* Insert(size_t index
,
454 const wxSizerFlags
& flags
);
455 wxSizerItem
* Insert(size_t index
,
457 const wxSizerFlags
& flags
);
458 virtual wxSizerItem
* Insert( size_t index
, wxSizerItem
*item
);
460 wxSizerItem
* InsertSpacer(size_t index
, int size
);
461 wxSizerItem
* InsertStretchSpacer(size_t index
, int prop
= 1);
463 wxSizerItem
* Prepend(wxWindow
*window
,
467 wxObject
* userData
= NULL
);
468 wxSizerItem
* Prepend(wxSizer
*sizer
,
472 wxObject
* userData
= NULL
);
473 wxSizerItem
* Prepend(int width
,
478 wxObject
* userData
= NULL
);
479 wxSizerItem
* Prepend(wxWindow
*window
, const wxSizerFlags
& flags
);
480 wxSizerItem
* Prepend(wxSizer
*sizer
, const wxSizerFlags
& flags
);
481 wxSizerItem
* Prepend(wxSizerItem
*item
);
483 wxSizerItem
* PrependSpacer(int size
);
484 wxSizerItem
* PrependStretchSpacer(int prop
= 1);
486 // set (or possibly unset if window is NULL) or get the window this sizer
488 void SetContainingWindow(wxWindow
*window
);
489 wxWindow
*GetContainingWindow() const { return m_containingWindow
; }
491 #if WXWIN_COMPATIBILITY_2_6
492 // Deprecated in 2.6 since historically it does not delete the window,
493 // use Detach instead.
494 wxDEPRECATED( virtual bool Remove( wxWindow
*window
) );
495 #endif // WXWIN_COMPATIBILITY_2_6
497 virtual bool Remove( wxSizer
*sizer
);
498 virtual bool Remove( int index
);
500 virtual bool Detach( wxWindow
*window
);
501 virtual bool Detach( wxSizer
*sizer
);
502 virtual bool Detach( int index
);
504 virtual bool Replace( wxWindow
*oldwin
, wxWindow
*newwin
, bool recursive
= false );
505 virtual bool Replace( wxSizer
*oldsz
, wxSizer
*newsz
, bool recursive
= false );
506 virtual bool Replace( size_t index
, wxSizerItem
*newitem
);
508 virtual void Clear( bool delete_windows
= false );
509 virtual void DeleteWindows();
511 void SetMinSize( int width
, int height
)
512 { DoSetMinSize( width
, height
); }
513 void SetMinSize( const wxSize
& size
)
514 { DoSetMinSize( size
.x
, size
.y
); }
516 // Searches recursively
517 bool SetItemMinSize( wxWindow
*window
, int width
, int height
)
518 { return DoSetItemMinSize( window
, width
, height
); }
519 bool SetItemMinSize( wxWindow
*window
, const wxSize
& size
)
520 { return DoSetItemMinSize( window
, size
.x
, size
.y
); }
522 // Searches recursively
523 bool SetItemMinSize( wxSizer
*sizer
, int width
, int height
)
524 { return DoSetItemMinSize( sizer
, width
, height
); }
525 bool SetItemMinSize( wxSizer
*sizer
, const wxSize
& size
)
526 { return DoSetItemMinSize( sizer
, size
.x
, size
.y
); }
528 bool SetItemMinSize( size_t index
, int width
, int height
)
529 { return DoSetItemMinSize( index
, width
, height
); }
530 bool SetItemMinSize( size_t index
, const wxSize
& size
)
531 { return DoSetItemMinSize( index
, size
.x
, size
.y
); }
533 wxSize
GetSize() const
535 wxPoint
GetPosition() const
536 { return m_position
; }
538 // Calculate the minimal size or return m_minSize if bigger.
541 virtual void RecalcSizes() = 0;
542 virtual wxSize
CalcMin() = 0;
544 virtual void Layout();
546 wxSize
Fit( wxWindow
*window
);
547 void FitInside( wxWindow
*window
);
548 void SetSizeHints( wxWindow
*window
);
549 void SetVirtualSizeHints( wxWindow
*window
);
551 wxSizerItemList
& GetChildren()
552 { return m_children
; }
554 void SetDimension( int x
, int y
, int width
, int height
);
556 wxSizerItem
* GetItem( wxWindow
*window
, bool recursive
= false );
557 wxSizerItem
* GetItem( wxSizer
*sizer
, bool recursive
= false );
558 wxSizerItem
* GetItem( size_t index
);
560 // Manage whether individual scene items are considered
561 // in the layout calculations or not.
562 bool Show( wxWindow
*window
, bool show
= true, bool recursive
= false );
563 bool Show( wxSizer
*sizer
, bool show
= true, bool recursive
= false );
564 bool Show( size_t index
, bool show
= true );
566 bool Hide( wxSizer
*sizer
, bool recursive
= false )
567 { return Show( sizer
, false, recursive
); }
568 bool Hide( wxWindow
*window
, bool recursive
= false )
569 { return Show( window
, false, recursive
); }
570 bool Hide( size_t index
)
571 { return Show( index
, false ); }
573 bool IsShown( wxWindow
*window
) const;
574 bool IsShown( wxSizer
*sizer
) const;
575 bool IsShown( size_t index
) const;
577 // Recursively call wxWindow::Show () on all sizer items.
578 virtual void ShowItems (bool show
);
580 void Show(bool show
) { ShowItems(show
); }
586 wxSizerItemList m_children
;
588 // the window this sizer is used in, can be NULL
589 wxWindow
*m_containingWindow
;
591 wxSize
GetMaxWindowSize( wxWindow
*window
) const;
592 wxSize
GetMinWindowSize( wxWindow
*window
);
593 wxSize
GetMaxClientSize( wxWindow
*window
) const;
594 wxSize
GetMinClientSize( wxWindow
*window
);
595 wxSize
VirtualFitSize( wxWindow
*window
);
597 virtual void DoSetMinSize( int width
, int height
);
598 virtual bool DoSetItemMinSize( wxWindow
*window
, int width
, int height
);
599 virtual bool DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
);
600 virtual bool DoSetItemMinSize( size_t index
, int width
, int height
);
603 DECLARE_CLASS(wxSizer
)
606 //---------------------------------------------------------------------------
608 //---------------------------------------------------------------------------
610 class WXDLLEXPORT wxGridSizer
: public wxSizer
613 wxGridSizer( int rows
, int cols
, int vgap
, int hgap
);
614 wxGridSizer( int cols
, int vgap
= 0, int hgap
= 0 );
616 virtual void RecalcSizes();
617 virtual wxSize
CalcMin();
619 void SetCols( int cols
) { m_cols
= cols
; }
620 void SetRows( int rows
) { m_rows
= rows
; }
621 void SetVGap( int gap
) { m_vgap
= gap
; }
622 void SetHGap( int gap
) { m_hgap
= gap
; }
623 int GetCols() const { return m_cols
; }
624 int GetRows() const { return m_rows
; }
625 int GetVGap() const { return m_vgap
; }
626 int GetHGap() const { return m_hgap
; }
634 // return the number of total items and the number of columns and rows
635 int CalcRowsCols(int& rows
, int& cols
) const;
637 void SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
);
640 DECLARE_CLASS(wxGridSizer
)
643 //---------------------------------------------------------------------------
645 //---------------------------------------------------------------------------
647 // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible"
649 enum wxFlexSizerGrowMode
651 // don't resize the cells in non-flexible direction at all
652 wxFLEX_GROWMODE_NONE
,
654 // uniformly resize only the specified ones (default)
655 wxFLEX_GROWMODE_SPECIFIED
,
657 // uniformly resize all cells
661 class WXDLLEXPORT wxFlexGridSizer
: public wxGridSizer
665 wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
);
666 wxFlexGridSizer( int cols
, int vgap
= 0, int hgap
= 0 );
667 virtual ~wxFlexGridSizer();
670 // set the rows/columns which will grow (the others will remain of the
671 // constant initial size)
672 void AddGrowableRow( size_t idx
, int proportion
= 0 );
673 void RemoveGrowableRow( size_t idx
);
674 void AddGrowableCol( size_t idx
, int proportion
= 0 );
675 void RemoveGrowableCol( size_t idx
);
678 // the sizer cells may grow in both directions, not grow at all or only
679 // grow in one direction but not the other
681 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
682 void SetFlexibleDirection(int direction
) { m_flexDirection
= direction
; }
683 int GetFlexibleDirection() const { return m_flexDirection
; }
685 // note that the grow mode only applies to the direction which is not
687 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode
) { m_growMode
= mode
; }
688 wxFlexSizerGrowMode
GetNonFlexibleGrowMode() const { return m_growMode
; }
690 // Read-only access to the row heights and col widths arrays
691 const wxArrayInt
& GetRowHeights() const { return m_rowHeights
; }
692 const wxArrayInt
& GetColWidths() const { return m_colWidths
; }
695 virtual void RecalcSizes();
696 virtual wxSize
CalcMin();
699 void AdjustForFlexDirection();
700 void AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
701 int nrows
, int ncols
);
703 // the heights/widths of all rows/columns
704 wxArrayInt m_rowHeights
,
707 // indices of the growable columns and rows
708 wxArrayInt m_growableRows
,
711 // proportion values of the corresponding growable rows and columns
712 wxArrayInt m_growableRowsProportions
,
713 m_growableColsProportions
;
715 // parameters describing whether the growable cells should be resized in
716 // both directions or only one
718 wxFlexSizerGrowMode m_growMode
;
720 // saves CalcMin result to optimize RecalcSizes
721 wxSize m_calculatedMinSize
;
724 DECLARE_CLASS(wxFlexGridSizer
)
725 DECLARE_NO_COPY_CLASS(wxFlexGridSizer
)
728 //---------------------------------------------------------------------------
730 //---------------------------------------------------------------------------
732 class WXDLLEXPORT wxBoxSizer
: public wxSizer
735 wxBoxSizer( int orient
);
740 int GetOrientation() const
743 void SetOrientation(int orient
)
744 { m_orient
= orient
; }
755 DECLARE_CLASS(wxBoxSizer
)
758 //---------------------------------------------------------------------------
760 //---------------------------------------------------------------------------
764 class WXDLLEXPORT wxStaticBox
;
766 class WXDLLEXPORT wxStaticBoxSizer
: public wxBoxSizer
769 wxStaticBoxSizer(wxStaticBox
*box
, int orient
);
770 wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& label
= wxEmptyString
);
771 virtual ~wxStaticBoxSizer();
776 wxStaticBox
*GetStaticBox() const
777 { return m_staticBox
; }
779 // override to hide/show the static box as well
780 virtual void ShowItems (bool show
);
782 virtual bool Detach( wxWindow
*window
);
783 virtual bool Detach( wxSizer
*sizer
) { return wxBoxSizer::Detach(sizer
); }
784 virtual bool Detach( int index
) { return wxBoxSizer::Detach(index
); }
787 wxStaticBox
*m_staticBox
;
790 DECLARE_CLASS(wxStaticBoxSizer
)
791 DECLARE_NO_COPY_CLASS(wxStaticBoxSizer
)
794 #endif // wxUSE_STATBOX
798 class WXDLLEXPORT wxStdDialogButtonSizer
: public wxBoxSizer
801 // Constructor just creates a new wxBoxSizer, not much else.
802 // Box sizer orientation is automatically determined here:
803 // vertical for PDAs, horizontal for everything else?
804 wxStdDialogButtonSizer();
806 // Checks button ID against system IDs and sets one of the pointers below
807 // to this button. Does not do any sizer-related things here.
808 void AddButton(wxButton
*button
);
810 // Use these if no standard ID can/should be used
811 void SetAffirmativeButton( wxButton
*button
);
812 void SetNegativeButton( wxButton
*button
);
813 void SetCancelButton( wxButton
*button
);
815 // All platform-specific code here, checks which buttons exist and add
816 // them to the sizer accordingly.
817 // Note - one potential hack on Mac we could use here,
818 // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE
819 // is set to _("Save") and m_buttonNegative is set to _("Don't Save")
820 // I wouldn't add any other hacks like that into here,
821 // but this one I can see being useful.
824 wxButton
*GetAffirmativeButton() const { return m_buttonAffirmative
; }
825 wxButton
*GetApplyButton() const { return m_buttonApply
; }
826 wxButton
*GetNegativeButton() const { return m_buttonNegative
; }
827 wxButton
*GetCancelButton() const { return m_buttonCancel
; }
828 wxButton
*GetHelpButton() const { return m_buttonHelp
; }
831 wxButton
*m_buttonAffirmative
; // wxID_OK, wxID_YES, wxID_SAVE go here
832 wxButton
*m_buttonApply
;
833 wxButton
*m_buttonNegative
; // wxID_NO
834 wxButton
*m_buttonCancel
;
835 wxButton
*m_buttonHelp
;
838 DECLARE_CLASS(wxStdDialogButtonSizer
)
839 DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer
)
842 #endif // wxUSE_BUTTON
844 #if WXWIN_COMPATIBILITY_2_4
845 // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
846 // don't do anything. wxBookCtrlBase::DoGetBestSize does the job now.
848 // ----------------------------------------------------------------------------
850 // ----------------------------------------------------------------------------
854 // this sizer works with wxNotebook/wxListbook/... and sizes the control to
856 class WXDLLEXPORT wxBookCtrlBase
;
858 class WXDLLEXPORT wxBookCtrlSizer
: public wxSizer
861 #if WXWIN_COMPATIBILITY_2_6
862 wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
) );
863 #endif // WXWIN_COMPATIBILITY_2_6
865 wxBookCtrlBase
*GetControl() const { return m_bookctrl
; }
867 virtual void RecalcSizes();
868 virtual wxSize
CalcMin();
871 // this protected ctor lets us mark the real one above as deprecated
872 // and still have warning-free build of the library itself:
875 wxBookCtrlBase
*m_bookctrl
;
878 DECLARE_CLASS(wxBookCtrlSizer
)
879 DECLARE_NO_COPY_CLASS(wxBookCtrlSizer
)
885 // before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards
887 class WXDLLEXPORT wxNotebook
;
889 class WXDLLEXPORT wxNotebookSizer
: public wxBookCtrlSizer
892 #if WXWIN_COMPATIBILITY_2_6
893 wxDEPRECATED( wxNotebookSizer(wxNotebook
*nb
) );
894 #endif // WXWIN_COMPATIBILITY_2_6
896 wxNotebook
*GetNotebook() const { return (wxNotebook
*)m_bookctrl
; }
899 DECLARE_CLASS(wxNotebookSizer
)
900 DECLARE_NO_COPY_CLASS(wxNotebookSizer
)
903 #endif // wxUSE_NOTEBOOK
905 #endif // wxUSE_BOOKCTRL
907 #endif // WXWIN_COMPATIBILITY_2_4
909 // ----------------------------------------------------------------------------
910 // inline functions implementation
911 // ----------------------------------------------------------------------------
914 wxSizer::Add( wxSizerItem
*item
)
916 return Insert( m_children
.GetCount(), item
);
920 wxSizer::Add( wxWindow
*window
, int proportion
, int flag
, int border
, wxObject
* userData
)
922 return Add( new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
926 wxSizer::Add( wxSizer
*sizer
, int proportion
, int flag
, int border
, wxObject
* userData
)
928 return Add( new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
932 wxSizer::Add( int width
, int height
, int proportion
, int flag
, int border
, wxObject
* userData
)
934 return Add( new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
938 wxSizer::Add( wxWindow
*window
, const wxSizerFlags
& flags
)
940 return Add( new wxSizerItem(window
, flags
) );
944 wxSizer::Add( wxSizer
*sizer
, const wxSizerFlags
& flags
)
946 return Add( new wxSizerItem(sizer
, flags
) );
950 wxSizer::AddSpacer(int size
)
952 return Add(size
, size
);
956 wxSizer::AddStretchSpacer(int prop
)
958 return Add(0, 0, prop
);
962 wxSizer::Prepend( wxSizerItem
*item
)
964 return Insert( 0, item
);
968 wxSizer::Prepend( wxWindow
*window
, int proportion
, int flag
, int border
, wxObject
* userData
)
970 return Prepend( new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
974 wxSizer::Prepend( wxSizer
*sizer
, int proportion
, int flag
, int border
, wxObject
* userData
)
976 return Prepend( new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
980 wxSizer::Prepend( int width
, int height
, int proportion
, int flag
, int border
, wxObject
* userData
)
982 return Prepend( new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
986 wxSizer::PrependSpacer(int size
)
988 return Prepend(size
, size
);
992 wxSizer::PrependStretchSpacer(int prop
)
994 return Prepend(0, 0, prop
);
998 wxSizer::Prepend( wxWindow
*window
, const wxSizerFlags
& flags
)
1000 return Prepend( new wxSizerItem(window
, flags
) );
1004 wxSizer::Prepend( wxSizer
*sizer
, const wxSizerFlags
& flags
)
1006 return Prepend( new wxSizerItem(sizer
, flags
) );
1010 wxSizer::Insert( size_t index
,
1015 wxObject
* userData
)
1017 return Insert( index
, new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
1021 wxSizer::Insert( size_t index
,
1026 wxObject
* userData
)
1028 return Insert( index
, new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
1032 wxSizer::Insert( size_t index
,
1038 wxObject
* userData
)
1040 return Insert( index
, new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
1044 wxSizer::Insert( size_t index
, wxWindow
*window
, const wxSizerFlags
& flags
)
1046 return Insert( index
, new wxSizerItem(window
, flags
) );
1050 wxSizer::Insert( size_t index
, wxSizer
*sizer
, const wxSizerFlags
& flags
)
1052 return Insert( index
, new wxSizerItem(sizer
, flags
) );
1056 wxSizer::InsertSpacer(size_t index
, int size
)
1058 return Insert(index
, size
, size
);
1062 wxSizer::InsertStretchSpacer(size_t index
, int prop
)
1064 return Insert(index
, 0, 0, prop
);
1068 #endif // __WXSIZER_H__