]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved allocate size correction code from combobox
authorRobert Roebling <robert@roebling.de>
Tue, 12 Dec 2006 21:43:55 +0000 (21:43 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 12 Dec 2006 21:43:55 +0000 (21:43 +0000)
    to toolbar code since that is where the problem
    is and it affects other controls, too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/combobox.cpp
src/gtk/tbargtk.cpp

index 80c4c23856bf5b6e885e0d61386aa46538e1b8a3..8dc1c7a820ba7f6dbf1e5204e131c404cff08bfc 100644 (file)
@@ -201,29 +201,6 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 }
 }
 
 }
 }
 
-extern "C" {
-static
-void gtkcombobox_size_callback( GtkWidget *widget,
-                               GtkAllocation *alloc,
-                               wxWindow *win )
-{
-    if (win->GetParent()->m_wxwindow) return;
-    
-    // we are probably a wxToolBar
-    
-    wxSize size = win->GetEffectiveMinSize();
-    if (size.y != alloc->height)
-    {
-        GtkAllocation alloc2;
-        alloc2.x = alloc->x;
-        alloc2.y = (alloc->height - size.y + 3) / 2;
-        alloc2.width = alloc->width;
-        alloc2.height = size.y;
-        gtk_widget_size_allocate( widget, &alloc2 );
-    }
-}
-}
-
 #endif
 
 //-----------------------------------------------------------------------------
 #endif
 
 //-----------------------------------------------------------------------------
@@ -373,9 +350,6 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
         g_signal_connect_after (m_widget, "changed",
                             G_CALLBACK (gtkcombobox_changed_callback), this);
                             
         g_signal_connect_after (m_widget, "changed",
                             G_CALLBACK (gtkcombobox_changed_callback), this);
                             
-        // Connect to in order to correct size_allocate events
-        g_signal_connect_after (m_widget, "size_allocate",
-                          G_CALLBACK (gtkcombobox_size_callback), this);
     }
     else
 #endif
     }
     else
 #endif
index dd18e1d3a9b00be34867ec7417615680c010efe7..3ce3d74f7d16d2352051678fc8c4cbd08686d87d 100644 (file)
@@ -215,6 +215,27 @@ static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget),
 }
 }
 
 }
 }
 
+extern "C" {
+static
+void gtktoolwidget_size_callback( GtkWidget *widget,
+                                  GtkAllocation *alloc,
+                                  wxWindow *win )
+{
+    // this shouldn't happen...
+    if (win->GetParent()->m_wxwindow) return;
+    
+    wxSize size = win->GetEffectiveMinSize();
+    if (size.y != alloc->height)
+    {
+        GtkAllocation alloc2;
+        alloc2.x = alloc->x;
+        alloc2.y = (alloc->height - size.y + 3) / 2;
+        alloc2.width = alloc->width;
+        alloc2.height = size.y;
+        gtk_widget_size_allocate( widget, &alloc2 );
+    }
+}
+}
 //-----------------------------------------------------------------------------
 // InsertChild callback for wxToolBar
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // InsertChild callback for wxToolBar
 //-----------------------------------------------------------------------------
@@ -453,6 +474,11 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
                                        (const char *) NULL,
                                        posGtk
                                       );
                                        (const char *) NULL,
                                        posGtk
                                       );
+                                      
+            // connect after in order to correct size_allocate events
+            g_signal_connect_after (tool->GetControl()->m_widget, "size_allocate",
+                          G_CALLBACK (gtktoolwidget_size_callback), tool->GetControl());
+                                      
             break;
     }
 
             break;
     }