/////////////////////////////////////////////////////////////////////////////
-// 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;
GdkEventCrossing *gdk_event,
wxToolBarTool *tool )
{
- if (g_isIdle) wxapp_install_idle_handler();
+ // don't need to install idle handler, its done from "event" signal
if (g_blockEventsOnDrag) return TRUE;
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)
return true;
}
+GdkWindow *wxToolBar::GTKGetWindow(wxArrayGdkWindows& windows) const
+{
+ return GTK_WIDGET(m_toolbar)->window;
+}
+
void wxToolBar::GtkSetStyle()
{
GtkOrientation orient;
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 )
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,
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;
}
void wxToolBar::OnInternalIdle()
{
+ // Check if we have to show window now
+ if (GtkShowFromOnIdle()) return;
+
wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor;