mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Add wxMSW-specific wxBitmapBundle accessors to wxMenuItem
Provide GetBitmapBundle(bool checked) and GetDisabledBitmapBundle() too in wxMSW, for consistency with the existing MSW-only member functions returning bitmaps. See #25705. Closes #25685.
This commit is contained in:
@@ -83,6 +83,11 @@ public:
|
||||
DoSetBitmap(bmp, bChecked);
|
||||
}
|
||||
|
||||
wxBitmapBundle GetBitmapBundle(bool bChecked) const
|
||||
{
|
||||
return bChecked ? m_bitmap : m_bmpUnchecked;
|
||||
}
|
||||
|
||||
wxBitmap GetBitmap(bool bChecked) const;
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
@@ -92,6 +97,8 @@ public:
|
||||
SetOwnerDrawn(true);
|
||||
}
|
||||
|
||||
wxBitmapBundle GetDisabledBitmapBundle() const { return m_bmpDisabled; }
|
||||
|
||||
wxBitmap GetDisabledBitmap() const;
|
||||
|
||||
int MeasureAccelWidth() const;
|
||||
|
||||
@@ -179,6 +179,9 @@ public:
|
||||
/**
|
||||
Returns the checked or unchecked bitmap.
|
||||
|
||||
Prefer using GetBitmapBundle() overload taking @a checked parameter in
|
||||
the new code.
|
||||
|
||||
This overload only exists in wxMSW, avoid using it in portable code.
|
||||
*/
|
||||
wxBitmap GetBitmap(bool checked) const;
|
||||
@@ -195,13 +198,34 @@ public:
|
||||
*/
|
||||
wxBitmapBundle GetBitmapBundle() const;
|
||||
|
||||
/**
|
||||
Returns the bitmap bundle containing the checked or unchecked bitmap
|
||||
for this item.
|
||||
|
||||
@onlyfor{wxmsw}
|
||||
|
||||
@since 3.3.2
|
||||
*/
|
||||
wxBitmapBundle GetBitmapBundle(bool checked) const;
|
||||
|
||||
/**
|
||||
Returns the bitmap used for disabled items.
|
||||
|
||||
@see GetDisabledBitmapBundle()
|
||||
|
||||
@onlyfor{wxmsw}
|
||||
*/
|
||||
virtual wxBitmap GetDisabledBitmap() const;
|
||||
|
||||
/**
|
||||
Returns the bitmap bundle used for disabled items.
|
||||
|
||||
@onlyfor{wxmsw}
|
||||
|
||||
@since 3.3.2
|
||||
*/
|
||||
wxBitmap GetDisabledBitmapBundle() const;
|
||||
|
||||
/**
|
||||
Returns the font associated with the menu item.
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ void wxMenuItem::SetItemLabel(const wxString& txt)
|
||||
|
||||
wxBitmap wxMenuItem::GetBitmap(bool bChecked) const
|
||||
{
|
||||
wxBitmap bmp = GetBitmapFromBundle(bChecked ? m_bitmap : m_bmpUnchecked);
|
||||
wxBitmap bmp = GetBitmapFromBundle(GetBitmapBundle(bChecked));
|
||||
#if wxUSE_IMAGE
|
||||
if ( bmp.IsOk() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user