X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/69aa257b8391b5c05d5ba70f0587c696347b048a..0c0e063e66f80ce608d8bb9447b33609858ba6be:/interface/wx/ribbon/buttonbar.h?ds=sidebyside diff --git a/interface/wx/ribbon/buttonbar.h b/interface/wx/ribbon/buttonbar.h index c209cf7146..9f1bfe12b3 100644 --- a/interface/wx/ribbon/buttonbar.h +++ b/interface/wx/ribbon/buttonbar.h @@ -78,10 +78,15 @@ enum wxRibbonButtonBarButtonState */ wxRIBBON_BUTTONBAR_BUTTON_DISABLED = 1 << 7, + /** + The button is a toggle button which is currently in the toggled state. + */ + wxRIBBON_BUTTONBAR_BUTTON_TOGGLED = 1 << 8, + /** A mask to extract button state from a combination of flags. */ - wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0xF8, + wxRIBBON_BUTTONBAR_BUTTON_STATE_MASK = 0x1F8, }; /** @@ -190,6 +195,17 @@ public: const wxBitmap& bitmap, const wxString& help_string = wxEmptyString); + /** + Add a toggle button to the button bar (simple version). + + @see AddButton() + */ + virtual wxRibbonButtonBarButtonBase* AddToggleButton( + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + /** Add a button to the button bar. @@ -223,6 +239,7 @@ public: @see AddDropdownButton() @see AddHybridButton() + @see AddToggleButton() */ virtual wxRibbonButtonBarButtonBase* AddButton( int button_id, @@ -235,6 +252,131 @@ public: const wxString& help_string = wxEmptyString, wxObject* client_data = NULL); + /** + Inserts a button to the button bar (simple version) at the given position. + + @see AddButton() + + @since 2.9.4 + */ + virtual wxRibbonButtonBarButtonBase* InsertButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string, + wxRibbonButtonBarButtonKind kind = wxRIBBON_BUTTONBAR_BUTTON_NORMAL); + + /** + Inserts a dropdown button to the button bar (simple version) at the + given position. + + @see InsertButton() + @see AddDropdownButton() + @see AddButton() + + @since 2.9.4 + */ + virtual wxRibbonButtonBarButtonBase* InsertDropdownButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + /** + Inserts a hybrid button to the button bar (simple version) at the given + position. + + @see InsertButton() + @see AddHybridButton() + @see AddButton() + + @since 2.9.4 + */ + virtual wxRibbonButtonBarButtonBase* InsertHybridButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + /** + Inserts a toggle button to the button bar (simple version) at the given + position. + + @see InsertButton() + @see AddToggleButton() + @see AddButton() + + @since 2.9.4 + */ + virtual wxRibbonButtonBarButtonBase* InsertToggleButton( + size_t pos, + int button_id, + const wxString& label, + const wxBitmap& bitmap, + const wxString& help_string = wxEmptyString); + + /** + Insert a button to the button bar at the given position. + + @param pos + Position of the new button in the button bar. + @param button_id + ID of the new button (used for event callbacks). + @param label + Label of the new button. + @param bitmap + Large bitmap of the new button. Must be the same size as all other + large bitmaps used on the button bar. + @param bitmap_small + Small bitmap of the new button. If left as null, then a small + bitmap will be automatically generated. Must be the same size as + all other small bitmaps used on the button bar. + @param bitmap_disabled + Large bitmap of the new button when it is disabled. If left as + null, then a bitmap will be automatically generated from @a bitmap. + @param bitmap_small_disabled + Small bitmap of the new button when it is disabled. If left as + null, then a bitmap will be automatically generated from @a + bitmap_small. + @param kind + 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. + + @see InsertDropdownButton() + @see InsertHybridButton() + @see InsertToggleButton() + @see AddButton() + + @since 2.9.4 + */ + 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, + wxRibbonButtonBarButtonKind kind = wxRIBBON_BUTTONBAR_BUTTON_NORMAL, + const wxString& help_string = wxEmptyString, + wxObject* client_data = NULL); + + /** + Returns the number of buttons in this button bar. + + @since 2.9.4 + */ + virtual size_t GetButtonCount() const; + /** Calculate button layouts and positions. @@ -267,13 +409,25 @@ public: @true to enable the button, @false to disable it. */ virtual void EnableButton(int button_id, bool enable = true); + + /** + Set a toggle button to the checked or unchecked state. + + @param button_id + ID of the toggle button to manipulate. + @param checked + @true to set the button to the toggled/pressed/checked state, + @false to set it to the untoggled/unpressed/unchecked state. + */ + virtual void ToggleButton(int button_id, bool checked); }; /** @class wxRibbonButtonBarEvent Event used to indicate various actions relating to a button on a - wxRibbonButtonBar. + wxRibbonButtonBar. For toggle buttons, IsChecked() can be used to test + the state of the button. See wxRibbonButtonBar for available event types.