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"
28 #include "wx/statbox.h"
29 #include "wx/settings.h"
30 #include "wx/listimpl.cpp"
32 #if WXWIN_COMPATIBILITY_2_4
33 #include "wx/notebook.h"
36 //---------------------------------------------------------------------------
38 IMPLEMENT_CLASS(wxSizerItem
, wxObject
)
39 IMPLEMENT_CLASS(wxSizer
, wxObject
)
40 IMPLEMENT_CLASS(wxGridSizer
, wxSizer
)
41 IMPLEMENT_CLASS(wxFlexGridSizer
, wxGridSizer
)
42 IMPLEMENT_CLASS(wxBoxSizer
, wxSizer
)
44 IMPLEMENT_CLASS(wxStaticBoxSizer
, wxBoxSizer
)
47 IMPLEMENT_CLASS(wxStdDialogButtonSizer
, wxBoxSizer
)
50 WX_DEFINE_EXPORTED_LIST( wxSizerItemList
)
85 // ----------------------------------------------------------------------------
87 // ----------------------------------------------------------------------------
89 void wxSizerItem::Init(const wxSizerFlags
& flags
)
93 m_proportion
= flags
.GetProportion();
94 m_flag
= flags
.GetFlags();
95 m_border
= flags
.GetBorderInPixels();
98 wxSizerItem::wxSizerItem()
110 void wxSizerItem::SetWindow(wxWindow
*window
)
112 wxCHECK_RET( window
, _T("NULL window in wxSizerItem::SetWindow()") );
114 m_kind
= Item_Window
;
117 // window doesn't become smaller than its initial size, whatever happens
118 m_minSize
= window
->GetSize();
120 if ( m_flag
& wxFIXED_MINSIZE
)
121 window
->SetMinSize(m_minSize
);
123 // aspect ratio calculated from initial size
127 wxSizerItem::wxSizerItem(wxWindow
*window
,
132 : m_proportion(proportion
),
141 void wxSizerItem::SetSizer(wxSizer
*sizer
)
147 wxSizerItem::wxSizerItem(wxSizer
*sizer
,
152 : m_proportion(proportion
),
160 // m_minSize is set later
164 void wxSizerItem::SetSpacer(const wxSize
& size
)
166 m_kind
= Item_Spacer
;
167 m_spacer
= new wxSizerSpacer(size
);
172 wxSizerItem::wxSizerItem(int width
,
178 : m_minSize(width
, height
), // minimal size is the initial size
179 m_proportion(proportion
),
184 SetSpacer(width
, height
);
187 wxSizerItem::~wxSizerItem()
197 m_window
->SetContainingSizer(NULL
);
210 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
214 wxSize
wxSizerItem::GetSpacer() const
217 if ( m_kind
== Item_Spacer
)
218 size
= m_spacer
->GetSize();
224 wxSize
wxSizerItem::GetSize() const
233 ret
= m_window
->GetSize();
237 ret
= m_sizer
->GetSize();
241 ret
= m_spacer
->GetSize();
246 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
253 if (m_flag
& wxNORTH
)
255 if (m_flag
& wxSOUTH
)
261 wxSize
wxSizerItem::CalcMin()
265 m_minSize
= m_sizer
->GetMinSize();
267 // if we have to preserve aspect ratio _AND_ this is
268 // the first-time calculation, consider ret to be initial size
269 if ( (m_flag
& wxSHAPED
) && wxIsNullDouble(m_ratio
) )
272 else if ( IsWindow() )
274 // Since the size of the window may change during runtime, we
275 // should use the current minimal/best size.
276 m_minSize
= m_window
->GetBestFittingSize();
279 return GetMinSizeWithBorder();
282 wxSize
wxSizerItem::GetMinSizeWithBorder() const
284 wxSize ret
= m_minSize
;
290 if (m_flag
& wxNORTH
)
292 if (m_flag
& wxSOUTH
)
299 void wxSizerItem::SetDimension( const wxPoint
& pos_
, const wxSize
& size_
)
303 if (m_flag
& wxSHAPED
)
305 // adjust aspect ratio
306 int rwidth
= (int) (size
.y
* m_ratio
);
310 int rheight
= (int) (size
.x
/ m_ratio
);
311 // add vertical space
312 if (m_flag
& wxALIGN_CENTER_VERTICAL
)
313 pos
.y
+= (size
.y
- rheight
) / 2;
314 else if (m_flag
& wxALIGN_BOTTOM
)
315 pos
.y
+= (size
.y
- rheight
);
316 // use reduced dimensions
319 else if (rwidth
< size
.x
)
321 // add horizontal space
322 if (m_flag
& wxALIGN_CENTER_HORIZONTAL
)
323 pos
.x
+= (size
.x
- rwidth
) / 2;
324 else if (m_flag
& wxALIGN_RIGHT
)
325 pos
.x
+= (size
.x
- rwidth
);
330 // This is what GetPosition() returns. Since we calculate
331 // borders afterwards, GetPosition() will be the left/top
332 // corner of the surrounding border.
344 if (m_flag
& wxNORTH
)
349 if (m_flag
& wxSOUTH
)
354 m_rect
= wxRect(pos
, size
);
359 wxFAIL_MSG( _T("can't set size of uninitialized sizer item") );
363 m_window
->SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
,
364 wxSIZE_ALLOW_MINUS_ONE
);
368 m_sizer
->SetDimension(pos
.x
, pos
.y
, size
.x
, size
.y
);
372 m_spacer
->SetSize(size
);
377 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
381 void wxSizerItem::DeleteWindows()
390 //We are deleting the window from this sizer - normally
391 //the window destroys the sizer associated with it,
392 //which might destroy this, which we don't want
393 m_window
->SetContainingSizer(NULL
);
395 //Putting this after the switch will result in a spacer
396 //not being deleted properly on destruction
401 m_sizer
->DeleteWindows();
406 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
411 void wxSizerItem::Show( bool show
)
416 wxFAIL_MSG( _T("can't show uninitialized sizer item") );
420 m_window
->Show(show
);
428 m_spacer
->Show(show
);
433 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
437 bool wxSizerItem::IsShown() const
442 // we may be called from CalcMin(), just return false so that we're
447 return m_window
->IsShown();
450 return m_sizer
->IsShown();
453 return m_spacer
->IsShown();
457 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
463 void wxSizerItem::SetOption( int option
)
465 SetProportion( option
);
468 int wxSizerItem::GetOption() const
470 return GetProportion();
474 //---------------------------------------------------------------------------
476 //---------------------------------------------------------------------------
485 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
488 wxSizerItem
* wxSizer::Insert( size_t index
, wxSizerItem
*item
)
490 m_children
.Insert( index
, item
);
492 if ( item
->GetWindow() )
493 item
->GetWindow()->SetContainingSizer( this );
498 bool wxSizer::Remove( wxWindow
*window
)
500 return Detach( window
);
503 bool wxSizer::Remove( wxSizer
*sizer
)
505 wxASSERT_MSG( sizer
, _T("Removing NULL sizer") );
507 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
510 wxSizerItem
*item
= node
->GetData();
512 if (item
->GetSizer() == sizer
)
515 m_children
.Erase( node
);
519 node
= node
->GetNext();
525 bool wxSizer::Remove( int index
)
527 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
529 _T("Remove index is out of range") );
531 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
533 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
535 wxSizerItem
*item
= node
->GetData();
537 if ( item
->IsWindow() )
538 item
->GetWindow()->SetContainingSizer( NULL
);
541 m_children
.Erase( node
);
545 bool wxSizer::Detach( wxSizer
*sizer
)
547 wxASSERT_MSG( sizer
, _T("Detaching NULL sizer") );
549 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
552 wxSizerItem
*item
= node
->GetData();
554 if (item
->GetSizer() == sizer
)
558 m_children
.Erase( node
);
561 node
= node
->GetNext();
567 bool wxSizer::Detach( wxWindow
*window
)
569 wxASSERT_MSG( window
, _T("Detaching NULL window") );
571 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
574 wxSizerItem
*item
= node
->GetData();
576 if (item
->GetWindow() == window
)
578 item
->GetWindow()->SetContainingSizer( NULL
);
580 m_children
.Erase( node
);
583 node
= node
->GetNext();
589 bool wxSizer::Detach( int index
)
591 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
593 _T("Detach index is out of range") );
595 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
597 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
599 wxSizerItem
*item
= node
->GetData();
601 if ( item
->IsSizer() )
603 else if ( item
->IsWindow() )
604 item
->GetWindow()->SetContainingSizer( NULL
);
607 m_children
.Erase( node
);
611 void wxSizer::Clear( bool delete_windows
)
613 // First clear the ContainingSizer pointers
614 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
617 wxSizerItem
*item
= node
->GetData();
619 if (item
->IsWindow())
620 item
->GetWindow()->SetContainingSizer( NULL
);
621 node
= node
->GetNext();
624 // Destroy the windows if needed
628 // Now empty the list
629 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
632 void wxSizer::DeleteWindows()
634 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
637 wxSizerItem
*item
= node
->GetData();
639 item
->DeleteWindows();
640 node
= node
->GetNext();
644 wxSize
wxSizer::Fit( wxWindow
*window
)
646 wxSize
size(window
->IsTopLevel() ? FitSize(window
)
647 : GetMinWindowSize(window
));
649 window
->SetSize( size
);
654 void wxSizer::FitInside( wxWindow
*window
)
657 if (window
->IsTopLevel())
658 size
= VirtualFitSize( window
);
660 size
= GetMinClientSize( window
);
662 window
->SetVirtualSize( size
);
665 void wxSizer::Layout()
667 // (re)calculates minimums needed for each item and other preparations
671 // Applies the layout and repositions/resizes the items
675 void wxSizer::SetSizeHints( wxWindow
*window
)
677 // Preserve the window's max size hints, but set the
678 // lower bound according to the sizer calculations.
680 wxSize size
= Fit( window
);
682 window
->SetSizeHints( size
.x
,
684 window
->GetMaxWidth(),
685 window
->GetMaxHeight() );
688 void wxSizer::SetVirtualSizeHints( wxWindow
*window
)
690 // Preserve the window's max size hints, but set the
691 // lower bound according to the sizer calculations.
694 wxSize
size( window
->GetVirtualSize() );
695 window
->SetVirtualSizeHints( size
.x
,
697 window
->GetMaxWidth(),
698 window
->GetMaxHeight() );
701 wxSize
wxSizer::GetMaxWindowSize( wxWindow
*window
) const
703 return window
->GetMaxSize();
706 wxSize
wxSizer::GetMinWindowSize( wxWindow
*window
)
708 wxSize
minSize( GetMinSize() );
709 wxSize
size( window
->GetSize() );
710 wxSize
client_size( window
->GetClientSize() );
712 return wxSize( minSize
.x
+size
.x
-client_size
.x
,
713 minSize
.y
+size
.y
-client_size
.y
);
716 // TODO on mac we need a function that determines how much free space this
717 // min size contains, in order to make sure that we have 20 pixels of free
718 // space around the controls
720 // Return a window size that will fit within the screens dimensions
721 wxSize
wxSizer::FitSize( wxWindow
*window
)
723 wxSize size
= GetMinWindowSize( window
);
724 wxSize sizeMax
= GetMaxWindowSize( window
);
726 // Limit the size if sizeMax != wxDefaultSize
728 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
730 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
736 wxSize
wxSizer::GetMaxClientSize( wxWindow
*window
) const
738 wxSize
maxSize( window
->GetMaxSize() );
740 if ( maxSize
!= wxDefaultSize
)
742 wxSize
size( window
->GetSize() );
743 wxSize
client_size( window
->GetClientSize() );
745 return wxSize( maxSize
.x
+ client_size
.x
- size
.x
,
746 maxSize
.y
+ client_size
.y
- size
.y
);
749 return wxDefaultSize
;
752 wxSize
wxSizer::GetMinClientSize( wxWindow
*WXUNUSED(window
) )
754 return GetMinSize(); // Already returns client size.
757 wxSize
wxSizer::VirtualFitSize( wxWindow
*window
)
759 wxSize size
= GetMinClientSize( window
);
760 wxSize sizeMax
= GetMaxClientSize( window
);
762 // Limit the size if sizeMax != wxDefaultSize
764 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
766 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
772 void wxSizer::SetDimension( int x
, int y
, int width
, int height
)
781 wxSize
wxSizer::GetMinSize()
783 wxSize
ret( CalcMin() );
784 if (ret
.x
< m_minSize
.x
) ret
.x
= m_minSize
.x
;
785 if (ret
.y
< m_minSize
.y
) ret
.y
= m_minSize
.y
;
789 void wxSizer::DoSetMinSize( int width
, int height
)
792 m_minSize
.y
= height
;
795 bool wxSizer::DoSetItemMinSize( wxWindow
*window
, int width
, int height
)
797 wxASSERT_MSG( window
, _T("SetMinSize for NULL window") );
799 // Is it our immediate child?
801 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
804 wxSizerItem
*item
= node
->GetData();
806 if (item
->GetWindow() == window
)
808 item
->SetMinSize( width
, height
);
811 node
= node
->GetNext();
814 // No? Search any subsizers we own then
816 node
= m_children
.GetFirst();
819 wxSizerItem
*item
= node
->GetData();
821 if ( item
->GetSizer() &&
822 item
->GetSizer()->DoSetItemMinSize( window
, width
, height
) )
824 // A child sizer found the requested windw, exit.
827 node
= node
->GetNext();
833 bool wxSizer::DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
)
835 wxASSERT_MSG( sizer
, _T("SetMinSize for NULL sizer") );
837 // Is it our immediate child?
839 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
842 wxSizerItem
*item
= node
->GetData();
844 if (item
->GetSizer() == sizer
)
846 item
->GetSizer()->DoSetMinSize( width
, height
);
849 node
= node
->GetNext();
852 // No? Search any subsizers we own then
854 node
= m_children
.GetFirst();
857 wxSizerItem
*item
= node
->GetData();
859 if ( item
->GetSizer() &&
860 item
->GetSizer()->DoSetItemMinSize( sizer
, width
, height
) )
862 // A child found the requested sizer, exit.
865 node
= node
->GetNext();
871 bool wxSizer::DoSetItemMinSize( size_t index
, int width
, int height
)
873 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
875 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
877 wxSizerItem
*item
= node
->GetData();
879 if (item
->GetSizer())
881 // Sizers contains the minimal size in them, if not calculated ...
882 item
->GetSizer()->DoSetMinSize( width
, height
);
886 // ... but the minimal size of spacers and windows is stored via the item
887 item
->SetMinSize( width
, height
);
893 wxSizerItem
* wxSizer::GetItem( wxWindow
*window
, bool recursive
)
895 wxASSERT_MSG( window
, _T("GetItem for NULL window") );
897 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
900 wxSizerItem
*item
= node
->GetData();
902 if (item
->GetWindow() == window
)
906 else if (recursive
&& item
->IsSizer())
908 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( window
, true );
913 node
= node
->GetNext();
919 wxSizerItem
* wxSizer::GetItem( wxSizer
*sizer
, bool recursive
)
921 wxASSERT_MSG( sizer
, _T("GetItem for NULL sizer") );
923 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
926 wxSizerItem
*item
= node
->GetData();
928 if (item
->GetSizer() == sizer
)
932 else if (recursive
&& item
->IsSizer())
934 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( sizer
, true );
939 node
= node
->GetNext();
945 wxSizerItem
* wxSizer::GetItem( size_t index
)
947 wxCHECK_MSG( index
< m_children
.GetCount(),
949 _T("GetItem index is out of range") );
951 return m_children
.Item( index
)->GetData();
954 bool wxSizer::Show( wxWindow
*window
, bool show
, bool recursive
)
956 wxSizerItem
*item
= GetItem( window
, recursive
);
967 bool wxSizer::Show( wxSizer
*sizer
, bool show
, bool recursive
)
969 wxSizerItem
*item
= GetItem( sizer
, recursive
);
980 bool wxSizer::Show( size_t index
, bool show
)
982 wxSizerItem
*item
= GetItem( index
);
993 void wxSizer::ShowItems( bool show
)
995 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
998 node
->GetData()->Show( show
);
999 node
= node
->GetNext();
1003 bool wxSizer::IsShown( wxWindow
*window
) const
1005 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1008 wxSizerItem
*item
= node
->GetData();
1010 if (item
->GetWindow() == window
)
1012 return item
->IsShown();
1014 node
= node
->GetNext();
1017 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1022 bool wxSizer::IsShown( wxSizer
*sizer
) const
1024 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1027 wxSizerItem
*item
= node
->GetData();
1029 if (item
->GetSizer() == sizer
)
1031 return item
->IsShown();
1033 node
= node
->GetNext();
1036 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1041 bool wxSizer::IsShown( size_t index
) const
1043 wxCHECK_MSG( index
< m_children
.GetCount(),
1045 _T("IsShown index is out of range") );
1047 return m_children
.Item( index
)->GetData()->IsShown();
1051 //---------------------------------------------------------------------------
1053 //---------------------------------------------------------------------------
1055 wxGridSizer::wxGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1056 : m_rows( ( cols
== 0 && rows
== 0 ) ? 1 : rows
)
1063 wxGridSizer::wxGridSizer( int cols
, int vgap
, int hgap
)
1064 : m_rows( cols
== 0 ? 1 : 0 )
1071 int wxGridSizer::CalcRowsCols(int& nrows
, int& ncols
) const
1073 int nitems
= m_children
.GetCount();
1079 nrows
= (nitems
+ m_cols
- 1) / m_cols
;
1083 ncols
= (nitems
+ m_rows
- 1) / m_rows
;
1086 else // 0 columns, 0 rows?
1088 wxFAIL_MSG( _T("grid sizer must have either rows or columns fixed") );
1097 void wxGridSizer::RecalcSizes()
1099 int nitems
, nrows
, ncols
;
1100 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1103 wxSize
sz( GetSize() );
1104 wxPoint
pt( GetPosition() );
1106 int w
= (sz
.x
- (ncols
- 1) * m_hgap
) / ncols
;
1107 int h
= (sz
.y
- (nrows
- 1) * m_vgap
) / nrows
;
1110 for (int c
= 0; c
< ncols
; c
++)
1113 for (int r
= 0; r
< nrows
; r
++)
1115 int i
= r
* ncols
+ c
;
1118 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1120 wxASSERT_MSG( node
, _T("Failed to find SizerItemList node") );
1122 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1130 wxSize
wxGridSizer::CalcMin()
1133 if ( CalcRowsCols(nrows
, ncols
) == 0 )
1134 return wxSize(10, 10);
1136 // Find the max width and height for any component
1140 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1143 wxSizerItem
*item
= node
->GetData();
1144 wxSize
sz( item
->CalcMin() );
1146 w
= wxMax( w
, sz
.x
);
1147 h
= wxMax( h
, sz
.y
);
1149 node
= node
->GetNext();
1152 return wxSize( ncols
* w
+ (ncols
-1) * m_hgap
,
1153 nrows
* h
+ (nrows
-1) * m_vgap
);
1156 void wxGridSizer::SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
)
1159 wxSize
sz( item
->GetMinSizeWithBorder() );
1160 int flag
= item
->GetFlag();
1162 if ((flag
& wxEXPAND
) || (flag
& wxSHAPED
))
1168 if (flag
& wxALIGN_CENTER_HORIZONTAL
)
1170 pt
.x
= x
+ (w
- sz
.x
) / 2;
1172 else if (flag
& wxALIGN_RIGHT
)
1174 pt
.x
= x
+ (w
- sz
.x
);
1177 if (flag
& wxALIGN_CENTER_VERTICAL
)
1179 pt
.y
= y
+ (h
- sz
.y
) / 2;
1181 else if (flag
& wxALIGN_BOTTOM
)
1183 pt
.y
= y
+ (h
- sz
.y
);
1187 item
->SetDimension(pt
, sz
);
1190 //---------------------------------------------------------------------------
1192 //---------------------------------------------------------------------------
1194 wxFlexGridSizer::wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1195 : wxGridSizer( rows
, cols
, vgap
, hgap
),
1196 m_flexDirection(wxBOTH
),
1197 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1201 wxFlexGridSizer::wxFlexGridSizer( int cols
, int vgap
, int hgap
)
1202 : wxGridSizer( cols
, vgap
, hgap
),
1203 m_flexDirection(wxBOTH
),
1204 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1208 wxFlexGridSizer::~wxFlexGridSizer()
1212 void wxFlexGridSizer::RecalcSizes()
1214 int nitems
, nrows
, ncols
;
1215 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1218 wxPoint
pt( GetPosition() );
1219 wxSize
sz( GetSize() );
1221 AdjustForGrowables(sz
, m_calculatedMinSize
, nrows
, ncols
);
1223 sz
= wxSize( pt
.x
+ sz
.x
, pt
.y
+ sz
.y
);
1226 for (int c
= 0; c
< ncols
; c
++)
1229 for (int r
= 0; r
< nrows
; r
++)
1231 int i
= r
* ncols
+ c
;
1234 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1236 wxASSERT_MSG( node
, _T("Failed to find node") );
1238 int w
= wxMax( 0, wxMin( m_colWidths
[c
], sz
.x
- x
) );
1239 int h
= wxMax( 0, wxMin( m_rowHeights
[r
], sz
.y
- y
) );
1241 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1243 if (m_rowHeights
[r
] != -1)
1244 y
= y
+ m_rowHeights
[r
] + m_vgap
;
1246 if (m_colWidths
[c
] != -1)
1247 x
= x
+ m_colWidths
[c
] + m_hgap
;
1251 wxSize
wxFlexGridSizer::CalcMin()
1257 // Number of rows/columns can change as items are added or removed.
1258 if ( !CalcRowsCols(nrows
, ncols
) )
1259 return wxSize(10, 10);
1261 m_rowHeights
.SetCount(nrows
);
1262 m_colWidths
.SetCount(ncols
);
1264 // We have to recalcuate the sizes in case the item minimum size has
1265 // changed since the previous layout, or the item has been hidden using
1266 // wxSizer::Show(). If all the items in a row/column are hidden, the final
1267 // dimension of the row/column will be -1, indicating that the column
1268 // itself is hidden.
1269 for( s
= m_rowHeights
.GetCount(), i
= 0; i
< s
; ++i
)
1270 m_rowHeights
[ i
] = -1;
1271 for( s
= m_colWidths
.GetCount(), i
= 0; i
< s
; ++i
)
1272 m_colWidths
[ i
] = -1;
1274 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1279 wxSizerItem
*item
= node
->GetData();
1280 if ( item
->IsShown() )
1282 wxSize
sz( item
->CalcMin() );
1283 int row
= i
/ ncols
;
1284 int col
= i
% ncols
;
1286 m_rowHeights
[ row
] = wxMax( wxMax( 0, sz
.y
), m_rowHeights
[ row
] );
1287 m_colWidths
[ col
] = wxMax( wxMax( 0, sz
.x
), m_colWidths
[ col
] );
1290 node
= node
->GetNext();
1294 AdjustForFlexDirection();
1296 // Sum total minimum size, including gaps between rows/columns.
1297 // -1 is used as a magic number meaning empty column.
1299 for (int col
= 0; col
< ncols
; col
++)
1300 if ( m_colWidths
[ col
] != -1 )
1301 width
+= m_colWidths
[ col
] + m_hgap
;
1306 for (int row
= 0; row
< nrows
; row
++)
1307 if ( m_rowHeights
[ row
] != -1 )
1308 height
+= m_rowHeights
[ row
] + m_vgap
;
1312 m_calculatedMinSize
= wxSize( width
, height
);
1313 return m_calculatedMinSize
;
1316 void wxFlexGridSizer::AdjustForFlexDirection()
1318 // the logic in CalcMin works when we resize flexibly in both directions
1319 // but maybe this is not the case
1320 if ( m_flexDirection
!= wxBOTH
)
1322 // select the array corresponding to the direction in which we do *not*
1324 wxArrayInt
& array
= m_flexDirection
== wxVERTICAL
? m_colWidths
1327 const size_t count
= array
.GetCount();
1329 // find the largest value in this array
1333 for ( n
= 0; n
< count
; ++n
)
1335 if ( array
[n
] > largest
)
1339 // and now fill it with the largest value
1340 for ( n
= 0; n
< count
; ++n
)
1348 void wxFlexGridSizer::AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
1349 int nrows
, int ncols
)
1351 // what to do with the rows? by default, resize them proportionally
1352 if ( sz
.y
> minsz
.y
&& ( (m_flexDirection
& wxVERTICAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1354 int sum_proportions
= 0;
1355 int growable_space
= 0;
1358 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1360 // Since the number of rows/columns can change as items are
1361 // inserted/deleted, we need to verify at runtime that the
1362 // requested growable rows/columns are still valid.
1363 if (m_growableRows
[idx
] >= nrows
)
1366 // If all items in a row/column are hidden, that row/column will
1367 // have a dimension of -1. This causes the row/column to be
1368 // hidden completely.
1369 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1371 sum_proportions
+= m_growableRowsProportions
[idx
];
1372 growable_space
+= m_rowHeights
[ m_growableRows
[idx
] ];
1378 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1380 if (m_growableRows
[idx
] >= nrows
)
1382 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1383 m_rowHeights
[ m_growableRows
[idx
] ] = 0;
1386 int delta
= (sz
.y
- minsz
.y
);
1387 if (sum_proportions
== 0)
1388 delta
= (delta
/num
) + m_rowHeights
[ m_growableRows
[idx
] ];
1390 delta
= ((delta
+growable_space
)*m_growableRowsProportions
[idx
]) / sum_proportions
;
1391 m_rowHeights
[ m_growableRows
[idx
] ] = delta
;
1396 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.y
> minsz
.y
) )
1398 // rounding problem?
1399 for ( int row
= 0; row
< nrows
; ++row
)
1400 m_rowHeights
[ row
] = sz
.y
/ nrows
;
1403 // the same logic as above but for the columns
1404 if ( sz
.x
> minsz
.x
&& ( (m_flexDirection
& wxHORIZONTAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1406 int sum_proportions
= 0;
1407 int growable_space
= 0;
1410 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1412 // Since the number of rows/columns can change as items are
1413 // inserted/deleted, we need to verify at runtime that the
1414 // requested growable rows/columns are still valid.
1415 if (m_growableCols
[idx
] >= ncols
)
1418 // If all items in a row/column are hidden, that row/column will
1419 // have a dimension of -1. This causes the column to be hidden
1421 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1423 sum_proportions
+= m_growableColsProportions
[idx
];
1424 growable_space
+= m_colWidths
[ m_growableCols
[idx
] ];
1430 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1432 if (m_growableCols
[idx
] >= ncols
)
1434 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1435 m_colWidths
[ m_growableCols
[idx
] ] = 0;
1438 int delta
= (sz
.x
- minsz
.x
);
1439 if (sum_proportions
== 0)
1440 delta
= (delta
/num
) + m_colWidths
[ m_growableCols
[idx
] ];
1442 delta
= ((delta
+growable_space
)*m_growableColsProportions
[idx
])/sum_proportions
;
1443 m_colWidths
[ m_growableCols
[idx
] ] = delta
;
1448 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.x
> minsz
.x
) )
1450 for ( int col
=0; col
< ncols
; ++col
)
1451 m_colWidths
[ col
] = sz
.x
/ ncols
;
1456 void wxFlexGridSizer::AddGrowableRow( size_t idx
, int proportion
)
1458 m_growableRows
.Add( idx
);
1459 m_growableRowsProportions
.Add( proportion
);
1462 void wxFlexGridSizer::RemoveGrowableRow( size_t idx
)
1464 m_growableRows
.Remove( idx
);
1467 void wxFlexGridSizer::AddGrowableCol( size_t idx
, int proportion
)
1469 m_growableCols
.Add( idx
);
1470 m_growableColsProportions
.Add( proportion
);
1473 void wxFlexGridSizer::RemoveGrowableCol( size_t idx
)
1475 m_growableCols
.Remove( idx
);
1478 //---------------------------------------------------------------------------
1480 //---------------------------------------------------------------------------
1482 wxBoxSizer::wxBoxSizer( int orient
)
1483 : m_orient( orient
)
1487 void wxBoxSizer::RecalcSizes()
1489 if (m_children
.GetCount() == 0)
1495 if (m_orient
== wxHORIZONTAL
)
1496 delta
= m_size
.x
- m_fixedWidth
;
1498 delta
= m_size
.y
- m_fixedHeight
;
1501 wxPoint
pt( m_position
);
1503 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1506 wxSizerItem
*item
= node
->GetData();
1508 if (item
->IsShown())
1510 wxSize
size( item
->GetMinSizeWithBorder() );
1512 if (m_orient
== wxVERTICAL
)
1514 wxCoord height
= size
.y
;
1515 if (item
->GetProportion())
1517 // Because of at least one visible item has non-zero
1518 // proportion then m_stretchable is not zero
1519 height
= (delta
* item
->GetProportion()) / m_stretchable
;
1522 wxPoint
child_pos( pt
);
1523 wxSize
child_size( size
.x
, height
);
1525 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1526 child_size
.x
= m_size
.x
;
1527 else if (item
->GetFlag() & wxALIGN_RIGHT
)
1528 child_pos
.x
+= m_size
.x
- size
.x
;
1529 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
1530 // XXX wxCENTER is added for backward compatibility;
1531 // wxALIGN_CENTER should be used in new code
1532 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
1534 item
->SetDimension( child_pos
, child_size
);
1540 wxCoord width
= size
.x
;
1541 if (item
->GetProportion())
1543 // Because of at least one visible item has non-zero
1544 // proportion then m_stretchable is not zero
1545 width
= (delta
* item
->GetProportion()) / m_stretchable
;
1548 wxPoint
child_pos( pt
);
1549 wxSize
child_size( width
, size
.y
);
1551 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1552 child_size
.y
= m_size
.y
;
1553 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
1554 child_pos
.y
+= m_size
.y
- size
.y
;
1555 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
1556 // XXX wxCENTER is added for backward compatibility;
1557 // wxALIGN_CENTER should be used in new code
1558 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
1560 item
->SetDimension( child_pos
, child_size
);
1566 node
= node
->GetNext();
1570 wxSize
wxBoxSizer::CalcMin()
1572 if (m_children
.GetCount() == 0)
1573 return wxSize(10,10);
1581 // precalc item minsizes and count proportions
1582 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1585 wxSizerItem
*item
= node
->GetData();
1587 if ( item
->IsShown() )
1589 item
->CalcMin(); // result is stored in the item
1591 m_stretchable
+= item
->GetProportion();
1594 node
= node
->GetNext();
1597 // Total minimum size (width or height) of sizer
1600 node
= m_children
.GetFirst();
1603 wxSizerItem
*item
= node
->GetData();
1605 if (item
->IsShown() && item
->GetProportion() != 0)
1607 int stretch
= item
->GetProportion();
1608 wxSize
size( item
->GetMinSizeWithBorder() );
1611 // Integer division rounded up is (a + b - 1) / b
1612 // Round up needed in order to guarantee that all
1613 // all items will have size not less then their min size
1614 if (m_orient
== wxHORIZONTAL
)
1615 minSize
= ( size
.x
*m_stretchable
+ stretch
- 1)/stretch
;
1617 minSize
= ( size
.y
*m_stretchable
+ stretch
- 1)/stretch
;
1619 if (minSize
> maxMinSize
)
1620 maxMinSize
= minSize
;
1622 node
= node
->GetNext();
1625 // Calculate overall minimum size
1626 node
= m_children
.GetFirst();
1629 wxSizerItem
*item
= node
->GetData();
1631 if (item
->IsShown())
1633 wxSize
size( item
->GetMinSizeWithBorder() );
1634 if (item
->GetProportion() != 0)
1636 if (m_orient
== wxHORIZONTAL
)
1637 size
.x
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1639 size
.y
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1643 if (m_orient
== wxVERTICAL
)
1645 m_fixedHeight
+= size
.y
;
1646 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
1650 m_fixedWidth
+= size
.x
;
1651 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
1655 if (m_orient
== wxHORIZONTAL
)
1657 m_minWidth
+= size
.x
;
1658 m_minHeight
= wxMax( m_minHeight
, size
.y
);
1662 m_minHeight
+= size
.y
;
1663 m_minWidth
= wxMax( m_minWidth
, size
.x
);
1666 node
= node
->GetNext();
1669 return wxSize( m_minWidth
, m_minHeight
);
1672 //---------------------------------------------------------------------------
1674 //---------------------------------------------------------------------------
1678 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
1679 : wxBoxSizer( orient
)
1680 , m_staticBox( box
)
1682 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
1685 wxStaticBoxSizer::wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& s
)
1686 : wxBoxSizer(orient
),
1687 m_staticBox(new wxStaticBox(win
, wxID_ANY
, s
))
1691 static void GetStaticBoxBorders( wxStaticBox
*box
,
1695 // this has to be done platform by platform as there is no way to
1696 // guess the thickness of a wxStaticBox border
1697 box
->GetBordersForSizer(borderTop
, borderOther
);
1700 void wxStaticBoxSizer::RecalcSizes()
1702 int top_border
, other_border
;
1703 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1705 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1707 wxPoint
old_pos( m_position
);
1708 m_position
.x
+= other_border
;
1709 m_position
.y
+= top_border
;
1710 wxSize
old_size( m_size
);
1711 m_size
.x
-= 2*other_border
;
1712 m_size
.y
-= top_border
+ other_border
;
1714 wxBoxSizer::RecalcSizes();
1716 m_position
= old_pos
;
1720 wxSize
wxStaticBoxSizer::CalcMin()
1722 int top_border
, other_border
;
1723 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1725 wxSize
ret( wxBoxSizer::CalcMin() );
1726 ret
.x
+= 2*other_border
;
1727 ret
.y
+= other_border
+ top_border
;
1732 void wxStaticBoxSizer::ShowItems( bool show
)
1734 m_staticBox
->Show( show
);
1735 wxBoxSizer::ShowItems( show
);
1738 #endif // wxUSE_STATBOX
1742 wxStdDialogButtonSizer::wxStdDialogButtonSizer()
1743 : wxBoxSizer(wxHORIZONTAL
)
1745 // Vertical buttons with lots of space on either side
1746 // looks rubbish on WinCE, so let's not do this for now.
1747 // If we are going to use vertical buttons, we should
1748 // put the sizer to the right of other controls in the dialog,
1749 // and that's beyond the scope of this sizer.
1751 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1752 // If we have a PDA screen, put yes/no button over
1753 // all other buttons, otherwise on the left side.
1755 m_orient
= wxVERTICAL
;
1758 m_buttonAffirmative
= NULL
;
1759 m_buttonApply
= NULL
;
1760 m_buttonNegative
= NULL
;
1761 m_buttonCancel
= NULL
;
1762 m_buttonHelp
= NULL
;
1765 void wxStdDialogButtonSizer::AddButton(wxButton
*mybutton
)
1767 switch (mybutton
->GetId())
1772 m_buttonAffirmative
= mybutton
;
1775 m_buttonApply
= mybutton
;
1778 m_buttonNegative
= mybutton
;
1781 m_buttonCancel
= mybutton
;
1784 case wxID_CONTEXT_HELP
:
1785 m_buttonHelp
= mybutton
;
1792 void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton
*button
)
1794 m_buttonAffirmative
= button
;
1797 void wxStdDialogButtonSizer::SetNegativeButton( wxButton
*button
)
1799 m_buttonNegative
= button
;
1802 void wxStdDialogButtonSizer::SetCancelButton( wxButton
*button
)
1804 m_buttonCancel
= button
;
1807 void wxStdDialogButtonSizer::Realize()
1810 Add(0, 0, 0, wxLEFT
, 6);
1812 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1814 if (m_buttonNegative
){
1815 // HIG POLICE BULLETIN - destructive buttons need extra padding
1816 // 24 pixels on either side
1817 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 12);
1820 // extra whitespace between help/negative and cancel/ok buttons
1821 Add(0, 0, 1, wxEXPAND
, 0);
1823 if (m_buttonCancel
){
1824 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1825 // Cancel or help should be default
1826 // m_buttonCancel->SetDefaultButton();
1829 // Ugh, Mac doesn't really have apply dialogs, so I'll just
1830 // figure the best place is between Cancel and OK
1832 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1834 if (m_buttonAffirmative
){
1835 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1837 if (m_buttonAffirmative
->GetId() == wxID_SAVE
){
1838 // these buttons have set labels under Mac so we should use them
1839 m_buttonAffirmative
->SetLabel(_("Save"));
1840 m_buttonNegative
->SetLabel(_("Don't Save"));
1844 // Extra space around and at the right
1846 #elif defined(__WXGTK20__)
1847 Add(0, 0, 0, wxLEFT
, 9);
1849 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1851 // extra whitespace between help and cancel/ok buttons
1852 Add(0, 0, 1, wxEXPAND
, 0);
1854 if (m_buttonNegative
){
1855 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1858 if (m_buttonCancel
){
1859 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1860 // Cancel or help should be default
1861 // m_buttonCancel->SetDefaultButton();
1865 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1867 if (m_buttonAffirmative
)
1868 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1869 #elif defined(__WXMSW__)
1872 // right-justify buttons
1873 Add(0, 0, 1, wxEXPAND
, 0);
1875 if (m_buttonAffirmative
){
1876 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1879 if (m_buttonNegative
){
1880 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1883 if (m_buttonCancel
){
1884 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1887 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1890 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1892 // GTK+1 and any other platform
1894 // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
1896 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1898 // extra whitespace between help and cancel/ok buttons
1899 Add(0, 0, 1, wxEXPAND
, 0);
1902 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1904 if (m_buttonAffirmative
){
1905 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1908 if (m_buttonNegative
){
1909 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1912 if (m_buttonCancel
){
1913 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1914 // Cancel or help should be default
1915 // m_buttonCancel->SetDefaultButton();
1921 #endif // wxUSE_BUTTON
1923 #if WXWIN_COMPATIBILITY_2_4
1925 // ----------------------------------------------------------------------------
1927 // ----------------------------------------------------------------------------
1930 IMPLEMENT_CLASS(wxBookCtrlSizer
, wxSizer
)
1932 IMPLEMENT_CLASS(wxNotebookSizer
, wxBookCtrlSizer
)
1933 #endif // wxUSE_NOTEBOOK
1934 #endif // wxUSE_BOOKCTRL
1938 wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
)
1939 : m_bookctrl(bookctrl
)
1941 wxASSERT_MSG( bookctrl
, wxT("wxBookCtrlSizer needs a control") );
1944 void wxBookCtrlSizer::RecalcSizes()
1946 m_bookctrl
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1949 wxSize
wxBookCtrlSizer::CalcMin()
1951 wxSize sizeBorder
= m_bookctrl
->CalcSizeFromPage(wxSize(0,0));
1956 if ( m_bookctrl
->GetPageCount() == 0 )
1958 return wxSize(sizeBorder
.x
+ 10, sizeBorder
.y
+ 10);
1964 wxWindowList::compatibility_iterator
1965 node
= m_bookctrl
->GetChildren().GetFirst();
1968 wxWindow
*item
= node
->GetData();
1969 wxSizer
*itemsizer
= item
->GetSizer();
1973 wxSize
subsize( itemsizer
->CalcMin() );
1975 if (subsize
.x
> maxX
)
1977 if (subsize
.y
> maxY
)
1981 node
= node
->GetNext();
1984 return wxSize( maxX
, maxY
) + sizeBorder
;
1989 wxNotebookSizer::wxNotebookSizer(wxNotebook
*nb
)
1991 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a control") );
1995 #endif // wxUSE_NOTEBOOOK
1996 #endif // wxUSE_BOOKCTRL
1998 #endif // WXWIN_COMPATIBILITY_2_4