+ wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
+
+ if (tool->m_item)
+ {
+ g_signal_handlers_block_by_func(tool->m_item, (void*)item_toggled, tool);
+
+ gtk_toggle_tool_button_set_active(
+ GTK_TOGGLE_TOOL_BUTTON(tool->m_item), toggle);
+
+ g_signal_handlers_unblock_by_func(tool->m_item, (void*)item_toggled, tool);
+ }
+}
+
+void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
+ bool WXUNUSED(toggle))
+{
+ // VZ: absolutely no idea about how to do it
+ wxFAIL_MSG( _T("not implemented") );
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxToolBar::DoGetBestSize() const
+{
+ // Unfortunately, if overflow arrow is enabled GtkToolbar only reports size
+ // of arrow. To get the real size, the arrow is temporarily disabled here.
+ // This is gross, since it will cause a queue_resize, and could potentially
+ // lead to an infinite loop. But there seems to be no alternative, short of
+ // disabling the arrow entirely.
+ gtk_toolbar_set_show_arrow(m_toolbar, false);
+ const wxSize size = wxToolBarBase::DoGetBestSize();
+ gtk_toolbar_set_show_arrow(m_toolbar, true);
+ return size;
+}
+
+wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
+ wxCoord WXUNUSED(y)) const
+{
+ // VZ: GTK+ doesn't seem to have such thing
+ wxFAIL_MSG( _T("wxToolBar::FindToolForPosition() not implemented") );
+
+ return (wxToolBarToolBase *)NULL;
+}
+
+void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
+{
+ wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+
+ if ( tool )
+ {
+ (void)tool->SetShortHelp(helpString);
+ if (tool->m_item)
+ {
+ gtk_tool_item_set_tooltip(tool->m_item,
+ m_tooltips, wxGTK_CONV(helpString), "");
+ }
+ }
+}
+
+void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
+{
+ wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+ if ( tool )
+ {
+ wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+ tool->SetNormalBitmap(bitmap);
+ tool->SetImage();
+ }
+}
+
+void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
+{
+ wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+ if ( tool )
+ {
+ wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+ tool->SetDisabledBitmap(bitmap);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar idle handling
+// ----------------------------------------------------------------------------
+
+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;
+
+ if (cursor.Ok())
+ {
+ /* I now set the cursor the anew in every OnInternalIdle call
+ as setting the cursor in a parent window also effects the
+ windows above so that checking for the current cursor is
+ not possible. */
+
+ if (HasFlag(wxTB_DOCKABLE) && (m_widget->window))
+ {
+ /* if the toolbar is dockable, then m_widget stands for the
+ GtkHandleBox widget, which uses its own window so that we
+ can set the cursor for it. if the toolbar is not dockable,
+ m_widget comes from m_toolbar which uses its parent's
+ window ("windowless windows") and thus we cannot set the
+ cursor. */
+ gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
+ }
+
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
+ while ( node )
+ {
+ wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+ node = node->GetNext();
+
+ if (tool->m_item)
+ {
+ GdkWindow* window = GTK_WIDGET(tool->m_item)->window;
+
+ if ( window )
+ {
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+ }
+ }
+ }
+ }
+
+ if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
+ UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+}
+
+
+// ----------------------------------------------------------------------------
+
+// static
+wxVisualAttributes
+wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new);
+}