Store any number of image lists in wxRibbonBar, not just two

The same wxRibbonBar can use multiple button bars with different icon
sizes, so 2 image lists are not enough. But OTOH there is no need to
distinguish between small and large images neither, so 2 may be also 1
too many.

Instead, use however many image lists we need, depending on the size.
For now, just store them in a vector and use linear search in it,
instead of using a map or, maybe, sorted vector, as we suppose there are
never going to be more than a couple of elements in this vector anyhow.
This commit is contained in:
Vadim Zeitlin
2020-02-07 19:21:33 +01:00
parent 18e8a68c1b
commit 10c49631a3
3 changed files with 20 additions and 27 deletions

View File

@@ -20,6 +20,8 @@ class WXDLLIMPEXP_FWD_CORE wxImageList;
#include "wx/ribbon/control.h"
#include "wx/ribbon/page.h"
#include "wx/vector.h"
enum wxRibbonBarOption
{
wxRIBBON_BAR_SHOW_PAGE_LABELS = 1 << 0,
@@ -154,9 +156,9 @@ public:
void HideIfExpanded();
// Implementation only.
// Return the image list containing images of the given size, creating it
// if necessary.
wxImageList* GetButtonImageList(wxSize size);
wxImageList* GetButtonSmallImageList(wxSize size);
protected:
friend class wxRibbonPage;
@@ -214,8 +216,7 @@ protected:
wxRibbonDisplayMode m_ribbon_state;
wxImageList* m_buttonImageList;
wxImageList* m_buttonSmallImageList;
wxVector<wxImageList*> m_image_lists;
#ifndef SWIG
wxDECLARE_CLASS(wxRibbonBar);