Use GetBitmapBundle() whenever possible in XRC handlers

This allows specifying multiple bitmaps and/or SVG in the XRC for the
controls which support them.
This commit is contained in:
Vadim Zeitlin 2022-02-20 01:02:52 +00:00
parent 5fcea04d71
commit 38ad817163
7 changed files with 15 additions and 14 deletions

View file

@ -61,9 +61,10 @@ wxObject *wxAnimationCtrlXmlHandler::DoCreateResource()
if ( animation )
ctrl->SetAnimation(*animation);
// if no inactive-bitmap has been provided, GetBitmap() will return wxNullBitmap
// which just tells wxAnimationCtrl to use the default for inactive status
ctrl->SetInactiveBitmap(GetBitmap(wxT("inactive-bitmap")));
// if no inactive-bitmap has been provided, GetBitmapBundle() will return
// an empty bundle, which just tells wxAnimationCtrl to use the default
// bitmap for inactive status
ctrl->SetInactiveBitmap(GetBitmapBundle(wxT("inactive-bitmap")));
SetupWindow(ctrl);

View file

@ -244,7 +244,7 @@ wxObject *wxAuiXmlHandler::DoCreateResource()
m_notebook->AddPage(wnd,
GetText(wxS("label")),
GetBool(wxS("selected")),
GetBitmap(wxS("bitmap"), wxART_OTHER));
GetBitmapBundle(wxS("bitmap"), wxART_OTHER));
}
else
{

View file

@ -111,8 +111,8 @@ wxObject *wxAuiToolBarXmlHandler::DoCreateResource()
(
GetID(),
GetText(wxS("label")),
GetBitmap(wxS("bitmap"), wxART_TOOLBAR, m_toolSize),
GetBitmap(wxS("bitmap2"), wxART_TOOLBAR, m_toolSize),
GetBitmapBundle(wxS("bitmap"), wxART_TOOLBAR, m_toolSize),
GetBitmapBundle(wxS("bitmap2"), wxART_TOOLBAR, m_toolSize),
kind,
GetText(wxS("tooltip")),
GetText(wxS("longhelp")),

View file

@ -56,7 +56,7 @@ wxObject *wxBannerWindowXmlHandler::DoCreateResource()
}
}
wxBitmap bitmap = GetBitmap();
wxBitmapBundle bitmap = GetBitmapBundle();
if ( bitmap.IsOk() )
{
if ( colStart.IsOk() || colEnd.IsOk() )

View file

@ -152,11 +152,11 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
// and unchecked bitmaps for menu items
#ifdef __WXMSW__
if (HasParam(wxT("bitmap2")))
mitem->SetBitmaps(GetBitmap(wxT("bitmap2"), wxART_MENU),
GetBitmap(wxT("bitmap"), wxART_MENU));
mitem->SetBitmaps(GetBitmapBundle(wxT("bitmap2"), wxART_MENU),
GetBitmapBundle(wxT("bitmap"), wxART_MENU));
else
#endif // __WXMSW__
mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU));
mitem->SetBitmap(GetBitmapBundle(wxT("bitmap"), wxART_MENU));
}
#endif
p_menu->Append(mitem);

View file

@ -82,7 +82,7 @@ void wxToggleButtonXmlHandler::DoCreateToggleButton(wxObject *control)
#ifdef wxHAVE_BITMAPS_IN_BUTTON
if ( GetParamNode("bitmap") )
{
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
button->SetBitmap(GetBitmapBundle("bitmap", wxART_BUTTON),
GetDirection("bitmapposition"));
}
#endif
@ -97,7 +97,7 @@ void wxToggleButtonXmlHandler::DoCreateBitmapToggleButton(wxObject *control)
button->Create(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap"), wxART_BUTTON),
GetBitmapBundle(wxT("bitmap"), wxART_BUTTON),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,

View file

@ -126,8 +126,8 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
(
GetID(),
GetText(wxT("label")),
GetBitmap(wxT("bitmap"), wxART_TOOLBAR, m_toolSize),
GetBitmap(wxT("bitmap2"), wxART_TOOLBAR, m_toolSize),
GetBitmapBundle(wxT("bitmap"), wxART_TOOLBAR, m_toolSize),
GetBitmapBundle(wxT("bitmap2"), wxART_TOOLBAR, m_toolSize),
kind,
GetText(wxT("tooltip")),
GetText(wxT("longhelp"))