X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c693edf3bc9539378a7ac56d90d41d89c7dc7579..866592d872daa1f4e3d44948d7d3a6c90b0af9d0:/src/gtk/tbargtk.cpp diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 4c07013c12..0f90b72a74 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -147,7 +147,12 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, { m_needParent = TRUE; - PreCreation( parent, id, pos, size, style, name ); + if (!PreCreation( parent, pos, size ) || + !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) + { + wxFAIL_MSG( _T("wxToolBar creation failed") ); + return FALSE; + } m_tools.DeleteContents( TRUE ); @@ -381,9 +386,32 @@ void wxToolBar::ToggleTool( int toolIndex, bool toggle ) wxToolBarTool *tool = (wxToolBarTool*)node->Data(); if (tool->m_index == toolIndex) { - tool->m_toggleState = toggle; if ((tool->m_item) && (GTK_IS_TOGGLE_BUTTON(tool->m_item))) + { + tool->m_toggleState = toggle; + + if (tool->m_bitmap2.Ok()) + { + wxBitmap bitmap = tool->m_bitmap1; + if (tool->m_toggleState) bitmap = tool->m_bitmap2; + + GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap ); + + GdkBitmap *mask = (GdkBitmap *) NULL; + if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap(); + + 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 ); + 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; } node = node->Next();