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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma implementation "sizer.h"
17 // For compilers that support precompilation, includes "wx.h".
18 #include "wx/wxprec.h"
25 #include "wx/string.h"
31 #include "wx/statbox.h"
32 #include "wx/settings.h"
33 #include "wx/listimpl.cpp"
35 #if WXWIN_COMPATIBILITY_2_4
36 #include "wx/notebook.h"
39 //---------------------------------------------------------------------------
41 IMPLEMENT_CLASS(wxSizerItem
, wxObject
)
42 IMPLEMENT_CLASS(wxSizer
, wxObject
)
43 IMPLEMENT_CLASS(wxGridSizer
, wxSizer
)
44 IMPLEMENT_CLASS(wxFlexGridSizer
, wxGridSizer
)
45 IMPLEMENT_CLASS(wxBoxSizer
, wxSizer
)
47 IMPLEMENT_CLASS(wxStaticBoxSizer
, wxBoxSizer
)
50 IMPLEMENT_CLASS(wxStdDialogButtonSizer
, wxBoxSizer
)
53 WX_DEFINE_EXPORTED_LIST( wxSizerItemList
);
88 // ----------------------------------------------------------------------------
90 // ----------------------------------------------------------------------------
92 void wxSizerItem::Init(const wxSizerFlags
& flags
)
96 m_proportion
= flags
.GetProportion();
97 m_flag
= flags
.GetFlags();
98 m_border
= flags
.GetBorderInPixels();
101 wxSizerItem::wxSizerItem()
113 void wxSizerItem::SetWindow(wxWindow
*window
)
115 wxCHECK_RET( window
, _T("NULL window in wxSizerItem::SetWindow()") );
117 m_kind
= Item_Window
;
120 // window doesn't become smaller than its initial size, whatever happens
121 m_minSize
= window
->GetSize();
123 if ( m_flag
& wxFIXED_MINSIZE
)
124 window
->SetMinSize(m_minSize
);
126 // aspect ratio calculated from initial size
130 wxSizerItem::wxSizerItem(wxWindow
*window
,
135 : m_proportion(proportion
),
144 void wxSizerItem::SetSizer(wxSizer
*sizer
)
150 wxSizerItem::wxSizerItem(wxSizer
*sizer
,
155 : m_proportion(proportion
),
163 // m_minSize is set later
167 void wxSizerItem::SetSpacer(const wxSize
& size
)
169 m_kind
= Item_Spacer
;
170 m_spacer
= new wxSizerSpacer(size
);
175 wxSizerItem::wxSizerItem(int width
,
181 : m_minSize(width
, height
), // minimal size is the initial size
182 m_proportion(proportion
),
187 SetSpacer(width
, height
);
190 wxSizerItem::~wxSizerItem()
200 m_window
->SetContainingSizer(NULL
);
213 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
217 wxSize
wxSizerItem::GetSpacer() const
220 if ( m_kind
== Item_Spacer
)
221 size
= m_spacer
->GetSize();
227 wxSize
wxSizerItem::GetSize() const
236 ret
= m_window
->GetSize();
240 ret
= m_sizer
->GetSize();
244 ret
= m_spacer
->GetSize();
249 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
256 if (m_flag
& wxNORTH
)
258 if (m_flag
& wxSOUTH
)
264 wxSize
wxSizerItem::CalcMin()
268 m_minSize
= m_sizer
->GetMinSize();
270 // if we have to preserve aspect ratio _AND_ this is
271 // the first-time calculation, consider ret to be initial size
272 if ((m_flag
& wxSHAPED
) && !m_ratio
)
275 else if ( IsWindow() )
277 // Since the size of the window may change during runtime, we
278 // should use the current minimal/best size.
279 m_minSize
= m_window
->GetBestFittingSize();
282 return GetMinSizeWithBorder();
285 wxSize
wxSizerItem::GetMinSizeWithBorder() const
287 wxSize ret
= m_minSize
;
293 if (m_flag
& wxNORTH
)
295 if (m_flag
& wxSOUTH
)
302 void wxSizerItem::SetDimension( wxPoint pos
, wxSize size
)
304 if (m_flag
& wxSHAPED
)
306 // adjust aspect ratio
307 int rwidth
= (int) (size
.y
* m_ratio
);
311 int rheight
= (int) (size
.x
/ m_ratio
);
312 // add vertical space
313 if (m_flag
& wxALIGN_CENTER_VERTICAL
)
314 pos
.y
+= (size
.y
- rheight
) / 2;
315 else if (m_flag
& wxALIGN_BOTTOM
)
316 pos
.y
+= (size
.y
- rheight
);
317 // use reduced dimensions
320 else if (rwidth
< size
.x
)
322 // add horizontal space
323 if (m_flag
& wxALIGN_CENTER_HORIZONTAL
)
324 pos
.x
+= (size
.x
- rwidth
) / 2;
325 else if (m_flag
& wxALIGN_RIGHT
)
326 pos
.x
+= (size
.x
- rwidth
);
331 // This is what GetPosition() returns. Since we calculate
332 // borders afterwards, GetPosition() will be the left/top
333 // corner of the surrounding border.
345 if (m_flag
& wxNORTH
)
350 if (m_flag
& wxSOUTH
)
355 m_rect
= wxRect(pos
, size
);
360 wxFAIL_MSG( _T("can't set size of uninitialized sizer item") );
364 m_window
->SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
,
365 wxSIZE_ALLOW_MINUS_ONE
);
369 m_sizer
->SetDimension(pos
.x
, pos
.y
, size
.x
, size
.y
);
373 m_spacer
->SetSize(size
);
378 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
382 void wxSizerItem::DeleteWindows()
391 //We are deleting the window from this sizer - normally
392 //the window destroys the sizer associated with it,
393 //which might destroy this, which we don't want
394 m_window
->SetContainingSizer(NULL
);
396 //Putting this after the switch will result in a spacer
397 //not being deleted properly on destruction
402 m_sizer
->DeleteWindows();
407 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
412 void wxSizerItem::Show( bool show
)
417 wxFAIL_MSG( _T("can't show uninitialized sizer item") );
421 m_window
->Show(show
);
429 m_spacer
->Show(show
);
434 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
438 bool wxSizerItem::IsShown() const
443 wxFAIL_MSG( _T("uninitialized sizer item") );
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
)
1061 if (m_rows
== 0 && m_cols
== 0)
1065 wxGridSizer::wxGridSizer( int cols
, int vgap
, int hgap
)
1071 if (m_rows
== 0 && m_cols
== 0)
1075 int wxGridSizer::CalcRowsCols(int& nrows
, int& ncols
) const
1077 int nitems
= m_children
.GetCount();
1083 nrows
= (nitems
+ m_cols
- 1) / m_cols
;
1087 ncols
= (nitems
+ m_rows
- 1) / m_rows
;
1090 else // 0 columns, 0 rows?
1092 wxFAIL_MSG( _T("grid sizer must have either rows or columns fixed") );
1101 void wxGridSizer::RecalcSizes()
1103 int nitems
, nrows
, ncols
;
1104 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1107 wxSize
sz( GetSize() );
1108 wxPoint
pt( GetPosition() );
1110 int w
= (sz
.x
- (ncols
- 1) * m_hgap
) / ncols
;
1111 int h
= (sz
.y
- (nrows
- 1) * m_vgap
) / nrows
;
1114 for (int c
= 0; c
< ncols
; c
++)
1117 for (int r
= 0; r
< nrows
; r
++)
1119 int i
= r
* ncols
+ c
;
1122 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1124 wxASSERT_MSG( node
, _T("Failed to find SizerItemList node") );
1126 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1134 wxSize
wxGridSizer::CalcMin()
1137 if ( CalcRowsCols(nrows
, ncols
) == 0 )
1138 return wxSize(10, 10);
1140 // Find the max width and height for any component
1144 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1147 wxSizerItem
*item
= node
->GetData();
1148 wxSize
sz( item
->CalcMin() );
1150 w
= wxMax( w
, sz
.x
);
1151 h
= wxMax( h
, sz
.y
);
1153 node
= node
->GetNext();
1156 return wxSize( ncols
* w
+ (ncols
-1) * m_hgap
,
1157 nrows
* h
+ (nrows
-1) * m_vgap
);
1160 void wxGridSizer::SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
)
1163 wxSize
sz( item
->GetMinSizeWithBorder() );
1164 int flag
= item
->GetFlag();
1166 if ((flag
& wxEXPAND
) || (flag
& wxSHAPED
))
1172 if (flag
& wxALIGN_CENTER_HORIZONTAL
)
1174 pt
.x
= x
+ (w
- sz
.x
) / 2;
1176 else if (flag
& wxALIGN_RIGHT
)
1178 pt
.x
= x
+ (w
- sz
.x
);
1181 if (flag
& wxALIGN_CENTER_VERTICAL
)
1183 pt
.y
= y
+ (h
- sz
.y
) / 2;
1185 else if (flag
& wxALIGN_BOTTOM
)
1187 pt
.y
= y
+ (h
- sz
.y
);
1191 item
->SetDimension(pt
, sz
);
1194 //---------------------------------------------------------------------------
1196 //---------------------------------------------------------------------------
1198 wxFlexGridSizer::wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1199 : wxGridSizer( rows
, cols
, vgap
, hgap
),
1200 m_flexDirection(wxBOTH
),
1201 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1205 wxFlexGridSizer::wxFlexGridSizer( int cols
, int vgap
, int hgap
)
1206 : wxGridSizer( cols
, vgap
, hgap
),
1207 m_flexDirection(wxBOTH
),
1208 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1212 wxFlexGridSizer::~wxFlexGridSizer()
1216 void wxFlexGridSizer::RecalcSizes()
1218 int nitems
, nrows
, ncols
;
1219 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1222 wxPoint
pt( GetPosition() );
1223 wxSize
sz( GetSize() );
1225 AdjustForGrowables(sz
, m_calculatedMinSize
, nrows
, ncols
);
1227 sz
= wxSize( pt
.x
+ sz
.x
, pt
.y
+ sz
.y
);
1230 for (int c
= 0; c
< ncols
; c
++)
1233 for (int r
= 0; r
< nrows
; r
++)
1235 int i
= r
* ncols
+ c
;
1238 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1240 wxASSERT_MSG( node
, _T("Failed to find node") );
1242 int w
= wxMax( 0, wxMin( m_colWidths
[c
], sz
.x
- x
) );
1243 int h
= wxMax( 0, wxMin( m_rowHeights
[r
], sz
.y
- y
) );
1245 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1247 if (m_rowHeights
[r
] != -1)
1248 y
= y
+ m_rowHeights
[r
] + m_vgap
;
1250 if (m_colWidths
[c
] != -1)
1251 x
= x
+ m_colWidths
[c
] + m_hgap
;
1255 wxSize
wxFlexGridSizer::CalcMin()
1261 // Number of rows/columns can change as items are added or removed.
1262 if ( !CalcRowsCols(nrows
, ncols
) )
1263 return wxSize(10, 10);
1265 m_rowHeights
.SetCount(nrows
);
1266 m_colWidths
.SetCount(ncols
);
1268 // We have to recalcuate the sizes in case the item minimum size has
1269 // changed since the previous layout, or the item has been hidden using
1270 // wxSizer::Show(). If all the items in a row/column are hidden, the final
1271 // dimension of the row/column will be -1, indicating that the column
1272 // itself is hidden.
1273 for( s
= m_rowHeights
.GetCount(), i
= 0; i
< s
; ++i
)
1274 m_rowHeights
[ i
] = -1;
1275 for( s
= m_colWidths
.GetCount(), i
= 0; i
< s
; ++i
)
1276 m_colWidths
[ i
] = -1;
1278 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1283 wxSizerItem
*item
= node
->GetData();
1284 if ( item
->IsShown() )
1286 wxSize
sz( item
->CalcMin() );
1287 int row
= i
/ ncols
;
1288 int col
= i
% ncols
;
1290 m_rowHeights
[ row
] = wxMax( wxMax( 0, sz
.y
), m_rowHeights
[ row
] );
1291 m_colWidths
[ col
] = wxMax( wxMax( 0, sz
.x
), m_colWidths
[ col
] );
1294 node
= node
->GetNext();
1298 AdjustForFlexDirection();
1300 // Sum total minimum size, including gaps between rows/columns.
1301 // -1 is used as a magic number meaning empty column.
1303 for (int col
= 0; col
< ncols
; col
++)
1304 if ( m_colWidths
[ col
] != -1 )
1305 width
+= m_colWidths
[ col
] + m_hgap
;
1310 for (int row
= 0; row
< nrows
; row
++)
1311 if ( m_rowHeights
[ row
] != -1 )
1312 height
+= m_rowHeights
[ row
] + m_vgap
;
1316 m_calculatedMinSize
= wxSize( width
, height
);
1317 return m_calculatedMinSize
;
1320 void wxFlexGridSizer::AdjustForFlexDirection()
1322 // the logic in CalcMin works when we resize flexibly in both directions
1323 // but maybe this is not the case
1324 if ( m_flexDirection
!= wxBOTH
)
1326 // select the array corresponding to the direction in which we do *not*
1328 wxArrayInt
& array
= m_flexDirection
== wxVERTICAL
? m_colWidths
1331 const int count
= array
.GetCount();
1333 // find the largest value in this array
1335 for ( n
= 0; n
< count
; ++n
)
1337 if ( array
[n
] > largest
)
1341 // and now fill it with the largest value
1342 for ( n
= 0; n
< count
; ++n
)
1350 void wxFlexGridSizer::AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
1351 int nrows
, int ncols
)
1353 // what to do with the rows? by default, resize them proportionally
1354 if ( sz
.y
> minsz
.y
&& ( (m_flexDirection
& wxVERTICAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1356 int sum_proportions
= 0;
1357 int growable_space
= 0;
1360 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1362 // Since the number of rows/columns can change as items are
1363 // inserted/deleted, we need to verify at runtime that the
1364 // requested growable rows/columns are still valid.
1365 if (m_growableRows
[idx
] >= nrows
)
1368 // If all items in a row/column are hidden, that row/column will
1369 // have a dimension of -1. This causes the row/column to be
1370 // hidden completely.
1371 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1373 sum_proportions
+= m_growableRowsProportions
[idx
];
1374 growable_space
+= m_rowHeights
[ m_growableRows
[idx
] ];
1380 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1382 if (m_growableRows
[idx
] >= nrows
)
1384 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1385 m_rowHeights
[ m_growableRows
[idx
] ] = 0;
1388 int delta
= (sz
.y
- minsz
.y
);
1389 if (sum_proportions
== 0)
1390 delta
= (delta
/num
) + m_rowHeights
[ m_growableRows
[idx
] ];
1392 delta
= ((delta
+growable_space
)*m_growableRowsProportions
[idx
]) / sum_proportions
;
1393 m_rowHeights
[ m_growableRows
[idx
] ] = delta
;
1398 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.y
> minsz
.y
) )
1400 // rounding problem?
1401 for ( int row
= 0; row
< nrows
; ++row
)
1402 m_rowHeights
[ row
] = sz
.y
/ nrows
;
1405 // the same logic as above but for the columns
1406 if ( sz
.x
> minsz
.x
&& ( (m_flexDirection
& wxHORIZONTAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1408 int sum_proportions
= 0;
1409 int growable_space
= 0;
1412 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1414 // Since the number of rows/columns can change as items are
1415 // inserted/deleted, we need to verify at runtime that the
1416 // requested growable rows/columns are still valid.
1417 if (m_growableCols
[idx
] >= ncols
)
1420 // If all items in a row/column are hidden, that row/column will
1421 // have a dimension of -1. This causes the column to be hidden
1423 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1425 sum_proportions
+= m_growableColsProportions
[idx
];
1426 growable_space
+= m_colWidths
[ m_growableCols
[idx
] ];
1432 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1434 if (m_growableCols
[idx
] >= ncols
)
1436 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1437 m_colWidths
[ m_growableCols
[idx
] ] = 0;
1440 int delta
= (sz
.x
- minsz
.x
);
1441 if (sum_proportions
== 0)
1442 delta
= (delta
/num
) + m_colWidths
[ m_growableCols
[idx
] ];
1444 delta
= ((delta
+growable_space
)*m_growableColsProportions
[idx
])/sum_proportions
;
1445 m_colWidths
[ m_growableCols
[idx
] ] = delta
;
1450 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.x
> minsz
.x
) )
1452 for ( int col
=0; col
< ncols
; ++col
)
1453 m_colWidths
[ col
] = sz
.x
/ ncols
;
1458 void wxFlexGridSizer::AddGrowableRow( size_t idx
, int proportion
)
1460 m_growableRows
.Add( idx
);
1461 m_growableRowsProportions
.Add( proportion
);
1464 void wxFlexGridSizer::RemoveGrowableRow( size_t idx
)
1466 m_growableRows
.Remove( idx
);
1469 void wxFlexGridSizer::AddGrowableCol( size_t idx
, int proportion
)
1471 m_growableCols
.Add( idx
);
1472 m_growableColsProportions
.Add( proportion
);
1475 void wxFlexGridSizer::RemoveGrowableCol( size_t idx
)
1477 m_growableCols
.Remove( idx
);
1480 //---------------------------------------------------------------------------
1482 //---------------------------------------------------------------------------
1484 wxBoxSizer::wxBoxSizer( int orient
)
1485 : m_orient( orient
)
1489 void wxBoxSizer::RecalcSizes()
1491 if (m_children
.GetCount() == 0)
1497 if (m_orient
== wxHORIZONTAL
)
1498 delta
= m_size
.x
- m_fixedWidth
;
1500 delta
= m_size
.y
- m_fixedHeight
;
1503 wxPoint
pt( m_position
);
1505 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1508 wxSizerItem
*item
= node
->GetData();
1510 if (item
->IsShown())
1512 wxSize
size( item
->GetMinSizeWithBorder() );
1514 if (m_orient
== wxVERTICAL
)
1516 wxCoord height
= size
.y
;
1517 if (item
->GetProportion())
1519 // Because of at least one visible item has non-zero
1520 // proportion then m_stretchable is not zero
1521 height
= (delta
* item
->GetProportion()) / m_stretchable
;
1524 wxPoint
child_pos( pt
);
1525 wxSize
child_size( size
.x
, height
);
1527 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1528 child_size
.x
= m_size
.x
;
1529 else if (item
->GetFlag() & wxALIGN_RIGHT
)
1530 child_pos
.x
+= m_size
.x
- size
.x
;
1531 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
1532 // XXX wxCENTER is added for backward compatibility;
1533 // wxALIGN_CENTER should be used in new code
1534 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
1536 item
->SetDimension( child_pos
, child_size
);
1542 wxCoord width
= size
.x
;
1543 if (item
->GetProportion())
1545 // Because of at least one visible item has non-zero
1546 // proportion then m_stretchable is not zero
1547 width
= (delta
* item
->GetProportion()) / m_stretchable
;
1550 wxPoint
child_pos( pt
);
1551 wxSize
child_size( width
, size
.y
);
1553 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1554 child_size
.y
= m_size
.y
;
1555 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
1556 child_pos
.y
+= m_size
.y
- size
.y
;
1557 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
1558 // XXX wxCENTER is added for backward compatibility;
1559 // wxALIGN_CENTER should be used in new code
1560 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
1562 item
->SetDimension( child_pos
, child_size
);
1568 node
= node
->GetNext();
1572 wxSize
wxBoxSizer::CalcMin()
1574 if (m_children
.GetCount() == 0)
1575 return wxSize(10,10);
1583 // precalc item minsizes and count proportions
1584 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1587 wxSizerItem
*item
= node
->GetData();
1589 if ( item
->IsShown() )
1591 item
->CalcMin(); // result is stored in the item
1593 m_stretchable
+= item
->GetProportion();
1596 node
= node
->GetNext();
1599 // Total minimum size (width or height) of sizer
1602 node
= m_children
.GetFirst();
1605 wxSizerItem
*item
= node
->GetData();
1607 if (item
->IsShown() && item
->GetProportion() != 0)
1609 int stretch
= item
->GetProportion();
1610 wxSize
size( item
->GetMinSizeWithBorder() );
1613 // Integer division rounded up is (a + b - 1) / b
1614 // Round up needed in order to guarantee that all
1615 // all items will have size not less then their min size
1616 if (m_orient
== wxHORIZONTAL
)
1617 minSize
= ( size
.x
*m_stretchable
+ stretch
- 1)/stretch
;
1619 minSize
= ( size
.y
*m_stretchable
+ stretch
- 1)/stretch
;
1621 if (minSize
> maxMinSize
)
1622 maxMinSize
= minSize
;
1624 node
= node
->GetNext();
1627 // Calculate overall minimum size
1628 node
= m_children
.GetFirst();
1631 wxSizerItem
*item
= node
->GetData();
1633 if (item
->IsShown())
1635 wxSize
size( item
->GetMinSizeWithBorder() );
1636 if (item
->GetProportion() != 0)
1638 if (m_orient
== wxHORIZONTAL
)
1639 size
.x
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1641 size
.y
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1645 if (m_orient
== wxVERTICAL
)
1647 m_fixedHeight
+= size
.y
;
1648 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
1652 m_fixedWidth
+= size
.x
;
1653 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
1657 if (m_orient
== wxHORIZONTAL
)
1659 m_minWidth
+= size
.x
;
1660 m_minHeight
= wxMax( m_minHeight
, size
.y
);
1664 m_minHeight
+= size
.y
;
1665 m_minWidth
= wxMax( m_minWidth
, size
.x
);
1668 node
= node
->GetNext();
1671 return wxSize( m_minWidth
, m_minHeight
);
1674 //---------------------------------------------------------------------------
1676 //---------------------------------------------------------------------------
1680 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
1681 : wxBoxSizer( orient
)
1682 , m_staticBox( box
)
1684 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
1687 wxStaticBoxSizer::wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& s
)
1688 : wxBoxSizer(orient
),
1689 m_staticBox(new wxStaticBox(win
, wxID_ANY
, s
))
1693 static void GetStaticBoxBorders( wxStaticBox
*box
,
1697 // this has to be done platform by platform as there is no way to
1698 // guess the thickness of a wxStaticBox border
1699 box
->GetBordersForSizer(borderTop
, borderOther
);
1702 void wxStaticBoxSizer::RecalcSizes()
1704 int top_border
, other_border
;
1705 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1707 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1709 wxPoint
old_pos( m_position
);
1710 m_position
.x
+= other_border
;
1711 m_position
.y
+= top_border
;
1712 wxSize
old_size( m_size
);
1713 m_size
.x
-= 2*other_border
;
1714 m_size
.y
-= top_border
+ other_border
;
1716 wxBoxSizer::RecalcSizes();
1718 m_position
= old_pos
;
1722 wxSize
wxStaticBoxSizer::CalcMin()
1724 int top_border
, other_border
;
1725 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1727 wxSize
ret( wxBoxSizer::CalcMin() );
1728 ret
.x
+= 2*other_border
;
1729 ret
.y
+= other_border
+ top_border
;
1734 void wxStaticBoxSizer::ShowItems( bool show
)
1736 m_staticBox
->Show( show
);
1737 wxBoxSizer::ShowItems( show
);
1740 #endif // wxUSE_STATBOX
1744 wxStdDialogButtonSizer::wxStdDialogButtonSizer()
1745 : wxBoxSizer(wxHORIZONTAL
)
1747 // Vertical buttons with lots of space on either side
1748 // looks rubbish on WinCE, so let's not do this for now.
1749 // If we are going to use vertical buttons, we should
1750 // put the sizer to the right of other controls in the dialog,
1751 // and that's beyond the scope of this sizer.
1753 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1754 // If we have a PDA screen, put yes/no button over
1755 // all other buttons, otherwise on the left side.
1757 m_orient
= wxVERTICAL
;
1760 m_buttonAffirmative
= NULL
;
1761 m_buttonApply
= NULL
;
1762 m_buttonNegative
= NULL
;
1763 m_buttonCancel
= NULL
;
1764 m_buttonHelp
= NULL
;
1767 void wxStdDialogButtonSizer::AddButton(wxButton
*mybutton
)
1769 switch (mybutton
->GetId())
1774 m_buttonAffirmative
= mybutton
;
1777 m_buttonApply
= mybutton
;
1780 m_buttonNegative
= mybutton
;
1783 m_buttonCancel
= mybutton
;
1786 case wxID_CONTEXT_HELP
:
1787 m_buttonHelp
= mybutton
;
1794 void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton
*button
)
1796 m_buttonAffirmative
= button
;
1799 void wxStdDialogButtonSizer::SetNegativeButton( wxButton
*button
)
1801 m_buttonNegative
= button
;
1804 void wxStdDialogButtonSizer::SetCancelButton( wxButton
*button
)
1806 m_buttonCancel
= button
;
1809 void wxStdDialogButtonSizer::Realize()
1812 Add(0, 0, 0, wxLEFT
, 6);
1814 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1816 if (m_buttonNegative
){
1817 // HIG POLICE BULLETIN - destructive buttons need extra padding
1818 // 24 pixels on either side
1819 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 12);
1822 // extra whitespace between help/negative and cancel/ok buttons
1823 Add(0, 0, 1, wxEXPAND
, 0);
1825 if (m_buttonCancel
){
1826 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1827 // Cancel or help should be default
1828 // m_buttonCancel->SetDefaultButton();
1831 // Ugh, Mac doesn't really have apply dialogs, so I'll just
1832 // figure the best place is between Cancel and OK
1834 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1836 if (m_buttonAffirmative
){
1837 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1839 if (m_buttonAffirmative
->GetId() == wxID_SAVE
){
1840 // these buttons have set labels under Mac so we should use them
1841 m_buttonAffirmative
->SetLabel(_("Save"));
1842 m_buttonNegative
->SetLabel(_("Don't Save"));
1846 // Extra space around and at the right
1848 #elif defined(__WXGTK20__)
1849 Add(0, 0, 0, wxLEFT
, 9);
1851 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1853 // extra whitespace between help and cancel/ok buttons
1854 Add(0, 0, 1, wxEXPAND
, 0);
1856 if (m_buttonNegative
){
1857 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1860 if (m_buttonCancel
){
1861 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1862 // Cancel or help should be default
1863 // m_buttonCancel->SetDefaultButton();
1867 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1869 if (m_buttonAffirmative
)
1870 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1871 #elif defined(__WXMSW__)
1874 // right-justify buttons
1875 Add(0, 0, 1, wxEXPAND
, 0);
1877 if (m_buttonAffirmative
){
1878 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1881 if (m_buttonNegative
){
1882 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1885 if (m_buttonCancel
){
1886 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1889 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1892 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1894 // GTK+1 and any other platform
1896 // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
1898 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1900 // extra whitespace between help and cancel/ok buttons
1901 Add(0, 0, 1, wxEXPAND
, 0);
1904 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1906 if (m_buttonAffirmative
){
1907 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1910 if (m_buttonNegative
){
1911 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1914 if (m_buttonCancel
){
1915 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1916 // Cancel or help should be default
1917 // m_buttonCancel->SetDefaultButton();
1923 #endif // wxUSE_BUTTON
1925 #if WXWIN_COMPATIBILITY_2_4
1927 // ----------------------------------------------------------------------------
1929 // ----------------------------------------------------------------------------
1932 IMPLEMENT_CLASS(wxBookCtrlSizer
, wxSizer
)
1934 IMPLEMENT_CLASS(wxNotebookSizer
, wxBookCtrlSizer
)
1935 #endif // wxUSE_NOTEBOOK
1936 #endif // wxUSE_BOOKCTRL
1940 wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
)
1941 : m_bookctrl(bookctrl
)
1943 wxASSERT_MSG( bookctrl
, wxT("wxBookCtrlSizer needs a control") );
1946 void wxBookCtrlSizer::RecalcSizes()
1948 m_bookctrl
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1951 wxSize
wxBookCtrlSizer::CalcMin()
1953 wxSize sizeBorder
= m_bookctrl
->CalcSizeFromPage(wxSize(0,0));
1958 if ( m_bookctrl
->GetPageCount() == 0 )
1960 return wxSize(sizeBorder
.x
+ 10, sizeBorder
.y
+ 10);
1966 wxWindowList::compatibility_iterator
1967 node
= m_bookctrl
->GetChildren().GetFirst();
1970 wxWindow
*item
= node
->GetData();
1971 wxSizer
*itemsizer
= item
->GetSizer();
1975 wxSize
subsize( itemsizer
->CalcMin() );
1977 if (subsize
.x
> maxX
)
1979 if (subsize
.y
> maxY
)
1983 node
= node
->GetNext();
1986 return wxSize( maxX
, maxY
) + sizeBorder
;
1991 wxNotebookSizer::wxNotebookSizer(wxNotebook
*nb
)
1993 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a control") );
1997 #endif // wxUSE_NOTEBOOOK
1998 #endif // wxUSE_BOOKCTRL
2000 #endif // WXWIN_COMPATIBILITY_2_4