backported wxSizer::ComputeFittingClientSize() and ComputeFittingWindowSize() to 2.8
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -121,6 +121,7 @@ All (GUI):
|
|||||||
- Added wxSizerFlags::ReserveSpaceEvenIfHidden() and
|
- Added wxSizerFlags::ReserveSpaceEvenIfHidden() and
|
||||||
wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag.
|
wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag.
|
||||||
- Added wxWindow::ClientToWindowSize() and WindowToClientSize() helpers.
|
- Added wxWindow::ClientToWindowSize() and WindowToClientSize() helpers.
|
||||||
|
- Added wxSizer::ComputeFittingClientSize() and ComputeFittingWindowSize().
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -197,6 +197,48 @@ Here, the sizer will do the actual calculation of its children minimal sizes.
|
|||||||
Detaches all children from the sizer. If \arg{delete\_windows} is \true then child windows will also be deleted.
|
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}.
|
||||||
|
|
||||||
|
\since{2.8.8}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{ComputeFittingWindowSize}{wxsizercomputefittingwindowsize},
|
||||||
|
\helpref{Fit}{wxsizerfit}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxSizer::ComputeFittingWindowSize}\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}.
|
||||||
|
|
||||||
|
\since{2.8.8}
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize},
|
||||||
|
\helpref{Fit}{wxsizerfit}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSizer::Detach}\label{wxsizerdetach}
|
\membersection{wxSizer::Detach}\label{wxsizerdetach}
|
||||||
|
|
||||||
\func{bool}{Detach}{\param{wxWindow* }{window}}
|
\func{bool}{Detach}{\param{wxWindow* }{window}}
|
||||||
@@ -228,6 +270,11 @@ of \helpref{wxBoxSizer}{wxboxsizer}. Returns the new size.
|
|||||||
|
|
||||||
For a top level window this is the total window size, not client size.
|
For a top level window this is the total window size, not client size.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{ComputeFittingClientSize}{wxsizercomputefittingclientsize},
|
||||||
|
\helpref{ComputeFittingWindowSize}{wxsizercomputefittingwindowsize}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxSizer::FitInside}\label{wxsizerfitinside}
|
\membersection{wxSizer::FitInside}\label{wxsizerfitinside}
|
||||||
|
|
||||||
@@ -297,6 +344,13 @@ Returns the minimal size of the sizer. This is either the combined minimal
|
|||||||
size of all the children and their borders or the minimal size set by
|
size of all the children and their borders or the minimal size set by
|
||||||
\helpref{SetMinSize}{wxsizersetminsize}, depending on which is bigger.
|
\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}
|
\membersection{wxSizer::Hide}\label{wxsizerhide}
|
||||||
|
|
||||||
|
@@ -562,6 +562,11 @@ public:
|
|||||||
|
|
||||||
virtual void Layout();
|
virtual void Layout();
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20808
|
||||||
|
wxSize ComputeFittingClientSize(wxWindow *window);
|
||||||
|
wxSize ComputeFittingWindowSize(wxWindow *window);
|
||||||
|
#endif
|
||||||
|
|
||||||
wxSize Fit( wxWindow *window );
|
wxSize Fit( wxWindow *window );
|
||||||
void FitInside( wxWindow *window );
|
void FitInside( wxWindow *window );
|
||||||
void SetSizeHints( wxWindow *window );
|
void SetSizeHints( wxWindow *window );
|
||||||
|
@@ -809,7 +809,7 @@ void wxSizer::DeleteWindows()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxSizer::Fit( wxWindow *window )
|
wxSize wxSizer::ComputeFittingWindowSize(wxWindow *window)
|
||||||
{
|
{
|
||||||
// take the min size by default and limit it by max size
|
// take the min size by default and limit it by max size
|
||||||
wxSize size = GetMinWindowSize(window);
|
wxSize size = GetMinWindowSize(window);
|
||||||
@@ -842,9 +842,20 @@ wxSize wxSizer::Fit( wxWindow *window )
|
|||||||
if ( sizeMax.y != wxDefaultCoord && size.y > sizeMax.y )
|
if ( sizeMax.y != wxDefaultCoord && size.y > sizeMax.y )
|
||||||
size.y = sizeMax.y;
|
size.y = sizeMax.y;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
window->SetSize( size );
|
wxSize wxSizer::ComputeFittingClientSize(wxWindow *window)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( window, wxDefaultSize, "window can't be NULL" );
|
||||||
|
|
||||||
|
return window->WindowToClientSize(ComputeFittingWindowSize(window));
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize wxSizer::Fit( wxWindow *window )
|
||||||
|
{
|
||||||
|
wxSize size = ComputeFittingWindowSize(window);
|
||||||
|
window->SetSize(size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,6 +37,8 @@
|
|||||||
*wxRichTextCtrl*SetTextCursor*;
|
*wxRichTextCtrl*SetTextCursor*;
|
||||||
*wxRichTextCtrl*SetURLCursor*;
|
*wxRichTextCtrl*SetURLCursor*;
|
||||||
*wxScrollHelper*HandleOnChildFocus*;
|
*wxScrollHelper*HandleOnChildFocus*;
|
||||||
|
*wxSizer*ComputeFittingClientSize*;
|
||||||
|
*wxSizer*ComputeFittingWindowSize*;
|
||||||
*wxSizerFlags*ReserveSpaceEvenIfHidden*;
|
*wxSizerFlags*ReserveSpaceEvenIfHidden*;
|
||||||
*wxSizerItem*ShouldAccountFor*;
|
*wxSizerItem*ShouldAccountFor*;
|
||||||
*wxWindowBase*ClientToWindowSize*;
|
*wxWindowBase*ClientToWindowSize*;
|
||||||
|
Reference in New Issue
Block a user