]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tbargtk.cpp
//... => /* ... */
[wxWidgets.git] / src / gtk / tbargtk.cpp
index 4c07013c125f157e83acc6d6839b11336943aca6..0f90b72a744d05b447935a8dd19d32b6f82c13cf 100644 (file)
@@ -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();