From a65b84f43417c8d0d156d63ae12474b29d1a739c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 29 Sep 2010 13:46:35 +0000 Subject: [PATCH] Add EVT_RIBBONBAR_TAB_LEFT_DCLICK event. Generate a special event when a ribbon bar is double clicked. Closes #12399. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/ribbon/bar.h | 6 ++++++ interface/wx/ribbon/bar.h | 2 ++ src/ribbon/bar.cpp | 7 +++++++ 4 files changed, 16 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 9bea912c0b..4e6372ab86 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -414,6 +414,7 @@ All (GUI): - wxRibbon: added EVT_RIBBONGALLERY_CLICKED event (John Roberts). - Add support for CP-866 encoding to wxEncodingConverter (madnut). - Consistency fixes for keyboard events across all major ports. +- Added EVT_RIBBONBAR_TAB_LEFT_DCLICK event (snowleopard). MSW: diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index 4f62dbadd9..08cf7c20e2 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -148,6 +148,7 @@ protected: void OnMouseRightUp(wxMouseEvent& evt); void OnMouseMove(wxMouseEvent& evt); void OnMouseLeave(wxMouseEvent& evt); + void OnMouseDoubleClick(wxMouseEvent& evt); void DoMouseButtonCommon(wxMouseEvent& evt, wxEventType tab_event_type); wxRibbonPageTabInfoArray m_pages; @@ -180,6 +181,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, wxRibbonBarEvent); wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, wxRibbonBarEvent); wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, wxRibbonBarEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, wxRibbonBarEvent); typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&); @@ -198,6 +200,8 @@ typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&); wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, winid, wxRibbonBarEventHandler(fn)) #define EVT_RIBBONBAR_TAB_RIGHT_UP(winid, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, winid, wxRibbonBarEventHandler(fn)) +#define EVT_RIBBONBAR_TAB_LEFT_DCLICK(winid, fn) \ + wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, winid, wxRibbonBarEventHandler(fn)) #else // wxpython/swig event work @@ -207,6 +211,7 @@ typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&); %constant wxEventType wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP; %constant wxEventType wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN; %constant wxEventType wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP; +%constant wxEventType wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK; %pythoncode { EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, 1 ) @@ -215,6 +220,7 @@ typedef void (wxEvtHandler::*wxRibbonBarEventFunction)(wxRibbonBarEvent&); EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, 1 ) EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, 1 ) EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, 1 ) + EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, 1 ) } #endif diff --git a/interface/wx/ribbon/bar.h b/interface/wx/ribbon/bar.h index 34d3a258be..e7ef600e7c 100644 --- a/interface/wx/ribbon/bar.h +++ b/interface/wx/ribbon/bar.h @@ -101,6 +101,8 @@ public: Triggered when the right mouse button is pressed on a tab. @event{EVT_RIBBONBAR_TAB_RIGHT_UP(id, func)} Triggered when the right mouse button is released on a tab. + @event{EVT_RIBBONBAR_TAB_LEFT_DCLICK(id, func)} + Triggered when the left mouse button is double clicked on a tab. @endEventTable @library{wxribbon} diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index e8f6d4fe26..9e5c6435dc 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -38,6 +38,7 @@ wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, wxRibbonBarEvent); wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, wxRibbonBarEvent); +wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, wxRibbonBarEvent); IMPLEMENT_CLASS(wxRibbonBar, wxRibbonControl) IMPLEMENT_DYNAMIC_CLASS(wxRibbonBarEvent, wxNotifyEvent) @@ -53,6 +54,7 @@ BEGIN_EVENT_TABLE(wxRibbonBar, wxRibbonControl) EVT_PAINT(wxRibbonBar::OnPaint) EVT_RIGHT_DOWN(wxRibbonBar::OnMouseRightDown) EVT_RIGHT_UP(wxRibbonBar::OnMouseRightUp) + EVT_LEFT_DCLICK(wxRibbonBar::OnMouseDoubleClick) EVT_SIZE(wxRibbonBar::OnSize) END_EVENT_TABLE() @@ -902,6 +904,11 @@ void wxRibbonBar::OnMouseRightUp(wxMouseEvent& evt) DoMouseButtonCommon(evt, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP); } +void wxRibbonBar::OnMouseDoubleClick(wxMouseEvent& evt) +{ + DoMouseButtonCommon(evt, wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK); +} + void wxRibbonBar::DoMouseButtonCommon(wxMouseEvent& evt, wxEventType tab_event_type) { wxRibbonPageTabInfo *tab = HitTestTabs(evt.GetPosition());