Use wxBaseArray instead of object arrays for wxAuiNotebook arrays

These classes can also be potentially used in the user code, as they are
used for the protected members of wxAuiTabContainer, so don't replace
them with just std::vector, but do, at least, use wxBaseArray template
for them instead of the macro-based object arrays.

Note that this required the check for the button presence in m_buttons
in wxAuiTabContainer::TabHitTest() as wxBaseArray::Index() relies on
object comparison, whereas the original version relied on object address
comparison, so keep it like this, even though we probably could compare
the buttons IDs instead (and, possibly, not compare anything at all but
just return the result of the button we found from ButtonHitTest()
directly).

Also document these container classes.
This commit is contained in:
Vadim Zeitlin 2023-04-11 16:29:00 +02:00
parent bc23b1f4f0
commit bceace12b5
3 changed files with 41 additions and 10 deletions

View file

@ -109,10 +109,19 @@ public:
};
#ifndef SWIG
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiNotebookPage, wxAuiNotebookPageArray, WXDLLIMPEXP_AUI);
WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiTabContainerButton, wxAuiTabContainerButtonArray, WXDLLIMPEXP_AUI);
#endif
// These legacy classes can't be just typedefs as they can be (and are)
// forward-declared in the existing code.
class wxAuiNotebookPageArray : public wxBaseArray<wxAuiNotebookPage>
{
public:
using wxBaseArray<wxAuiNotebookPage>::wxBaseArray;
};
class wxAuiTabContainerButtonArray : public wxBaseArray<wxAuiTabContainerButton>
{
public:
using wxBaseArray<wxAuiTabContainerButton>::wxBaseArray;
};
class WXDLLIMPEXP_AUI wxAuiTabContainer