1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: provide new wxSizer class for layout
4 // Author: Robert Roebling and Robin Dunn
8 // Copyright: (c) Robin Dunn, Dirk Holtwick and Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "sizer.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
25 #include "wx/statbox.h"
26 #include "wx/notebook.h"
28 //---------------------------------------------------------------------------
30 IMPLEMENT_ABSTRACT_CLASS(wxSizerItem
, wxObject
);
31 IMPLEMENT_ABSTRACT_CLASS(wxSizer
, wxObject
);
32 IMPLEMENT_ABSTRACT_CLASS(wxGridSizer
, wxSizer
);
33 IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer
, wxGridSizer
);
34 IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer
, wxSizer
);
35 IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer
, wxBoxSizer
);
37 IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer
, wxSizer
);
40 //---------------------------------------------------------------------------
42 //---------------------------------------------------------------------------
44 wxSizerItem::wxSizerItem( int width
, int height
, int option
, int flag
, int border
, wxObject
* userData
)
46 m_window
= (wxWindow
*) NULL
;
47 m_sizer
= (wxSizer
*) NULL
;
51 m_userData
= userData
;
53 // minimal size is the initial size
57 SetRatio(width
, height
);
59 // size is set directly
63 wxSizerItem::wxSizerItem( wxWindow
*window
, int option
, int flag
, int border
, wxObject
* userData
)
66 m_sizer
= (wxSizer
*) NULL
;
70 m_userData
= userData
;
72 // minimal size is the initial size
73 m_minSize
= window
->GetSize();
75 // aspect ratio calculated from initial size
78 // size is calculated later
82 wxSizerItem::wxSizerItem( wxSizer
*sizer
, int option
, int flag
, int border
, wxObject
* userData
)
84 m_window
= (wxWindow
*) NULL
;
89 m_userData
= userData
;
91 // minimal size is calculated later
95 // size is calculated later
99 wxSizerItem::~wxSizerItem()
108 wxSize
wxSizerItem::GetSize()
112 ret
= m_sizer
->GetSize();
115 ret
= m_window
->GetSize();
122 if (m_flag
& wxNORTH
)
124 if (m_flag
& wxSOUTH
)
130 wxSize
wxSizerItem::CalcMin()
135 ret
= m_sizer
->GetMinSize();
137 // if we have to preserve aspect ratio _AND_ this is
138 // the first-time calculation, consider ret to be initial size
139 if ((m_flag
& wxSHAPED
) && !m_ratio
)
144 if ( IsWindow() && (m_flag
& wxADJUST_MINSIZE
) )
146 // check if the best (minimal, in fact) window size hadn't changed
147 // by chance: this may happen for, e.g. static text if its label
149 wxSize size
= m_window
->GetBestSize();
150 if ( size
.x
> m_minSize
.x
)
151 m_minSize
.x
= size
.x
;
152 if ( size
.y
> m_minSize
.y
)
153 m_minSize
.y
= size
.y
;
163 if (m_flag
& wxNORTH
)
165 if (m_flag
& wxSOUTH
)
171 void wxSizerItem::SetDimension( wxPoint pos
, wxSize size
)
173 if (m_flag
& wxSHAPED
)
175 // adjust aspect ratio
176 int rwidth
= (int) (size
.y
* m_ratio
);
180 int rheight
= (int) (size
.x
/ m_ratio
);
181 // add vertical space
182 if (m_flag
& wxALIGN_CENTER_VERTICAL
)
183 pos
.y
+= (size
.y
- rheight
) / 2;
184 else if (m_flag
& wxALIGN_BOTTOM
)
185 pos
.y
+= (size
.y
- rheight
);
186 // use reduced dimensions
189 else if (rwidth
< size
.x
)
191 // add horizontal space
192 if (m_flag
& wxALIGN_CENTER_HORIZONTAL
)
193 pos
.x
+= (size
.x
- rwidth
) / 2;
194 else if (m_flag
& wxALIGN_RIGHT
)
195 pos
.x
+= (size
.x
- rwidth
);
200 // This is what GetPosition() returns. Since we calculate
201 // borders afterwards, GetPosition() will be the left/top
202 // corner of the surrounding border.
214 if (m_flag
& wxNORTH
)
219 if (m_flag
& wxSOUTH
)
225 m_sizer
->SetDimension( pos
.x
, pos
.y
, size
.x
, size
.y
);
228 m_window
->SetSize( pos
.x
, pos
.y
, size
.x
, size
.y
, wxSIZE_ALLOW_MINUS_ONE
);
233 bool wxSizerItem::IsWindow()
235 return (m_window
!= NULL
);
238 bool wxSizerItem::IsSizer()
240 return (m_sizer
!= NULL
);
243 bool wxSizerItem::IsSpacer()
245 return (m_window
== NULL
) && (m_sizer
== NULL
);
248 //---------------------------------------------------------------------------
250 //---------------------------------------------------------------------------
254 m_children
.DeleteContents( TRUE
);
263 void wxSizer::Add( wxWindow
*window
, int option
, int flag
, int border
, wxObject
* userData
)
265 m_children
.Append( new wxSizerItem( window
, option
, flag
, border
, userData
) );
268 void wxSizer::Add( wxSizer
*sizer
, int option
, int flag
, int border
, wxObject
* userData
)
270 m_children
.Append( new wxSizerItem( sizer
, option
, flag
, border
, userData
) );
273 void wxSizer::Add( int width
, int height
, int option
, int flag
, int border
, wxObject
* userData
)
275 m_children
.Append( new wxSizerItem( width
, height
, option
, flag
, border
, userData
) );
278 void wxSizer::Prepend( wxWindow
*window
, int option
, int flag
, int border
, wxObject
* userData
)
280 m_children
.Insert( new wxSizerItem( window
, option
, flag
, border
, userData
) );
283 void wxSizer::Prepend( wxSizer
*sizer
, int option
, int flag
, int border
, wxObject
* userData
)
285 m_children
.Insert( new wxSizerItem( sizer
, option
, flag
, border
, userData
) );
288 void wxSizer::Prepend( int width
, int height
, int option
, int flag
, int border
, wxObject
* userData
)
290 m_children
.Insert( new wxSizerItem( width
, height
, option
, flag
, border
, userData
) );
293 void wxSizer::Insert( int before
, wxWindow
*window
, int option
, int flag
, int border
, wxObject
* userData
)
295 m_children
.Insert( before
, new wxSizerItem( window
, option
, flag
, border
, userData
) );
298 void wxSizer::Insert( int before
, wxSizer
*sizer
, int option
, int flag
, int border
, wxObject
* userData
)
300 m_children
.Insert( before
, new wxSizerItem( sizer
, option
, flag
, border
, userData
) );
303 void wxSizer::Insert( int before
, int width
, int height
, int option
, int flag
, int border
, wxObject
* userData
)
305 m_children
.Insert( before
, new wxSizerItem( width
, height
, option
, flag
, border
, userData
) );
308 bool wxSizer::Remove( wxWindow
*window
)
312 wxNode
*node
= m_children
.First();
315 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
316 if (item
->GetWindow() == window
)
318 m_children
.DeleteNode( node
);
327 bool wxSizer::Remove( wxSizer
*sizer
)
331 wxNode
*node
= m_children
.First();
334 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
335 if (item
->GetSizer() == sizer
)
337 m_children
.DeleteNode( node
);
346 bool wxSizer::Remove( int pos
)
348 wxNode
*node
= m_children
.Nth( pos
);
349 if (!node
) return FALSE
;
351 m_children
.DeleteNode( node
);
356 void wxSizer::Fit( wxWindow
*window
)
358 window
->SetSize( GetMinWindowSize( window
) );
361 void wxSizer::Layout()
367 void wxSizer::SetSizeHints( wxWindow
*window
)
369 wxSize
size( GetMinWindowSize( window
) );
370 window
->SetSizeHints( size
.x
, size
.y
);
373 wxSize
wxSizer::GetMinWindowSize( wxWindow
*window
)
375 wxSize
minSize( GetMinSize() );
376 wxSize
size( window
->GetSize() );
377 wxSize
client_size( window
->GetClientSize() );
378 return wxSize( minSize
.x
+size
.x
-client_size
.x
,
379 minSize
.y
+size
.y
-client_size
.y
);
382 void wxSizer::SetDimension( int x
, int y
, int width
, int height
)
392 wxSize
wxSizer::GetMinSize()
394 wxSize
ret( CalcMin() );
395 if (ret
.x
< m_minSize
.x
) ret
.x
= m_minSize
.x
;
396 if (ret
.y
< m_minSize
.y
) ret
.y
= m_minSize
.y
;
400 void wxSizer::DoSetMinSize( int width
, int height
)
403 m_minSize
.y
= height
;
406 bool wxSizer::DoSetItemMinSize( wxWindow
*window
, int width
, int height
)
410 wxNode
*node
= m_children
.First();
413 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
414 if (item
->GetWindow() == window
)
416 item
->SetInitSize( width
, height
);
422 node
= m_children
.First();
425 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
426 if (item
->GetSizer())
428 /* It's a sizer, so lets search recursively. */
429 if (item
->GetSizer()->DoSetItemMinSize( window
, width
, height
))
431 /* A child sizer found the requested windw, exit. */
441 bool wxSizer::DoSetItemMinSize( wxSizer
*sizer
, int width
, int height
)
445 wxNode
*node
= m_children
.First();
448 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
449 if (item
->GetSizer() == sizer
)
451 item
->GetSizer()->DoSetMinSize( width
, height
);
457 node
= m_children
.First();
460 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
461 if (item
->GetSizer())
463 /* It's a sizer, so lets search recursively. */
464 if (item
->GetSizer()->DoSetItemMinSize( sizer
, width
, height
))
466 /* A child sizer found the requested windw, exit. */
476 bool wxSizer::DoSetItemMinSize( int pos
, int width
, int height
)
478 wxNode
*node
= m_children
.Nth( pos
);
479 if (!node
) return FALSE
;
481 wxSizerItem
*item
= (wxSizerItem
*) node
->Data();
482 if (item
->GetSizer())
484 /* Sizers contains the minimal size in them, if not calculated ... */
485 item
->GetSizer()->DoSetMinSize( width
, height
);
489 /* ... whereas the minimal size of spacers and windows in stored
491 item
->SetInitSize( width
, height
);
497 //---------------------------------------------------------------------------
499 //---------------------------------------------------------------------------
501 wxGridSizer::wxGridSizer( int rows
, int cols
, int vgap
, int hgap
)
509 wxGridSizer::wxGridSizer( int cols
, int vgap
, int hgap
)
517 void wxGridSizer::RecalcSizes()
519 if (m_children
.GetCount() == 0)
522 int nitems
= m_children
.GetCount();
527 nrows
= (nitems
+ ncols
-1) / ncols
;
529 ncols
= (nitems
+ nrows
-1) / nrows
;
531 wxSize
sz( GetSize() );
532 wxPoint
pt( GetPosition() );
534 int w
= (sz
.x
- (ncols
- 1) * m_hgap
) / ncols
;
535 int h
= (sz
.y
- (nrows
- 1) * m_vgap
) / nrows
;
538 for (int c
= 0; c
< ncols
; c
++)
541 for (int r
= 0; r
< nrows
; r
++)
543 int i
= r
* ncols
+ c
;
546 wxNode
*node
= m_children
.Nth( i
);
549 SetItemBounds( (wxSizerItem
*) node
->Data(), x
, y
, w
, h
);
557 wxSize
wxGridSizer::CalcMin()
559 if (m_children
.GetCount() == 0)
560 return wxSize(10,10);
562 int nitems
= m_children
.GetCount();
567 nrows
= (nitems
+ ncols
-1) / ncols
;
569 ncols
= (nitems
+ nrows
-1) / nrows
;
571 /* Find the max width and height for any component */
575 wxNode
*node
= m_children
.First();
578 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
579 wxSize
sz( item
->CalcMin() );
580 w
= wxMax( w
, sz
.x
);
581 h
= wxMax( h
, sz
.y
);
586 return wxSize(ncols
* w
+ (ncols
-1) * m_hgap
,
587 nrows
* h
+ (nrows
-1) * m_vgap
);
590 void wxGridSizer::SetItemBounds( wxSizerItem
*item
, int x
, int y
, int w
, int h
)
593 wxSize
sz( item
->CalcMin() );
594 int flag
= item
->GetFlag();
596 if ((flag
& wxEXPAND
) || (flag
& wxSHAPED
))
602 if (flag
& wxALIGN_CENTER_HORIZONTAL
)
604 pt
.x
= x
+ (w
- sz
.x
) / 2;
606 else if (flag
& wxALIGN_RIGHT
)
608 pt
.x
= x
+ (w
- sz
.x
);
611 if (flag
& wxALIGN_CENTER_VERTICAL
)
613 pt
.y
= y
+ (h
- sz
.y
) / 2;
615 else if (flag
& wxALIGN_BOTTOM
)
617 pt
.y
= y
+ (h
- sz
.y
);
621 item
->SetDimension(pt
, sz
);
624 //---------------------------------------------------------------------------
626 //---------------------------------------------------------------------------
628 wxFlexGridSizer::wxFlexGridSizer( int rows
, int cols
, int vgap
, int hgap
)
629 : wxGridSizer( rows
, cols
, vgap
, hgap
)
631 m_rowHeights
= (int*) NULL
;
632 m_colWidths
= (int*) NULL
;
635 wxFlexGridSizer::wxFlexGridSizer( int cols
, int vgap
, int hgap
)
636 : wxGridSizer( cols
, vgap
, hgap
)
638 m_rowHeights
= (int*) NULL
;
639 m_colWidths
= (int*) NULL
;
642 wxFlexGridSizer::~wxFlexGridSizer()
645 delete[] m_rowHeights
;
647 delete[] m_colWidths
;
650 void wxFlexGridSizer::CreateArrays()
653 delete[] m_rowHeights
;
655 delete[] m_colWidths
;
657 if (m_children
.GetCount() == 0)
660 int nitems
= m_children
.GetCount();
665 nrows
= (nitems
+ ncols
-1) / ncols
;
667 ncols
= (nitems
+ nrows
-1) / nrows
;
669 m_rowHeights
= new int[nrows
];
670 m_colWidths
= new int[ncols
];
672 for (int col
= 0; col
< ncols
; col
++)
673 m_colWidths
[ col
] = 0;
674 for (int row
= 0; row
< nrows
; row
++)
675 m_rowHeights
[ row
] = 0;
678 void wxFlexGridSizer::RecalcSizes()
680 if (m_children
.GetCount() == 0)
683 int nitems
= m_children
.GetCount();
688 nrows
= (nitems
+ ncols
-1) / ncols
;
690 ncols
= (nitems
+ nrows
-1) / nrows
;
692 wxSize
sz( GetSize() );
693 wxSize
minsz( CalcMin() );
694 wxPoint
pt( GetPosition() );
698 if ((m_growableRows
.GetCount() > 0) && (sz
.y
> minsz
.y
))
700 delta
= (sz
.y
- minsz
.y
) / m_growableRows
.GetCount();
701 for (idx
= 0; idx
< m_growableRows
.GetCount(); idx
++)
702 m_rowHeights
[ m_growableRows
[idx
] ] += delta
;
705 if ((m_growableCols
.GetCount() > 0) && (sz
.x
> minsz
.x
))
707 delta
= (sz
.x
- minsz
.x
) / m_growableCols
.GetCount();
708 for (idx
= 0; idx
< m_growableCols
.GetCount(); idx
++)
709 m_colWidths
[ m_growableCols
[idx
] ] += delta
;
712 sz
= wxSize( pt
.x
+ sz
.x
, pt
.y
+ sz
.y
);
715 for (int c
= 0; c
< ncols
; c
++)
718 for (int r
= 0; r
< nrows
; r
++)
720 int i
= r
* ncols
+ c
;
723 wxNode
*node
= m_children
.Nth( i
);
726 int w
= wxMax( 0, wxMin( m_colWidths
[c
], sz
.x
- x
) );
727 int h
= wxMax( 0, wxMin( m_rowHeights
[r
], sz
.y
- y
) );
729 SetItemBounds( (wxSizerItem
*) node
->Data(), x
, y
, w
, h
);
731 y
= y
+ m_rowHeights
[r
] + m_vgap
;
733 x
= x
+ m_colWidths
[c
] + m_hgap
;
737 wxSize
wxFlexGridSizer::CalcMin()
739 if (m_children
.GetCount() == 0)
740 return wxSize(10,10);
742 int nitems
= m_children
.GetCount();
747 nrows
= (nitems
+ ncols
-1) / ncols
;
749 ncols
= (nitems
+ nrows
-1) / nrows
;
757 wxNode
*node
= m_children
.First();
760 wxSizerItem
*item
= (wxSizerItem
*)node
->Data();
761 wxSize
sz( item
->CalcMin() );
764 m_rowHeights
[ row
] = wxMax( sz
.y
, m_rowHeights
[ row
] );
765 m_colWidths
[ col
] = wxMax( sz
.x
, m_colWidths
[ col
] );
772 for (col
= 0; col
< ncols
; col
++)
773 width
+= m_colWidths
[ col
];
776 for (row
= 0; row
< nrows
; row
++)
777 height
+= m_rowHeights
[ row
];
779 return wxSize( width
+ (ncols
-1) * m_hgap
,
780 height
+ (nrows
-1) * m_vgap
);
783 void wxFlexGridSizer::AddGrowableRow( size_t idx
)
785 m_growableRows
.Add( idx
);
788 void wxFlexGridSizer::RemoveGrowableRow( size_t WXUNUSED(idx
) )
792 void wxFlexGridSizer::AddGrowableCol( size_t idx
)
794 m_growableCols
.Add( idx
);
797 void wxFlexGridSizer::RemoveGrowableCol( size_t WXUNUSED(idx
) )
801 //---------------------------------------------------------------------------
803 //---------------------------------------------------------------------------
805 wxBoxSizer::wxBoxSizer( int orient
)
810 void wxBoxSizer::RecalcSizes()
812 if (m_children
.GetCount() == 0)
819 if (m_orient
== wxHORIZONTAL
)
821 delta
= (m_size
.x
- m_fixedWidth
) / m_stretchable
;
822 extra
= (m_size
.x
- m_fixedWidth
) % m_stretchable
;
826 delta
= (m_size
.y
- m_fixedHeight
) / m_stretchable
;
827 extra
= (m_size
.y
- m_fixedHeight
) % m_stretchable
;
831 wxPoint
pt( m_position
);
833 wxNode
*node
= m_children
.GetFirst();
836 wxSizerItem
*item
= (wxSizerItem
*) node
->Data();
839 if (item
->GetOption())
840 weight
= item
->GetOption();
842 wxSize
size( item
->CalcMin() );
844 if (m_orient
== wxVERTICAL
)
846 wxCoord height
= size
.y
;
847 if (item
->GetOption())
849 height
= (delta
* weight
) + extra
;
850 extra
= 0; // only the first item will get the remainder as extra size
853 wxPoint
child_pos( pt
);
854 wxSize
child_size( wxSize( size
.x
, height
) );
856 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
857 child_size
.x
= m_size
.x
;
858 else if (item
->GetFlag() & wxALIGN_RIGHT
)
859 child_pos
.x
+= m_size
.x
- size
.x
;
860 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_HORIZONTAL
))
861 // XXX wxCENTER is added for backward compatibility;
862 // wxALIGN_CENTER should be used in new code
863 child_pos
.x
+= (m_size
.x
- size
.x
) / 2;
865 item
->SetDimension( child_pos
, child_size
);
871 wxCoord width
= size
.x
;
872 if (item
->GetOption())
874 width
= (delta
* weight
) + extra
;
875 extra
= 0; // only the first item will get the remainder as extra size
878 wxPoint
child_pos( pt
);
879 wxSize
child_size( wxSize(width
, size
.y
) );
881 if (item
->GetFlag() & (wxEXPAND
| wxSHAPED
))
882 child_size
.y
= m_size
.y
;
883 else if (item
->GetFlag() & wxALIGN_BOTTOM
)
884 child_pos
.y
+= m_size
.y
- size
.y
;
885 else if (item
->GetFlag() & (wxCENTER
| wxALIGN_CENTER_VERTICAL
))
886 // XXX wxCENTER is added for backward compatibility;
887 // wxALIGN_CENTER should be used in new code
888 child_pos
.y
+= (m_size
.y
- size
.y
) / 2;
890 item
->SetDimension( child_pos
, child_size
);
899 wxSize
wxBoxSizer::CalcMin()
901 if (m_children
.GetCount() == 0)
902 return wxSize(10,10);
910 wxNode
*node
= m_children
.GetFirst();
913 wxSizerItem
*item
= (wxSizerItem
*) node
->Data();
915 m_stretchable
+= item
->GetOption();
917 wxSize
size( item
->CalcMin() );
919 if (m_orient
== wxHORIZONTAL
)
921 m_minWidth
+= size
.x
;
922 m_minHeight
= wxMax( m_minHeight
, size
.y
);
926 m_minHeight
+= size
.y
;
927 m_minWidth
= wxMax( m_minWidth
, size
.x
);
930 if (item
->GetOption() == 0)
932 if (m_orient
== wxVERTICAL
)
934 m_fixedHeight
+= size
.y
;
935 m_fixedWidth
= wxMax( m_fixedWidth
, size
.x
);
939 m_fixedWidth
+= size
.x
;
940 m_fixedHeight
= wxMax( m_fixedHeight
, size
.y
);
947 return wxSize( m_minWidth
, m_minHeight
);
950 //---------------------------------------------------------------------------
952 //---------------------------------------------------------------------------
954 wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox
*box
, int orient
)
955 : wxBoxSizer( orient
)
957 wxASSERT_MSG( box
, wxT("wxStaticBoxSizer needs a static box") );
962 static void GetStaticBoxBorders(wxStaticBox
*box
,
963 int *borderTop
, int *borderOther
)
965 // this has to be done platform by platform as there is no way to
966 // guess the thickness of a wxStaticBox border
968 if ( box
->GetLabel().IsEmpty() )
977 void wxStaticBoxSizer::RecalcSizes()
979 int top_border
, other_border
;
980 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
982 m_staticBox
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
984 wxPoint
old_pos( m_position
);
985 m_position
.x
+= other_border
;
986 m_position
.y
+= top_border
;
987 wxSize
old_size( m_size
);
988 m_size
.x
-= 2*other_border
;
989 m_size
.y
-= top_border
+ other_border
;
991 wxBoxSizer::RecalcSizes();
993 m_position
= old_pos
;
997 wxSize
wxStaticBoxSizer::CalcMin()
999 int top_border
, other_border
;
1000 GetStaticBoxBorders(m_staticBox
, &top_border
, &other_border
);
1002 wxSize
ret( wxBoxSizer::CalcMin() );
1003 ret
.x
+= 2*other_border
;
1004 ret
.y
+= other_border
+ top_border
;
1009 //---------------------------------------------------------------------------
1011 //---------------------------------------------------------------------------
1015 wxNotebookSizer::wxNotebookSizer( wxNotebook
*nb
)
1017 wxASSERT_MSG( nb
, wxT("wxNotebookSizer needs a notebook") );
1022 void wxNotebookSizer::RecalcSizes()
1024 m_notebook
->SetSize( m_position
.x
, m_position
.y
, m_size
.x
, m_size
.y
);
1027 wxSize
wxNotebookSizer::CalcMin()
1029 // This will have to be done platform by platform
1030 // as there is no way to guess the thickness of
1031 // the wxNotebook tabs and border.
1035 if ((m_notebook
->HasFlag(wxNB_RIGHT
)) ||
1036 (m_notebook
->HasFlag(wxNB_LEFT
)))
1038 borderX
+= 90; // improvements later..
1042 borderY
+= 40; // improvements later..
1045 if (m_notebook
->GetChildren().GetCount() == 0)
1046 return wxSize(borderX
+ 10, borderY
+ 10);
1051 wxWindowList::Node
*node
= m_notebook
->GetChildren().GetFirst();
1054 wxWindow
*item
= node
->GetData();
1055 wxSizer
*itemsizer
= item
->GetSizer();
1059 wxSize
subsize( itemsizer
->CalcMin() );
1061 if (subsize
.x
> maxX
) maxX
= subsize
.x
;
1062 if (subsize
.y
> maxY
) maxY
= subsize
.y
;
1065 node
= node
->GetNext();
1068 return wxSize( borderX
+ maxX
, borderY
+ maxY
);
1071 #endif // wxUSE_NOTEBOOK