]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/tbargtk.cpp
really applied Robert's patch (and not the converse of it)
[wxWidgets.git] / src / gtk1 / tbargtk.cpp
index 5c47efac8b6a86b30cf8f51a55483d26b24c085f..4755e17a0e16c75c2aca7d42daf8d82f878bd9ff 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "tbargtk.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/toolbar.h"
 
 #if wxUSE_TOOLBAR_NATIVE
@@ -136,7 +139,7 @@ protected:
 // wxWin macros
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
 
 // ============================================================================
 // implementation
@@ -181,7 +184,22 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget),
         }
     }
 
-    tbar->OnLeftClick( tool->GetId(), tool->IsToggled() );
+    if( !tbar->OnLeftClick( tool->GetId(), tool->IsToggled() ) && tool->CanBeToggled() )
+    {
+        // revert back
+        tool->Toggle();
+
+        wxBitmap bitmap = tool->GetBitmap();
+        if ( bitmap.Ok() )
+        {
+            GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap );
+
+            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
+                                               : (GdkBitmap *)NULL;
+
+            gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask );
+        }
+    }
 }
 
 //-----------------------------------------------------------------------------
@@ -255,6 +273,8 @@ void wxToolBar::Init()
     m_bg = (GdkColor *)NULL;
     m_toolbar = (GtkToolbar *)NULL;
     m_blockEvent = FALSE;
+    m_defaultWidth = 32;
+    m_defaultHeight = 32;
 }
 
 wxToolBar::~wxToolBar()
@@ -433,7 +453,8 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 
                 if ( tool->IsRadio() )
                 {
-                    wxToolBarToolsList::compatibility_iterator node;
+                    wxToolBarToolsList::compatibility_iterator node
+                        = wxToolBarToolsList::compatibility_iterator();
                     if ( pos ) node = m_tools.Item(pos - 1);
 
                     while ( node )