]> git.saurik.com Git - wxWidgets.git/blobdiff - src/ribbon/bar.cpp
Use Cairo for wxGraphicsContext in wxX11.
[wxWidgets.git] / src / ribbon / bar.cpp
index 6f285d7bda27fabd6f0cdf0074a1258749500951..9e5c6435dcd9511e2aacc91c5e89a37b6b10d192 100644 (file)
     #pragma hdrstop
 #endif
 
-#include "wx/ribbon/bar.h"
-
 #if wxUSE_RIBBON
 
+#include "wx/ribbon/bar.h"
 #include "wx/ribbon/art.h"
 #include "wx/dcbuffer.h"
 
@@ -31,7 +30,7 @@
 
 #include "wx/arrimpl.cpp"
 
-WX_DEFINE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfoArray);
+WX_DEFINE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfoArray)
 
 wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, wxRibbonBarEvent);
 wxDEFINE_EVENT(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, wxRibbonBarEvent);
@@ -39,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)
@@ -54,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()
 
@@ -210,9 +211,9 @@ void wxRibbonBar::OnMouseMove(wxMouseEvent& evt)
     if(m_tab_scroll_buttons_shown)
     {
 #define SET_FLAG(variable, flag) \
-    { if(((variable) & (flag)) != (flag)) variable |= (flag), refresh_tabs = true; }
+    { if(((variable) & (flag)) != (flag)) { variable |= (flag); refresh_tabs = true; }}
 #define UNSET_FLAG(variable, flag) \
-    { if((variable) & (flag)) variable &= ~(flag), refresh_tabs = true; }
+    { if((variable) & (flag)) { variable &= ~(flag); refresh_tabs = true; }}
 
         if(m_tab_scroll_left_button_rect.Contains(x, y))
             SET_FLAG(m_tab_scroll_left_button_state, wxRIBBON_SCROLL_BTN_HOVERED)
@@ -903,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());