]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tbargtk.cpp
PCH build fix.
[wxWidgets.git] / src / gtk / tbargtk.cpp
index d767b494aeb18ba3015c30b98969540445e77116..458e5f12997e6be57a117eba0ad87fffe7daff7d 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        tbargtk.cpp
+// Name:        src/gtk/tbargtk.cpp
 // Purpose:     GTK toolbar
 // Author:      Robert Roebling
 // Modified:    13.12.99 by VZ to derive from wxToolBarBase
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_TOOLBAR_NATIVE
+
 #include "wx/toolbar.h"
 
-#if wxUSE_TOOLBAR_NATIVE
+#ifndef WX_PRECOMP
+    #include "wx/frame.h"
+#endif
 
-#include "wx/frame.h"
+// FIXME: Use GtkImage instead of GtkPixmap. Use the new toolbar API for when gtk runtime is new enough?
+// Beware that the new and old toolbar API may not be mixed in usage.
+#include <gtk/gtkversion.h>
+#ifdef GTK_DISABLE_DEPRECATED
+#undef GTK_DISABLE_DEPRECATED
+#endif
 
-#include <glib.h>
 #include "wx/gtk/private.h"
 
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
 
-// idle system
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
 // data
 extern bool       g_blockEventsOnDrag;
 extern wxCursor   g_globalCursor;
@@ -314,8 +318,6 @@ bool wxToolBar::Create( wxWindow *parent,
         gtk_widget_show(GTK_WIDGET(m_toolbar));
     }
 
-    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
-
     // FIXME: there is no such function for toolbars in 2.0
 #if 0
     if (style & wxTB_FLAT)
@@ -337,6 +339,7 @@ void wxToolBar::GtkSetStyle()
 
     gtk_toolbar_set_orientation(m_toolbar, orient);
     gtk_toolbar_set_style(m_toolbar, style);
+    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), !(style & wxTB_NO_TOOLTIPS) );
 }
 
 void wxToolBar::SetWindowStyleFlag( long style )
@@ -362,7 +365,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
             wxCHECK_MSG( bitmap.Ok(), false,
                          wxT("invalid bitmap for wxToolBar icon") );
 
-            wxCHECK_MSG( bitmap.GetBitmap() == NULL, false,
+            wxCHECK_MSG( bitmap.GetDepth() != 1, false,
                          wxT("wxToolBar doesn't support GdkBitmap") );
 
             wxCHECK_MSG( bitmap.GetPixmap() != NULL, false,
@@ -456,14 +459,12 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
                     return false;
                 }
 
-                gtk_signal_connect( GTK_OBJECT(tool->m_item),
-                                    "enter_notify_event",
-                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
-                                    (gpointer)tool );
-                gtk_signal_connect( GTK_OBJECT(tool->m_item),
-                                    "leave_notify_event",
-                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
-                                    (gpointer)tool );
+                g_signal_connect (tool->m_item, "enter_notify_event",
+                                  G_CALLBACK (gtk_toolbar_tool_callback),
+                                  tool);
+                g_signal_connect (tool->m_item, "leave_notify_event",
+                                  G_CALLBACK (gtk_toolbar_tool_callback),
+                                  tool);
             }
             break;
 
@@ -542,7 +543,7 @@ void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
 
         m_blockEvent = true;
 
-        gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
+        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(item), toggle );
 
         m_blockEvent = false;
     }