Applied patch [ 892543 ] wxUniversal: Bitmaps in disabled menu items
Christian Sturmlechner git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,6 +48,11 @@ public:
|
|||||||
const wxBitmap& GetBitmap(bool checked = TRUE) const
|
const wxBitmap& GetBitmap(bool checked = TRUE) const
|
||||||
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
|
{ return checked ? m_bmpChecked : m_bmpUnchecked; }
|
||||||
|
|
||||||
|
void SetDisabledBitmap( const wxBitmap& bmpDisabled )
|
||||||
|
{ m_bmpDisabled = bmpDisabled; }
|
||||||
|
const wxBitmap& GetDisabledBitmap() const
|
||||||
|
{ return m_bmpDisabled; }
|
||||||
|
|
||||||
// mark item as belonging to the given radio group
|
// mark item as belonging to the given radio group
|
||||||
void SetAsRadioGroupStart();
|
void SetAsRadioGroupStart();
|
||||||
void SetRadioGroupStart(int start);
|
void SetRadioGroupStart(int start);
|
||||||
@@ -92,7 +97,8 @@ protected:
|
|||||||
|
|
||||||
// the bitmaps (may be invalid, then they're not used)
|
// the bitmaps (may be invalid, then they're not used)
|
||||||
wxBitmap m_bmpChecked,
|
wxBitmap m_bmpChecked,
|
||||||
m_bmpUnchecked;
|
m_bmpUnchecked,
|
||||||
|
m_bmpDisabled;
|
||||||
|
|
||||||
// the positions of the first and last items of the radio group this item
|
// 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
|
// belongs to or -1: start is the radio group start and is valid for all
|
||||||
|
@@ -585,6 +585,21 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
|
|||||||
if ( item == GetCurrentItem() )
|
if ( item == GetCurrentItem() )
|
||||||
flags |= wxCONTROL_SELECTED;
|
flags |= wxCONTROL_SELECTED;
|
||||||
|
|
||||||
|
wxBitmap bmp;
|
||||||
|
|
||||||
|
if ( !item->IsEnabled() )
|
||||||
|
{
|
||||||
|
bmp = item->GetDisabledBitmap();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !bmp.Ok() )
|
||||||
|
{
|
||||||
|
// strangely enough, for unchecked item we use the
|
||||||
|
// "checked" bitmap because this is the default one - this
|
||||||
|
// explains this strange boolean expression
|
||||||
|
bmp = item->GetBitmap(!item->IsCheckable() || item->IsChecked());
|
||||||
|
}
|
||||||
|
|
||||||
rend->DrawMenuItem
|
rend->DrawMenuItem
|
||||||
(
|
(
|
||||||
dc,
|
dc,
|
||||||
@@ -592,10 +607,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
|
|||||||
gi,
|
gi,
|
||||||
item->GetLabel(),
|
item->GetLabel(),
|
||||||
item->GetAccelString(),
|
item->GetAccelString(),
|
||||||
// strangely enough, for unchecked item we use the
|
bmp,
|
||||||
// "checked" bitmap because this is the default one - this
|
|
||||||
// explains this strange boolean expression
|
|
||||||
item->GetBitmap(!item->IsCheckable() || item->IsChecked()),
|
|
||||||
flags,
|
flags,
|
||||||
item->GetAccelIndex()
|
item->GetAccelIndex()
|
||||||
);
|
);
|
||||||
@@ -1487,6 +1499,8 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
|
|||||||
m_radioGroup.start = -1;
|
m_radioGroup.start = -1;
|
||||||
m_isRadioGroupStart = FALSE;
|
m_isRadioGroupStart = FALSE;
|
||||||
|
|
||||||
|
m_bmpDisabled = wxNullBitmap;
|
||||||
|
|
||||||
UpdateAccelInfo();
|
UpdateAccelInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user