Fix and enhance support for client data in wxRibbonButtonBar.

Add the possibility to retrieve the client data associated with a button and
not only set it (which wasn't very useful on its own).

Also allow having both typed (owned) and untyped (not owned) client data, as
in the other wxWidgets controls.

To avoid confusion between two different kinds of data, remove "client_data"
argument from the functions adding buttons and provide separate methods with
distinct names for setting and getting client data.

Closes #14630.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72529 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-09-20 20:02:25 +00:00
parent 7f08b8283b
commit 652aa9360f
4 changed files with 83 additions and 20 deletions

View File

@@ -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,37 @@ 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.