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 int count
= array
.GetCount();
1329 // find the largest value in this array
1331 for ( n
= 0; n
< count
; ++n
)
1333 if ( array
[n
] > largest
)
1337 // and now fill it with the largest value
1338 for ( n
= 0; n
< count
; ++n
)
1346 void wxFlexGridSizer::AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
1347 int nrows
, int ncols
)
1349 // what to do with the rows? by default, resize them proportionally
1350 if ( sz
.y
> minsz
.y
&& ( (m_flexDirection
& wxVERTICAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1352 int sum_proportions
= 0;
1353 int growable_space
= 0;
1356 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1358 // Since the number of rows/columns can change as items are
1359 // inserted/deleted, we need to verify at runtime that the
1360 // requested growable rows/columns are still valid.
1361 if (m_growableRows
[idx
] >= nrows
)
1364 // If all items in a row/column are hidden, that row/column will
1365 // have a dimension of -1. This causes the row/column to be
1366 // hidden completely.
1367 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1369 sum_proportions
+= m_growableRowsProportions
[idx
];
1370 growable_space
+= m_rowHeights
[ m_growableRows
[idx
] ];
1376 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1378 if (m_growableRows
[idx
] >= nrows
)
1380 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1381 m_rowHeights
[ m_growableRows
[idx
] ] = 0;
1384 int delta
= (sz
.y
- minsz
.y
);
1385 if (sum_proportions
== 0)
1386 delta
= (delta
/num
) + m_rowHeights
[ m_growableRows
[idx
] ];
1388 delta
= ((delta
+growable_space
)*m_growableRowsProportions
[idx
]) / sum_proportions
;
1389 m_rowHeights
[ m_growableRows
[idx
] ] = delta
;
1394 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.y
> minsz
.y
) )
1396 // rounding problem?
1397 for ( int row
= 0; row
< nrows
; ++row
)
1398 m_rowHeights
[ row
] = sz
.y
/ nrows
;
1401 // the same logic as above but for the columns
1402 if ( sz
.x
> minsz
.x
&& ( (m_flexDirection
& wxHORIZONTAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1404 int sum_proportions
= 0;
1405 int growable_space
= 0;
1408 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1410 // Since the number of rows/columns can change as items are
1411 // inserted/deleted, we need to verify at runtime that the
1412 // requested growable rows/columns are still valid.
1413 if (m_growableCols
[idx
] >= ncols
)
1416 // If all items in a row/column are hidden, that row/column will
1417 // have a dimension of -1. This causes the column to be hidden
1419 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1421 sum_proportions
+= m_growableColsProportions
[idx
];
1422 growable_space
+= m_colWidths
[ m_growableCols
[idx
] ];
1428 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1430 if (m_growableCols
[idx
] >= ncols
)
1432 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1433 m_colWidths
[ m_growableCols
[idx
] ] = 0;
1436 int delta
= (sz
.x
- minsz
.x
);
1437 if (sum_proportions
== 0)
1438 delta
= (delta
/num
) + m_colWidths
[ m_growableCols
[idx
] ];
1440 delta
= ((delta
+growable_space
)*m_growableColsProportions
[idx
])/sum_proportions
;
1441 m_colWidths
[ m_growableCols
[idx
] ] = delta
;
1446 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.x
> minsz
.x
) )
1448 for ( int col
=0; col
< ncols
; ++col
)
1449 m_colWidths
[ col
] = sz
.x
/ ncols
;
1454 void wxFlexGridSizer::AddGrowableRow( size_t idx
, int proportion
)
1456 m_growableRows
.Add( idx
);
1457 m_growableRowsProportions
.Add( proportion
);
1460 void wxFlexGridSizer::RemoveGrowableRow( size_t idx
)
1462 m_growableRows
.Remove( idx
);
1465 void wxFlexGridSizer::AddGrowableCol( size_t idx
, int proportion
)
1467 m_growableCols
.Add( idx
);
1468 m_growableColsProportions
.Add( proportion
);
1471 void wxFlexGridSizer::RemoveGrowableCol( size_t idx
)
1473 m_growableCols
.Remove( idx
);
1476 //---------------------------------------------------------------------------
1478 //---------------------------------------------------------------------------
1480 wxBoxSizer::wxBoxSizer( int orient
)
1481 : m_orient( orient
)
1485 void wxBoxSizer::RecalcSizes()
1487 if (m_children
.GetCount() == 0)
1493 if (m_orient
== wxHORIZONTAL
)
1494 delta
= m_size
.x
- m_fixedWidth
;
1496 delta
= m_size
.y
- m_fixedHeight
;
1499 wxPoint
pt( m_position
);
1501 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1504 wxSizerItem
*item
= node
->GetData();
1506 if (item
->IsShown())
1508 wxSize
size( item
->GetMinSizeWithBorder() );
1510 if (m_orient
== wxVERTICAL
)
1512 wxCoord height
= size
.y
;
1513 if (item
->GetProportion())
1515 // Because of at least one visible item has non-zero
1516 // proportion then m_stretchable is not zero
1517 height
= (delta
* item
->GetProportion()) / m_stretchable
;
1520 wxPoint
child_pos( pt
);
1521 wxSize
child_size( size
.x
, height
);
1523 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1524 child_size
.x
= m_size
.x
;
1525 else if (item
->GetFlag() & wxALIGN_RIGHT
)
1526 child_pos
.x
+= m_size
.x
- size
.x
;
1527 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
1528 // XXX wxCENTER is added for backward compatibility;
1529 // wxALIGN_CENTER should be used in new code
1530 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
1532 item
->SetDimension( child_pos
, child_size
);
1538 wxCoord width
= size
.x
;
1539 if (item
->GetProportion())
1541 // Because of at least one visible item has non-zero
1542 // proportion then m_stretchable is not zero
1543 width
= (delta
* item
->GetProportion()) / m_stretchable
;
1546 wxPoint
child_pos( pt
);
1547 wxSize
child_size( width
, size
.y
);
1549 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1550 child_size
.y
= m_size
.y
;
1551 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
1552 child_pos
.y
+= m_size
.y
- size
.y
;
1553 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
1554 // XXX wxCENTER is added for backward compatibility;
1555 // wxALIGN_CENTER should be used in new code
1556 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
1558 item
->SetDimension( child_pos
, child_size
);
1564 node
= node
->GetNext();
1568 wxSize
wxBoxSizer::CalcMin()
1570 if (m_children
.GetCount() == 0)
1571 return wxSize(10,10);
1579 // precalc item minsizes and count proportions
1580 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1583 wxSizerItem
*item
= node
->GetData();
1585 if ( item
->IsShown() )
1587 item
->CalcMin(); // result is stored in the item
1589 m_stretchable
+= item
->GetProportion();
1592 node
= node
->GetNext();
1595 // Total minimum size (width or height) of sizer
1598 node
= m_children
.GetFirst();
1601 wxSizerItem
*item
= node
->GetData();
1603 if (item
->IsShown() && item
->GetProportion() != 0)
1605 int stretch
= item
->GetProportion();
1606 wxSize
size( item
->GetMinSizeWithBorder() );
1609 // Integer division rounded up is (a + b - 1) / b
1610 // Round up needed in order to guarantee that all
1611 // all items will have size not less then their min size
1612 if (m_orient
== wxHORIZONTAL
)
1613 minSize
= ( size
.x
*m_stretchable
+ stretch
- 1)/stretch
;
1615 minSize
= ( size
.y
*m_stretchable
+ stretch
- 1)/stretch
;
1617 if (minSize
> maxMinSize
)
1618 maxMinSize
= minSize
;
1620 node
= node
->GetNext();
1623 // Calculate overall minimum size
1624 node
= m_children
.GetFirst();
1627 wxSizerItem
*item
= node
->GetData();
1629 if (item
->IsShown())
1631 wxSize
size( item
->GetMinSizeWithBorder() );
1632 if (item
->GetProportion() != 0)
1634 if (m_orient
== wxHORIZONTAL
)
1635 size
.x
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1637 size
.y
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1641 if (m_orient
== wxVERTICAL
)
1643 m_fixedHeight
+= size
.y
;
1644 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
1648 m_fixedWidth
+= size
.x
;
1649 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
1653 if (m_orient
== wxHORIZONTAL
)
1655 m_minWidth
+= size
.x
;
1656 m_minHeight
= wxMax( m_minHeight
, size
.y
);
1660 m_minHeight
+= size
.y
;
1661 m_minWidth
= wxMax( m_minWidth
, size
.x
);
1664 node
= node
->GetNext();
1667 return wxSize( m_minWidth
, m_minHeight
);
1670 //---------------------------------------------------------------------------
1672 //---------------------------------------------------------------------------
1676 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
1677 : wxBoxSizer( orient
)
1678 , m_staticBox( box
)
1680 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
1683 wxStaticBoxSizer::wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& s
)
1684 : wxBoxSizer(orient
),
1685 m_staticBox(new wxStaticBox(win
, wxID_ANY
, s
))
1689 static void GetStaticBoxBorders( wxStaticBox
*box
,
1693 // this has to be done platform by platform as there is no way to
1694 // guess the thickness of a wxStaticBox border
1695 box
->GetBordersForSizer(borderTop
, borderOther
);
1698 void wxStaticBoxSizer::RecalcSizes()
1700 int top_border
, other_border
;
1701 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1703 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1705 wxPoint
old_pos( m_position
);
1706 m_position
.x
+= other_border
;
1707 m_position
.y
+= top_border
;
1708 wxSize
old_size( m_size
);
1709 m_size
.x
-= 2*other_border
;
1710 m_size
.y
-= top_border
+ other_border
;
1712 wxBoxSizer::RecalcSizes();
1714 m_position
= old_pos
;
1718 wxSize
wxStaticBoxSizer::CalcMin()
1720 int top_border
, other_border
;
1721 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1723 wxSize
ret( wxBoxSizer::CalcMin() );
1724 ret
.x
+= 2*other_border
;
1725 ret
.y
+= other_border
+ top_border
;
1730 void wxStaticBoxSizer::ShowItems( bool show
)
1732 m_staticBox
->Show( show
);
1733 wxBoxSizer::ShowItems( show
);
1736 #endif // wxUSE_STATBOX
1740 wxStdDialogButtonSizer::wxStdDialogButtonSizer()
1741 : wxBoxSizer(wxHORIZONTAL
)
1743 // Vertical buttons with lots of space on either side
1744 // looks rubbish on WinCE, so let's not do this for now.
1745 // If we are going to use vertical buttons, we should
1746 // put the sizer to the right of other controls in the dialog,
1747 // and that's beyond the scope of this sizer.
1749 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1750 // If we have a PDA screen, put yes/no button over
1751 // all other buttons, otherwise on the left side.
1753 m_orient
= wxVERTICAL
;
1756 m_buttonAffirmative
= NULL
;
1757 m_buttonApply
= NULL
;
1758 m_buttonNegative
= NULL
;
1759 m_buttonCancel
= NULL
;
1760 m_buttonHelp
= NULL
;
1763 void wxStdDialogButtonSizer::AddButton(wxButton
*mybutton
)
1765 switch (mybutton
->GetId())
1770 m_buttonAffirmative
= mybutton
;
1773 m_buttonApply
= mybutton
;
1776 m_buttonNegative
= mybutton
;
1779 m_buttonCancel
= mybutton
;
1782 case wxID_CONTEXT_HELP
:
1783 m_buttonHelp
= mybutton
;
1790 void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton
*button
)
1792 m_buttonAffirmative
= button
;
1795 void wxStdDialogButtonSizer::SetNegativeButton( wxButton
*button
)
1797 m_buttonNegative
= button
;
1800 void wxStdDialogButtonSizer::SetCancelButton( wxButton
*button
)
1802 m_buttonCancel
= button
;
1805 void wxStdDialogButtonSizer::Realize()
1808 Add(0, 0, 0, wxLEFT
, 6);
1810 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1812 if (m_buttonNegative
){
1813 // HIG POLICE BULLETIN - destructive buttons need extra padding
1814 // 24 pixels on either side
1815 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 12);
1818 // extra whitespace between help/negative and cancel/ok buttons
1819 Add(0, 0, 1, wxEXPAND
, 0);
1821 if (m_buttonCancel
){
1822 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1823 // Cancel or help should be default
1824 // m_buttonCancel->SetDefaultButton();
1827 // Ugh, Mac doesn't really have apply dialogs, so I'll just
1828 // figure the best place is between Cancel and OK
1830 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1832 if (m_buttonAffirmative
){
1833 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1835 if (m_buttonAffirmative
->GetId() == wxID_SAVE
){
1836 // these buttons have set labels under Mac so we should use them
1837 m_buttonAffirmative
->SetLabel(_("Save"));
1838 m_buttonNegative
->SetLabel(_("Don't Save"));
1842 // Extra space around and at the right
1844 #elif defined(__WXGTK20__)
1845 Add(0, 0, 0, wxLEFT
, 9);
1847 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1849 // extra whitespace between help and cancel/ok buttons
1850 Add(0, 0, 1, wxEXPAND
, 0);
1852 if (m_buttonNegative
){
1853 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1856 if (m_buttonCancel
){
1857 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1858 // Cancel or help should be default
1859 // m_buttonCancel->SetDefaultButton();
1863 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1865 if (m_buttonAffirmative
)
1866 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1867 #elif defined(__WXMSW__)
1870 // right-justify buttons
1871 Add(0, 0, 1, wxEXPAND
, 0);
1873 if (m_buttonAffirmative
){
1874 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1877 if (m_buttonNegative
){
1878 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1881 if (m_buttonCancel
){
1882 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1885 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1888 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1890 // GTK+1 and any other platform
1892 // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
1894 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1896 // extra whitespace between help and cancel/ok buttons
1897 Add(0, 0, 1, wxEXPAND
, 0);
1900 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1902 if (m_buttonAffirmative
){
1903 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1906 if (m_buttonNegative
){
1907 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1910 if (m_buttonCancel
){
1911 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1912 // Cancel or help should be default
1913 // m_buttonCancel->SetDefaultButton();
1919 #endif // wxUSE_BUTTON
1921 #if WXWIN_COMPATIBILITY_2_4
1923 // ----------------------------------------------------------------------------
1925 // ----------------------------------------------------------------------------
1928 IMPLEMENT_CLASS(wxBookCtrlSizer
, wxSizer
)
1930 IMPLEMENT_CLASS(wxNotebookSizer
, wxBookCtrlSizer
)
1931 #endif // wxUSE_NOTEBOOK
1932 #endif // wxUSE_BOOKCTRL
1936 wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
)
1937 : m_bookctrl(bookctrl
)
1939 wxASSERT_MSG( bookctrl
, wxT("wxBookCtrlSizer needs a control") );
1942 void wxBookCtrlSizer::RecalcSizes()
1944 m_bookctrl
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1947 wxSize
wxBookCtrlSizer::CalcMin()
1949 wxSize sizeBorder
= m_bookctrl
->CalcSizeFromPage(wxSize(0,0));
1954 if ( m_bookctrl
->GetPageCount() == 0 )
1956 return wxSize(sizeBorder
.x
+ 10, sizeBorder
.y
+ 10);
1962 wxWindowList::compatibility_iterator
1963 node
= m_bookctrl
->GetChildren().GetFirst();
1966 wxWindow
*item
= node
->GetData();
1967 wxSizer
*itemsizer
= item
->GetSizer();
1971 wxSize
subsize( itemsizer
->CalcMin() );
1973 if (subsize
.x
> maxX
)
1975 if (subsize
.y
> maxY
)
1979 node
= node
->GetNext();
1982 return wxSize( maxX
, maxY
) + sizeBorder
;
1987 wxNotebookSizer::wxNotebookSizer(wxNotebook
*nb
)
1989 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a control") );
1993 #endif // wxUSE_NOTEBOOOK
1994 #endif // wxUSE_BOOKCTRL
1996 #endif // WXWIN_COMPATIBILITY_2_4