Initialize all bitmaps in wxODButtonImageData
This is the same initialization as wxXPButtonImageData does.
This commit is contained in:
@@ -181,12 +181,8 @@ public:
|
|||||||
wxODButtonImageData(wxAnyButton *btn, const wxBitmapBundle& bitmapBundle)
|
wxODButtonImageData(wxAnyButton *btn, const wxBitmapBundle& bitmapBundle)
|
||||||
: wxButtonImageData(btn, bitmapBundle)
|
: wxButtonImageData(btn, bitmapBundle)
|
||||||
{
|
{
|
||||||
SetBitmap(GetBitmapFromBundle(bitmapBundle),
|
InitImageList();
|
||||||
wxAnyButton::State_Normal);
|
|
||||||
#if wxUSE_IMAGE
|
|
||||||
SetBitmap(GetBitmapFromBundle(bitmapBundle).ConvertToDisabled(),
|
|
||||||
wxAnyButton::State_Disabled);
|
|
||||||
#endif
|
|
||||||
m_dir = wxLEFT;
|
m_dir = wxLEFT;
|
||||||
|
|
||||||
// we use margins when we have both bitmap and text, but when we have
|
// we use margins when we have both bitmap and text, but when we have
|
||||||
@@ -229,6 +225,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void InitImageList()
|
||||||
|
{
|
||||||
|
const wxBitmap bitmap = m_bitmapBundles[wxAnyButton::State_Normal].GetBitmap(m_bitmapSize);
|
||||||
|
|
||||||
|
for ( int n = 0; n < wxAnyButton::State_Max; n++ )
|
||||||
|
{
|
||||||
|
wxBitmap stateBitmap = m_bitmapBundles[n].GetBitmap(m_bitmapSize);
|
||||||
|
if ( !stateBitmap.IsOk() )
|
||||||
|
{
|
||||||
|
#if wxUSE_IMAGE
|
||||||
|
if ( n == wxAnyButton::State_Disabled )
|
||||||
|
stateBitmap = bitmap.ConvertToDisabled();
|
||||||
|
else
|
||||||
|
#endif // wxUSE_IMAGE
|
||||||
|
stateBitmap = bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetBitmap(stateBitmap, (wxAnyButton::State)n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// just store the values passed to us to be able to retrieve them later
|
// just store the values passed to us to be able to retrieve them later
|
||||||
// from the drawing code
|
// from the drawing code
|
||||||
wxBitmap m_bitmaps[wxAnyButton::State_Max];
|
wxBitmap m_bitmaps[wxAnyButton::State_Max];
|
||||||
|
|||||||
Reference in New Issue
Block a user