(thanks to Dimitri) and a few updates to the docs after the recent changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15828
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
\membersection{wxSizer::Fit}\label{wxsizerfit}
\membersection{wxSizer::Fit}\label{wxsizerfit}
-\func{void}{Fit}{\param{wxWindow* }{window}}
+\func{wxSize}{Fit}{\param{wxWindow* }{window}}
Tell the sizer to resize the {\it window} to match the sizer's minimal size. This
is commonly done in the constructor of the window itself, see sample in the description
Tell the sizer to resize the {\it window} to match the sizer's minimal size. This
is commonly done in the constructor of the window itself, see sample in the description
-of \helpref{wxBoxSizer}{wxboxsizer}.
+of \helpref{wxBoxSizer}{wxboxsizer}. Returns the new size.
\membersection{wxSizer::FitInside}\label{wxsizerfitinside}
\membersection{wxSizer::FitInside}\label{wxsizerfitinside}
0, // make vertically unstretchable
wxALIGN_CENTER ); // no border and centre horizontally
0, // make vertically unstretchable
wxALIGN_CENTER ); // no border and centre horizontally
- SetAutoLayout( TRUE ); // tell dialog to use sizer
- SetSizer( topsizer ); // actually set the sizer
+ SetSizer( topsizer ); // use the sizer for layout
- topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour minimum size
}
\end{verbatim}
topsizer->SetSizeHints( this ); // set size hints to honour minimum size
}
\end{verbatim}
\func{void}{SetAutoLayout}{\param{bool}{ autoLayout}}
Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
\func{void}{SetAutoLayout}{\param{bool}{ autoLayout}}
Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
-be called automatically when the window is resized. Use in connection with
-\helpref{wxWindow::SetSizer}{wxwindowsetsizer} and
-\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for laying out
-subwindows.
+be called automatically when the window is resized. It is called implicitly by
+\helpref{wxWindow::SetSizer}{wxwindowsetsizer} but if you use
+\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} you should call it
+manually or otherwise the window layout won't be correctly updated when its
+size changes.
If an existing layout constraints object is already owned by the
window, it will be deleted if the deleteOld parameter is TRUE.
If an existing layout constraints object is already owned by the
window, it will be deleted if the deleteOld parameter is TRUE.
+Note that this function will also call
+\helpref{SetAutoLayout}{wxwindowsetautolayout} implicitly with {\tt TRUE}
+parameter if the {\it sizer}\/ is non-NULL and {\tt FALSE} otherwise.
+
\wxheading{Parameters}
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete
\wxheading{Parameters}
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete
- void Fit( wxWindow *window );
+ wxSize Fit( wxWindow *window );
void FitInside( wxWindow *window );
void SetSizeHints( wxWindow *window );
void SetVirtualSizeHints( wxWindow *window );
void FitInside( wxWindow *window );
void SetSizeHints( wxWindow *window );
void SetVirtualSizeHints( wxWindow *window );
-void wxSizer::Fit( wxWindow *window )
+wxSize wxSizer::Fit( wxWindow *window )
{
wxSize size;
if (window->IsTopLevel())
{
wxSize size;
if (window->IsTopLevel())
else
size = GetMinWindowSize( window );
else
size = GetMinWindowSize( window );
- //window->SetClientSize( size );
}
void wxSizer::FitInside( wxWindow *window )
}
void wxSizer::FitInside( wxWindow *window )
// Preserve the window's max size hints, but set the
// lower bound according to the sizer calculations.
// Preserve the window's max size hints, but set the
// lower bound according to the sizer calculations.
- Fit( window );
- wxSize size( window->GetSize() );
+ wxSize size = Fit( window );
+
window->SetSizeHints( size.x,
size.y,
window->GetMaxWidth(),
window->SetSizeHints( size.x,
size.y,
window->GetMaxWidth(),