From: Paul Cornett Date: Tue, 23 Mar 2010 17:19:02 +0000 (+0000) Subject: ignore iconized state when computing client size for GetBestSize(), fixes #11803 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3c7620f666a5a8cfd6a570c949d2e9ba109858a5 ignore iconized state when computing client size for GetBestSize(), fixes #11803 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63750 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index 013e081df6..40129f5def 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -16,6 +16,7 @@ class WXDLLIMPEXP_CORE wxTopLevelWindowGTK : public wxTopLevelWindowBase { + typedef wxTopLevelWindowBase base_type; public: // construction wxTopLevelWindowGTK() { Init(); } @@ -137,6 +138,7 @@ protected: virtual void DoSetClientSize(int width, int height); virtual void DoGetClientSize(int *width, int *height) const; + virtual wxSize DoGetBestSize() const; // string shown in the title bar wxString m_title; diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index d0f1b1e59d..81c5430f1e 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -887,7 +887,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) HandleWindowEvent(event); } - bool change = wxTopLevelWindowBase::Show(show); + bool change = base_type::Show(show); if (change && !show) { @@ -1004,7 +1004,7 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) { - wxTopLevelWindowBase::DoSetClientSize(width, height); + base_type::DoSetClientSize(width, height); // Since client size is being explicitly set, don't change it later // Has to be done after calling base because it calls SetSize, @@ -1012,6 +1012,17 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) m_deferShowAllowed = false; } +wxSize wxTopLevelWindowGTK::DoGetBestSize() const +{ + // temporarily turn off m_isIconized, + // so we get an accurate client size from DoGetClientSize + const bool save = m_isIconized; + const_cast(this)->m_isIconized = false; + const wxSize size = base_type::DoGetBestSize(); + const_cast(this)->m_isIconized = save; + return size; +} + void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { wxASSERT_MSG(m_widget, wxT("invalid frame")); @@ -1035,7 +1046,7 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ) { - wxTopLevelWindowBase::DoSetSizeHints( minW, minH, maxW, maxH, incW, incH ); + base_type::DoSetSizeHints(minW, minH, maxW, maxH, incW, incH); const wxSize minSize = GetMinSize(); const wxSize maxSize = GetMaxSize(); @@ -1177,7 +1188,7 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - wxTopLevelWindowBase::SetIcons( icons ); + base_type::SetIcons(icons); // Setting icons before window is realized can cause a GTK assertion if // another TLW is realized before this one, and it has this one as it's