Allow using wxBitmapBundle for wxButton bitmaps

Take wxBitmapBundle in wxButton::SetBitmapLabel() and related functions
in order to be able to associate several bitmaps to be used in different
resolutions with the button, instead of just a single bitmap.
This commit is contained in:
Vadim Zeitlin 2021-10-10 19:32:43 +01:00
parent 2910327ef3
commit 4e5d2d97e2
36 changed files with 223 additions and 175 deletions

View file

@ -99,8 +99,9 @@ protected:
// function called when any of the bitmaps changes
virtual void OnSetBitmap() { InvalidateBestSize(); Refresh(); }
virtual wxBitmap DoGetBitmap(State which) const { return m_bitmaps[which]; }
virtual void DoSetBitmap(const wxBitmap& bitmap, State which)
virtual wxBitmap DoGetBitmap(State which) const
{ return m_bitmaps[which].GetBitmap(wxDefaultSize); }
virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which)
{ m_bitmaps[which] = bitmap; OnSetBitmap(); }
virtual wxSize DoGetBitmapMargins() const
@ -114,8 +115,8 @@ protected:
m_marginY = y;
}
// the bitmaps for various states
wxBitmap m_bitmaps[State_Max];
// the bitmap bundles for various states
wxBitmapBundle m_bitmaps[State_Max];
// the margins around the bitmap
int m_marginX,