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 // accessors for wxSizer only
157 int GetProportion() const { return m_proportion
; }
158 int GetFlags() const { return m_flags
; }
159 int GetBorderInPixels() const { return m_borderInPixels
; }
164 int m_borderInPixels
;
168 // ----------------------------------------------------------------------------
169 // wxSizerSpacer: used by wxSizerItem to represent a spacer
170 // ----------------------------------------------------------------------------
172 class WXDLLEXPORT wxSizerSpacer
175 wxSizerSpacer(const wxSize
& size
) : m_size(size
), m_isShown(true) { }
177 void SetSize(const wxSize
& size
) { m_size
= size
; }
178 const wxSize
& GetSize() const { return m_size
; }
180 void Show(bool show
) { m_isShown
= show
; }
181 bool IsShown() const { return m_isShown
; }
184 // the size, in pixel
187 // is the spacer currently shown?
191 // ----------------------------------------------------------------------------
193 // ----------------------------------------------------------------------------
195 class WXDLLEXPORT wxSizerItem
: public wxObject
199 wxSizerItem( wxWindow
*window
,
203 wxObject
* userData
);
206 wxSizerItem(wxWindow
*window
, const wxSizerFlags
& flags
)
214 wxSizerItem( wxSizer
*sizer
,
218 wxObject
* userData
);
221 wxSizerItem(wxSizer
*sizer
, const wxSizerFlags
& flags
)
229 wxSizerItem( int width
,
237 wxSizerItem(int width
, int height
, const wxSizerFlags
& flags
)
241 SetSpacer(width
, height
);
245 virtual ~wxSizerItem();
247 virtual void DeleteWindows();
249 // Enable deleting the SizerItem without destroying the contained sizer.
250 void DetachSizer() { m_sizer
= NULL
; }
252 virtual wxSize
GetSize() const;
253 virtual wxSize
CalcMin();
254 virtual void SetDimension( const wxPoint
& pos
, const wxSize
& size
);
256 wxSize
GetMinSize() const
257 { return m_minSize
; }
258 wxSize
GetMinSizeWithBorder() const;
260 void SetMinSize(const wxSize
& size
)
263 m_window
->SetMinSize(size
);
266 void SetMinSize( int x
, int y
)
267 { SetMinSize(wxSize(x
, y
)); }
268 void SetInitSize( int x
, int y
)
269 { SetMinSize(wxSize(x
, y
)); }
271 // if either of dimensions is zero, ratio is assumed to be 1
272 // to avoid "divide by zero" errors
273 void SetRatio(int width
, int height
)
274 { m_ratio
= (width
&& height
) ? ((float) width
/ (float) height
) : 1; }
275 void SetRatio(const wxSize
& size
)
276 { SetRatio(size
.x
, size
.y
); }
277 void SetRatio(float ratio
)
279 float GetRatio() const
282 virtual wxRect
GetRect() { return m_rect
; }
284 bool IsWindow() const { return m_kind
== Item_Window
; }
285 bool IsSizer() const { return m_kind
== Item_Sizer
; }
286 bool IsSpacer() const { return m_kind
== Item_Spacer
; }
288 #if WXWIN_COMPATIBILITY_2_6
289 // Deprecated in 2.6, use {G,S}etProportion instead.
290 wxDEPRECATED( void SetOption( int option
) );
291 wxDEPRECATED( int GetOption() const );
292 #endif // WXWIN_COMPATIBILITY_2_6
294 void SetProportion( int proportion
)
295 { m_proportion
= proportion
; }
296 int GetProportion() const
297 { return m_proportion
; }
298 void SetFlag( int flag
)
302 void SetBorder( int border
)
303 { m_border
= border
; }
304 int GetBorder() const
307 wxWindow
*GetWindow() const
308 { return m_kind
== Item_Window
? m_window
: NULL
; }
309 wxSizer
*GetSizer() const
310 { return m_kind
== Item_Sizer
? m_sizer
: NULL
; }
311 wxSize
GetSpacer() const;
313 // this function behaves obviously for the windows and spacers but for the
314 // sizers it returns true if any sizer element is shown and only returns
315 // false if all of them are hidden
316 bool IsShown() const;
317 void Show(bool show
);
319 void SetUserData(wxObject
* userData
)
320 { delete m_userData
; m_userData
= userData
; }
321 wxObject
* GetUserData() const
322 { return m_userData
; }
323 wxPoint
GetPosition() const
327 // these functions do not free old sizer/spacer
328 void SetWindow(wxWindow
*window
);
329 void SetSizer(wxSizer
*sizer
);
330 void SetSpacer(const wxSize
& size
);
331 void SetSpacer(int width
, int height
) { SetSpacer(wxSize(width
, height
)); }
334 // common part of several ctors
335 void Init() { m_userData
= NULL
; }
337 // common part of ctors taking wxSizerFlags
338 void Init(const wxSizerFlags
& flags
);
341 // discriminated union: depending on m_kind one of the fields is valid
354 wxSizerSpacer
*m_spacer
;
363 // on screen rectangle of this item (not including borders)
366 // Aspect ratio can always be calculated from m_size,
367 // but this would cause precision loss when the window
368 // is shrunk. It is safer to preserve the initial value.
371 wxObject
*m_userData
;
374 DECLARE_CLASS(wxSizerItem
)
375 DECLARE_NO_COPY_CLASS(wxSizerItem
)
378 WX_DECLARE_EXPORTED_LIST( wxSizerItem
, wxSizerItemList
);
381 //---------------------------------------------------------------------------
383 //---------------------------------------------------------------------------
385 class WXDLLEXPORT wxSizer
: public wxObject
, public wxClientDataContainer
388 wxSizer() { m_containingWindow
= NULL
; }
391 // methods for adding elements to the sizer: there are Add/Insert/Prepend
392 // overloads for each of window/sizer/spacer/wxSizerItem
393 wxSizerItem
* Add(wxWindow
*window
,
397 wxObject
* userData
= NULL
);
398 wxSizerItem
* Add(wxSizer
*sizer
,
402 wxObject
* userData
= NULL
);
403 wxSizerItem
* Add(int width
,
408 wxObject
* userData
= NULL
);
409 wxSizerItem
* Add( wxWindow
*window
, const wxSizerFlags
& flags
);
410 wxSizerItem
* Add( wxSizer
*sizer
, const wxSizerFlags
& flags
);
411 wxSizerItem
* Add( wxSizerItem
*item
);
413 wxSizerItem
* AddSpacer(int size
);
414 wxSizerItem
* AddStretchSpacer(int prop
= 1);
416 wxSizerItem
* Insert(size_t index
,
421 wxObject
* userData
= NULL
);
422 wxSizerItem
* Insert(size_t index
,
427 wxObject
* userData
= NULL
);
428 wxSizerItem
* Insert(size_t index
,
434 wxObject
* userData
= NULL
);
435 wxSizerItem
* Insert(size_t index
,
437 const wxSizerFlags
& flags
);
438 wxSizerItem
* Insert(size_t index
,
440 const wxSizerFlags
& flags
);
441 virtual wxSizerItem
* Insert( size_t index
, wxSizerItem
*item
);
443 wxSizerItem
* InsertSpacer(size_t index
, int size
);
444 wxSizerItem
* InsertStretchSpacer(size_t index
, int prop
= 1);
446 wxSizerItem
* Prepend(wxWindow
*window
,
450 wxObject
* userData
= NULL
);
451 wxSizerItem
* Prepend(wxSizer
*sizer
,
455 wxObject
* userData
= NULL
);
456 wxSizerItem
* Prepend(int width
,
461 wxObject
* userData
= NULL
);
462 wxSizerItem
* Prepend(wxWindow
*window
, const wxSizerFlags
& flags
);
463 wxSizerItem
* Prepend(wxSizer
*sizer
, const wxSizerFlags
& flags
);
464 wxSizerItem
* Prepend(wxSizerItem
*item
);
466 wxSizerItem
* PrependSpacer(int size
);
467 wxSizerItem
* PrependStretchSpacer(int prop
= 1);
469 // set (or possibly unset if window is NULL) or get the window this sizer
471 void SetContainingWindow(wxWindow
*window
);
472 wxWindow
*GetContainingWindow() const { return m_containingWindow
; }
474 #if WXWIN_COMPATIBILITY_2_6
475 // Deprecated in 2.6 since historically it does not delete the window,
476 // use Detach instead.
477 wxDEPRECATED( virtual bool Remove( wxWindow
*window
) );
478 #endif // WXWIN_COMPATIBILITY_2_6
480 virtual bool Remove( wxSizer
*sizer
);
481 virtual bool Remove( int index
);
483 virtual bool Detach( wxWindow
*window
);
484 virtual bool Detach( wxSizer
*sizer
);
485 virtual bool Detach( int index
);
487 virtual bool Replace( wxWindow
*oldwin
, wxWindow
*newwin
, bool recursive
= false );
488 virtual bool Replace( wxSizer
*oldsz
, wxSizer
*newsz
, bool recursive
= false );
489 virtual bool Replace( size_t index
, wxSizerItem
*newitem
);
491 virtual void Clear( bool delete_windows
= false );
492 virtual void DeleteWindows();
494 void SetMinSize( int width
, int height
)
495 { DoSetMinSize( width
, height
); }
496 void SetMinSize( const wxSize
& size
)
497 { DoSetMinSize( size
.x
, size
.y
); }
499 // Searches recursively
500 bool SetItemMinSize( wxWindow
*window
, int width
, int height
)
501 { return DoSetItemMinSize( window
, width
, height
); }
502 bool SetItemMinSize( wxWindow
*window
, const wxSize
& size
)
503 { return DoSetItemMinSize( window
, size
.x
, size
.y
); }
505 // Searches recursively
506 bool SetItemMinSize( wxSizer
*sizer
, int width
, int height
)
507 { return DoSetItemMinSize( sizer
, width
, height
); }
508 bool SetItemMinSize( wxSizer
*sizer
, const wxSize
& size
)
509 { return DoSetItemMinSize( sizer
, size
.x
, size
.y
); }
511 bool SetItemMinSize( size_t index
, int width
, int height
)
512 { return DoSetItemMinSize( index
, width
, height
); }
513 bool SetItemMinSize( size_t index
, const wxSize
& size
)
514 { return DoSetItemMinSize( index
, size
.x
, size
.y
); }
516 wxSize
GetSize() const
518 wxPoint
GetPosition() const
519 { return m_position
; }
521 // Calculate the minimal size or return m_minSize if bigger.
524 virtual void RecalcSizes() = 0;
525 virtual wxSize
CalcMin() = 0;
527 virtual void Layout();
529 wxSize
Fit( wxWindow
*window
);
530 void FitInside( wxWindow
*window
);
531 void SetSizeHints( wxWindow
*window
);
532 void SetVirtualSizeHints( wxWindow
*window
);
534 wxSizerItemList
& GetChildren()
535 { return m_children
; }
537 void SetDimension( int x
, int y
, int width
, int height
);
539 wxSizerItem
* GetItem( wxWindow
*window
, bool recursive
= false );
540 wxSizerItem
* GetItem( wxSizer
*sizer
, bool recursive
= false );
541 wxSizerItem
* GetItem( size_t index
);
543 // Manage whether individual scene items are considered
544 // in the layout calculations or not.
545 bool Show( wxWindow
*window
, bool show
= true, bool recursive
= false );
546 bool Show( wxSizer
*sizer
, bool show
= true, bool recursive
= false );
547 bool Show( size_t index
, bool show
= true );
549 bool Hide( wxSizer
*sizer
, bool recursive
= false )
550 { return Show( sizer
, false, recursive
); }
551 bool Hide( wxWindow
*window
, bool recursive
= false )
552 { return Show( window
, false, recursive
); }
553 bool Hide( size_t index
)
554 { return Show( index
, false ); }
556 bool IsShown( wxWindow
*window
) const;
557 bool IsShown( wxSizer
*sizer
) const;
558 bool IsShown( size_t index
) const;
560 // Recursively call wxWindow::Show () on all sizer items.
561 virtual void ShowItems (bool show
);
563 void Show(bool show
) { ShowItems(show
); }
569 wxSizerItemList m_children
;
571 // the window this sizer is used in, can be NULL
572 wxWindow
*m_containingWindow
;
574 wxSize
GetMaxWindowSize( wxWindow
*window
) const;
575 wxSize
GetMinWindowSize( wxWindow
*window
);
576 wxSize
GetMaxClientSize( wxWindow
*window
) const;
577 wxSize
GetMinClientSize( wxWindow
*window
);
578 wxSize
FitSize( wxWindow
*window
);
579 wxSize
VirtualFitSize( wxWindow
*window
);
581 virtual void DoSetMinSize( int width
, int height
);
582 virtual bool DoSetItemMinSize( wxWindow
*window
, int width
, int height
);
583 virtual bool DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
);
584 virtual bool DoSetItemMinSize( size_t index
, int width
, int height
);
587 DECLARE_CLASS(wxSizer
)
590 //---------------------------------------------------------------------------
592 //---------------------------------------------------------------------------
594 class WXDLLEXPORT wxGridSizer
: public wxSizer
597 wxGridSizer( int rows
, int cols
, int vgap
, int hgap
);
598 wxGridSizer( int cols
, int vgap
= 0, int hgap
= 0 );
600 virtual void RecalcSizes();
601 virtual wxSize
CalcMin();
603 void SetCols( int cols
) { m_cols
= cols
; }
604 void SetRows( int rows
) { m_rows
= rows
; }
605 void SetVGap( int gap
) { m_vgap
= gap
; }
606 void SetHGap( int gap
) { m_hgap
= gap
; }
607 int GetCols() const { return m_cols
; }
608 int GetRows() const { return m_rows
; }
609 int GetVGap() const { return m_vgap
; }
610 int GetHGap() const { return m_hgap
; }
618 // return the number of total items and the number of columns and rows
619 int CalcRowsCols(int& rows
, int& cols
) const;
621 void SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
);
624 DECLARE_CLASS(wxGridSizer
)
627 //---------------------------------------------------------------------------
629 //---------------------------------------------------------------------------
631 // the bevaiour for resizing wxFlexGridSizer cells in the "non-flexible"
633 enum wxFlexSizerGrowMode
635 // don't resize the cells in non-flexible direction at all
636 wxFLEX_GROWMODE_NONE
,
638 // uniformly resize only the specified ones (default)
639 wxFLEX_GROWMODE_SPECIFIED
,
641 // uniformly resize all cells
645 class WXDLLEXPORT wxFlexGridSizer
: public wxGridSizer
649 wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
);
650 wxFlexGridSizer( int cols
, int vgap
= 0, int hgap
= 0 );
651 virtual ~wxFlexGridSizer();
654 // set the rows/columns which will grow (the others will remain of the
655 // constant initial size)
656 void AddGrowableRow( size_t idx
, int proportion
= 0 );
657 void RemoveGrowableRow( size_t idx
);
658 void AddGrowableCol( size_t idx
, int proportion
= 0 );
659 void RemoveGrowableCol( size_t idx
);
662 // the sizer cells may grow in both directions, not grow at all or only
663 // grow in one direction but not the other
665 // the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
666 void SetFlexibleDirection(int direction
) { m_flexDirection
= direction
; }
667 int GetFlexibleDirection() const { return m_flexDirection
; }
669 // note that the grow mode only applies to the direction which is not
671 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode
) { m_growMode
= mode
; }
672 wxFlexSizerGrowMode
GetNonFlexibleGrowMode() const { return m_growMode
; }
674 // Read-only access to the row heights and col widths arrays
675 const wxArrayInt
& GetRowHeights() const { return m_rowHeights
; }
676 const wxArrayInt
& GetColWidths() const { return m_colWidths
; }
679 virtual void RecalcSizes();
680 virtual wxSize
CalcMin();
683 void AdjustForFlexDirection();
684 void AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
685 int nrows
, int ncols
);
687 // the heights/widths of all rows/columns
688 wxArrayInt m_rowHeights
,
691 // indices of the growable columns and rows
692 wxArrayInt m_growableRows
,
695 // proportion values of the corresponding growable rows and columns
696 wxArrayInt m_growableRowsProportions
,
697 m_growableColsProportions
;
699 // parameters describing whether the growable cells should be resized in
700 // both directions or only one
702 wxFlexSizerGrowMode m_growMode
;
704 // saves CalcMin result to optimize RecalcSizes
705 wxSize m_calculatedMinSize
;
708 DECLARE_CLASS(wxFlexGridSizer
)
709 DECLARE_NO_COPY_CLASS(wxFlexGridSizer
)
712 //---------------------------------------------------------------------------
714 //---------------------------------------------------------------------------
716 class WXDLLEXPORT wxBoxSizer
: public wxSizer
719 wxBoxSizer( int orient
);
724 int GetOrientation() const
727 void SetOrientation(int orient
)
728 { m_orient
= orient
; }
739 DECLARE_CLASS(wxBoxSizer
)
742 //---------------------------------------------------------------------------
744 //---------------------------------------------------------------------------
748 class WXDLLEXPORT wxStaticBox
;
750 class WXDLLEXPORT wxStaticBoxSizer
: public wxBoxSizer
753 wxStaticBoxSizer(wxStaticBox
*box
, int orient
);
754 wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& label
= wxEmptyString
);
755 virtual ~wxStaticBoxSizer();
760 wxStaticBox
*GetStaticBox() const
761 { return m_staticBox
; }
763 // override to hide/show the static box as well
764 virtual void ShowItems (bool show
);
766 virtual bool Detach( wxWindow
*window
);
767 virtual bool Detach( wxSizer
*sizer
) { return wxBoxSizer::Detach(sizer
); }
768 virtual bool Detach( int index
) { return wxBoxSizer::Detach(index
); }
771 wxStaticBox
*m_staticBox
;
774 DECLARE_CLASS(wxStaticBoxSizer
)
775 DECLARE_NO_COPY_CLASS(wxStaticBoxSizer
)
778 #endif // wxUSE_STATBOX
782 class WXDLLEXPORT wxStdDialogButtonSizer
: public wxBoxSizer
785 // Constructor just creates a new wxBoxSizer, not much else.
786 // Box sizer orientation is automatically determined here:
787 // vertical for PDAs, horizontal for everything else?
788 wxStdDialogButtonSizer();
790 // Checks button ID against system IDs and sets one of the pointers below
791 // to this button. Does not do any sizer-related things here.
792 void AddButton(wxButton
*button
);
794 // Use these if no standard ID can/should be used
795 void SetAffirmativeButton( wxButton
*button
);
796 void SetNegativeButton( wxButton
*button
);
797 void SetCancelButton( wxButton
*button
);
799 // All platform-specific code here, checks which buttons exist and add
800 // them to the sizer accordingly.
801 // Note - one potential hack on Mac we could use here,
802 // if m_buttonAffirmative is wxID_SAVE then ensure wxID_SAVE
803 // is set to _("Save") and m_buttonNegative is set to _("Don't Save")
804 // I wouldn't add any other hacks like that into here,
805 // but this one I can see being useful.
808 wxButton
*GetAffirmativeButton() const { return m_buttonAffirmative
; }
809 wxButton
*GetApplyButton() const { return m_buttonApply
; }
810 wxButton
*GetNegativeButton() const { return m_buttonNegative
; }
811 wxButton
*GetCancelButton() const { return m_buttonCancel
; }
812 wxButton
*GetHelpButton() const { return m_buttonHelp
; }
815 wxButton
*m_buttonAffirmative
; // wxID_OK, wxID_YES, wxID_SAVE go here
816 wxButton
*m_buttonApply
;
817 wxButton
*m_buttonNegative
; // wxID_NO
818 wxButton
*m_buttonCancel
;
819 wxButton
*m_buttonHelp
;
822 DECLARE_CLASS(wxStdDialogButtonSizer
)
823 DECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer
)
826 #endif // wxUSE_BUTTON
828 #if WXWIN_COMPATIBILITY_2_4
829 // NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
830 // don't do anything. wxBookCtrlBase::DoGetBestSize does the job now.
832 // ----------------------------------------------------------------------------
834 // ----------------------------------------------------------------------------
838 // this sizer works with wxNotebook/wxListbook/... and sizes the control to
840 class WXDLLEXPORT wxBookCtrlBase
;
842 class WXDLLEXPORT wxBookCtrlSizer
: public wxSizer
845 #if WXWIN_COMPATIBILITY_2_6
846 wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
) );
847 #endif // WXWIN_COMPATIBILITY_2_6
849 wxBookCtrlBase
*GetControl() const { return m_bookctrl
; }
851 virtual void RecalcSizes();
852 virtual wxSize
CalcMin();
855 // this protected ctor lets us mark the real one above as deprecated
856 // and still have warning-free build of the library itself:
859 wxBookCtrlBase
*m_bookctrl
;
862 DECLARE_CLASS(wxBookCtrlSizer
)
863 DECLARE_NO_COPY_CLASS(wxBookCtrlSizer
)
869 // before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards
871 class WXDLLEXPORT wxNotebook
;
873 class WXDLLEXPORT wxNotebookSizer
: public wxBookCtrlSizer
876 #if WXWIN_COMPATIBILITY_2_6
877 wxDEPRECATED( wxNotebookSizer(wxNotebook
*nb
) );
878 #endif // WXWIN_COMPATIBILITY_2_6
880 wxNotebook
*GetNotebook() const { return (wxNotebook
*)m_bookctrl
; }
883 DECLARE_CLASS(wxNotebookSizer
)
884 DECLARE_NO_COPY_CLASS(wxNotebookSizer
)
887 #endif // wxUSE_NOTEBOOK
889 #endif // wxUSE_BOOKCTRL
891 #endif // WXWIN_COMPATIBILITY_2_4
893 // ----------------------------------------------------------------------------
894 // inline functions implementation
895 // ----------------------------------------------------------------------------
898 wxSizer::Add( wxSizerItem
*item
)
900 return Insert( m_children
.GetCount(), item
);
904 wxSizer::Add( wxWindow
*window
, int proportion
, int flag
, int border
, wxObject
* userData
)
906 return Add( new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
910 wxSizer::Add( wxSizer
*sizer
, int proportion
, int flag
, int border
, wxObject
* userData
)
912 return Add( new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
916 wxSizer::Add( int width
, int height
, int proportion
, int flag
, int border
, wxObject
* userData
)
918 return Add( new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
922 wxSizer::Add( wxWindow
*window
, const wxSizerFlags
& flags
)
924 return Add( new wxSizerItem(window
, flags
) );
928 wxSizer::Add( wxSizer
*sizer
, const wxSizerFlags
& flags
)
930 return Add( new wxSizerItem(sizer
, flags
) );
934 wxSizer::AddSpacer(int size
)
936 return Add(size
, size
);
940 wxSizer::AddStretchSpacer(int prop
)
942 return Add(0, 0, prop
);
946 wxSizer::Prepend( wxSizerItem
*item
)
948 return Insert( 0, item
);
952 wxSizer::Prepend( wxWindow
*window
, int proportion
, int flag
, int border
, wxObject
* userData
)
954 return Prepend( new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
958 wxSizer::Prepend( wxSizer
*sizer
, int proportion
, int flag
, int border
, wxObject
* userData
)
960 return Prepend( new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
964 wxSizer::Prepend( int width
, int height
, int proportion
, int flag
, int border
, wxObject
* userData
)
966 return Prepend( new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
970 wxSizer::PrependSpacer(int size
)
972 return Prepend(size
, size
);
976 wxSizer::PrependStretchSpacer(int prop
)
978 return Prepend(0, 0, prop
);
982 wxSizer::Prepend( wxWindow
*window
, const wxSizerFlags
& flags
)
984 return Prepend( new wxSizerItem(window
, flags
) );
988 wxSizer::Prepend( wxSizer
*sizer
, const wxSizerFlags
& flags
)
990 return Prepend( new wxSizerItem(sizer
, flags
) );
994 wxSizer::Insert( size_t index
,
1001 return Insert( index
, new wxSizerItem( window
, proportion
, flag
, border
, userData
) );
1005 wxSizer::Insert( size_t index
,
1010 wxObject
* userData
)
1012 return Insert( index
, new wxSizerItem( sizer
, proportion
, flag
, border
, userData
) );
1016 wxSizer::Insert( size_t index
,
1022 wxObject
* userData
)
1024 return Insert( index
, new wxSizerItem( width
, height
, proportion
, flag
, border
, userData
) );
1028 wxSizer::Insert( size_t index
, wxWindow
*window
, const wxSizerFlags
& flags
)
1030 return Insert( index
, new wxSizerItem(window
, flags
) );
1034 wxSizer::Insert( size_t index
, wxSizer
*sizer
, const wxSizerFlags
& flags
)
1036 return Insert( index
, new wxSizerItem(sizer
, flags
) );
1040 wxSizer::InsertSpacer(size_t index
, int size
)
1042 return Insert(index
, size
, size
);
1046 wxSizer::InsertStretchSpacer(size_t index
, int prop
)
1048 return Insert(index
, 0, 0, prop
);
1052 #endif // __WXSIZER_H__