]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/tbargtk.cpp
Compile fixes: gcc seems to need pbt.h including, and PBT_APMRESUMEAUTOMATIC
[wxWidgets.git] / src / gtk / tbargtk.cpp
index d767b494aeb18ba3015c30b98969540445e77116..e56eba64a14790c3d4995e60d8dc48ad3075e37d 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
 
 #if wxUSE_TOOLBAR_NATIVE
 
-#include "wx/frame.h"
+#ifndef WX_PRECOMP
+    #include "wx/frame.h"
+#endif
+
+// 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;
@@ -313,8 +317,7 @@ bool wxToolBar::Create( wxWindow *parent,
         ConnectWidget( m_widget );
         gtk_widget_show(GTK_WIDGET(m_toolbar));
     }
-
-    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), !(style & wxTB_NO_TOOLTIPS) );
 
     // FIXME: there is no such function for toolbars in 2.0
 #if 0
@@ -342,7 +345,16 @@ void wxToolBar::GtkSetStyle()
 void wxToolBar::SetWindowStyleFlag( long style )
 {
     wxToolBarBase::SetWindowStyleFlag(style);
-
+    if( style & wxTB_TOOLTIPS )
+    {
+        if( m_toolbar )
+             gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+    }
+    else
+    {
+        if( m_toolbar )
+             gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), FALSE );
+    }
     if ( m_toolbar )
         GtkSetStyle();
 }
@@ -456,14 +468,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 +552,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;
     }