[ 1718338 ] wxToolBarGTK: Implement tool right-click handling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2007-05-16 08:51:23 +00:00
parent b5ef33b2ae
commit 729b47568a

View File

@ -187,6 +187,30 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget),
}
}
//-----------------------------------------------------------------------------
// "right-click"
//-----------------------------------------------------------------------------
extern "C" {
static gboolean gtk_toolbar_tool_rclick_callback(GtkWidget *WXUNUSED(widget),
GdkEventButton *event,
wxToolBarToolBase *tool)
{
if (event->button != 3)
return FALSE;
wxToolBar *tbar = (wxToolBar *)tool->GetToolBar();
if (tbar->m_blockEvent) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!tool->IsEnabled()) return TRUE;
tbar->OnRightClick( tool->GetId(), (int)event->x, (int)event->y );
return TRUE;
}
}
//-----------------------------------------------------------------------------
// "enter_notify_event" / "leave_notify_event"
//-----------------------------------------------------------------------------
@ -452,6 +476,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
g_signal_connect (tool->m_item, "leave_notify_event",
G_CALLBACK (gtk_toolbar_tool_callback),
tool);
g_signal_connect(tool->m_item, "button-press-event",
G_CALLBACK (gtk_toolbar_tool_rclick_callback),
tool);
}
break;