Delete the button object in wxRibbonButtonBar::DeleteButton().

Unlike ClearButtons(), DeleteButton() didn't actually delete the button.

Fix this and document this behaviour.

Closes #15909.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-25 17:39:21 +00:00
parent 2c260e8188
commit 5f30588ebd
3 changed files with 14 additions and 1 deletions

View File

@@ -6,6 +6,15 @@ Note: This file contains the list of changes since wxWidgets 3.x, please see
docs/changes_30.txt for the changes in the previous versions. docs/changes_30.txt for the changes in the previous versions.
INCOMPATIBLE CHANGES SINCE 3.0.x:
=================================
Changes in behaviour not resulting in compilation errors
--------------------------------------------------------
- wxRibbonButtonBar::DeleteButton() now deletes and not just removes the button.
3.1.0: (released 2014-xx-xx) 3.1.0: (released 2014-xx-xx)
---------------------------- ----------------------------

View File

@@ -443,6 +443,9 @@ public:
/** /**
Delete a single button from the button bar. Delete a single button from the button bar.
The corresponding button is deleted by this function, so any pointers to
it previously obtained by GetItem() or GetItemById() become invalid.
@see ClearButtons() @see ClearButtons()
*/ */
virtual bool DeleteButton(int button_id); virtual bool DeleteButton(int button_id);

View File

@@ -515,6 +515,7 @@ bool wxRibbonButtonBar::DeleteButton(int button_id)
{ {
m_layouts_valid = false; m_layouts_valid = false;
m_buttons.RemoveAt(i); m_buttons.RemoveAt(i);
delete button;
Realize(); Realize();
Refresh(); Refresh();
return true; return true;