Detaches all children from the sizer. If \arg{delete\_windows} is \true then child windows will also be deleted.
+\membersection{wxSizer::ComputeFittingClientSize}\label{wxsizercomputefittingclientsize}
+
+\func{wxSize}{ComputeFittingClientSize}{\param{wxWindow* }{window}}
+
+Computes client area size for \arg{window} so that it matches the
+sizer's minimal size. Unlike \helpref{GetMinSize}{wxsizergetminsize}, this
+method accounts for other constraints imposed on \arg{window}, namely display's
+size (returned size will never be too large for the display) and maximum
+window size if previously set by
+\helpref{wxWindow::SetMaxSize}{wxwindowsetmaxsize}.
+
+The returned value is suitable for passing to
+\helpref{wxWindow::SetClientSize}{wxwindowsetclientsize} or
+\helpref{wxWindow::SetMinClientSize}{wxwindowsetminclientsize}.
+
+\wxheading{See also}
+
+\helpref{ComputeFittingWindowSize}{wxsizercomputefittingwindowsize},
+\helpref{Fit}{wxsizerfit}
+
+
+\membersection{wxSizer::ComputeFittintWindowSize}\label{wxsizercomputefittingwindowsize}
+
+\func{wxSize}{ComputeFittingWindowSize}{\param{wxWindow* }{window}}
+
+Like \helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize},
+but converts the result into \emph{window} size.
+
+The returned value is suitable for passing to
+\helpref{wxWindow::SetSize}{wxwindowsetsize} or
+\helpref{wxWindow::SetMinSize}{wxwindowsetminsize}.
+
+\wxheading{See also}
+
+\helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize},
+\helpref{Fit}{wxsizerfit}
+
+
\membersection{wxSizer::Detach}\label{wxsizerdetach}
\func{bool}{Detach}{\param{wxWindow* }{window}}
\func{wxSize}{Fit}{\param{wxWindow* }{window}}
-Tell the sizer to resize the \arg{window} so that its client area matchesthe
-sizer's minimal size. This is commonly done in the constructor of the window
+Tell the sizer to resize the \arg{window} so that its client area matches the
+sizer's minimal size
+(\helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize} is called
+to determine it).
+This is commonly done in the constructor of the window
itself, see sample in the description
-of \helpref{wxBoxSizer}{wxboxsizer}. Returns the new size.
+of \helpref{wxBoxSizer}{wxboxsizer}. Returns the new \emph{window} size.
+
+\wxheading{See also}
+
+\helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize},
+\helpref{ComputeFittingWindowSize}{wxsizercomputefittingwindowsize}
+
\membersection{wxSizer::FitInside}\label{wxsizerfitinside}
size of all the children and their borders or the minimal size set by
\helpref{SetMinSize}{wxsizersetminsize}, depending on which is bigger.
+Note that the returned value is \emph{client} size, not window size.
+In particular, if you use the value to set toplevel window's minimal or
+actual size, use \helpref{wxWindow::SetMinClientSize}{wxwindowsetminclientsize}
+or \helpref{wxWindow::SetClientSize}{wxwindowsetclientsize}, \emph{not}
+\helpref{wxWindow::SetMinSize}{wxwindowsetminsize}
+or \helpref{wxWindow::SetSize}{wxwindowsetsize}.
+
\membersection{wxSizer::Hide}\label{wxsizerhide}
}
}
-wxSize wxSizer::Fit( wxWindow *window )
+wxSize wxSizer::ComputeFittingClientSize(wxWindow *window)
{
+ wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" );
+
// take the min size by default and limit it by max size
wxSize size = GetMinClientSize(window);
wxSize sizeMax;
// hack for small screen devices where TLWs are always full screen
if ( tlw->IsAlwaysMaximized() )
{
- // do nothing
- return tlw->GetSize();
+ return tlw->GetClientSize();
}
// limit the window to the size of the display it is on
if ( sizeMax.y != wxDefaultCoord && size.y > sizeMax.y )
size.y = sizeMax.y;
+ return size;
+}
+
+wxSize wxSizer::ComputeFittingWindowSize(wxWindow *window)
+{
+ wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" );
+
+ return window->ClientToWindowSize(ComputeFittingClientSize(window));
+}
+
+wxSize wxSizer::Fit( wxWindow *window )
+{
+ wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" );
+
// set client size
- window->SetClientSize( size );
+ window->SetClientSize(ComputeFittingClientSize(window));
// return entire size
return window->GetSize();