1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: provide new wxSizer class for layout
4 // Author: Robert Roebling and Robin Dunn, contributions by
5 // Dirk Holtwick, Ron Lee
6 // Modified by: Ron Lee
9 // Copyright: (c) Robin Dunn, Robert Roebling
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 // For compilers that support precompilation, includes "wx.h".
14 #include "wx/wxprec.h"
21 #include "wx/string.h"
27 #include "wx/statbox.h"
28 #include "wx/settings.h"
29 #include "wx/listimpl.cpp"
31 #if WXWIN_COMPATIBILITY_2_4
32 #include "wx/notebook.h"
35 //---------------------------------------------------------------------------
37 IMPLEMENT_CLASS(wxSizerItem
, wxObject
)
38 IMPLEMENT_CLASS(wxSizer
, wxObject
)
39 IMPLEMENT_CLASS(wxGridSizer
, wxSizer
)
40 IMPLEMENT_CLASS(wxFlexGridSizer
, wxGridSizer
)
41 IMPLEMENT_CLASS(wxBoxSizer
, wxSizer
)
43 IMPLEMENT_CLASS(wxStaticBoxSizer
, wxBoxSizer
)
46 IMPLEMENT_CLASS(wxStdDialogButtonSizer
, wxBoxSizer
)
49 WX_DEFINE_EXPORTED_LIST( wxSizerItemList
);
84 // ----------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
88 void wxSizerItem::Init(const wxSizerFlags
& flags
)
92 m_proportion
= flags
.GetProportion();
93 m_flag
= flags
.GetFlags();
94 m_border
= flags
.GetBorderInPixels();
97 wxSizerItem::wxSizerItem()
109 void wxSizerItem::SetWindow(wxWindow
*window
)
111 wxCHECK_RET( window
, _T("NULL window in wxSizerItem::SetWindow()") );
113 m_kind
= Item_Window
;
116 // window doesn't become smaller than its initial size, whatever happens
117 m_minSize
= window
->GetSize();
119 if ( m_flag
& wxFIXED_MINSIZE
)
120 window
->SetMinSize(m_minSize
);
122 // aspect ratio calculated from initial size
126 wxSizerItem::wxSizerItem(wxWindow
*window
,
131 : m_proportion(proportion
),
140 void wxSizerItem::SetSizer(wxSizer
*sizer
)
146 wxSizerItem::wxSizerItem(wxSizer
*sizer
,
151 : m_proportion(proportion
),
159 // m_minSize is set later
163 void wxSizerItem::SetSpacer(const wxSize
& size
)
165 m_kind
= Item_Spacer
;
166 m_spacer
= new wxSizerSpacer(size
);
171 wxSizerItem::wxSizerItem(int width
,
177 : m_minSize(width
, height
), // minimal size is the initial size
178 m_proportion(proportion
),
183 SetSpacer(width
, height
);
186 wxSizerItem::~wxSizerItem()
196 m_window
->SetContainingSizer(NULL
);
209 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
213 wxSize
wxSizerItem::GetSpacer() const
216 if ( m_kind
== Item_Spacer
)
217 size
= m_spacer
->GetSize();
223 wxSize
wxSizerItem::GetSize() const
232 ret
= m_window
->GetSize();
236 ret
= m_sizer
->GetSize();
240 ret
= m_spacer
->GetSize();
245 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
252 if (m_flag
& wxNORTH
)
254 if (m_flag
& wxSOUTH
)
260 wxSize
wxSizerItem::CalcMin()
264 m_minSize
= m_sizer
->GetMinSize();
266 // if we have to preserve aspect ratio _AND_ this is
267 // the first-time calculation, consider ret to be initial size
268 if ((m_flag
& wxSHAPED
) && !m_ratio
)
271 else if ( IsWindow() )
273 // Since the size of the window may change during runtime, we
274 // should use the current minimal/best size.
275 m_minSize
= m_window
->GetBestFittingSize();
278 return GetMinSizeWithBorder();
281 wxSize
wxSizerItem::GetMinSizeWithBorder() const
283 wxSize ret
= m_minSize
;
289 if (m_flag
& wxNORTH
)
291 if (m_flag
& wxSOUTH
)
298 void wxSizerItem::SetDimension( const wxPoint
& pos_
, const wxSize
& size_
)
302 if (m_flag
& wxSHAPED
)
304 // adjust aspect ratio
305 int rwidth
= (int) (size
.y
* m_ratio
);
309 int rheight
= (int) (size
.x
/ m_ratio
);
310 // add vertical space
311 if (m_flag
& wxALIGN_CENTER_VERTICAL
)
312 pos
.y
+= (size
.y
- rheight
) / 2;
313 else if (m_flag
& wxALIGN_BOTTOM
)
314 pos
.y
+= (size
.y
- rheight
);
315 // use reduced dimensions
318 else if (rwidth
< size
.x
)
320 // add horizontal space
321 if (m_flag
& wxALIGN_CENTER_HORIZONTAL
)
322 pos
.x
+= (size
.x
- rwidth
) / 2;
323 else if (m_flag
& wxALIGN_RIGHT
)
324 pos
.x
+= (size
.x
- rwidth
);
329 // This is what GetPosition() returns. Since we calculate
330 // borders afterwards, GetPosition() will be the left/top
331 // corner of the surrounding border.
343 if (m_flag
& wxNORTH
)
348 if (m_flag
& wxSOUTH
)
353 m_rect
= wxRect(pos
, size
);
358 wxFAIL_MSG( _T("can't set size of uninitialized sizer item") );
362 m_window
->SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
,
363 wxSIZE_ALLOW_MINUS_ONE
);
367 m_sizer
->SetDimension(pos
.x
, pos
.y
, size
.x
, size
.y
);
371 m_spacer
->SetSize(size
);
376 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
380 void wxSizerItem::DeleteWindows()
389 //We are deleting the window from this sizer - normally
390 //the window destroys the sizer associated with it,
391 //which might destroy this, which we don't want
392 m_window
->SetContainingSizer(NULL
);
394 //Putting this after the switch will result in a spacer
395 //not being deleted properly on destruction
400 m_sizer
->DeleteWindows();
405 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
410 void wxSizerItem::Show( bool show
)
415 wxFAIL_MSG( _T("can't show uninitialized sizer item") );
419 m_window
->Show(show
);
427 m_spacer
->Show(show
);
432 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
436 bool wxSizerItem::IsShown() const
441 // we may be called from CalcMin(), just return false so that we're
446 return m_window
->IsShown();
449 return m_sizer
->IsShown();
452 return m_spacer
->IsShown();
456 wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
462 void wxSizerItem::SetOption( int option
)
464 SetProportion( option
);
467 int wxSizerItem::GetOption() const
469 return GetProportion();
473 //---------------------------------------------------------------------------
475 //---------------------------------------------------------------------------
484 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
487 wxSizerItem
* wxSizer::Insert( size_t index
, wxSizerItem
*item
)
489 m_children
.Insert( index
, item
);
491 if ( item
->GetWindow() )
492 item
->GetWindow()->SetContainingSizer( this );
497 bool wxSizer::Remove( wxWindow
*window
)
499 return Detach( window
);
502 bool wxSizer::Remove( wxSizer
*sizer
)
504 wxASSERT_MSG( sizer
, _T("Removing NULL sizer") );
506 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
509 wxSizerItem
*item
= node
->GetData();
511 if (item
->GetSizer() == sizer
)
514 m_children
.Erase( node
);
518 node
= node
->GetNext();
524 bool wxSizer::Remove( int index
)
526 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
528 _T("Remove index is out of range") );
530 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
532 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
534 wxSizerItem
*item
= node
->GetData();
536 if ( item
->IsWindow() )
537 item
->GetWindow()->SetContainingSizer( NULL
);
540 m_children
.Erase( node
);
544 bool wxSizer::Detach( wxSizer
*sizer
)
546 wxASSERT_MSG( sizer
, _T("Detaching NULL sizer") );
548 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
551 wxSizerItem
*item
= node
->GetData();
553 if (item
->GetSizer() == sizer
)
557 m_children
.Erase( node
);
560 node
= node
->GetNext();
566 bool wxSizer::Detach( wxWindow
*window
)
568 wxASSERT_MSG( window
, _T("Detaching NULL window") );
570 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
573 wxSizerItem
*item
= node
->GetData();
575 if (item
->GetWindow() == window
)
577 item
->GetWindow()->SetContainingSizer( NULL
);
579 m_children
.Erase( node
);
582 node
= node
->GetNext();
588 bool wxSizer::Detach( int index
)
590 wxCHECK_MSG( index
>= 0 && (size_t)index
< m_children
.GetCount(),
592 _T("Detach index is out of range") );
594 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
596 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
598 wxSizerItem
*item
= node
->GetData();
600 if ( item
->IsSizer() )
602 else if ( item
->IsWindow() )
603 item
->GetWindow()->SetContainingSizer( NULL
);
606 m_children
.Erase( node
);
610 void wxSizer::Clear( bool delete_windows
)
612 // First clear the ContainingSizer pointers
613 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
616 wxSizerItem
*item
= node
->GetData();
618 if (item
->IsWindow())
619 item
->GetWindow()->SetContainingSizer( NULL
);
620 node
= node
->GetNext();
623 // Destroy the windows if needed
627 // Now empty the list
628 WX_CLEAR_LIST(wxSizerItemList
, m_children
);
631 void wxSizer::DeleteWindows()
633 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
636 wxSizerItem
*item
= node
->GetData();
638 item
->DeleteWindows();
639 node
= node
->GetNext();
643 wxSize
wxSizer::Fit( wxWindow
*window
)
645 wxSize
size(window
->IsTopLevel() ? FitSize(window
)
646 : GetMinWindowSize(window
));
648 window
->SetSize( size
);
653 void wxSizer::FitInside( wxWindow
*window
)
656 if (window
->IsTopLevel())
657 size
= VirtualFitSize( window
);
659 size
= GetMinClientSize( window
);
661 window
->SetVirtualSize( size
);
664 void wxSizer::Layout()
666 // (re)calculates minimums needed for each item and other preparations
670 // Applies the layout and repositions/resizes the items
674 void wxSizer::SetSizeHints( wxWindow
*window
)
676 // Preserve the window's max size hints, but set the
677 // lower bound according to the sizer calculations.
679 wxSize size
= Fit( window
);
681 window
->SetSizeHints( size
.x
,
683 window
->GetMaxWidth(),
684 window
->GetMaxHeight() );
687 void wxSizer::SetVirtualSizeHints( wxWindow
*window
)
689 // Preserve the window's max size hints, but set the
690 // lower bound according to the sizer calculations.
693 wxSize
size( window
->GetVirtualSize() );
694 window
->SetVirtualSizeHints( size
.x
,
696 window
->GetMaxWidth(),
697 window
->GetMaxHeight() );
700 wxSize
wxSizer::GetMaxWindowSize( wxWindow
*window
) const
702 return window
->GetMaxSize();
705 wxSize
wxSizer::GetMinWindowSize( wxWindow
*window
)
707 wxSize
minSize( GetMinSize() );
708 wxSize
size( window
->GetSize() );
709 wxSize
client_size( window
->GetClientSize() );
711 return wxSize( minSize
.x
+size
.x
-client_size
.x
,
712 minSize
.y
+size
.y
-client_size
.y
);
715 // TODO on mac we need a function that determines how much free space this
716 // min size contains, in order to make sure that we have 20 pixels of free
717 // space around the controls
719 // Return a window size that will fit within the screens dimensions
720 wxSize
wxSizer::FitSize( wxWindow
*window
)
722 wxSize size
= GetMinWindowSize( window
);
723 wxSize sizeMax
= GetMaxWindowSize( window
);
725 // Limit the size if sizeMax != wxDefaultSize
727 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
729 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
735 wxSize
wxSizer::GetMaxClientSize( wxWindow
*window
) const
737 wxSize
maxSize( window
->GetMaxSize() );
739 if ( maxSize
!= wxDefaultSize
)
741 wxSize
size( window
->GetSize() );
742 wxSize
client_size( window
->GetClientSize() );
744 return wxSize( maxSize
.x
+ client_size
.x
- size
.x
,
745 maxSize
.y
+ client_size
.y
- size
.y
);
748 return wxDefaultSize
;
751 wxSize
wxSizer::GetMinClientSize( wxWindow
*WXUNUSED(window
) )
753 return GetMinSize(); // Already returns client size.
756 wxSize
wxSizer::VirtualFitSize( wxWindow
*window
)
758 wxSize size
= GetMinClientSize( window
);
759 wxSize sizeMax
= GetMaxClientSize( window
);
761 // Limit the size if sizeMax != wxDefaultSize
763 if ( size
.x
> sizeMax
.x
&& sizeMax
.x
!= wxDefaultCoord
)
765 if ( size
.y
> sizeMax
.y
&& sizeMax
.y
!= wxDefaultCoord
)
771 void wxSizer::SetDimension( int x
, int y
, int width
, int height
)
780 wxSize
wxSizer::GetMinSize()
782 wxSize
ret( CalcMin() );
783 if (ret
.x
< m_minSize
.x
) ret
.x
= m_minSize
.x
;
784 if (ret
.y
< m_minSize
.y
) ret
.y
= m_minSize
.y
;
788 void wxSizer::DoSetMinSize( int width
, int height
)
791 m_minSize
.y
= height
;
794 bool wxSizer::DoSetItemMinSize( wxWindow
*window
, int width
, int height
)
796 wxASSERT_MSG( window
, _T("SetMinSize for NULL window") );
798 // Is it our immediate child?
800 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
803 wxSizerItem
*item
= node
->GetData();
805 if (item
->GetWindow() == window
)
807 item
->SetMinSize( width
, height
);
810 node
= node
->GetNext();
813 // No? Search any subsizers we own then
815 node
= m_children
.GetFirst();
818 wxSizerItem
*item
= node
->GetData();
820 if ( item
->GetSizer() &&
821 item
->GetSizer()->DoSetItemMinSize( window
, width
, height
) )
823 // A child sizer found the requested windw, exit.
826 node
= node
->GetNext();
832 bool wxSizer::DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
)
834 wxASSERT_MSG( sizer
, _T("SetMinSize for NULL sizer") );
836 // Is it our immediate child?
838 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
841 wxSizerItem
*item
= node
->GetData();
843 if (item
->GetSizer() == sizer
)
845 item
->GetSizer()->DoSetMinSize( width
, height
);
848 node
= node
->GetNext();
851 // No? Search any subsizers we own then
853 node
= m_children
.GetFirst();
856 wxSizerItem
*item
= node
->GetData();
858 if ( item
->GetSizer() &&
859 item
->GetSizer()->DoSetItemMinSize( sizer
, width
, height
) )
861 // A child found the requested sizer, exit.
864 node
= node
->GetNext();
870 bool wxSizer::DoSetItemMinSize( size_t index
, int width
, int height
)
872 wxSizerItemList::compatibility_iterator node
= m_children
.Item( index
);
874 wxCHECK_MSG( node
, false, _T("Failed to find child node") );
876 wxSizerItem
*item
= node
->GetData();
878 if (item
->GetSizer())
880 // Sizers contains the minimal size in them, if not calculated ...
881 item
->GetSizer()->DoSetMinSize( width
, height
);
885 // ... but the minimal size of spacers and windows is stored via the item
886 item
->SetMinSize( width
, height
);
892 wxSizerItem
* wxSizer::GetItem( wxWindow
*window
, bool recursive
)
894 wxASSERT_MSG( window
, _T("GetItem for NULL window") );
896 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
899 wxSizerItem
*item
= node
->GetData();
901 if (item
->GetWindow() == window
)
905 else if (recursive
&& item
->IsSizer())
907 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( window
, true );
912 node
= node
->GetNext();
918 wxSizerItem
* wxSizer::GetItem( wxSizer
*sizer
, bool recursive
)
920 wxASSERT_MSG( sizer
, _T("GetItem for NULL sizer") );
922 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
925 wxSizerItem
*item
= node
->GetData();
927 if (item
->GetSizer() == sizer
)
931 else if (recursive
&& item
->IsSizer())
933 wxSizerItem
*subitem
= item
->GetSizer()->GetItem( sizer
, true );
938 node
= node
->GetNext();
944 wxSizerItem
* wxSizer::GetItem( size_t index
)
946 wxCHECK_MSG( index
< m_children
.GetCount(),
948 _T("GetItem index is out of range") );
950 return m_children
.Item( index
)->GetData();
953 bool wxSizer::Show( wxWindow
*window
, bool show
, bool recursive
)
955 wxSizerItem
*item
= GetItem( window
, recursive
);
966 bool wxSizer::Show( wxSizer
*sizer
, bool show
, bool recursive
)
968 wxSizerItem
*item
= GetItem( sizer
, recursive
);
979 bool wxSizer::Show( size_t index
, bool show
)
981 wxSizerItem
*item
= GetItem( index
);
992 void wxSizer::ShowItems( bool show
)
994 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
997 node
->GetData()->Show( show
);
998 node
= node
->GetNext();
1002 bool wxSizer::IsShown( wxWindow
*window
) const
1004 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1007 wxSizerItem
*item
= node
->GetData();
1009 if (item
->GetWindow() == window
)
1011 return item
->IsShown();
1013 node
= node
->GetNext();
1016 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1021 bool wxSizer::IsShown( wxSizer
*sizer
) const
1023 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1026 wxSizerItem
*item
= node
->GetData();
1028 if (item
->GetSizer() == sizer
)
1030 return item
->IsShown();
1032 node
= node
->GetNext();
1035 wxFAIL_MSG( _T("IsShown failed to find sizer item") );
1040 bool wxSizer::IsShown( size_t index
) const
1042 wxCHECK_MSG( index
< m_children
.GetCount(),
1044 _T("IsShown index is out of range") );
1046 return m_children
.Item( index
)->GetData()->IsShown();
1050 //---------------------------------------------------------------------------
1052 //---------------------------------------------------------------------------
1054 wxGridSizer::wxGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1055 : m_rows( ( cols
== 0 && rows
== 0 ) ? 1 : rows
)
1062 wxGridSizer::wxGridSizer( int cols
, int vgap
, int hgap
)
1063 : m_rows( cols
== 0 ? 1 : 0 )
1070 int wxGridSizer::CalcRowsCols(int& nrows
, int& ncols
) const
1072 int nitems
= m_children
.GetCount();
1078 nrows
= (nitems
+ m_cols
- 1) / m_cols
;
1082 ncols
= (nitems
+ m_rows
- 1) / m_rows
;
1085 else // 0 columns, 0 rows?
1087 wxFAIL_MSG( _T("grid sizer must have either rows or columns fixed") );
1096 void wxGridSizer::RecalcSizes()
1098 int nitems
, nrows
, ncols
;
1099 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1102 wxSize
sz( GetSize() );
1103 wxPoint
pt( GetPosition() );
1105 int w
= (sz
.x
- (ncols
- 1) * m_hgap
) / ncols
;
1106 int h
= (sz
.y
- (nrows
- 1) * m_vgap
) / nrows
;
1109 for (int c
= 0; c
< ncols
; c
++)
1112 for (int r
= 0; r
< nrows
; r
++)
1114 int i
= r
* ncols
+ c
;
1117 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1119 wxASSERT_MSG( node
, _T("Failed to find SizerItemList node") );
1121 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1129 wxSize
wxGridSizer::CalcMin()
1132 if ( CalcRowsCols(nrows
, ncols
) == 0 )
1133 return wxSize(10, 10);
1135 // Find the max width and height for any component
1139 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1142 wxSizerItem
*item
= node
->GetData();
1143 wxSize
sz( item
->CalcMin() );
1145 w
= wxMax( w
, sz
.x
);
1146 h
= wxMax( h
, sz
.y
);
1148 node
= node
->GetNext();
1151 return wxSize( ncols
* w
+ (ncols
-1) * m_hgap
,
1152 nrows
* h
+ (nrows
-1) * m_vgap
);
1155 void wxGridSizer::SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
)
1158 wxSize
sz( item
->GetMinSizeWithBorder() );
1159 int flag
= item
->GetFlag();
1161 if ((flag
& wxEXPAND
) || (flag
& wxSHAPED
))
1167 if (flag
& wxALIGN_CENTER_HORIZONTAL
)
1169 pt
.x
= x
+ (w
- sz
.x
) / 2;
1171 else if (flag
& wxALIGN_RIGHT
)
1173 pt
.x
= x
+ (w
- sz
.x
);
1176 if (flag
& wxALIGN_CENTER_VERTICAL
)
1178 pt
.y
= y
+ (h
- sz
.y
) / 2;
1180 else if (flag
& wxALIGN_BOTTOM
)
1182 pt
.y
= y
+ (h
- sz
.y
);
1186 item
->SetDimension(pt
, sz
);
1189 //---------------------------------------------------------------------------
1191 //---------------------------------------------------------------------------
1193 wxFlexGridSizer::wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
)
1194 : wxGridSizer( rows
, cols
, vgap
, hgap
),
1195 m_flexDirection(wxBOTH
),
1196 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1200 wxFlexGridSizer::wxFlexGridSizer( int cols
, int vgap
, int hgap
)
1201 : wxGridSizer( cols
, vgap
, hgap
),
1202 m_flexDirection(wxBOTH
),
1203 m_growMode(wxFLEX_GROWMODE_SPECIFIED
)
1207 wxFlexGridSizer::~wxFlexGridSizer()
1211 void wxFlexGridSizer::RecalcSizes()
1213 int nitems
, nrows
, ncols
;
1214 if ( (nitems
= CalcRowsCols(nrows
, ncols
)) == 0 )
1217 wxPoint
pt( GetPosition() );
1218 wxSize
sz( GetSize() );
1220 AdjustForGrowables(sz
, m_calculatedMinSize
, nrows
, ncols
);
1222 sz
= wxSize( pt
.x
+ sz
.x
, pt
.y
+ sz
.y
);
1225 for (int c
= 0; c
< ncols
; c
++)
1228 for (int r
= 0; r
< nrows
; r
++)
1230 int i
= r
* ncols
+ c
;
1233 wxSizerItemList::compatibility_iterator node
= m_children
.Item( i
);
1235 wxASSERT_MSG( node
, _T("Failed to find node") );
1237 int w
= wxMax( 0, wxMin( m_colWidths
[c
], sz
.x
- x
) );
1238 int h
= wxMax( 0, wxMin( m_rowHeights
[r
], sz
.y
- y
) );
1240 SetItemBounds( node
->GetData(), x
, y
, w
, h
);
1242 if (m_rowHeights
[r
] != -1)
1243 y
= y
+ m_rowHeights
[r
] + m_vgap
;
1245 if (m_colWidths
[c
] != -1)
1246 x
= x
+ m_colWidths
[c
] + m_hgap
;
1250 wxSize
wxFlexGridSizer::CalcMin()
1256 // Number of rows/columns can change as items are added or removed.
1257 if ( !CalcRowsCols(nrows
, ncols
) )
1258 return wxSize(10, 10);
1260 m_rowHeights
.SetCount(nrows
);
1261 m_colWidths
.SetCount(ncols
);
1263 // We have to recalcuate the sizes in case the item minimum size has
1264 // changed since the previous layout, or the item has been hidden using
1265 // wxSizer::Show(). If all the items in a row/column are hidden, the final
1266 // dimension of the row/column will be -1, indicating that the column
1267 // itself is hidden.
1268 for( s
= m_rowHeights
.GetCount(), i
= 0; i
< s
; ++i
)
1269 m_rowHeights
[ i
] = -1;
1270 for( s
= m_colWidths
.GetCount(), i
= 0; i
< s
; ++i
)
1271 m_colWidths
[ i
] = -1;
1273 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1278 wxSizerItem
*item
= node
->GetData();
1279 if ( item
->IsShown() )
1281 wxSize
sz( item
->CalcMin() );
1282 int row
= i
/ ncols
;
1283 int col
= i
% ncols
;
1285 m_rowHeights
[ row
] = wxMax( wxMax( 0, sz
.y
), m_rowHeights
[ row
] );
1286 m_colWidths
[ col
] = wxMax( wxMax( 0, sz
.x
), m_colWidths
[ col
] );
1289 node
= node
->GetNext();
1293 AdjustForFlexDirection();
1295 // Sum total minimum size, including gaps between rows/columns.
1296 // -1 is used as a magic number meaning empty column.
1298 for (int col
= 0; col
< ncols
; col
++)
1299 if ( m_colWidths
[ col
] != -1 )
1300 width
+= m_colWidths
[ col
] + m_hgap
;
1305 for (int row
= 0; row
< nrows
; row
++)
1306 if ( m_rowHeights
[ row
] != -1 )
1307 height
+= m_rowHeights
[ row
] + m_vgap
;
1311 m_calculatedMinSize
= wxSize( width
, height
);
1312 return m_calculatedMinSize
;
1315 void wxFlexGridSizer::AdjustForFlexDirection()
1317 // the logic in CalcMin works when we resize flexibly in both directions
1318 // but maybe this is not the case
1319 if ( m_flexDirection
!= wxBOTH
)
1321 // select the array corresponding to the direction in which we do *not*
1323 wxArrayInt
& array
= m_flexDirection
== wxVERTICAL
? m_colWidths
1326 const int count
= array
.GetCount();
1328 // find the largest value in this array
1330 for ( n
= 0; n
< count
; ++n
)
1332 if ( array
[n
] > largest
)
1336 // and now fill it with the largest value
1337 for ( n
= 0; n
< count
; ++n
)
1345 void wxFlexGridSizer::AdjustForGrowables(const wxSize
& sz
, const wxSize
& minsz
,
1346 int nrows
, int ncols
)
1348 // what to do with the rows? by default, resize them proportionally
1349 if ( sz
.y
> minsz
.y
&& ( (m_flexDirection
& wxVERTICAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1351 int sum_proportions
= 0;
1352 int growable_space
= 0;
1355 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1357 // Since the number of rows/columns can change as items are
1358 // inserted/deleted, we need to verify at runtime that the
1359 // requested growable rows/columns are still valid.
1360 if (m_growableRows
[idx
] >= nrows
)
1363 // If all items in a row/column are hidden, that row/column will
1364 // have a dimension of -1. This causes the row/column to be
1365 // hidden completely.
1366 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1368 sum_proportions
+= m_growableRowsProportions
[idx
];
1369 growable_space
+= m_rowHeights
[ m_growableRows
[idx
] ];
1375 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
1377 if (m_growableRows
[idx
] >= nrows
)
1379 if (m_rowHeights
[ m_growableRows
[idx
] ] == -1)
1380 m_rowHeights
[ m_growableRows
[idx
] ] = 0;
1383 int delta
= (sz
.y
- minsz
.y
);
1384 if (sum_proportions
== 0)
1385 delta
= (delta
/num
) + m_rowHeights
[ m_growableRows
[idx
] ];
1387 delta
= ((delta
+growable_space
)*m_growableRowsProportions
[idx
]) / sum_proportions
;
1388 m_rowHeights
[ m_growableRows
[idx
] ] = delta
;
1393 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.y
> minsz
.y
) )
1395 // rounding problem?
1396 for ( int row
= 0; row
< nrows
; ++row
)
1397 m_rowHeights
[ row
] = sz
.y
/ nrows
;
1400 // the same logic as above but for the columns
1401 if ( sz
.x
> minsz
.x
&& ( (m_flexDirection
& wxHORIZONTAL
) || (m_growMode
== wxFLEX_GROWMODE_SPECIFIED
) ) )
1403 int sum_proportions
= 0;
1404 int growable_space
= 0;
1407 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1409 // Since the number of rows/columns can change as items are
1410 // inserted/deleted, we need to verify at runtime that the
1411 // requested growable rows/columns are still valid.
1412 if (m_growableCols
[idx
] >= ncols
)
1415 // If all items in a row/column are hidden, that row/column will
1416 // have a dimension of -1. This causes the column to be hidden
1418 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1420 sum_proportions
+= m_growableColsProportions
[idx
];
1421 growable_space
+= m_colWidths
[ m_growableCols
[idx
] ];
1427 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
1429 if (m_growableCols
[idx
] >= ncols
)
1431 if (m_colWidths
[ m_growableCols
[idx
] ] == -1)
1432 m_colWidths
[ m_growableCols
[idx
] ] = 0;
1435 int delta
= (sz
.x
- minsz
.x
);
1436 if (sum_proportions
== 0)
1437 delta
= (delta
/num
) + m_colWidths
[ m_growableCols
[idx
] ];
1439 delta
= ((delta
+growable_space
)*m_growableColsProportions
[idx
])/sum_proportions
;
1440 m_colWidths
[ m_growableCols
[idx
] ] = delta
;
1445 else if ( (m_growMode
== wxFLEX_GROWMODE_ALL
) && (sz
.x
> minsz
.x
) )
1447 for ( int col
=0; col
< ncols
; ++col
)
1448 m_colWidths
[ col
] = sz
.x
/ ncols
;
1453 void wxFlexGridSizer::AddGrowableRow( size_t idx
, int proportion
)
1455 m_growableRows
.Add( idx
);
1456 m_growableRowsProportions
.Add( proportion
);
1459 void wxFlexGridSizer::RemoveGrowableRow( size_t idx
)
1461 m_growableRows
.Remove( idx
);
1464 void wxFlexGridSizer::AddGrowableCol( size_t idx
, int proportion
)
1466 m_growableCols
.Add( idx
);
1467 m_growableColsProportions
.Add( proportion
);
1470 void wxFlexGridSizer::RemoveGrowableCol( size_t idx
)
1472 m_growableCols
.Remove( idx
);
1475 //---------------------------------------------------------------------------
1477 //---------------------------------------------------------------------------
1479 wxBoxSizer::wxBoxSizer( int orient
)
1480 : m_orient( orient
)
1484 void wxBoxSizer::RecalcSizes()
1486 if (m_children
.GetCount() == 0)
1492 if (m_orient
== wxHORIZONTAL
)
1493 delta
= m_size
.x
- m_fixedWidth
;
1495 delta
= m_size
.y
- m_fixedHeight
;
1498 wxPoint
pt( m_position
);
1500 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1503 wxSizerItem
*item
= node
->GetData();
1505 if (item
->IsShown())
1507 wxSize
size( item
->GetMinSizeWithBorder() );
1509 if (m_orient
== wxVERTICAL
)
1511 wxCoord height
= size
.y
;
1512 if (item
->GetProportion())
1514 // Because of at least one visible item has non-zero
1515 // proportion then m_stretchable is not zero
1516 height
= (delta
* item
->GetProportion()) / m_stretchable
;
1519 wxPoint
child_pos( pt
);
1520 wxSize
child_size( size
.x
, height
);
1522 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1523 child_size
.x
= m_size
.x
;
1524 else if (item
->GetFlag() & wxALIGN_RIGHT
)
1525 child_pos
.x
+= m_size
.x
- size
.x
;
1526 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
1527 // XXX wxCENTER is added for backward compatibility;
1528 // wxALIGN_CENTER should be used in new code
1529 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
1531 item
->SetDimension( child_pos
, child_size
);
1537 wxCoord width
= size
.x
;
1538 if (item
->GetProportion())
1540 // Because of at least one visible item has non-zero
1541 // proportion then m_stretchable is not zero
1542 width
= (delta
* item
->GetProportion()) / m_stretchable
;
1545 wxPoint
child_pos( pt
);
1546 wxSize
child_size( width
, size
.y
);
1548 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
1549 child_size
.y
= m_size
.y
;
1550 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
1551 child_pos
.y
+= m_size
.y
- size
.y
;
1552 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
1553 // XXX wxCENTER is added for backward compatibility;
1554 // wxALIGN_CENTER should be used in new code
1555 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
1557 item
->SetDimension( child_pos
, child_size
);
1563 node
= node
->GetNext();
1567 wxSize
wxBoxSizer::CalcMin()
1569 if (m_children
.GetCount() == 0)
1570 return wxSize(10,10);
1578 // precalc item minsizes and count proportions
1579 wxSizerItemList::compatibility_iterator node
= m_children
.GetFirst();
1582 wxSizerItem
*item
= node
->GetData();
1584 if ( item
->IsShown() )
1586 item
->CalcMin(); // result is stored in the item
1588 m_stretchable
+= item
->GetProportion();
1591 node
= node
->GetNext();
1594 // Total minimum size (width or height) of sizer
1597 node
= m_children
.GetFirst();
1600 wxSizerItem
*item
= node
->GetData();
1602 if (item
->IsShown() && item
->GetProportion() != 0)
1604 int stretch
= item
->GetProportion();
1605 wxSize
size( item
->GetMinSizeWithBorder() );
1608 // Integer division rounded up is (a + b - 1) / b
1609 // Round up needed in order to guarantee that all
1610 // all items will have size not less then their min size
1611 if (m_orient
== wxHORIZONTAL
)
1612 minSize
= ( size
.x
*m_stretchable
+ stretch
- 1)/stretch
;
1614 minSize
= ( size
.y
*m_stretchable
+ stretch
- 1)/stretch
;
1616 if (minSize
> maxMinSize
)
1617 maxMinSize
= minSize
;
1619 node
= node
->GetNext();
1622 // Calculate overall minimum size
1623 node
= m_children
.GetFirst();
1626 wxSizerItem
*item
= node
->GetData();
1628 if (item
->IsShown())
1630 wxSize
size( item
->GetMinSizeWithBorder() );
1631 if (item
->GetProportion() != 0)
1633 if (m_orient
== wxHORIZONTAL
)
1634 size
.x
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1636 size
.y
= (maxMinSize
*item
->GetProportion())/m_stretchable
;
1640 if (m_orient
== wxVERTICAL
)
1642 m_fixedHeight
+= size
.y
;
1643 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
1647 m_fixedWidth
+= size
.x
;
1648 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
1652 if (m_orient
== wxHORIZONTAL
)
1654 m_minWidth
+= size
.x
;
1655 m_minHeight
= wxMax( m_minHeight
, size
.y
);
1659 m_minHeight
+= size
.y
;
1660 m_minWidth
= wxMax( m_minWidth
, size
.x
);
1663 node
= node
->GetNext();
1666 return wxSize( m_minWidth
, m_minHeight
);
1669 //---------------------------------------------------------------------------
1671 //---------------------------------------------------------------------------
1675 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
1676 : wxBoxSizer( orient
)
1677 , m_staticBox( box
)
1679 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
1682 wxStaticBoxSizer::wxStaticBoxSizer(int orient
, wxWindow
*win
, const wxString
& s
)
1683 : wxBoxSizer(orient
),
1684 m_staticBox(new wxStaticBox(win
, wxID_ANY
, s
))
1688 static void GetStaticBoxBorders( wxStaticBox
*box
,
1692 // this has to be done platform by platform as there is no way to
1693 // guess the thickness of a wxStaticBox border
1694 box
->GetBordersForSizer(borderTop
, borderOther
);
1697 void wxStaticBoxSizer::RecalcSizes()
1699 int top_border
, other_border
;
1700 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1702 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1704 wxPoint
old_pos( m_position
);
1705 m_position
.x
+= other_border
;
1706 m_position
.y
+= top_border
;
1707 wxSize
old_size( m_size
);
1708 m_size
.x
-= 2*other_border
;
1709 m_size
.y
-= top_border
+ other_border
;
1711 wxBoxSizer::RecalcSizes();
1713 m_position
= old_pos
;
1717 wxSize
wxStaticBoxSizer::CalcMin()
1719 int top_border
, other_border
;
1720 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1722 wxSize
ret( wxBoxSizer::CalcMin() );
1723 ret
.x
+= 2*other_border
;
1724 ret
.y
+= other_border
+ top_border
;
1729 void wxStaticBoxSizer::ShowItems( bool show
)
1731 m_staticBox
->Show( show
);
1732 wxBoxSizer::ShowItems( show
);
1735 #endif // wxUSE_STATBOX
1739 wxStdDialogButtonSizer::wxStdDialogButtonSizer()
1740 : wxBoxSizer(wxHORIZONTAL
)
1742 // Vertical buttons with lots of space on either side
1743 // looks rubbish on WinCE, so let's not do this for now.
1744 // If we are going to use vertical buttons, we should
1745 // put the sizer to the right of other controls in the dialog,
1746 // and that's beyond the scope of this sizer.
1748 bool is_pda
= (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA
);
1749 // If we have a PDA screen, put yes/no button over
1750 // all other buttons, otherwise on the left side.
1752 m_orient
= wxVERTICAL
;
1755 m_buttonAffirmative
= NULL
;
1756 m_buttonApply
= NULL
;
1757 m_buttonNegative
= NULL
;
1758 m_buttonCancel
= NULL
;
1759 m_buttonHelp
= NULL
;
1762 void wxStdDialogButtonSizer::AddButton(wxButton
*mybutton
)
1764 switch (mybutton
->GetId())
1769 m_buttonAffirmative
= mybutton
;
1772 m_buttonApply
= mybutton
;
1775 m_buttonNegative
= mybutton
;
1778 m_buttonCancel
= mybutton
;
1781 case wxID_CONTEXT_HELP
:
1782 m_buttonHelp
= mybutton
;
1789 void wxStdDialogButtonSizer::SetAffirmativeButton( wxButton
*button
)
1791 m_buttonAffirmative
= button
;
1794 void wxStdDialogButtonSizer::SetNegativeButton( wxButton
*button
)
1796 m_buttonNegative
= button
;
1799 void wxStdDialogButtonSizer::SetCancelButton( wxButton
*button
)
1801 m_buttonCancel
= button
;
1804 void wxStdDialogButtonSizer::Realize()
1807 Add(0, 0, 0, wxLEFT
, 6);
1809 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1811 if (m_buttonNegative
){
1812 // HIG POLICE BULLETIN - destructive buttons need extra padding
1813 // 24 pixels on either side
1814 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 12);
1817 // extra whitespace between help/negative and cancel/ok buttons
1818 Add(0, 0, 1, wxEXPAND
, 0);
1820 if (m_buttonCancel
){
1821 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1822 // Cancel or help should be default
1823 // m_buttonCancel->SetDefaultButton();
1826 // Ugh, Mac doesn't really have apply dialogs, so I'll just
1827 // figure the best place is between Cancel and OK
1829 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 6);
1831 if (m_buttonAffirmative
){
1832 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1834 if (m_buttonAffirmative
->GetId() == wxID_SAVE
){
1835 // these buttons have set labels under Mac so we should use them
1836 m_buttonAffirmative
->SetLabel(_("Save"));
1837 m_buttonNegative
->SetLabel(_("Don't Save"));
1841 // Extra space around and at the right
1843 #elif defined(__WXGTK20__)
1844 Add(0, 0, 0, wxLEFT
, 9);
1846 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1848 // extra whitespace between help and cancel/ok buttons
1849 Add(0, 0, 1, wxEXPAND
, 0);
1851 if (m_buttonNegative
){
1852 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1855 if (m_buttonCancel
){
1856 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1857 // Cancel or help should be default
1858 // m_buttonCancel->SetDefaultButton();
1862 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, 3);
1864 if (m_buttonAffirmative
)
1865 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
, 6);
1866 #elif defined(__WXMSW__)
1869 // right-justify buttons
1870 Add(0, 0, 1, wxEXPAND
, 0);
1872 if (m_buttonAffirmative
){
1873 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1876 if (m_buttonNegative
){
1877 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1880 if (m_buttonCancel
){
1881 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1884 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1887 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(2, 0)).x
);
1889 // GTK+1 and any other platform
1891 // Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
1893 Add((wxWindow
*)m_buttonHelp
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonHelp
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1895 // extra whitespace between help and cancel/ok buttons
1896 Add(0, 0, 1, wxEXPAND
, 0);
1899 Add((wxWindow
*)m_buttonApply
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonApply
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1901 if (m_buttonAffirmative
){
1902 Add((wxWindow
*)m_buttonAffirmative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonAffirmative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1905 if (m_buttonNegative
){
1906 Add((wxWindow
*)m_buttonNegative
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonNegative
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1909 if (m_buttonCancel
){
1910 Add((wxWindow
*)m_buttonCancel
, 0, wxALIGN_CENTRE
| wxLEFT
| wxRIGHT
, m_buttonCancel
->ConvertDialogToPixels(wxSize(4, 0)).x
);
1911 // Cancel or help should be default
1912 // m_buttonCancel->SetDefaultButton();
1918 #endif // wxUSE_BUTTON
1920 #if WXWIN_COMPATIBILITY_2_4
1922 // ----------------------------------------------------------------------------
1924 // ----------------------------------------------------------------------------
1927 IMPLEMENT_CLASS(wxBookCtrlSizer
, wxSizer
)
1929 IMPLEMENT_CLASS(wxNotebookSizer
, wxBookCtrlSizer
)
1930 #endif // wxUSE_NOTEBOOK
1931 #endif // wxUSE_BOOKCTRL
1935 wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase
*bookctrl
)
1936 : m_bookctrl(bookctrl
)
1938 wxASSERT_MSG( bookctrl
, wxT("wxBookCtrlSizer needs a control") );
1941 void wxBookCtrlSizer::RecalcSizes()
1943 m_bookctrl
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1946 wxSize
wxBookCtrlSizer::CalcMin()
1948 wxSize sizeBorder
= m_bookctrl
->CalcSizeFromPage(wxSize(0,0));
1953 if ( m_bookctrl
->GetPageCount() == 0 )
1955 return wxSize(sizeBorder
.x
+ 10, sizeBorder
.y
+ 10);
1961 wxWindowList::compatibility_iterator
1962 node
= m_bookctrl
->GetChildren().GetFirst();
1965 wxWindow
*item
= node
->GetData();
1966 wxSizer
*itemsizer
= item
->GetSizer();
1970 wxSize
subsize( itemsizer
->CalcMin() );
1972 if (subsize
.x
> maxX
)
1974 if (subsize
.y
> maxY
)
1978 node
= node
->GetNext();
1981 return wxSize( maxX
, maxY
) + sizeBorder
;
1986 wxNotebookSizer::wxNotebookSizer(wxNotebook
*nb
)
1988 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a control") );
1992 #endif // wxUSE_NOTEBOOOK
1993 #endif // wxUSE_BOOKCTRL
1995 #endif // WXWIN_COMPATIBILITY_2_4