[ 1718338 ] wxToolBarGTK: Implement tool right-click handling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -190,6 +190,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"
|
// "enter_notify_event" / "leave_notify_event"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -457,6 +481,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||||||
g_signal_connect (tool->m_item, "leave_notify_event",
|
g_signal_connect (tool->m_item, "leave_notify_event",
|
||||||
G_CALLBACK (gtk_toolbar_tool_callback),
|
G_CALLBACK (gtk_toolbar_tool_callback),
|
||||||
tool);
|
tool);
|
||||||
|
g_signal_connect(tool->m_item, "button-press-event",
|
||||||
|
G_CALLBACK (gtk_toolbar_tool_rclick_callback),
|
||||||
|
tool);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user