backported ClientToWindowSize(), WindowToClientSize() to 2.8
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -120,6 +120,7 @@ All (GUI):
|
||||
- Remove associated help text from wxHelpProvider when a window is destroyed.
|
||||
- Added wxSizerFlags::ReserveSpaceEvenIfHidden() and
|
||||
wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag.
|
||||
- Added wxWindow::ClientToWindowSize() and WindowToClientSize() helpers.
|
||||
|
||||
All (Unix):
|
||||
|
||||
|
@@ -343,6 +343,25 @@ implements the following methods:\par
|
||||
\end{twocollist}}
|
||||
}
|
||||
|
||||
\membersection{wxWindow::ClientToWindowSize}\label{wxwindowclienttowindowsize}
|
||||
|
||||
\func{wxSize}{ClientToWindowSize}{\param{const wxSize\&}{ size}}
|
||||
|
||||
Converts client area size \arg{size} to corresponding window size. In other
|
||||
words, the returned value is what would \helpref{GetSize}{wxwindowgetsize}
|
||||
return if this window had client area of given size.
|
||||
Components with $wxDefaultCoord$ value are left unchanged.
|
||||
|
||||
Note that the conversion is not always exact, it assumes that non-client area
|
||||
doesn't change and so doesn't take into account things like menu bar
|
||||
(un)wrapping or (dis)appearance of the scrollbars.
|
||||
|
||||
\since{2.8.8}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxWindow::WindowToClientSize}{wxwindowwindowtoclientsize}
|
||||
|
||||
|
||||
\membersection{wxWindow::Close}\label{wxwindowclose}
|
||||
|
||||
@@ -3731,3 +3750,21 @@ Interface Guidelines forbid moving the mouse cursor programmatically.
|
||||
|
||||
\docparam{y}{The new y position for the cursor.}
|
||||
|
||||
\membersection{wxWindow::WindowToClientSize}\label{wxwindowwindowtoclientsize}
|
||||
|
||||
\func{virtual wxSize}{WindowToClientSize}{\param{const wxSize\&}{ size}}
|
||||
|
||||
Converts window size \arg{size} to corresponding client area size. In other
|
||||
words, the returned value is what would
|
||||
\helpref{GetClientSize}{wxwindowgetclientsize} return if this window had
|
||||
given window size. Components with $wxDefaultCoord$ value are left unchanged.
|
||||
|
||||
Note that the conversion is not always exact, it assumes that non-client area
|
||||
doesn't change and so doesn't take into account things like menu bar
|
||||
(un)wrapping or (dis)appearance of the scrollbars.
|
||||
|
||||
\since{2.8.8}
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxWindow::ClientToWindowSize}{wxwindowclienttowindowsize}
|
||||
|
@@ -326,6 +326,12 @@ public:
|
||||
return wxRect(GetClientAreaOrigin(), GetClientSize());
|
||||
}
|
||||
|
||||
#if wxABI_VERSION >= 20808
|
||||
// client<->window size conversion
|
||||
wxSize ClientToWindowSize(const wxSize& size) const;
|
||||
wxSize WindowToClientSize(const wxSize& size) const;
|
||||
#endif
|
||||
|
||||
// get the size best suited for the window (in fact, minimal
|
||||
// acceptable size using which it will still look "nice" in
|
||||
// most situations)
|
||||
|
@@ -755,6 +755,22 @@ wxPoint wxWindowBase::GetClientAreaOrigin() const
|
||||
return wxPoint(0,0);
|
||||
}
|
||||
|
||||
wxSize wxWindowBase::ClientToWindowSize(const wxSize& size) const
|
||||
{
|
||||
const wxSize diff(GetSize() - GetClientSize());
|
||||
|
||||
return wxSize(size.x == -1 ? -1 : size.x + diff.x,
|
||||
size.y == -1 ? -1 : size.y + diff.y);
|
||||
}
|
||||
|
||||
wxSize wxWindowBase::WindowToClientSize(const wxSize& size) const
|
||||
{
|
||||
const wxSize diff(GetSize() - GetClientSize());
|
||||
|
||||
return wxSize(size.x == -1 ? -1 : size.x - diff.x,
|
||||
size.y == -1 ? -1 : size.y - diff.y);
|
||||
}
|
||||
|
||||
void wxWindowBase::SetWindowVariant( wxWindowVariant variant )
|
||||
{
|
||||
if ( m_windowVariant != variant )
|
||||
|
@@ -39,7 +39,9 @@
|
||||
*wxScrollHelper*HandleOnChildFocus*;
|
||||
*wxSizerFlags*ReserveSpaceEvenIfHidden*;
|
||||
*wxSizerItem*ShouldAccountFor*;
|
||||
*wxWindowBase*ClientToWindowSize*;
|
||||
*wxWindowBase*Get*Sibling*;
|
||||
*wxWindowBase*WindowToClientSize*;
|
||||
};
|
||||
|
||||
# public symbols added in 2.8.7 (please keep in alphabetical order):
|
||||
|
Reference in New Issue
Block a user