Make SetMinSize() and SetMaxSize() virtual so they
can be overridden in wxTLW to set WM hints. Actually did that for wxGTK, nothing required for wxMSW, no idea about wxMac. Documented this in tlw.tex. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -280,6 +280,20 @@ Unavailable on full keyboard machines.
|
||||
\helpref{wxTopLevelWindow::SetRightMenu}{wxtoplevelwindowsetrightmenu}.
|
||||
|
||||
|
||||
\membersection{wxTopLevelWindow::SetMaxSize}\label{wxtoplevelwindowsetmaxsize}
|
||||
|
||||
\func{void}{SetMaxSize}{\param{const wxSize\& }{size}}
|
||||
|
||||
A simpler interface for setting the size hints than
|
||||
\helpref{SetSizeHints}{wxtoplevelwindowsetsizehints}.
|
||||
|
||||
\membersection{wxTopLevelWindow::SetMinSize}\label{wxtoplevelwindowsetminsize}
|
||||
|
||||
\func{void}{SetMinSize}{\param{const wxSize\& }{size}}
|
||||
|
||||
A simpler interface for setting the size hints than
|
||||
\helpref{SetSizeHints}{wxtoplevelwindowsetsizehints}.
|
||||
|
||||
\membersection{wxTopLevelWindow::SetSizeHints}\label{wxtoplevelwindowsetsizehints}
|
||||
|
||||
\func{virtual void}{SetSizeHints}{\param{int}{ minW}, \param{int}{ minH}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1},
|
||||
|
@@ -121,6 +121,12 @@ protected:
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// a different API for SetSizeHints
|
||||
virtual void SetMinSize(const wxSize& minSize);
|
||||
virtual void SetMaxSize(const wxSize& maxSize);
|
||||
|
||||
// give hints to the Window Manager for how the size
|
||||
// of the TLW can be changed by dragging
|
||||
virtual void DoSetSizeHints( int minW, int minH,
|
||||
int maxW = wxDefaultCoord, int maxH = wxDefaultCoord,
|
||||
int incW = wxDefaultCoord, int incH = wxDefaultCoord );
|
||||
|
@@ -420,18 +420,25 @@ public:
|
||||
SetVirtualSizeHints(minSize.x, minSize.y, maxSize.x, maxSize.y);
|
||||
}
|
||||
|
||||
|
||||
// Call these to override what GetBestSize() returns. This
|
||||
// method is only virtual because it is overriden in wxTLW
|
||||
// as a different API for SetSizeHints().
|
||||
virtual void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; }
|
||||
virtual void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; }
|
||||
|
||||
// Override these methods to impose restrictions on min/max size.
|
||||
// The easier way is to call SetMinSize() and SetMaxSize() which
|
||||
// will have the same effect. Doing both is non-sense.
|
||||
virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); }
|
||||
virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); }
|
||||
|
||||
// Get the min and max values one by one
|
||||
int GetMinWidth() const { return GetMinSize().x; }
|
||||
int GetMinHeight() const { return GetMinSize().y; }
|
||||
int GetMaxWidth() const { return GetMaxSize().x; }
|
||||
int GetMaxHeight() const { return GetMaxSize().y; }
|
||||
|
||||
// Override these methods to impose restrictions on min/max size
|
||||
virtual wxSize GetMinSize() const { return wxSize(m_minWidth, m_minHeight); }
|
||||
virtual wxSize GetMaxSize() const { return wxSize(m_maxWidth, m_maxHeight); }
|
||||
|
||||
void SetMinSize(const wxSize& minSize) { m_minWidth = minSize.x; m_minHeight = minSize.y; }
|
||||
void SetMaxSize(const wxSize& maxSize) { m_maxWidth = maxSize.x; m_maxHeight = maxSize.y; }
|
||||
|
||||
|
||||
// Methods for accessing the virtual size of a window. For most
|
||||
// windows this is just the client area of the window, but for
|
||||
|
@@ -958,6 +958,16 @@ void wxTopLevelWindowGTK::DoSetClientSize( int width, int height )
|
||||
width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0);
|
||||
}
|
||||
|
||||
void wxTopLevelWindowGTK::SetMinSize(const wxSize& minSize)
|
||||
{
|
||||
SetSizeHints( minSize.x, minSize.y, GetMaxWidth(), GetMaxHeight() );
|
||||
}
|
||||
|
||||
void wxTopLevelWindowGTK::SetMaxSize(const wxSize& maxSize)
|
||||
{
|
||||
SetSizeHints( GetMinWidth(), GetMinHeight(), maxSize.x, maxSize.y );
|
||||
}
|
||||
|
||||
void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
|
||||
int maxW, int maxH,
|
||||
int incW, int incH )
|
||||
|
Reference in New Issue
Block a user