Add wxToolBarTool::Get{Normal,Disabled}BitmapBundle() accessors

The existing variants returning wxBitmap are insufficient for non-MSW
ports where the toolbar bitmap size is unavailable otherwise, as
GetToolBitmapSize() value doesn't really correspond to it (which is a
problem on its own, but there is not much that can be done about it by
now).

Having these functions allows to retrieve the actually used bitmap size
by using wxBitmapBundle::GetDefaultSize().
This commit is contained in:
Vadim Zeitlin 2021-10-16 20:01:28 +02:00
parent 399b0ff9ae
commit 0f5c2851f4
2 changed files with 23 additions and 0 deletions

View File

@ -146,6 +146,9 @@ public:
{ return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO; }
// attributes
wxBitmapBundle GetNormalBitmapBundle() const { return m_bmpNormal; }
wxBitmapBundle GetDisabledBitmapBundle() const { return m_bmpDisabled; }
wxBitmap GetNormalBitmap(const wxSize& size = wxDefaultSize) const
{ return m_bmpNormal.GetBitmap(size); }
wxBitmap GetDisabledBitmap(const wxSize& size = wxDefaultSize) const

View File

@ -112,6 +112,26 @@ public:
bool IsToggled() const;
bool CanBeToggled() const;
/**
Return the bundle containing normal tool bitmaps.
This bundle may be invalid if the tool doesn't show a bitmap.
@since 3.1.6
*/
wxBitmapBundle GetNormalBitmapBundle() const;
/**
Return the bundle containing disabled tool bitmaps.
This bundle may be invalid if the tool doesn't show a bitmap or doesn't
have a specific disabled bitmap creates one automatically from the
normal bitmap.
@since 3.1.6
*/
wxBitmapBundle GetDisabledBitmapBundle() const;
wxBitmap GetNormalBitmap() const;
wxBitmap GetDisabledBitmap() const;