From a73ae836dff339ba626133a29fa2b0b87d99ca3c Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 12 Dec 2006 10:40:46 +0000 Subject: [PATCH] Add hack for correct height of wxComboBox in toolbar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43952 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/combobox.cpp | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 936f383894..80c4c23856 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -200,6 +200,30 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) combo->GetEventHandler()->ProcessEvent( event ); } } + +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 //----------------------------------------------------------------------------- @@ -348,6 +372,10 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, 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 @@ -371,16 +399,10 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, this); g_signal_connect_after (entry, "changed", G_CALLBACK (gtkcombo_text_changed_callback), this); - - // This is required for tool bar support - // Doesn't currently work -// wxSize setsize = GetSize(); -// gtk_widget_set_size_request( m_widget, setsize.x, setsize.y ); } SetInitialSize(size); // need this too because this is a wxControlWithItems - return true; } -- 2.45.2