fix handling of wxBitmap nodes broken by previous changes; remove the special case of passing empty attribute name to GetBitmap/Icon(wxString) and use the overload taking wxXmlNode directly instead
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
07e6fc431d
commit
9c1d2aa29c
@ -32,9 +32,7 @@ wxBitmapXmlHandler::wxBitmapXmlHandler()
|
||||
|
||||
wxObject *wxBitmapXmlHandler::DoCreateResource()
|
||||
{
|
||||
// NB: empty parameter name means "take directly from this node's next
|
||||
// instead of from subnode with given name"
|
||||
return new wxBitmap(GetBitmap(wxEmptyString));
|
||||
return new wxBitmap(GetBitmap(m_node));
|
||||
}
|
||||
|
||||
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
|
||||
|
@ -1334,13 +1334,29 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param,
|
||||
const wxArtClient& defaultArtClient,
|
||||
wxSize size)
|
||||
{
|
||||
return GetBitmap(GetParamNode(param), defaultArtClient, size);
|
||||
// it used to be possible to pass an empty string here to indicate that the
|
||||
// bitmap name should be read from this node itself but this is not
|
||||
// supported any more because GetBitmap(m_node) can be used directly
|
||||
// instead
|
||||
wxASSERT_MSG( !param.empty(), "bitmap parameter name can't be empty" );
|
||||
|
||||
const wxXmlNode* const node = GetParamNode(param);
|
||||
|
||||
if ( !node )
|
||||
{
|
||||
// this is not an error as bitmap parameter could be optional
|
||||
return wxNullBitmap;
|
||||
}
|
||||
|
||||
return GetBitmap(node, defaultArtClient, size);
|
||||
}
|
||||
|
||||
wxBitmap wxXmlResourceHandler::GetBitmap(const wxXmlNode* node,
|
||||
const wxArtClient& defaultArtClient,
|
||||
wxSize size)
|
||||
{
|
||||
wxCHECK_MSG( node, wxNullBitmap, "bitmap node can't be NULL" );
|
||||
|
||||
/* If the bitmap is specified as stock item, query wxArtProvider for it: */
|
||||
wxString art_id, art_client;
|
||||
if ( GetStockArtAttrs(node, defaultArtClient,
|
||||
@ -1389,7 +1405,18 @@ wxIcon wxXmlResourceHandler::GetIcon(const wxString& param,
|
||||
const wxArtClient& defaultArtClient,
|
||||
wxSize size)
|
||||
{
|
||||
return GetIcon(GetParamNode(param), defaultArtClient, size);
|
||||
// see comment in GetBitmap(wxString) overload
|
||||
wxASSERT_MSG( !param.empty(), "icon parameter name can't be empty" );
|
||||
|
||||
const wxXmlNode* const node = GetParamNode(param);
|
||||
|
||||
if ( !node )
|
||||
{
|
||||
// this is not an error as icon parameter could be optional
|
||||
return wxIcon();
|
||||
}
|
||||
|
||||
return GetIcon(node, defaultArtClient, size);
|
||||
}
|
||||
|
||||
wxIcon wxXmlResourceHandler::GetIcon(const wxXmlNode* node,
|
||||
|
Loading…
Reference in New Issue
Block a user