X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9eddec696f06d65a80e7339b2fae14fcb55f8383..6d7b547184bfdcdf67790755deb0122050b1d728:/src/xrc/xmlres.cpp diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index d85ca8d459..96a7cd6b5a 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -26,6 +26,8 @@ #include "wx/frame.h" #include "wx/dialog.h" #include "wx/settings.h" + #include "wx/bitmap.h" + #include "wx/image.h" #endif #ifndef __WXWINCE__ @@ -38,8 +40,6 @@ #include "wx/tokenzr.h" #include "wx/fontenum.h" #include "wx/module.h" -#include "wx/bitmap.h" -#include "wx/image.h" #include "wx/fontmap.h" #include "wx/artprov.h" @@ -643,7 +643,7 @@ static void MergeNodes(wxXmlNode& dest, wxXmlNode& with) } } - if ( dest.GetType() == wxXML_TEXT_NODE && with.GetContent().Length() ) + if ( dest.GetType() == wxXML_TEXT_NODE && with.GetContent().length() ) dest.SetContent(with.GetContent()); } @@ -1042,9 +1042,13 @@ static wxColour GetSystemColour(const wxString& name) return wxNullColour; } -wxColour wxXmlResourceHandler::GetColour(const wxString& param) +wxColour wxXmlResourceHandler::GetColour(const wxString& param, const wxColour& defaultv) { wxString v = GetParamValue(param); + + if ( v.empty() ) + return defaultv; + wxColour clr; // wxString -> wxColour conversion @@ -1147,6 +1151,14 @@ wxXmlNode *wxXmlResourceHandler::GetParamNode(const wxString& param) } + +bool wxXmlResourceHandler::IsOfClass(wxXmlNode *node, const wxString& classname) +{ + return node->GetPropVal(wxT("class"), wxEmptyString) == classname; +} + + + wxString wxXmlResourceHandler::GetNodeContent(wxXmlNode *node) { wxXmlNode *n = node; @@ -1351,15 +1363,14 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param) if (hasFacename) { wxString faces = GetParamValue(wxT("face")); - wxFontEnumerator enu; - enu.EnumerateFacenames(); + wxArrayString facenames(wxFontEnumerator::GetFacenames()); wxStringTokenizer tk(faces, wxT(",")); while (tk.HasMoreTokens()) { - int index = enu.GetFacenames()->Index(tk.GetNextToken(), false); + int index = facenames.Index(tk.GetNextToken(), false); if (index != wxNOT_FOUND) { - facename = (*enu.GetFacenames())[index]; + facename = facenames[index]; break; } }