]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/ribbon/buttonbar.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / ribbon / buttonbar.h
index 70985121eaa073eef7c7b332a7f38de11dc66cdb..ab637a104e6dcb3e09d2a9c79c9ce5fe0d3a4a24 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Peter Cawley
 // Modified by:
 // Created:     2009-07-01
 // Author:      Peter Cawley
 // Modified by:
 // Created:     2009-07-01
-// RCS-ID:      $Id$
 // Copyright:   (C) Peter Cawley
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 // Copyright:   (C) Peter Cawley
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -81,8 +80,58 @@ public:
                 const wxBitmap& bitmap_disabled = wxNullBitmap,
                 const wxBitmap& bitmap_small_disabled = wxNullBitmap,
                 wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
                 const wxBitmap& bitmap_disabled = wxNullBitmap,
                 const wxBitmap& bitmap_small_disabled = wxNullBitmap,
                 wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
-                const wxString& help_string = wxEmptyString,
-                wxObject* client_data = NULL);
+                const wxString& help_string = wxEmptyString);
+
+    virtual wxRibbonButtonBarButtonBase* InsertButton(
+                size_t pos,
+                int button_id,
+                const wxString& label,
+                const wxBitmap& bitmap,
+                const wxString& help_string,
+                wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL);
+
+    virtual wxRibbonButtonBarButtonBase* InsertDropdownButton(
+                size_t pos,
+                int button_id,
+                const wxString& label,
+                const wxBitmap& bitmap,
+                const wxString& help_string = wxEmptyString);
+
+    virtual wxRibbonButtonBarButtonBase* InsertHybridButton(
+                size_t pos,
+                int button_id,
+                const wxString& label,
+                const wxBitmap& bitmap,
+                const wxString& help_string = wxEmptyString);
+
+    virtual wxRibbonButtonBarButtonBase* InsertToggleButton(
+                size_t pos,
+                int button_id,
+                const wxString& label,
+                const wxBitmap& bitmap,
+                const wxString& help_string = wxEmptyString);
+
+    virtual wxRibbonButtonBarButtonBase* InsertButton(
+                size_t pos,
+                int button_id,
+                const wxString& label,
+                const wxBitmap& bitmap,
+                const wxBitmap& bitmap_small = wxNullBitmap,
+                const wxBitmap& bitmap_disabled = wxNullBitmap,
+                const wxBitmap& bitmap_small_disabled = wxNullBitmap,
+                wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL,
+                const wxString& help_string = wxEmptyString);
+
+    void SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* data);
+    wxClientData* GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const;
+    void SetItemClientData(wxRibbonButtonBarButtonBase* item, void* data);
+    void* GetItemClientData(const wxRibbonButtonBarButtonBase* item) const;
+
+    virtual size_t GetButtonCount() const;
+    virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const;
+    virtual wxRibbonButtonBarButtonBase *GetItemById(int id) const;
+    virtual int GetItemId(wxRibbonButtonBarButtonBase *button) const;
+
 
     virtual bool Realize();
     virtual void ClearButtons();
 
     virtual bool Realize();
     virtual void ClearButtons();
@@ -90,10 +139,17 @@ public:
     virtual void EnableButton(int button_id, bool enable = true);
     virtual void ToggleButton(int button_id, bool checked);
 
     virtual void EnableButton(int button_id, bool enable = true);
     virtual void ToggleButton(int button_id, bool checked);
 
+    virtual wxRibbonButtonBarButtonBase *GetActiveItem() const;
+    virtual wxRibbonButtonBarButtonBase *GetHoveredItem() const;
+
     virtual void SetArtProvider(wxRibbonArtProvider* art);
     virtual bool IsSizingContinuous() const;
 
     virtual wxSize GetMinSize() const;
     virtual void SetArtProvider(wxRibbonArtProvider* art);
     virtual bool IsSizingContinuous() const;
 
     virtual wxSize GetMinSize() const;
+
+    void SetShowToolTipsForDisabled(bool show);
+    bool GetShowToolTipsForDisabled() const;
+
 protected:
     friend class wxRibbonButtonBarEvent;
     virtual wxSize DoGetBestSize() const;
 protected:
     friend class wxRibbonButtonBarEvent;
     virtual wxSize DoGetBestSize() const;
@@ -120,6 +176,7 @@ protected:
     static wxBitmap MakeDisabledBitmap(const wxBitmap& original);
     void FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button,
         wxRibbonButtonBarButtonState size, wxDC& dc);
     static wxBitmap MakeDisabledBitmap(const wxBitmap& original);
     void FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button,
         wxRibbonButtonBarButtonState size, wxDC& dc);
+    virtual void UpdateWindowUI(long flags);
 
     wxArrayRibbonButtonBarLayout m_layouts;
     wxArrayRibbonButtonBarButtonBase m_buttons;
 
     wxArrayRibbonButtonBarLayout m_layouts;
     wxArrayRibbonButtonBarButtonBase m_buttons;
@@ -132,6 +189,7 @@ protected:
     int m_current_layout;
     bool m_layouts_valid;
     bool m_lock_active_state;
     int m_current_layout;
     bool m_layouts_valid;
     bool m_lock_active_state;
+    bool m_show_tooltips_for_disabled;
 
 #ifndef SWIG
     DECLARE_CLASS(wxRibbonButtonBar)
 
 #ifndef SWIG
     DECLARE_CLASS(wxRibbonButtonBar)
@@ -144,25 +202,30 @@ class WXDLLIMPEXP_RIBBON wxRibbonButtonBarEvent : public wxCommandEvent
 public:
     wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
                        int win_id = 0,
 public:
     wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL,
                        int win_id = 0,
-                       wxRibbonButtonBar* bar = NULL)
+                       wxRibbonButtonBar* bar = NULL,
+                       wxRibbonButtonBarButtonBase* button = NULL)
         : wxCommandEvent(command_type, win_id)
         : wxCommandEvent(command_type, win_id)
-        , m_bar(bar)
+        , m_bar(bar), m_button(button)
     {
     }
 #ifndef SWIG
     wxRibbonButtonBarEvent(const wxRibbonButtonBarEvent& e) : wxCommandEvent(e)
     {
         m_bar = e.m_bar;
     {
     }
 #ifndef SWIG
     wxRibbonButtonBarEvent(const wxRibbonButtonBarEvent& e) : wxCommandEvent(e)
     {
         m_bar = e.m_bar;
+        m_button = e.m_button;
     }
 #endif
     wxEvent *Clone() const { return new wxRibbonButtonBarEvent(*this); }
 
     wxRibbonButtonBar* GetBar() {return m_bar;}
     }
 #endif
     wxEvent *Clone() const { return new wxRibbonButtonBarEvent(*this); }
 
     wxRibbonButtonBar* GetBar() {return m_bar;}
+    wxRibbonButtonBarButtonBase *GetButton() { return m_button; }
     void SetBar(wxRibbonButtonBar* bar) {m_bar = bar;}
     void SetBar(wxRibbonButtonBar* bar) {m_bar = bar;}
+    void SetButton(wxRibbonButtonBarButtonBase* button) { m_button = button; }
     bool PopupMenu(wxMenu* menu);
 
 protected:
     wxRibbonButtonBar* m_bar;
     bool PopupMenu(wxMenu* menu);
 
 protected:
     wxRibbonButtonBar* m_bar;
+    wxRibbonButtonBarButtonBase *m_button;
 
 #ifndef SWIG
 private:
 
 #ifndef SWIG
 private:
@@ -172,8 +235,8 @@ private:
 
 #ifndef SWIG
 
 
 #ifndef SWIG
 
-wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEvent);
-wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, wxRibbonButtonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_CLICKED, wxRibbonButtonBarEvent);
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_RIBBON, wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, wxRibbonButtonBarEvent);
 
 typedef void (wxEvtHandler::*wxRibbonButtonBarEventFunction)(wxRibbonButtonBarEvent&);
 
 
 typedef void (wxEvtHandler::*wxRibbonButtonBarEventFunction)(wxRibbonButtonBarEvent&);
 
@@ -181,21 +244,25 @@ typedef void (wxEvtHandler::*wxRibbonButtonBarEventFunction)(wxRibbonButtonBarEv
     wxEVENT_HANDLER_CAST(wxRibbonButtonBarEventFunction, func)
 
 #define EVT_RIBBONBUTTONBAR_CLICKED(winid, fn) \
     wxEVENT_HANDLER_CAST(wxRibbonButtonBarEventFunction, func)
 
 #define EVT_RIBBONBUTTONBAR_CLICKED(winid, fn) \
-    wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONBUTTON_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
+    wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
 #define EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(winid, fn) \
 #define EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED(winid, fn) \
-    wx__DECLARE_EVT1(wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
+    wx__DECLARE_EVT1(wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, winid, wxRibbonButtonBarEventHandler(fn))
 #else
 
 // wxpython/swig event work
 #else
 
 // wxpython/swig event work
-%constant wxEventType wxEVT_COMMAND_RIBBONBUTTON_CLICKED;
-%constant wxEventType wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED;
+%constant wxEventType wxEVT_RIBBONBUTTONBAR_CLICKED;
+%constant wxEventType wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED;
 
 %pythoncode {
 
 %pythoncode {
-    EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBUTTON_CLICKED, 1 )
-    EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, 1 )
+    EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_CLICKED, 1 )
+    EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, 1 )
 }
 #endif
 
 }
 #endif
 
+// old wxEVT_COMMAND_* constants
+#define wxEVT_COMMAND_RIBBONBUTTON_CLICKED            wxEVT_RIBBONBUTTONBAR_CLICKED
+#define wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED   wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED
+
 #endif // wxUSE_RIBBON
 
 #endif // _WX_RIBBON_BUTTON_BAR_H_
 #endif // wxUSE_RIBBON
 
 #endif // _WX_RIBBON_BUTTON_BAR_H_