From 92153555cf08cc818d6f4becfc1576d9c2add023 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Oct 2009 22:54:46 +0000 Subject: [PATCH] Added GTKShouldConnectSizeRequest() to prevent size_request handling. Don't hard code the exception for GtkFileChooserButton in wxWindow::PostCreation() in wxGTK, handling size_request signal also breaks other controls (e.g. upcoming wxInfoBar native implementation). Instead, define a virtual function which may be overridden to return false if size_request shouldn't be connected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/filepicker.h | 2 ++ include/wx/gtk/window.h | 5 +++++ src/gtk/window.cpp | 11 +---------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/wx/gtk/filepicker.h b/include/wx/gtk/filepicker.h index f3f6803..8b92ee6 100644 --- a/include/wx/gtk/filepicker.h +++ b/include/wx/gtk/filepicker.h @@ -105,6 +105,8 @@ public: // overrides FILEDIRBTN_OVERRIDES protected: + virtual bool GTKShouldConnectSizeRequest() const { return false; } + wxDialog *m_dialog; DECLARE_DYNAMIC_CLASS(wxFileButton) diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index d34f5b1..f3639f2 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -363,6 +363,11 @@ protected: // should be called from OnInternalIdle() if it's overridden void GTKUpdateCursor(); + // Return true from here if PostCreation() should connect to size_request + // signal: this is done by default but doesn't work for some native + // controls which override this function to return false + virtual bool GTKShouldConnectSizeRequest() const { return !IsTopLevel(); } + void ConstrainSize(); private: diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 84846a2..b73603f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2365,16 +2365,7 @@ void wxWindowGTK::PostCreation() #endif } -#ifdef GTK_IS_FILE_CHOOSER_BUTTON - if (!gtk_check_version(2,6,0) && GTK_IS_FILE_CHOOSER_BUTTON(m_widget)) - { - // If we connect to the "size_request" signal of a GtkFileChooserButton - // then that control won't be sized properly when placed inside sizers - // (this can be tested removing this elseif and running XRC or WIDGETS samples) - // FIXME: what should be done here ? - } else -#endif - if ( !IsTopLevel() ) // top level windows use their own callback + if ( GTKShouldConnectSizeRequest() ) { // This is needed if we want to add our windows into native // GTK controls, such as the toolbar. With this callback, the -- 2.7.4