fixes to the sizers behaviour necessary to make the log dialog work again

(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
This commit is contained in:
Vadim Zeitlin
2002-06-13 20:21:20 +00:00
parent aad65f130d
commit e5251d4f78
5 changed files with 18 additions and 14 deletions

View File

@@ -125,11 +125,11 @@ Here, the sizer will do the actual calculation of its children minimal sizes.
\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 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 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}

View File

@@ -252,10 +252,8 @@ MyDialog::MyDialog(wxFrame *parent, wxWindowID id, const wxString &title )
0, // make vertically unstretchable 0, // make vertically unstretchable
wxALIGN_CENTER ); // no border and centre horizontally wxALIGN_CENTER ); // no border and centre horizontally
SetAutoLayout( TRUE ); // tell dialog to use sizer SetSizer( topsizer ); // use the sizer for layout
SetSizer( topsizer ); // actually set the sizer
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour minimum size topsizer->SetSizeHints( this ); // set size hints to honour minimum size
} }
\end{verbatim} \end{verbatim}

View File

@@ -1914,10 +1914,11 @@ Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxa
\func{void}{SetAutoLayout}{\param{bool}{ autoLayout}} \func{void}{SetAutoLayout}{\param{bool}{ autoLayout}}
Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will
be called automatically when the window is resized. Use in connection with be called automatically when the window is resized. It is called implicitly by
\helpref{wxWindow::SetSizer}{wxwindowsetsizer} and \helpref{wxWindow::SetSizer}{wxwindowsetsizer} but if you use
\helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for laying out \helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} you should call it
subwindows. manually or otherwise the window layout won't be correctly updated when its
size changes.
\wxheading{Parameters} \wxheading{Parameters}
@@ -2481,6 +2482,10 @@ will then own the object, and will take care of its deletion.
If an existing layout constraints object is already owned by the If an existing layout constraints object is already owned by the
window, it will be deleted if the deleteOld parameter is TRUE. 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} \wxheading{Parameters}
\docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete \docparam{sizer}{The sizer to set. Pass NULL to disassociate and conditionally delete

View File

@@ -184,7 +184,7 @@ public:
virtual void Layout(); virtual void Layout();
void Fit( wxWindow *window ); wxSize Fit( wxWindow *window );
void FitInside( wxWindow *window ); void FitInside( wxWindow *window );
void SetSizeHints( wxWindow *window ); void SetSizeHints( wxWindow *window );
void SetVirtualSizeHints( wxWindow *window ); void SetVirtualSizeHints( wxWindow *window );

View File

@@ -400,7 +400,7 @@ void wxSizer::DeleteWindows()
} }
} }
void wxSizer::Fit( wxWindow *window ) wxSize wxSizer::Fit( wxWindow *window )
{ {
wxSize size; wxSize size;
if (window->IsTopLevel()) if (window->IsTopLevel())
@@ -408,8 +408,9 @@ void wxSizer::Fit( wxWindow *window )
else else
size = GetMinWindowSize( window ); size = GetMinWindowSize( window );
//window->SetClientSize( size );
window->SetSize( size ); window->SetSize( size );
return size;
} }
void wxSizer::FitInside( wxWindow *window ) void wxSizer::FitInside( wxWindow *window )
@@ -434,8 +435,8 @@ void wxSizer::SetSizeHints( wxWindow *window )
// Preserve the window's max size hints, but set the // Preserve the window's max size hints, but set the
// lower bound according to the sizer calculations. // lower bound according to the sizer calculations.
Fit( window ); wxSize size = Fit( window );
wxSize size( window->GetSize() );
window->SetSizeHints( size.x, window->SetSizeHints( size.x,
size.y, size.y,
window->GetMaxWidth(), window->GetMaxWidth(),