1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: provide new wxSizer class for layout
4 // Author: Robert Roebling and Robin Dunn, contributions by
5 // Dirk Holtwick, Ron Lee
6 // Modified by: Ron Lee
9 // Copyright: (c) Robin Dunn, Robert Roebling
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx.h".
14 #include "wx/wxprec.h"
21 #include "wx/string.h"
27 #include "wx/statbox.h"
28 #include "wx/settings.h"
29 #include "wx/listimpl.cpp"
31 #if WXWIN_COMPATIBILITY_2_4
32 #include "wx/notebook.h"
35 //---------------------------------------------------------------------------
37 IMPLEMENT_CLASS(wxSizerItem
, wxObject
)
38 IMPLEMENT_CLASS(wxSizer
, wxObject
)
39 IMPLEMENT_CLASS(wxGridSizer
, wxSizer
)
40 IMPLEMENT_CLASS(wxFlexGridSizer
, wxGridSizer
)
41 IMPLEMENT_CLASS(wxBoxSizer
, wxSizer
)
43 IMPLEMENT_CLASS(wxStaticBoxSizer
, wxBoxSizer
)
46 IMPLEMENT_CLASS(wxStdDialogButtonSizer
, wxBoxSizer
)
49 WX_DEFINE_EXPORTED_LIST( wxSizerItemList
);
84 // ----------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
88 void wxSizerItem::Init(const wxSizerFlags
& flags
)
92 m_proportion
= flags
.GetProportion();
93 m_flag
= flags
.GetFlags();
94 m_border
= flags
.GetBorderInPixels();
97 wxSizerItem::wxSizerItem()
109 void wxSizerItem::SetWindow(wxWindow
*window
)
111 wxCHECK_RET( window
, _T("NULL window in wxSizerItem::SetWindow()") );
113 m_kind
= Item_Window
;
116 // window doesn't become smaller than its initial size, whatever happens
117 m_minSize
= window
->GetSize();
119 if ( m_flag
& wxFIXED_MINSIZE
)
120 window
->SetMinSize(m_minSize
);
122 // aspect ratio calculated from initial size
126 wxSizerItem::wxSizerItem(wxWindow
*window
,
131 : m_proportion(proportion
),
140 void wxSizerItem::SetSizer(wxSizer
*sizer
)
146 wxSizerItem::wxSizerItem(wxSizer
*sizer
,
151 : m_proportion(proportion
),
159 // m_minSize is set later
163 void wxSizerItem::SetSpacer(const wxSize
& size
)
165 m_kind
= Item_Spacer
;
166 m_spacer
= new wxSizerSpacer(size
);
171 wxSizerItem::wxSizerItem(int width
,
177 : m_minSize(width
, height
), // minimal size is the initial size
178 m_proportion(proportion
),
183 SetSpacer(width
, height
);
186 wxSizerItem::~wxSizerItem()
196 m_window
->SetContainingSizer(NULL
);
209 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
213 wxSize
wxSizerItem::GetSpacer() const
216 if ( m_kind
== Item_Spacer
)
217 size
= m_spacer
->GetSize();
223 wxSize
wxSizerItem::GetSize() const
232 ret
= m_window
->GetSize();
236 ret
= m_sizer
->GetSize();
240 ret
= m_spacer
->GetSize();
245 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
252 if (m_flag
& wxNORTH
)
254 if (m_flag
& wxSOUTH
)
260 wxSize
wxSizerItem::CalcMin()
264 m_minSize
= m_sizer
->GetMinSize();
266 // if we have to preserve aspect ratio _AND_ this is
267 // the first-time calculation, consider ret to be initial size
268 if ((m_flag
& wxSHAPED
) && !m_ratio
)
271 else if ( IsWindow() )
273 // Since the size of the window may change during runtime, we
274 // should use the current minimal/best size.
275 m_minSize
= m_window
->GetBestFittingSize();
278 return GetMinSizeWithBorder();
281 wxSize
wxSizerItem::GetMinSizeWithBorder() const
283 wxSize ret
= m_minSize
;
289 if (m_flag
& wxNORTH
)
291 if (m_flag
& wxSOUTH
)
298 void wxSizerItem::SetDimension( wxPoint pos
, wxSize size
)
300 if (m_flag
& wxSHAPED
)
302 // adjust aspect ratio
303 int rwidth
= (int) (size
.y
* m_ratio
);
307 int rheight
= (int) (size
.x
/ m_ratio
);
308 // add vertical space
309 if (m_flag
& wxALIGN_CENTER_VERTICAL
)
310 pos
.y
+= (size
.y
- rheight
) / 2;
311 else if (m_flag
& wxALIGN_BOTTOM
)
312 pos
.y
+= (size
.y
- rheight
);
313 // use reduced dimensions
316 else if (rwidth
< size
.x
)
318 // add horizontal space
319 if (m_flag
& wxALIGN_CENTER_HORIZONTAL
)
320 pos
.x
+= (size
.x
- rwidth
) / 2;
321 else if (m_flag
& wxALIGN_RIGHT
)
322 pos
.x
+= (size
.x
- rwidth
);
327 // This is what GetPosition() returns. Since we calculate
328 // borders afterwards, GetPosition() will be the left/top
329 // corner of the surrounding border.
341 if (m_flag
& wxNORTH
)
346 if (m_flag
& wxSOUTH
)
351 m_rect
= wxRect(pos
, size
);
356 wxFAIL_MSG( _T("can't set size of uninitialized sizer item") );
360 m_window
->SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
,
361 wxSIZE_ALLOW_MINUS_ONE
);
365 m_sizer
->SetDimension(pos
.x
, pos
.y
, size
.x
, size
.y
);
369 m_spacer
->SetSize(size
);
374 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
378 void wxSizerItem::DeleteWindows()
387 //We are deleting the window from this sizer - normally
388 //the window destroys the sizer associated with it,
389 //which might destroy this, which we don't want
390 m_window
->SetContainingSizer(NULL
);
392 //Putting this after the switch will result in a spacer
393 //not being deleted properly on destruction
398 m_sizer
->DeleteWindows();
403 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
408 void wxSizerItem::Show( bool show
)
413 wxFAIL_MSG( _T("can't show uninitialized sizer item") );
417 m_window
->Show(show
);
425 m_spacer
->Show(show
);
430 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
434 bool wxSizerItem::IsShown() const
439 // we may be called from CalcMin(), just return false so that we're
444 return m_window
->IsShown();
447 return m_sizer
->IsShown();
450 return m_spacer
->IsShown();
454 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
460 void wxSizerItem::SetOption( int option
)
462 SetProportion( option
);
465 int wxSizerItem::GetOption() const
467 return GetProportion();
471 //---------------------------------------------------------------------------
473 //---------------------------------------------------------------------------
482 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
485 wxSizerItem
* wxSizer::Insert( size_t index
, wxSizerItem
*item
)
487 m_children
.Insert( index
, item
);
489 if ( item
->GetWindow() )
490 item
->GetWindow()->SetContainingSizer( this );
495 bool wxSizer::Remove( wxWindow
*window
)
497 return Detach( window
);
500 bool wxSizer::Remove( wxSizer
*sizer
)
502 wxASSERT_MSG( sizer
, _T("Removing NULL sizer") );
504 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
507 wxSizerItem
*item
= node
->GetData();
509 if (item
->GetSizer() == sizer
)
512 m_children
.Erase( node
);
516 node
= node
->GetNext();
522 bool wxSizer::Remove( int index
)
524 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
526 _T("Remove index is out of range") );
528 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
530 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
532 wxSizerItem
*item
= node
->GetData();
534 if ( item
->IsWindow() )
535 item
->GetWindow()->SetContainingSizer( NULL
);
538 m_children
.Erase( node
);
542 bool wxSizer::Detach( wxSizer
*sizer
)
544 wxASSERT_MSG( sizer
, _T("Detaching NULL sizer") );
546 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
549 wxSizerItem
*item
= node
->GetData();
551 if (item
->GetSizer() == sizer
)
555 m_children
.Erase( node
);
558 node
= node
->GetNext();
564 bool wxSizer::Detach( wxWindow
*window
)
566 wxASSERT_MSG( window
, _T("Detaching NULL window") );
568 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
571 wxSizerItem
*item
= node
->GetData();
573 if (item
->GetWindow() == window
)
575 item
->GetWindow()->SetContainingSizer( NULL
);
577 m_children
.Erase( node
);
580 node
= node
->GetNext();
586 bool wxSizer::Detach( int index
)
588 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
590 _T("Detach index is out of range") );
592 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
594 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
596 wxSizerItem
*item
= node
->GetData();
598 if ( item
->IsSizer() )
600 else if ( item
->IsWindow() )
601 item
->GetWindow()->SetContainingSizer( NULL
);
604 m_children
.Erase( node
);
608 void wxSizer::Clear( bool delete_windows
)
610 // First clear the ContainingSizer pointers
611 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
614 wxSizerItem
*item
= node
->GetData();
616 if (item
->IsWindow())
617 item
->GetWindow()->SetContainingSizer( NULL
);
618 node
= node
->GetNext();
621 // Destroy the windows if needed
625 // Now empty the list
626 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
629 void wxSizer::DeleteWindows()
631 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
634 wxSizerItem
*item
= node
->GetData();
636 item
->DeleteWindows();
637 node
= node
->GetNext();
641 wxSize
wxSizer::Fit( wxWindow
*window
)
643 wxSize
size(window
->IsTopLevel() ? FitSize(window
)
644 : GetMinWindowSize(window
));
646 window
->SetSize( size
);
651 void wxSizer::FitInside( wxWindow
*window
)
654 if (window
->IsTopLevel())
655 size
= VirtualFitSize( window
);
657 size
= GetMinClientSize( window
);
659 window
->SetVirtualSize( size
);
662 void wxSizer::Layout()
664 // (re)calculates minimums needed for each item and other preparations
668 // Applies the layout and repositions/resizes the items
672 void wxSizer::SetSizeHints( wxWindow
*window
)
674 // Preserve the window's max size hints, but set the
675 // lower bound according to the sizer calculations.
677 wxSize size
= Fit( window
);
679 window
->SetSizeHints( size
.x
,
681 window
->GetMaxWidth(),
682 window
->GetMaxHeight() );
685 void wxSizer::SetVirtualSizeHints( wxWindow
*window
)
687 // Preserve the window's max size hints, but set the
688 // lower bound according to the sizer calculations.
691 wxSize
size( window
->GetVirtualSize() );
692 window
->SetVirtualSizeHints( size
.x
,
694 window
->GetMaxWidth(),
695 window
->GetMaxHeight() );
698 wxSize
wxSizer::GetMaxWindowSize( wxWindow
*window
) const
700 return window
->GetMaxSize();
703 wxSize
wxSizer::GetMinWindowSize( wxWindow
*window
)
705 wxSize
minSize( GetMinSize() );
706 wxSize
size( window
->GetSize() );
707 wxSize
client_size( window
->GetClientSize() );
709 return wxSize( minSize
.x
+size
.x
-client_size
.x
,
710 minSize
.y
+size
.y
-client_size
.y
);
713 // TODO on mac we need a function that determines how much free space this
714 // min size contains, in order to make sure that we have 20 pixels of free
715 // space around the controls
717 // Return a window size that will fit within the screens dimensions
718 wxSize
wxSizer::FitSize( wxWindow
*window
)
720 wxSize size
= GetMinWindowSize( window
);
721 wxSize sizeMax
= GetMaxWindowSize( window
);
723 // Limit the size if sizeMax != wxDefaultSize
725 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
727 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
733 wxSize
wxSizer::GetMaxClientSize( wxWindow
*window
) const
735 wxSize
maxSize( window
->GetMaxSize() );
737 if ( maxSize
!= wxDefaultSize
)
739 wxSize
size( window
->GetSize() );
740 wxSize
client_size( window
->GetClientSize() );
742 return wxSize( maxSize
.x
+ client_size
.x
- size
.x
,
743 maxSize
.y
+ client_size
.y
- size
.y
);
746 return wxDefaultSize
;
749 wxSize
wxSizer::GetMinClientSize( wxWindow
*WXUNUSED(window
) )
751 return GetMinSize(); // Already returns client size.
754 wxSize
wxSizer::VirtualFitSize( wxWindow
*window
)
756 wxSize size
= GetMinClientSize( window
);
757 wxSize sizeMax
= GetMaxClientSize( window
);
759 // Limit the size if sizeMax != wxDefaultSize
761 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
763 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
769 void wxSizer::SetDimension( int x
, int y
, int width
, int height
)
778 wxSize
wxSizer::GetMinSize()
780 wxSize
ret( CalcMin() );
781 if (ret
.x
< m_minSize
.x
) ret
.x
= m_minSize
.x
;
782 if (ret
.y
< m_minSize
.y
) ret
.y
= m_minSize
.y
;
786 void wxSizer::DoSetMinSize( int width
, int height
)
789 m_minSize
.y
= height
;
792 bool wxSizer::DoSetItemMinSize( wxWindow
*window
, int width
, int height
)
794 wxASSERT_MSG( window
, _T("SetMinSize for NULL window") );
796 // Is it our immediate child?
798 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
801 wxSizerItem
*item
= node
->GetData();
803 if (item
->GetWindow() == window
)
805 item
->SetMinSize( width
, height
);
808 node
= node
->GetNext();
811 // No? Search any subsizers we own then
813 node
= m_children
.GetFirst();
816 wxSizerItem
*item
= node
->GetData();
818 if ( item
->GetSizer() &&
819 item
->GetSizer()->DoSetItemMinSize( window
, width
, height
) )
821 // A child sizer found the requested windw, exit.
824 node
= node
->GetNext();
830 bool wxSizer::DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
)
832 wxASSERT_MSG( sizer
, _T("SetMinSize for NULL sizer") );
834 // Is it our immediate child?
836 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
839 wxSizerItem
*item
= node
->GetData();
841 if (item
->GetSizer() == sizer
)
843 item
->GetSizer()->DoSetMinSize( width
, height
);
846 node
= node
->GetNext();
849 // No? Search any subsizers we own then
851 node
= m_children
.GetFirst();
854 wxSizerItem
*item
= node
->GetData();
856 if ( item
->GetSizer() &&
857 item
->GetSizer()->DoSetItemMinSize( sizer
, width
, height
) )
859 // A child found the requested sizer, exit.
862 node
= node
->GetNext();
868 bool wxSizer::DoSetItemMinSize( size_t index
, int width
, int height
)
870 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
872 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
874 wxSizerItem
*item
= node
->GetData();
876 if (item
->GetSizer())
878 // Sizers contains the minimal size in them, if not calculated ...
879 item
->GetSizer()->DoSetMinSize( width
, height
);
883 // ... but the minimal size of spacers and windows is stored via the item
884 item
->SetMinSize( width
, height
);
890 wxSizerItem
* wxSizer::GetItem( wxWindow
*window
, bool recursive
)
892 wxASSERT_MSG( window
, _T("GetItem for NULL window") );
894 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
897 wxSizerItem
*item
= node
->GetData();
899 if (item
->GetWindow() == window
)
903 else if (recursive
&& item
->IsSizer())
905 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( window
, true );
910 node
= node
->GetNext();
916 wxSizerItem
* wxSizer::GetItem( wxSizer
*sizer
, bool recursive
)
918 wxASSERT_MSG( sizer
, _T("GetItem for NULL sizer") );
920 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
923 wxSizerItem
*item
= node
->GetData();
925 if (item
->GetSizer() == sizer
)
929 else if (recursive
&& item
->IsSizer())
931 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( sizer
, true );
936 node
= node
->GetNext();
942 wxSizerItem
* wxSizer::GetItem( size_t index
)
944 wxCHECK_MSG( index
< m_children
.GetCount(),
946 _T("GetItem index is out of range") );
948 return m_children
.Item( index
)->GetData();
951 bool wxSizer::Show( wxWindow
*window
, bool show
, bool recursive
)
953 wxSizerItem
*item
= GetItem( window
, recursive
);
964 bool wxSizer::Show( wxSizer
*sizer
, bool show
, bool recursive
)
966 wxSizerItem
*item
= GetItem( sizer
, recursive
);
977 bool wxSizer::Show( size_t index
, bool show
)
979 wxSizerItem
*item
= GetItem( index
);
990 void wxSizer::ShowItems( bool show
)
992 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
995 node
->GetData()->Show( show
);
996 node
= node
->GetNext();
1000 bool wxSizer::IsShown( wxWindow
*window
) const
1002 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1005 wxSizerItem
*item
= node
->GetData();
1007 if (item
->GetWindow() == window
)
1009 return item
->IsShown();
1011 node
= node
->GetNext();
1014 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1019 bool wxSizer::IsShown( wxSizer
*sizer
) const
1021 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1024 wxSizerItem
*item
= node
->GetData();
1026 if (item
->GetSizer() == sizer
)
1028 return item
->IsShown();
1030 node
= node
->GetNext();
1033 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1038 bool wxSizer::IsShown( size_t index
) const
1040 wxCHECK_MSG( index
< m_children
.GetCount(),
1042 _T("IsShown index is out of range") );
1044 return m_children
.Item( index
)->GetData()->IsShown();
1048 //---------------------------------------------------------------------------
1050 //---------------------------------------------------------------------------
1052 wxGridSizer::wxGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1053 : m_rows( ( cols
== 0 && rows
== 0 ) ? 1 : rows
)
1060 wxGridSizer::wxGridSizer( int cols
, int vgap
, int hgap
)
1061 : m_rows( cols
== 0 ? 1 : 0 )
1068 int wxGridSizer::CalcRowsCols(int& nrows
, int& ncols
) const
1070 int nitems
= m_children
.GetCount();
1076 nrows
= (nitems
+ m_cols
- 1) / m_cols
;
1080 ncols
= (nitems
+ m_rows
- 1) / m_rows
;
1083 else // 0 columns, 0 rows?
1085 wxFAIL_MSG( _T("grid sizer must have either rows or columns fixed") );
1094 void wxGridSizer::RecalcSizes()
1096 int nitems
, nrows
, ncols
;
1097 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1100 wxSize
sz( GetSize() );
1101 wxPoint
pt( GetPosition() );
1103 int w
= (sz
.x
- (ncols
- 1) * m_hgap
) / ncols
;
1104 int h
= (sz
.y
- (nrows
- 1) * m_vgap
) / nrows
;
1107 for (int c
= 0; c
< ncols
; c
++)
1110 for (int r
= 0; r
< nrows
; r
++)
1112 int i
= r
* ncols
+ c
;
1115 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1117 wxASSERT_MSG( node
, _T("Failed to find SizerItemList node") );
1119 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1127 wxSize
wxGridSizer::CalcMin()
1130 if ( CalcRowsCols(nrows
, ncols
) == 0 )
1131 return wxSize(10, 10);
1133 // Find the max width and height for any component
1137 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1140 wxSizerItem
*item
= node
->GetData();
1141 wxSize
sz( item
->CalcMin() );
1143 w
= wxMax( w
, sz
.x
);
1144 h
= wxMax( h
, sz
.y
);
1146 node
= node
->GetNext();
1149 return wxSize( ncols
* w
+ (ncols
-1) * m_hgap
,
1150 nrows
* h
+ (nrows
-1) * m_vgap
);
1153 void wxGridSizer::SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
)
1156 wxSize
sz( item
->GetMinSizeWithBorder() );
1157 int flag
= item
->GetFlag();
1159 if ((flag
& wxEXPAND
) || (flag
& wxSHAPED
))
1165 if (flag
& wxALIGN_CENTER_HORIZONTAL
)
1167 pt
.x
= x
+ (w
- sz
.x
) / 2;
1169 else if (flag
& wxALIGN_RIGHT
)
1171 pt
.x
= x
+ (w
- sz
.x
);
1174 if (flag
& wxALIGN_CENTER_VERTICAL
)
1176 pt
.y
= y
+ (h
- sz
.y
) / 2;
1178 else if (flag
& wxALIGN_BOTTOM
)
1180 pt
.y
= y
+ (h
- sz
.y
);
1184 item
->SetDimension(pt
, sz
);
1187 //---------------------------------------------------------------------------
1189 //---------------------------------------------------------------------------
1191 wxFlexGridSizer::wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1192 : wxGridSizer( rows
, cols
, vgap
, hgap
),
1193 m_flexDirection(wxBOTH
),
1194 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1198 wxFlexGridSizer::wxFlexGridSizer( int cols
, int vgap
, int hgap
)
1199 : wxGridSizer( cols
, vgap
, hgap
),
1200 m_flexDirection(wxBOTH
),
1201 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1205 wxFlexGridSizer::~wxFlexGridSizer()
1209 void wxFlexGridSizer::RecalcSizes()
1211 int nitems
, nrows
, ncols
;
1212 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1215 wxPoint
pt( GetPosition() );
1216 wxSize
sz( GetSize() );
1218 AdjustForGrowables(sz
, m_calculatedMinSize
, nrows
, ncols
);
1220 sz
= wxSize( pt
.x
+ sz
.x
, pt
.y
+ sz
.y
);
1223 for (int c
= 0; c
< ncols
; c
++)
1226 for (int r
= 0; r
< nrows
; r
++)
1228 int i
= r
* ncols
+ c
;
1231 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1233 wxASSERT_MSG( node
, _T("Failed to find node") );
1235 int w
= wxMax( 0, wxMin( m_colWidths
[c
], sz
.x
- x
) );
1236 int h
= wxMax( 0, wxMin( m_rowHeights
[r
], sz
.y
- y
) );
1238 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1240 if (m_rowHeights
[r
] != -1)
1241 y
= y
+ m_rowHeights
[r
] + m_vgap
;
1243 if (m_colWidths
[c
] != -1)
1244 x
= x
+ m_colWidths
[c
] + m_hgap
;
1248 wxSize
wxFlexGridSizer::CalcMin()
1254 // Number of rows/columns can change as items are added or removed.
1255 if ( !CalcRowsCols(nrows
, ncols
) )
1256 return wxSize(10, 10);
1258 m_rowHeights
.SetCount(nrows
);
1259 m_colWidths
.SetCount(ncols
);
1261 // We have to recalcuate the sizes in case the item minimum size has
1262 // changed since the previous layout, or the item has been hidden using
1263 // wxSizer::Show(). If all the items in a row/column are hidden, the final
1264 // dimension of the row/column will be -1, indicating that the column
1265 // itself is hidden.
1266 for( s
= m_rowHeights
.GetCount(), i
= 0; i
< s
; ++i
)
1267 m_rowHeights
[ i
] = -1;
1268 for( s
= m_colWidths
.GetCount(), i
= 0; i
< s
; ++i
)
1269 m_colWidths
[ i
] = -1;
1271 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1276 wxSizerItem
*item
= node
->GetData();
1277 if ( item
->IsShown() )
1279 wxSize
sz( item
->CalcMin() );
1280 int row
= i
/ ncols
;
1281 int col
= i
% ncols
;
1283 m_rowHeights
[ row
] = wxMax( wxMax( 0, sz
.y
), m_rowHeights
[ row
] );
1284 m_colWidths
[ col
] = wxMax( wxMax( 0, sz
.x
), m_colWidths
[ col
] );
1287 node
= node
->GetNext();
1291 AdjustForFlexDirection();
1293 // Sum total minimum size, including gaps between rows/columns.
1294 // -1 is used as a magic number meaning empty column.
1296 for (int col
= 0; col
< ncols
; col
++)
1297 if ( m_colWidths
[ col
] != -1 )
1298 width
+= m_colWidths
[ col
] + m_hgap
;
1303 for (int row
= 0; row
< nrows
; row
++)
1304 if ( m_rowHeights
[ row
] != -1 )
1305 height
+= m_rowHeights
[ row
] + m_vgap
;
1309 m_calculatedMinSize
= wxSize( width
, height
);
1310 return m_calculatedMinSize
;
1313 void wxFlexGridSizer::AdjustForFlexDirection()
1315 // the logic in CalcMin works when we resize flexibly in both directions
1316 // but maybe this is not the case
1317 if ( m_flexDirection
!= wxBOTH
)
1319 // select the array corresponding to the direction in which we do *not*
1321 wxArrayInt
& array
= m_flexDirection
== wxVERTICAL
? m_colWidths
1324 const int count
= array
.GetCount();
1326 // find the largest value in this array
1328 for ( n
= 0; n
< count
; ++n
)
1330 if ( array
[n
] > largest
)
1334 // and now fill it with the largest value
1335 for ( n
= 0; n
< count
; ++n
)
1343 void wxFlexGridSizer::AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
1344 int nrows
, int ncols
)
1346 // what to do with the rows? by default, resize them proportionally
1347 if ( sz
.y
> minsz
.y
&& ( (m_flexDirection
& wxVERTICAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1349 int sum_proportions
= 0;
1350 int growable_space
= 0;
1353 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1355 // Since the number of rows/columns can change as items are
1356 // inserted/deleted, we need to verify at runtime that the
1357 // requested growable rows/columns are still valid.
1358 if (m_growableRows
[idx
] >= nrows
)
1361 // If all items in a row/column are hidden, that row/column will
1362 // have a dimension of -1. This causes the row/column to be
1363 // hidden completely.
1364 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1366 sum_proportions
+= m_growableRowsProportions
[idx
];
1367 growable_space
+= m_rowHeights
[ m_growableRows
[idx
] ];
1373 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1375 if (m_growableRows
[idx
] >= nrows
)
1377 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1378 m_rowHeights
[ m_growableRows
[idx
] ] = 0;
1381 int delta
= (sz
.y
- minsz
.y
);
1382 if (sum_proportions
== 0)
1383 delta
= (delta
/num
) + m_rowHeights
[ m_growableRows
[idx
] ];
1385 delta
= ((delta
+growable_space
)*m_growableRowsProportions
[idx
]) / sum_proportions
;
1386 m_rowHeights
[ m_growableRows
[idx
] ] = delta
;
1391 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.y
> minsz
.y
) )
1393 // rounding problem?
1394 for ( int row
= 0; row
< nrows
; ++row
)
1395 m_rowHeights
[ row
] = sz
.y
/ nrows
;
1398 // the same logic as above but for the columns
1399 if ( sz
.x
> minsz
.x
&& ( (m_flexDirection
& wxHORIZONTAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1401 int sum_proportions
= 0;
1402 int growable_space
= 0;
1405 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1407 // Since the number of rows/columns can change as items are
1408 // inserted/deleted, we need to verify at runtime that the
1409 // requested growable rows/columns are still valid.
1410 if (m_growableCols
[idx
] >= ncols
)
1413 // If all items in a row/column are hidden, that row/column will
1414 // have a dimension of -1. This causes the column to be hidden
1416 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1418 sum_proportions
+= m_growableColsProportions
[idx
];
1419 growable_space
+= m_colWidths
[ m_growableCols
[idx
] ];
1425 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1427 if (m_growableCols
[idx
] >= ncols
)
1429 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1430 m_colWidths
[ m_growableCols
[idx
] ] = 0;
1433 int delta
= (sz
.x
- minsz
.x
);
1434 if (sum_proportions
== 0)
1435 delta
= (delta
/num
) + m_colWidths
[ m_growableCols
[idx
] ];
1437 delta
= ((delta
+growable_space
)*m_growableColsProportions
[idx
])/sum_proportions
;
1438 m_colWidths
[ m_growableCols
[idx
] ] = delta
;
1443 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.x
> minsz
.x
) )
1445 for ( int col
=0; col
< ncols
; ++col
)
1446 m_colWidths
[ col
] = sz
.x
/ ncols
;
1451 void wxFlexGridSizer::AddGrowableRow( size_t idx
, int proportion
)
1453 m_growableRows
.Add( idx
);
1454 m_growableRowsProportions
.Add( proportion
);
1457 void wxFlexGridSizer::RemoveGrowableRow( size_t idx
)
1459 m_growableRows
.Remove( idx
);
1462 void wxFlexGridSizer::AddGrowableCol( size_t idx
, int proportion
)
1464 m_growableCols
.Add( idx
);
1465 m_growableColsProportions
.Add( proportion
);
1468 void wxFlexGridSizer::RemoveGrowableCol( size_t idx
)
1470 m_growableCols
.Remove( idx
);
1473 //---------------------------------------------------------------------------
1475 //---------------------------------------------------------------------------
1477 wxBoxSizer::wxBoxSizer( int orient
)
1478 : m_orient( orient
)
1482 void wxBoxSizer::RecalcSizes()
1484 if (m_children
.GetCount() == 0)
1490 if (m_orient
== wxHORIZONTAL
)
1491 delta
= m_size
.x
- m_fixedWidth
;
1493 delta
= m_size
.y
- m_fixedHeight
;
1496 wxPoint
pt( m_position
);
1498 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1501 wxSizerItem
*item
= node
->GetData();
1503 if (item
->IsShown())
1505 wxSize
size( item
->GetMinSizeWithBorder() );
1507 if (m_orient
== wxVERTICAL
)
1509 wxCoord height
= size
.y
;
1510 if (item
->GetProportion())
1512 // Because of at least one visible item has non-zero
1513 // proportion then m_stretchable is not zero
1514 height
= (delta
* item
->GetProportion()) / m_stretchable
;
1517 wxPoint
child_pos( pt
);
1518 wxSize
child_size( size
.x
, height
);
1520 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1521 child_size
.x
= m_size
.x
;
1522 else if (item
->GetFlag() & wxALIGN_RIGHT
)
1523 child_pos
.x
+= m_size
.x
- size
.x
;
1524 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
1525 // XXX wxCENTER is added for backward compatibility;
1526 // wxALIGN_CENTER should be used in new code
1527 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
1529 item
->SetDimension( child_pos
, child_size
);
1535 wxCoord width
= size
.x
;
1536 if (item
->GetProportion())
1538 // Because of at least one visible item has non-zero
1539 // proportion then m_stretchable is not zero
1540 width
= (delta
* item
->GetProportion()) / m_stretchable
;
1543 wxPoint
child_pos( pt
);
1544 wxSize
child_size( width
, size
.y
);
1546 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1547 child_size
.y
= m_size
.y
;
1548 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
1549 child_pos
.y
+= m_size
.y
- size
.y
;
1550 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
1551 // XXX wxCENTER is added for backward compatibility;
1552 // wxALIGN_CENTER should be used in new code
1553 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
1555 item
->SetDimension( child_pos
, child_size
);
1561 node
= node
->GetNext();
1565 wxSize
wxBoxSizer::CalcMin()
1567 if (m_children
.GetCount() == 0)
1568 return wxSize(10,10);
1576 // precalc item minsizes and count proportions
1577 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1580 wxSizerItem
*item
= node
->GetData();
1582 if ( item
->IsShown() )
1584 item
->CalcMin(); // result is stored in the item
1586 m_stretchable
+= item
->GetProportion();
1589 node
= node
->GetNext();
1592 // Total minimum size (width or height) of sizer
1595 node
= m_children
.GetFirst();
1598 wxSizerItem
*item
= node
->GetData();
1600 if (item
->IsShown() && item
->GetProportion() != 0)
1602 int stretch
= item
->GetProportion();
1603 wxSize
size( item
->GetMinSizeWithBorder() );
1606 // Integer division rounded up is (a + b - 1) / b
1607 // Round up needed in order to guarantee that all
1608 // all items will have size not less then their min size
1609 if (m_orient
== wxHORIZONTAL
)
1610 minSize
= ( size
.x
*m_stretchable
+ stretch
- 1)/stretch
;
1612 minSize
= ( size
.y
*m_stretchable
+ stretch
- 1)/stretch
;
1614 if (minSize
> maxMinSize
)
1615 maxMinSize
= minSize
;
1617 node
= node
->GetNext();
1620 // Calculate overall minimum size
1621 node
= m_children
.GetFirst();
1624 wxSizerItem
*item
= node
->GetData();
1626 if (item
->IsShown())
1628 wxSize
size( item
->GetMinSizeWithBorder() );
1629 if (item
->GetProportion() != 0)
1631 if (m_orient
== wxHORIZONTAL
)
1632 size
.x
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1634 size
.y
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1638 if (m_orient
== wxVERTICAL
)
1640 m_fixedHeight
+= size
.y
;
1641 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
1645 m_fixedWidth
+= size
.x
;
1646 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
1650 if (m_orient
== wxHORIZONTAL
)
1652 m_minWidth
+= size
.x
;
1653 m_minHeight
= wxMax( m_minHeight
, size
.y
);
1657 m_minHeight
+= size
.y
;
1658 m_minWidth
= wxMax( m_minWidth
, size
.x
);
1661 node
= node
->GetNext();
1664 return wxSize( m_minWidth
, m_minHeight
);
1667 //---------------------------------------------------------------------------
1669 //---------------------------------------------------------------------------
1673 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
1674 : wxBoxSizer( orient
)
1675 , m_staticBox( box
)
1677 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
1680 wxStaticBoxSizer::wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& s
)
1681 : wxBoxSizer(orient
),
1682 m_staticBox(new wxStaticBox(win
, wxID_ANY
, s
))
1686 static void GetStaticBoxBorders( wxStaticBox
*box
,
1690 // this has to be done platform by platform as there is no way to
1691 // guess the thickness of a wxStaticBox border
1692 box
->GetBordersForSizer(borderTop
, borderOther
);
1695 void wxStaticBoxSizer::RecalcSizes()
1697 int top_border
, other_border
;
1698 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1700 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1702 wxPoint
old_pos( m_position
);
1703 m_position
.x
+= other_border
;
1704 m_position
.y
+= top_border
;
1705 wxSize
old_size( m_size
);
1706 m_size
.x
-= 2*other_border
;
1707 m_size
.y
-= top_border
+ other_border
;
1709 wxBoxSizer::RecalcSizes();
1711 m_position
= old_pos
;
1715 wxSize
wxStaticBoxSizer::CalcMin()
1717 int top_border
, other_border
;
1718 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1720 wxSize
ret( wxBoxSizer::CalcMin() );
1721 ret
.x
+= 2*other_border
;
1722 ret
.y
+= other_border
+ top_border
;
1727 void wxStaticBoxSizer::ShowItems( bool show
)
1729 m_staticBox
->Show( show
);
1730 wxBoxSizer::ShowItems( show
);
1733 #endif // wxUSE_STATBOX
1737 wxStdDialogButtonSizer::wxStdDialogButtonSizer()
1738 : wxBoxSizer(wxHORIZONTAL
)
1740 // Vertical buttons with lots of space on either side
1741 // looks rubbish on WinCE, so let's not do this for now.
1742 // If we are going to use vertical buttons, we should
1743 // put the sizer to the right of other controls in the dialog,
1744 // and that's beyond the scope of this sizer.
1746 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1747 // If we have a PDA screen, put yes/no button over
1748 // all other buttons, otherwise on the left side.
1750 m_orient
= wxVERTICAL
;
1753 m_buttonAffirmative
= NULL
;
1754 m_buttonApply
= NULL
;
1755 m_buttonNegative
= NULL
;
1756 m_buttonCancel
= NULL
;
1757 m_buttonHelp
= NULL
;
1760 void wxStdDialogButtonSizer::AddButton(wxButton
*mybutton
)
1762 switch (mybutton
->GetId())
1767 m_buttonAffirmative
= mybutton
;
1770 m_buttonApply
= mybutton
;
1773 m_buttonNegative
= mybutton
;
1776 m_buttonCancel
= mybutton
;
1779 case wxID_CONTEXT_HELP
:
1780 m_buttonHelp
= mybutton
;
1787 void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton
*button
)
1789 m_buttonAffirmative
= button
;
1792 void wxStdDialogButtonSizer::SetNegativeButton( wxButton
*button
)
1794 m_buttonNegative
= button
;
1797 void wxStdDialogButtonSizer::SetCancelButton( wxButton
*button
)
1799 m_buttonCancel
= button
;
1802 void wxStdDialogButtonSizer::Realize()
1805 Add(0, 0, 0, wxLEFT
, 6);
1807 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1809 if (m_buttonNegative
){
1810 // HIG POLICE BULLETIN - destructive buttons need extra padding
1811 // 24 pixels on either side
1812 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 12);
1815 // extra whitespace between help/negative and cancel/ok buttons
1816 Add(0, 0, 1, wxEXPAND
, 0);
1818 if (m_buttonCancel
){
1819 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1820 // Cancel or help should be default
1821 // m_buttonCancel->SetDefaultButton();
1824 // Ugh, Mac doesn't really have apply dialogs, so I'll just
1825 // figure the best place is between Cancel and OK
1827 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1829 if (m_buttonAffirmative
){
1830 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1832 if (m_buttonAffirmative
->GetId() == wxID_SAVE
){
1833 // these buttons have set labels under Mac so we should use them
1834 m_buttonAffirmative
->SetLabel(_("Save"));
1835 m_buttonNegative
->SetLabel(_("Don't Save"));
1839 // Extra space around and at the right
1841 #elif defined(__WXGTK20__)
1842 Add(0, 0, 0, wxLEFT
, 9);
1844 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1846 // extra whitespace between help and cancel/ok buttons
1847 Add(0, 0, 1, wxEXPAND
, 0);
1849 if (m_buttonNegative
){
1850 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1853 if (m_buttonCancel
){
1854 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1855 // Cancel or help should be default
1856 // m_buttonCancel->SetDefaultButton();
1860 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1862 if (m_buttonAffirmative
)
1863 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1864 #elif defined(__WXMSW__)
1867 // right-justify buttons
1868 Add(0, 0, 1, wxEXPAND
, 0);
1870 if (m_buttonAffirmative
){
1871 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1874 if (m_buttonNegative
){
1875 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1878 if (m_buttonCancel
){
1879 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1882 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1885 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1887 // GTK+1 and any other platform
1889 // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
1891 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1893 // extra whitespace between help and cancel/ok buttons
1894 Add(0, 0, 1, wxEXPAND
, 0);
1897 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1899 if (m_buttonAffirmative
){
1900 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1903 if (m_buttonNegative
){
1904 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1907 if (m_buttonCancel
){
1908 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1909 // Cancel or help should be default
1910 // m_buttonCancel->SetDefaultButton();
1916 #endif // wxUSE_BUTTON
1918 #if WXWIN_COMPATIBILITY_2_4
1920 // ----------------------------------------------------------------------------
1922 // ----------------------------------------------------------------------------
1925 IMPLEMENT_CLASS(wxBookCtrlSizer
, wxSizer
)
1927 IMPLEMENT_CLASS(wxNotebookSizer
, wxBookCtrlSizer
)
1928 #endif // wxUSE_NOTEBOOK
1929 #endif // wxUSE_BOOKCTRL
1933 wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
)
1934 : m_bookctrl(bookctrl
)
1936 wxASSERT_MSG( bookctrl
, wxT("wxBookCtrlSizer needs a control") );
1939 void wxBookCtrlSizer::RecalcSizes()
1941 m_bookctrl
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1944 wxSize
wxBookCtrlSizer::CalcMin()
1946 wxSize sizeBorder
= m_bookctrl
->CalcSizeFromPage(wxSize(0,0));
1951 if ( m_bookctrl
->GetPageCount() == 0 )
1953 return wxSize(sizeBorder
.x
+ 10, sizeBorder
.y
+ 10);
1959 wxWindowList::compatibility_iterator
1960 node
= m_bookctrl
->GetChildren().GetFirst();
1963 wxWindow
*item
= node
->GetData();
1964 wxSizer
*itemsizer
= item
->GetSizer();
1968 wxSize
subsize( itemsizer
->CalcMin() );
1970 if (subsize
.x
> maxX
)
1972 if (subsize
.y
> maxY
)
1976 node
= node
->GetNext();
1979 return wxSize( maxX
, maxY
) + sizeBorder
;
1984 wxNotebookSizer::wxNotebookSizer(wxNotebook
*nb
)
1986 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a control") );
1990 #endif // wxUSE_NOTEBOOOK
1991 #endif // wxUSE_BOOKCTRL
1993 #endif // WXWIN_COMPATIBILITY_2_4