]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/ribbon/panel.h
Add expand/collapse button to wxRibbonBar.
[wxWidgets.git] / include / wx / ribbon / panel.h
index 51d49c7964e1e3241dd3b3f7320f94e2a48efbf1..5e9635b94e7641ddb04b8641b1f053c021611250 100644 (file)
@@ -57,6 +57,7 @@ public:
     bool IsMinimised() const;
     bool IsMinimised(wxSize at_size) const;
     bool IsHovered() const;
+    bool IsExtButtonHovered() const;
     bool CanAutoMinimise() const;
 
     bool ShowExpanded();
@@ -73,6 +74,8 @@ public:
     virtual void AddChild(wxWindowBase *child);
     virtual void RemoveChild(wxWindowBase *child);
 
+    virtual bool HasExtButton() const;
+
     wxRibbonPanel* GetExpandedDummy();
     wxRibbonPanel* GetExpandedPanel();
 
@@ -102,6 +105,7 @@ protected:
     void OnMouseLeave(wxMouseEvent& evt);
     void OnMouseLeaveChild(wxMouseEvent& evt);
     void OnMouseClick(wxMouseEvent& evt);
+    void OnMotion(wxMouseEvent& evt);
     void OnKillFocus(wxFocusEvent& evt);
     void OnChildKillFocus(wxFocusEvent& evt);
 
@@ -125,6 +129,8 @@ protected:
     long m_flags;
     bool m_minimised;
     bool m_hovered;
+    bool m_ext_button_hovered;
+    wxRect m_ext_button_rect;
 
 #ifndef SWIG
     DECLARE_CLASS(wxRibbonPanel)
@@ -132,6 +138,58 @@ protected:
 #endif
 };
 
+
+class WXDLLIMPEXP_RIBBON wxRibbonPanelEvent : public wxCommandEvent
+{
+public:
+    wxRibbonPanelEvent(wxEventType command_type = wxEVT_NULL,
+                       int win_id = 0,
+                       wxRibbonPanel* panel = NULL)
+        : wxCommandEvent(command_type, win_id)
+        , m_panel(panel)
+    {
+    }
+#ifndef SWIG
+    wxRibbonPanelEvent(const wxRibbonPanelEvent& e) : wxCommandEvent(e)
+    {
+        m_panel = e.m_panel;
+    }
+#endif
+    wxEvent *Clone() const { return new wxRibbonPanelEvent(*this); }
+
+    wxRibbonPanel* GetPanel() {return m_panel;}
+    void SetPanel(wxRibbonPanel* panel) {m_panel = panel;}
+
+protected:
+    wxRibbonPanel* m_panel;
+
+#ifndef SWIG
+private:
+    DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRibbonPanelEvent)
+#endif
+};
+
+#ifndef SWIG
+
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, wxRibbonPanelEvent);
+
+typedef void (wxEvtHandler::*wxRibbonPanelEventFunction)(wxRibbonPanelEvent&);
+
+#define wxRibbonPanelEventHandler(func) \
+    wxEVENT_HANDLER_CAST(wxRibbonPanelEventFunction, func)
+
+#define EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED(winid, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, winid, wxRibbonPanelEventHandler(fn))
+#else
+
+// wxpython/swig event work
+%constant wxEventType wxEVT_COMMAND_RIBBONPANEL_ACTIVATED;
+
+%pythoncode {
+    EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1 )
+}
+#endif
+
 #endif // wxUSE_RIBBON
 
 #endif // _WX_RIBBON_PANEL_H_