X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e63f19ba93dad9ffe386e442e86d38e07345df7b..d4a1433fccecbd5c3e80f921c6de91cbef287b44:/src/xrc/xmlres.cpp diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 20b402dc64..17ee409812 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -28,6 +28,7 @@ #include "wx/settings.h" #include "wx/bitmap.h" #include "wx/image.h" + #include "wx/module.h" #endif #ifndef __WXWINCE__ @@ -39,7 +40,6 @@ #include "wx/filename.h" #include "wx/tokenzr.h" #include "wx/fontenum.h" -#include "wx/module.h" #include "wx/fontmap.h" #include "wx/artprov.h" @@ -65,24 +65,41 @@ wxXmlResource *wxXmlResource::ms_instance = NULL; return old; } -wxXmlResource::wxXmlResource(int flags) +wxXmlResource::wxXmlResource(int flags, const wxString& domain) { m_flags = flags; m_version = -1; + m_domain = NULL; + if (! domain.empty() ) + SetDomain(domain); } -wxXmlResource::wxXmlResource(const wxString& filemask, int flags) +wxXmlResource::wxXmlResource(const wxString& filemask, int flags, const wxString& domain) { m_flags = flags; m_version = -1; + m_domain = NULL; + if (! domain.empty() ) + SetDomain(domain); Load(filemask); } wxXmlResource::~wxXmlResource() { + if (m_domain) + free(m_domain); ClearHandlers(); } +void wxXmlResource::SetDomain(const wxChar* domain) +{ + if (m_domain) + free(m_domain); + m_domain = NULL; + if (domain && wxStrlen(domain)) + m_domain = wxStrdup(domain); +} + /* static */ wxString wxXmlResource::ConvertFileNameToURL(const wxString& filename) @@ -916,7 +933,7 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate) if (translate && parNode && parNode->GetPropVal(wxT("translate"), wxEmptyString) != wxT("0")) { - return wxGetTranslation(str2); + return wxGetTranslation(str2, m_resource->GetDomain()); } else {