Take wxBitmapBundle in wxMenuItem::SetBitmap() in all ports
Update the remaining ports to take wxBitmapBundle rather than wxBitmap as well to make their API consistent with the tier 1 ports -- even if there is no actual support for choosing the resolution-appropriate bitmap in them yet.
This commit is contained in:
parent
dec0c1b5b6
commit
5fcea04d71
5 changed files with 22 additions and 24 deletions
|
|
@ -39,8 +39,8 @@ public:
|
|||
// I'm not sure if this works but it silences the linker in the
|
||||
// menu sample.
|
||||
// JJ
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
||||
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
||||
virtual void SetBitmap(const wxBitmapBundle& bitmap) { m_bitmap = bitmap; }
|
||||
virtual wxBitmap GetBitmap() const { return GetBitmapFromBundle(m_bitmap); }
|
||||
|
||||
// implementation from now on
|
||||
void CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMenu,
|
||||
|
|
@ -59,7 +59,7 @@ private:
|
|||
WXWidget m_buttonWidget;
|
||||
wxMenuBar* m_menuBar;
|
||||
wxMenu* m_topMenu; // Top-level menu e.g. popup-menu
|
||||
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
||||
wxBitmapBundle m_bitmap; // Bitmap for menuitem, if any
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxMenuItem);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ public:
|
|||
virtual void Check(bool check = true) wxOVERRIDE;
|
||||
virtual bool IsChecked() const wxOVERRIDE;
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
||||
virtual void SetBitmap(const wxBitmapBundle& bitmap);
|
||||
virtual wxBitmap GetBitmap() const { return GetBitmapFromBundle(m_bitmap); }
|
||||
|
||||
virtual QAction *GetHandle() const;
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ public:
|
|||
private:
|
||||
// Qt is using an action instead of a menu item.
|
||||
wxQtAction *m_qtAction;
|
||||
wxBitmap m_bitmap;
|
||||
wxBitmapBundle m_bitmap;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS( wxMenuItem );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ public:
|
|||
// we add some extra functions which are also available under MSW from
|
||||
// wxOwnerDrawn class - they will be moved to wxMenuItemBase later
|
||||
// hopefully
|
||||
void SetBitmaps(const wxBitmap& bmpChecked,
|
||||
const wxBitmap& bmpUnchecked = wxNullBitmap);
|
||||
void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); }
|
||||
const wxBitmap& GetBitmap(bool checked = true) const
|
||||
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
|
||||
void SetBitmaps(const wxBitmapBundle& bmpChecked,
|
||||
const wxBitmapBundle& bmpUnchecked = wxBitmapBundle());
|
||||
void SetBitmap(const wxBitmapBundle& bmp) { SetBitmaps(bmp); }
|
||||
wxBitmap GetBitmap(bool checked = true) const
|
||||
{ return GetBitmapFromBundle(checked ? m_bmpChecked : m_bmpUnchecked); }
|
||||
|
||||
void SetDisabledBitmap( const wxBitmap& bmpDisabled )
|
||||
void SetDisabledBitmap( const wxBitmapBundle& bmpDisabled )
|
||||
{ m_bmpDisabled = bmpDisabled; }
|
||||
const wxBitmap& GetDisabledBitmap() const
|
||||
{ return m_bmpDisabled; }
|
||||
wxBitmap GetDisabledBitmap() const
|
||||
{ return GetBitmapFromBundle(m_bmpDisabled); }
|
||||
|
||||
// mark item as belonging to the given radio group
|
||||
void SetAsRadioGroupStart();
|
||||
|
|
@ -93,9 +93,9 @@ protected:
|
|||
void UpdateAccelInfo();
|
||||
|
||||
// the bitmaps (may be invalid, then they're not used)
|
||||
wxBitmap m_bmpChecked,
|
||||
m_bmpUnchecked,
|
||||
m_bmpDisabled;
|
||||
wxBitmapBundle m_bmpChecked,
|
||||
m_bmpUnchecked,
|
||||
m_bmpDisabled;
|
||||
|
||||
// the positions of the first and last items of the radio group this item
|
||||
// belongs to or -1: start is the radio group start and is valid for all
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ bool wxMenuItem::IsChecked() const
|
|||
}
|
||||
|
||||
|
||||
void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
|
||||
void wxMenuItem::SetBitmap(const wxBitmapBundle& bitmap)
|
||||
{
|
||||
if ( m_kind == wxITEM_NORMAL )
|
||||
{
|
||||
m_bitmap = bitmap;
|
||||
if ( !m_bitmap.IsNull() )
|
||||
if ( m_bitmap.IsOk() )
|
||||
{
|
||||
m_qtAction->setIcon( QIcon(*m_bitmap.GetHandle()) );
|
||||
m_qtAction->setIcon( QIcon(*GetBitmapFromBundle(m_bitmap).GetHandle()) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1550,8 +1550,6 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
|
|||
m_radioGroup.start = -1;
|
||||
m_isRadioGroupStart = false;
|
||||
|
||||
m_bmpDisabled = wxNullBitmap;
|
||||
|
||||
UpdateAccelInfo();
|
||||
}
|
||||
|
||||
|
|
@ -1615,8 +1613,8 @@ void wxMenuItem::SetCheckable(bool checkable)
|
|||
}
|
||||
}
|
||||
|
||||
void wxMenuItem::SetBitmaps(const wxBitmap& bmpChecked,
|
||||
const wxBitmap& bmpUnchecked)
|
||||
void wxMenuItem::SetBitmaps(const wxBitmapBundle& bmpChecked,
|
||||
const wxBitmapBundle& bmpUnchecked)
|
||||
{
|
||||
m_bmpChecked = bmpChecked;
|
||||
m_bmpUnchecked = bmpUnchecked;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue