X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..57c4d796c56bd48ce370240107f3e4c07e142985:/src/gtk1/tbargtk.cpp diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 6e5b301d48..2e0def79b6 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -41,7 +41,14 @@ extern wxCursor g_globalCursor; static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); + + if (tool->m_owner->m_blockNextEvent) + { + tool->m_owner->m_blockNextEvent = FALSE; + return; + } if (g_blockEventsOnDrag) return; if (!tool->m_enabled) return; @@ -147,6 +154,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, long style, const wxString& name ) { m_needParent = TRUE; + m_blockNextEvent = FALSE; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) @@ -309,6 +317,11 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, tool->m_item = item; + GtkRequisition req; + (* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req ); + m_width = req.width; + m_height = req.height; + gtk_signal_connect( GTK_OBJECT(tool->m_item), "enter_notify_event", GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback), @@ -404,13 +417,9 @@ void wxToolBar::ToggleTool( int toolIndex, bool toggle ) gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask ); } - gtk_signal_disconnect_by_func( GTK_OBJECT(tool->m_item), - GTK_SIGNAL_FUNC(gtk_toolbar_callback), (gpointer*)tool ); + m_blockNextEvent = TRUE; // we cannot use gtk_signal_disconnect here gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(tool->m_item), toggle ); - - gtk_signal_connect( GTK_OBJECT(tool->m_item), "clicked", - GTK_SIGNAL_FUNC(gtk_toolbar_callback), (gpointer*)tool ); } return;