X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9069ea3432ee562aa64b2d732c3919f87637bc1..5475b39f53097be2de0ad06c7807b3ab524a047e:/interface/wx/ribbon/buttonbar.h diff --git a/interface/wx/ribbon/buttonbar.h b/interface/wx/ribbon/buttonbar.h index cee957c25f..08951900f2 100644 --- a/interface/wx/ribbon/buttonbar.h +++ b/interface/wx/ribbon/buttonbar.h @@ -20,19 +20,19 @@ enum wxRibbonButtonBarButtonState { /** - Button is small (the interpretation of small is dependant upon the art + Button is small (the interpretation of small is dependent upon the art provider, but it will be smaller than medium). */ wxRIBBON_BUTTONBAR_BUTTON_SMALL = 0 << 0, /** - Button is medium sized (the interpretation of medium is dependant upon + Button is medium sized (the interpretation of medium is dependent upon the art provider, but it will be between small and large). */ wxRIBBON_BUTTONBAR_BUTTON_MEDIUM = 1 << 0, /** - Button is large (the interpretation of large is dependant upon the art + Button is large (the interpretation of large is dependent upon the art provider, but it will be larger than medium). */ wxRIBBON_BUTTONBAR_BUTTON_LARGE = 2 << 0, @@ -231,8 +231,6 @@ public: The kind of button to add. @param help_string The UI help string to associate with the new button. - @param client_data - Client data to associate with the new button. @return An opaque pointer which can be used only with other button bar methods. @@ -249,8 +247,7 @@ public: 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); /** Inserts a button to the button bar (simple version) at the given position. @@ -345,8 +342,6 @@ public: The kind of button to add. @param help_string The UI help string to associate with the new button. - @param client_data - Client data to associate with the new button. @return An opaque pointer which can be used only with other button bar methods. @@ -367,8 +362,7 @@ public: 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); /** Returns the number of buttons in this button bar. @@ -377,6 +371,60 @@ public: */ virtual size_t GetButtonCount() const; + /** + Set the client object associated with a button. The button bar + owns the given object and takes care of its deletion. + Please, note that you cannot use both client object and client data. + + @since 2.9.5 + */ + void SetItemClientObject(wxRibbonButtonBarButtonBase* item, wxClientData* data); + + /** + Get the client object associated with a button. + + @since 2.9.5 + */ + wxClientData* GetItemClientObject(const wxRibbonButtonBarButtonBase* item) const; + + /** + Set the client data associated with a button. + Please, note that you cannot use both client object and client data. + + @since 2.9.5 + */ + void SetItemClientData(wxRibbonButtonBarButtonBase* item, void* data); + + /** + Get the client data associated with a button. + + @since 2.9.5 + */ + void* GetItemClientData(const wxRibbonButtonBarButtonBase* item) const; + + /** + Returns the N-th button of the bar. + + @see GetButtonCount() + + @since 2.9.5 + */ + virtual wxRibbonButtonBarButtonBase *GetItem(size_t n) const; + + /** + Returns the first button having a given id or NULL if none matches. + + @since 2.9.5 + */ + virtual wxRibbonButtonBarButtonBase *GetItemById(int id) const; + + /** + Returns the id of a button. + + @since 2.9.5 + */ + virtual int GetItemId(wxRibbonButtonBarButtonBase *) const; + /** Calculate button layouts and positions. @@ -420,6 +468,23 @@ public: @false to set it to the untoggled/unpressed/unchecked state. */ virtual void ToggleButton(int button_id, bool checked); + + /** + Returns the active item of the button bar or NULL if there is none. + The active button is the one being clicked. + + @since 2.9.5 + */ + virtual wxRibbonButtonBarButtonBase *GetActiveItem() const; + + /** + Returns the hovered item of the button bar or NULL if there is none. + The hovered button is the one the mouse is over. + + @since 2.9.5 + */ + virtual wxRibbonButtonBarButtonBase *GetHoveredItem() const; + }; /** @@ -444,7 +509,8 @@ public: */ wxRibbonButtonBarEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0, - wxRibbonButtonBar* bar = NULL); + wxRibbonButtonBar* bar = NULL, + wxRibbonButtonBarButtonBase* button = NULL); /** Returns the bar which contains the button which the event relates to. @@ -456,6 +522,20 @@ public: */ void SetBar(wxRibbonButtonBar* bar); + /** + Returns the button which the event relates to. + + @since 2.9.5 + */ + wxRibbonButtonBarButtonBase* GetButton(); + + /** + Sets the button relating to this event. + + @since 2.9.5 + */ + void SetButton(wxRibbonButtonBarButtonBase* bar); + /** Display a popup menu as a result of this (dropdown clicked) event. */