Use wxBaseArray instead of object array for wxAuiToolBarItemArray

This class is part of the public API, as it is used by the public
wxAuiToolBar functions, so we can't make it just a vector, but we can
still make it a wxBaseArray instead of using the old macro-based object
array for it.

Also document it.
This commit is contained in:
Vadim Zeitlin
2023-04-12 18:09:48 +01:00
parent 5f58ea5733
commit bc23b1f4f0
3 changed files with 13 additions and 8 deletions
+1 -3
View File
@@ -254,9 +254,7 @@ private:
int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
};
#ifndef SWIG
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiToolBarItem, wxAuiToolBarItemArray, WXDLLIMPEXP_AUI);
#endif
using wxAuiToolBarItemArray = wxBaseArray<wxAuiToolBarItem>;
+11
View File
@@ -454,6 +454,17 @@ public:
bool CanBeToggled() const;
};
/**
A vector of AUI toolbar items.
This class is actually a legacy container (see @ref overview_container for
more details), but it can, and should be, handled as just a vector of
wxAuiToolBarItem objects in the application code.
*/
class wxAuiToolBarItemArray : public std::vector<wxAuiToolBarItem>
{
};
/**
@class wxAuiToolBarArt
+1 -5
View File
@@ -36,10 +36,6 @@
#include "wx/osx/private.h"
#endif
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxAuiToolBarItemArray)
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
wxDEFINE_EVENT( wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
@@ -1258,7 +1254,7 @@ wxAuiToolBarItem* wxAuiToolBar::FindToolByIndex(int idx) const
if (idx >= (int)m_items.size())
return nullptr;
return &(m_items[idx]);
return const_cast<wxAuiToolBarItem*>(&(m_items[idx]));
}
void wxAuiToolBar::SetToolClientData (int tool_id, wxObject *client_data)