1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xmlres.cpp
3 // Purpose: XRC resources
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
20 #include "wx/xrc/xmlres.h"
27 #include "wx/dialog.h"
28 #include "wx/settings.h"
29 #include "wx/bitmap.h"
31 #include "wx/module.h"
32 #include "wx/wxcrtvararg.h"
39 #include "wx/vector.h"
40 #include "wx/wfstream.h"
41 #include "wx/filesys.h"
42 #include "wx/filename.h"
43 #include "wx/tokenzr.h"
44 #include "wx/fontenum.h"
45 #include "wx/fontmap.h"
46 #include "wx/artprov.h"
48 #include "wx/xml/xml.h"
51 class wxXmlResourceDataRecord
54 wxXmlResourceDataRecord() : Doc(NULL
) {
56 Time
= wxDateTime::Now();
59 ~wxXmlResourceDataRecord() {delete Doc
;}
68 class wxXmlResourceDataRecords
: public wxVector
<wxXmlResourceDataRecord
*>
70 // this is a class so that it can be forward-declared
74 wxXmlResource
*wxXmlResource::ms_instance
= NULL
;
76 /*static*/ wxXmlResource
*wxXmlResource::Get()
79 ms_instance
= new wxXmlResource
;
83 /*static*/ wxXmlResource
*wxXmlResource::Set(wxXmlResource
*res
)
85 wxXmlResource
*old
= ms_instance
;
90 wxXmlResource::wxXmlResource(int flags
, const wxString
& domain
)
94 m_data
= new wxXmlResourceDataRecords
;
98 wxXmlResource::wxXmlResource(const wxString
& filemask
, int flags
, const wxString
& domain
)
102 m_data
= new wxXmlResourceDataRecords
;
107 wxXmlResource::~wxXmlResource()
111 for ( wxXmlResourceDataRecords::iterator i
= m_data
->begin();
112 i
!= m_data
->end(); ++i
)
119 void wxXmlResource::SetDomain(const wxString
& domain
)
126 wxString
wxXmlResource::ConvertFileNameToURL(const wxString
& filename
)
128 wxString
fnd(filename
);
130 // NB: as Load() and Unload() accept both filenames and URLs (should
131 // probably be changed to filenames only, but embedded resources
132 // currently rely on its ability to handle URLs - FIXME) we need to
133 // determine whether found name is filename and not URL and this is the
134 // fastest/simplest way to do it
135 if (wxFileName::FileExists(fnd
))
137 // Make the name absolute filename, because the app may
138 // change working directory later:
143 fnd
= fn
.GetFullPath();
146 fnd
= wxFileSystem::FileNameToURL(fnd
);
156 bool wxXmlResource::IsArchive(const wxString
& filename
)
158 const wxString fnd
= filename
.Lower();
160 return fnd
.Matches(wxT("*.zip")) || fnd
.Matches(wxT("*.xrs"));
163 #endif // wxUSE_FILESYSTEM
165 bool wxXmlResource::Load(const wxString
& filemask
)
169 # define wxXmlFindFirst fsys.FindFirst(filemask, wxFILE)
170 # define wxXmlFindNext fsys.FindNext()
172 # define wxXmlFindFirst wxFindFirstFile(filemask, wxFILE)
173 # define wxXmlFindNext wxFindNextFile()
175 wxString fnd
= wxXmlFindFirst
;
178 wxLogError(_("Cannot load resources from '%s'."), filemask
);
184 fnd
= ConvertFileNameToURL(fnd
);
187 if ( IsArchive(fnd
) )
189 if ( !Load(fnd
+ wxT("#zip:*.xrc")) )
192 else // a single resource URL
193 #endif // wxUSE_FILESYSTEM
195 wxXmlResourceDataRecord
*drec
= new wxXmlResourceDataRecord
;
197 Data().push_back(drec
);
202 # undef wxXmlFindFirst
203 # undef wxXmlFindNext
205 return UpdateResources();
208 bool wxXmlResource::Unload(const wxString
& filename
)
210 wxASSERT_MSG( !wxIsWild(filename
),
211 _T("wildcards not supported by wxXmlResource::Unload()") );
213 wxString fnd
= ConvertFileNameToURL(filename
);
215 const bool isArchive
= IsArchive(fnd
);
218 #endif // wxUSE_FILESYSTEM
220 bool unloaded
= false;
221 for ( wxXmlResourceDataRecords::iterator i
= Data().begin();
222 i
!= Data().end(); ++i
)
227 if ( (*i
)->File
.StartsWith(fnd
) )
229 // don't break from the loop, we can have other matching files
231 else // a single resource URL
232 #endif // wxUSE_FILESYSTEM
234 if ( (*i
)->File
== fnd
)
240 // no sense in continuing, there is only one file with this URL
250 IMPLEMENT_ABSTRACT_CLASS(wxXmlResourceHandler
, wxObject
)
252 void wxXmlResource::AddHandler(wxXmlResourceHandler
*handler
)
254 m_handlers
.push_back(handler
);
255 handler
->SetParentResource(this);
258 void wxXmlResource::InsertHandler(wxXmlResourceHandler
*handler
)
260 m_handlers
.insert(m_handlers
.begin(), handler
);
261 handler
->SetParentResource(this);
266 void wxXmlResource::ClearHandlers()
268 for ( wxVector
<wxXmlResourceHandler
*>::iterator i
= m_handlers
.begin();
269 i
!= m_handlers
.end(); ++i
)
275 wxMenu
*wxXmlResource::LoadMenu(const wxString
& name
)
277 return (wxMenu
*)CreateResFromNode(FindResource(name
, wxT("wxMenu")), NULL
, NULL
);
282 wxMenuBar
*wxXmlResource::LoadMenuBar(wxWindow
*parent
, const wxString
& name
)
284 return (wxMenuBar
*)CreateResFromNode(FindResource(name
, wxT("wxMenuBar")), parent
, NULL
);
290 wxToolBar
*wxXmlResource::LoadToolBar(wxWindow
*parent
, const wxString
& name
)
292 return (wxToolBar
*)CreateResFromNode(FindResource(name
, wxT("wxToolBar")), parent
, NULL
);
297 wxDialog
*wxXmlResource::LoadDialog(wxWindow
*parent
, const wxString
& name
)
299 return (wxDialog
*)CreateResFromNode(FindResource(name
, wxT("wxDialog")), parent
, NULL
);
302 bool wxXmlResource::LoadDialog(wxDialog
*dlg
, wxWindow
*parent
, const wxString
& name
)
304 return CreateResFromNode(FindResource(name
, wxT("wxDialog")), parent
, dlg
) != NULL
;
309 wxPanel
*wxXmlResource::LoadPanel(wxWindow
*parent
, const wxString
& name
)
311 return (wxPanel
*)CreateResFromNode(FindResource(name
, wxT("wxPanel")), parent
, NULL
);
314 bool wxXmlResource::LoadPanel(wxPanel
*panel
, wxWindow
*parent
, const wxString
& name
)
316 return CreateResFromNode(FindResource(name
, wxT("wxPanel")), parent
, panel
) != NULL
;
319 wxFrame
*wxXmlResource::LoadFrame(wxWindow
* parent
, const wxString
& name
)
321 return (wxFrame
*)CreateResFromNode(FindResource(name
, wxT("wxFrame")), parent
, NULL
);
324 bool wxXmlResource::LoadFrame(wxFrame
* frame
, wxWindow
*parent
, const wxString
& name
)
326 return CreateResFromNode(FindResource(name
, wxT("wxFrame")), parent
, frame
) != NULL
;
329 wxBitmap
wxXmlResource::LoadBitmap(const wxString
& name
)
331 wxBitmap
*bmp
= (wxBitmap
*)CreateResFromNode(
332 FindResource(name
, wxT("wxBitmap")), NULL
, NULL
);
335 if (bmp
) { rt
= *bmp
; delete bmp
; }
339 wxIcon
wxXmlResource::LoadIcon(const wxString
& name
)
341 wxIcon
*icon
= (wxIcon
*)CreateResFromNode(
342 FindResource(name
, wxT("wxIcon")), NULL
, NULL
);
345 if (icon
) { rt
= *icon
; delete icon
; }
350 wxObject
*wxXmlResource::LoadObject(wxWindow
*parent
, const wxString
& name
, const wxString
& classname
)
352 return CreateResFromNode(FindResource(name
, classname
), parent
, NULL
);
355 bool wxXmlResource::LoadObject(wxObject
*instance
, wxWindow
*parent
, const wxString
& name
, const wxString
& classname
)
357 return CreateResFromNode(FindResource(name
, classname
), parent
, instance
) != NULL
;
361 bool wxXmlResource::AttachUnknownControl(const wxString
& name
,
362 wxWindow
*control
, wxWindow
*parent
)
365 parent
= control
->GetParent();
366 wxWindow
*container
= parent
->FindWindow(name
+ wxT("_container"));
369 wxLogError(_("Cannot find container for unknown control '%s'."), name
.c_str());
372 return control
->Reparent(container
);
376 static void ProcessPlatformProperty(wxXmlNode
*node
)
381 wxXmlNode
*c
= node
->GetChildren();
385 if (!c
->GetAttribute(wxT("platform"), &s
))
389 wxStringTokenizer
tkn(s
, wxT(" |"));
391 while (tkn
.HasMoreTokens())
393 s
= tkn
.GetNextToken();
395 if (s
== wxT("win")) isok
= true;
397 #if defined(__MAC__) || defined(__APPLE__)
398 if (s
== wxT("mac")) isok
= true;
399 #elif defined(__UNIX__)
400 if (s
== wxT("unix")) isok
= true;
403 if (s
== wxT("os2")) isok
= true;
413 ProcessPlatformProperty(c
);
418 wxXmlNode
*c2
= c
->GetNext();
419 node
->RemoveChild(c
);
428 bool wxXmlResource::UpdateResources()
432 # if wxUSE_FILESYSTEM
433 wxFSFile
*file
= NULL
;
438 wxString
encoding(wxT("UTF-8"));
439 #if !wxUSE_UNICODE && wxUSE_INTL
440 if ( (GetFlags() & wxXRC_USE_LOCALE
) == 0 )
442 // In case we are not using wxLocale to translate strings, convert the
443 // strings GUI's charset. This must not be done when wxXRC_USE_LOCALE
444 // is on, because it could break wxGetTranslation lookup.
445 encoding
= wxLocale::GetSystemEncodingName();
449 for ( wxXmlResourceDataRecords::iterator i
= Data().begin();
450 i
!= Data().end(); ++i
)
452 wxXmlResourceDataRecord
* const rec
= *i
;
454 modif
= (rec
->Doc
== NULL
);
456 if (!modif
&& !(m_flags
& wxXRC_NO_RELOADING
))
458 # if wxUSE_FILESYSTEM
459 file
= fsys
.OpenFile(rec
->File
);
461 modif
= file
&& file
->GetModificationTime() > rec
->Time
;
462 # else // wxUSE_DATETIME
464 # endif // wxUSE_DATETIME
467 wxLogError(_("Cannot open file '%s'."), rec
->File
);
472 # else // wxUSE_FILESYSTEM
474 modif
= wxDateTime(wxFileModificationTime(rec
->File
)) > rec
->Time
;
475 # else // wxUSE_DATETIME
477 # endif // wxUSE_DATETIME
478 # endif // wxUSE_FILESYSTEM
483 wxLogTrace(_T("xrc"), _T("opening file '%s'"), rec
->File
);
485 wxInputStream
*stream
= NULL
;
487 # if wxUSE_FILESYSTEM
488 file
= fsys
.OpenFile(rec
->File
);
490 stream
= file
->GetStream();
492 stream
= new wxFileInputStream(rec
->File
);
498 rec
->Doc
= new wxXmlDocument
;
500 if (!stream
|| !rec
->Doc
->Load(*stream
, encoding
))
502 wxLogError(_("Cannot load resources from file '%s'."),
507 else if (rec
->Doc
->GetRoot()->GetName() != wxT("resource"))
509 wxLogError(_("Invalid XRC resource '%s': doesn't have root node 'resource'."), rec
->File
);
517 wxString verstr
= rec
->Doc
->GetRoot()->GetAttribute(
518 wxT("version"), wxT("0.0.0.0"));
519 if (wxSscanf(verstr
.c_str(), wxT("%i.%i.%i.%i"),
520 &v1
, &v2
, &v3
, &v4
) == 4)
521 version
= v1
*256*256*256+v2
*256*256+v3
*256+v4
;
526 if (m_version
!= version
)
528 wxLogError(_("Resource files must have same version number!"));
532 ProcessPlatformProperty(rec
->Doc
->GetRoot());
535 rec
->Time
= file
->GetModificationTime();
536 #else // wxUSE_FILESYSTEM
537 rec
->Time
= wxDateTime(wxFileModificationTime(rec
->File
));
538 #endif // wxUSE_FILESYSTEM
539 #endif // wxUSE_DATETIME
542 # if wxUSE_FILESYSTEM
555 wxXmlNode
*wxXmlResource::DoFindResource(wxXmlNode
*parent
,
556 const wxString
& name
,
557 const wxString
& classname
,
563 // first search for match at the top-level nodes (as this is
564 // where the resource is most commonly looked for):
565 for (node
= parent
->GetChildren(); node
; node
= node
->GetNext())
567 if ( node
->GetType() == wxXML_ELEMENT_NODE
&&
568 (node
->GetName() == wxT("object") ||
569 node
->GetName() == wxT("object_ref")) &&
570 node
->GetAttribute(wxT("name"), &dummy
) && dummy
== name
)
572 wxString
cls(node
->GetAttribute(wxT("class"), wxEmptyString
));
573 if (!classname
|| cls
== classname
)
575 // object_ref may not have 'class' attribute:
576 if (cls
.empty() && node
->GetName() == wxT("object_ref"))
578 wxString refName
= node
->GetAttribute(wxT("ref"), wxEmptyString
);
581 wxXmlNode
* refNode
= FindResource(refName
, wxEmptyString
, true);
583 refNode
->GetAttribute(wxT("class"), wxEmptyString
) == classname
)
592 for (node
= parent
->GetChildren(); node
; node
= node
->GetNext())
594 if ( node
->GetType() == wxXML_ELEMENT_NODE
&&
595 (node
->GetName() == wxT("object") ||
596 node
->GetName() == wxT("object_ref")) )
598 wxXmlNode
* found
= DoFindResource(node
, name
, classname
, true);
607 wxXmlNode
*wxXmlResource::FindResource(const wxString
& name
,
608 const wxString
& classname
,
611 UpdateResources(); //ensure everything is up-to-date
614 for ( wxXmlResourceDataRecords::const_iterator f
= Data().begin();
615 f
!= Data().end(); ++f
)
617 wxXmlResourceDataRecord
* const rec
= *f
;
618 if ( rec
->Doc
== NULL
|| rec
->Doc
->GetRoot() == NULL
)
621 wxXmlNode
* found
= DoFindResource(rec
->Doc
->GetRoot(),
622 name
, classname
, recursive
);
626 m_curFileSystem
.ChangePathTo(rec
->File
);
632 wxLogError(_("XRC resource '%s' (class '%s') not found!"),
633 name
.c_str(), classname
.c_str());
637 static void MergeNodes(wxXmlNode
& dest
, wxXmlNode
& with
)
640 for ( wxXmlAttribute
*attr
= with
.GetAttributes();
641 attr
; attr
= attr
->GetNext() )
643 wxXmlAttribute
*dattr
;
644 for (dattr
= dest
.GetAttributes(); dattr
; dattr
= dattr
->GetNext())
647 if ( dattr
->GetName() == attr
->GetName() )
649 dattr
->SetValue(attr
->GetValue());
655 dest
.AddAttribute(attr
->GetName(), attr
->GetValue());
658 // Merge child nodes:
659 for (wxXmlNode
* node
= with
.GetChildren(); node
; node
= node
->GetNext())
661 wxString name
= node
->GetAttribute(wxT("name"), wxEmptyString
);
664 for (dnode
= dest
.GetChildren(); dnode
; dnode
= dnode
->GetNext() )
666 if ( dnode
->GetName() == node
->GetName() &&
667 dnode
->GetAttribute(wxT("name"), wxEmptyString
) == name
&&
668 dnode
->GetType() == node
->GetType() )
670 MergeNodes(*dnode
, *node
);
677 static const wxChar
*AT_END
= wxT("end");
678 wxString insert_pos
= node
->GetAttribute(wxT("insert_at"), AT_END
);
679 if ( insert_pos
== AT_END
)
681 dest
.AddChild(new wxXmlNode(*node
));
683 else if ( insert_pos
== wxT("begin") )
685 dest
.InsertChild(new wxXmlNode(*node
), dest
.GetChildren());
690 if ( dest
.GetType() == wxXML_TEXT_NODE
&& with
.GetContent().length() )
691 dest
.SetContent(with
.GetContent());
694 wxObject
*wxXmlResource::CreateResFromNode(wxXmlNode
*node
, wxObject
*parent
,
696 wxXmlResourceHandler
*handlerToUse
)
698 if (node
== NULL
) return NULL
;
700 // handling of referenced resource
701 if ( node
->GetName() == wxT("object_ref") )
703 wxString refName
= node
->GetAttribute(wxT("ref"), wxEmptyString
);
704 wxXmlNode
* refNode
= FindResource(refName
, wxEmptyString
, true);
708 wxLogError(_("Referenced object node with ref=\"%s\" not found!"),
713 wxXmlNode
copy(*refNode
);
714 MergeNodes(copy
, *node
);
716 return CreateResFromNode(©
, parent
, instance
);
721 if (handlerToUse
->CanHandle(node
))
723 return handlerToUse
->CreateResource(node
, parent
, instance
);
726 else if (node
->GetName() == wxT("object"))
728 for ( wxVector
<wxXmlResourceHandler
*>::iterator h
= m_handlers
.begin();
729 h
!= m_handlers
.end(); ++h
)
731 wxXmlResourceHandler
*handler
= *h
;
732 if (handler
->CanHandle(node
))
733 return handler
->CreateResource(node
, parent
, instance
);
737 wxLogError(_("No handler found for XML node '%s', class '%s'!"),
738 node
->GetName().c_str(),
739 node
->GetAttribute(wxT("class"), wxEmptyString
).c_str());
744 class wxXmlSubclassFactories
: public wxVector
<wxXmlSubclassFactory
*>
746 // this is a class so that it can be forward-declared
749 wxXmlSubclassFactories
*wxXmlResource::ms_subclassFactories
= NULL
;
751 /*static*/ void wxXmlResource::AddSubclassFactory(wxXmlSubclassFactory
*factory
)
753 if (!ms_subclassFactories
)
755 ms_subclassFactories
= new wxXmlSubclassFactories
;
757 ms_subclassFactories
->push_back(factory
);
760 class wxXmlSubclassFactoryCXX
: public wxXmlSubclassFactory
763 ~wxXmlSubclassFactoryCXX() {}
765 wxObject
*Create(const wxString
& className
)
767 wxClassInfo
* classInfo
= wxClassInfo::FindClass(className
);
770 return classInfo
->CreateObject();
779 wxXmlResourceHandler::wxXmlResourceHandler()
780 : m_node(NULL
), m_parent(NULL
), m_instance(NULL
),
781 m_parentAsWindow(NULL
)
786 wxObject
*wxXmlResourceHandler::CreateResource(wxXmlNode
*node
, wxObject
*parent
, wxObject
*instance
)
788 wxXmlNode
*myNode
= m_node
;
789 wxString myClass
= m_class
;
790 wxObject
*myParent
= m_parent
, *myInstance
= m_instance
;
791 wxWindow
*myParentAW
= m_parentAsWindow
;
793 m_instance
= instance
;
794 if (!m_instance
&& node
->HasAttribute(wxT("subclass")) &&
795 !(m_resource
->GetFlags() & wxXRC_NO_SUBCLASSING
))
797 wxString subclass
= node
->GetAttribute(wxT("subclass"), wxEmptyString
);
798 if (!subclass
.empty())
800 for (wxXmlSubclassFactories::iterator i
= wxXmlResource::ms_subclassFactories
->begin();
801 i
!= wxXmlResource::ms_subclassFactories
->end(); ++i
)
803 m_instance
= (*i
)->Create(subclass
);
810 wxString name
= node
->GetAttribute(wxT("name"), wxEmptyString
);
811 wxLogError(_("Subclass '%s' not found for resource '%s', not subclassing!"),
812 subclass
.c_str(), name
.c_str());
818 m_class
= node
->GetAttribute(wxT("class"), wxEmptyString
);
820 m_parentAsWindow
= wxDynamicCast(m_parent
, wxWindow
);
822 wxObject
*returned
= DoCreateResource();
826 m_parent
= myParent
; m_parentAsWindow
= myParentAW
;
827 m_instance
= myInstance
;
833 void wxXmlResourceHandler::AddStyle(const wxString
& name
, int value
)
835 m_styleNames
.Add(name
);
836 m_styleValues
.Add(value
);
841 void wxXmlResourceHandler::AddWindowStyles()
843 XRC_ADD_STYLE(wxCLIP_CHILDREN
);
845 // the border styles all have the old and new names, recognize both for now
846 XRC_ADD_STYLE(wxSIMPLE_BORDER
); XRC_ADD_STYLE(wxBORDER_SIMPLE
);
847 XRC_ADD_STYLE(wxSUNKEN_BORDER
); XRC_ADD_STYLE(wxBORDER_SUNKEN
);
848 XRC_ADD_STYLE(wxDOUBLE_BORDER
); XRC_ADD_STYLE(wxBORDER_DOUBLE
);
849 XRC_ADD_STYLE(wxRAISED_BORDER
); XRC_ADD_STYLE(wxBORDER_RAISED
);
850 XRC_ADD_STYLE(wxSTATIC_BORDER
); XRC_ADD_STYLE(wxBORDER_STATIC
);
851 XRC_ADD_STYLE(wxNO_BORDER
); XRC_ADD_STYLE(wxBORDER_NONE
);
853 XRC_ADD_STYLE(wxTRANSPARENT_WINDOW
);
854 XRC_ADD_STYLE(wxWANTS_CHARS
);
855 XRC_ADD_STYLE(wxTAB_TRAVERSAL
);
856 XRC_ADD_STYLE(wxNO_FULL_REPAINT_ON_RESIZE
);
857 XRC_ADD_STYLE(wxFULL_REPAINT_ON_RESIZE
);
858 XRC_ADD_STYLE(wxALWAYS_SHOW_SB
);
859 XRC_ADD_STYLE(wxWS_EX_BLOCK_EVENTS
);
860 XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY
);
865 bool wxXmlResourceHandler::HasParam(const wxString
& param
)
867 return (GetParamNode(param
) != NULL
);
871 int wxXmlResourceHandler::GetStyle(const wxString
& param
, int defaults
)
873 wxString s
= GetParamValue(param
);
875 if (!s
) return defaults
;
877 wxStringTokenizer
tkn(s
, wxT("| \t\n"), wxTOKEN_STRTOK
);
881 while (tkn
.HasMoreTokens())
883 fl
= tkn
.GetNextToken();
884 index
= m_styleNames
.Index(fl
);
885 if (index
!= wxNOT_FOUND
)
886 style
|= m_styleValues
[index
];
888 wxLogError(_("Unknown style flag ") + fl
);
895 wxString
wxXmlResourceHandler::GetText(const wxString
& param
, bool translate
)
897 wxXmlNode
*parNode
= GetParamNode(param
);
898 wxString
str1(GetNodeContent(parNode
));
901 // "\\" wasn't translated to "\" prior to 2.5.3.0:
902 const bool escapeBackslash
= (m_resource
->CompareVersion(2,5,3,0) >= 0);
904 // VS: First version of XRC resources used $ instead of & (which is
905 // illegal in XML), but later I realized that '_' fits this purpose
906 // much better (because &File means "File with F underlined").
907 const wxChar amp_char
= (m_resource
->CompareVersion(2,3,0,1) < 0)
910 for ( wxString::const_iterator dt
= str1
.begin(); dt
!= str1
.end(); ++dt
)
912 // Remap amp_char to &, map double amp_char to amp_char (for things
913 // like "&File..." -- this is illegal in XML, so we use "_File..."):
914 if ( *dt
== amp_char
)
916 if ( *(++dt
) == amp_char
)
919 str2
<< wxT('&') << *dt
;
921 // Remap \n to CR, \r to LF, \t to TAB, \\ to \:
922 else if ( *dt
== wxT('\\') )
924 switch ( (*(++dt
)).GetValue() )
939 // "\\" wasn't translated to "\" prior to 2.5.3.0:
940 if ( escapeBackslash
)
945 // else fall-through to default: branch below
948 str2
<< wxT('\\') << *dt
;
958 if (m_resource
->GetFlags() & wxXRC_USE_LOCALE
)
960 if (translate
&& parNode
&&
961 parNode
->GetAttribute(wxT("translate"), wxEmptyString
) != wxT("0"))
963 return wxGetTranslation(str2
, m_resource
->GetDomain());
970 // The string is internally stored as UTF-8, we have to convert
971 // it into system's default encoding so that it can be displayed:
972 return wxString(str2
.wc_str(wxConvUTF8
), wxConvLocal
);
977 // If wxXRC_USE_LOCALE is not set, then the string is already in
978 // system's default encoding in ANSI build, so we don't have to
979 // do anything special here.
985 long wxXmlResourceHandler::GetLong(const wxString
& param
, long defaultv
)
988 wxString str1
= GetParamValue(param
);
990 if (!str1
.ToLong(&value
))
996 float wxXmlResourceHandler::GetFloat(const wxString
& param
, float defaultv
)
998 wxString str
= GetParamValue(param
);
1001 // strings in XRC always use C locale but wxString::ToDouble() uses the
1002 // current one, so transform the string to it supposing that the only
1003 // difference between them is the decimal separator
1005 // TODO: use wxString::ToCDouble() when we have it
1006 str
.Replace(wxT("."), wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT
,
1007 wxLOCALE_CAT_NUMBER
));
1008 #endif // wxUSE_INTL
1011 if (!str
.ToDouble(&value
))
1014 return wx_truncate_cast(float, value
);
1018 int wxXmlResourceHandler::GetID()
1020 return wxXmlResource::GetXRCID(GetName());
1025 wxString
wxXmlResourceHandler::GetName()
1027 return m_node
->GetAttribute(wxT("name"), wxT("-1"));
1032 bool wxXmlResourceHandler::GetBoolAttr(const wxString
& attr
, bool defaultv
)
1035 return m_node
->GetAttribute(attr
, &v
) ? v
== '1' : defaultv
;
1038 bool wxXmlResourceHandler::GetBool(const wxString
& param
, bool defaultv
)
1040 const wxString v
= GetParamValue(param
);
1042 return v
.empty() ? defaultv
: (v
== '1');
1046 static wxColour
GetSystemColour(const wxString
& name
)
1050 #define SYSCLR(clr) \
1051 if (name == _T(#clr)) return wxSystemSettings::GetColour(clr);
1052 SYSCLR(wxSYS_COLOUR_SCROLLBAR
)
1053 SYSCLR(wxSYS_COLOUR_BACKGROUND
)
1054 SYSCLR(wxSYS_COLOUR_DESKTOP
)
1055 SYSCLR(wxSYS_COLOUR_ACTIVECAPTION
)
1056 SYSCLR(wxSYS_COLOUR_INACTIVECAPTION
)
1057 SYSCLR(wxSYS_COLOUR_MENU
)
1058 SYSCLR(wxSYS_COLOUR_WINDOW
)
1059 SYSCLR(wxSYS_COLOUR_WINDOWFRAME
)
1060 SYSCLR(wxSYS_COLOUR_MENUTEXT
)
1061 SYSCLR(wxSYS_COLOUR_WINDOWTEXT
)
1062 SYSCLR(wxSYS_COLOUR_CAPTIONTEXT
)
1063 SYSCLR(wxSYS_COLOUR_ACTIVEBORDER
)
1064 SYSCLR(wxSYS_COLOUR_INACTIVEBORDER
)
1065 SYSCLR(wxSYS_COLOUR_APPWORKSPACE
)
1066 SYSCLR(wxSYS_COLOUR_HIGHLIGHT
)
1067 SYSCLR(wxSYS_COLOUR_HIGHLIGHTTEXT
)
1068 SYSCLR(wxSYS_COLOUR_BTNFACE
)
1069 SYSCLR(wxSYS_COLOUR_3DFACE
)
1070 SYSCLR(wxSYS_COLOUR_BTNSHADOW
)
1071 SYSCLR(wxSYS_COLOUR_3DSHADOW
)
1072 SYSCLR(wxSYS_COLOUR_GRAYTEXT
)
1073 SYSCLR(wxSYS_COLOUR_BTNTEXT
)
1074 SYSCLR(wxSYS_COLOUR_INACTIVECAPTIONTEXT
)
1075 SYSCLR(wxSYS_COLOUR_BTNHIGHLIGHT
)
1076 SYSCLR(wxSYS_COLOUR_BTNHILIGHT
)
1077 SYSCLR(wxSYS_COLOUR_3DHIGHLIGHT
)
1078 SYSCLR(wxSYS_COLOUR_3DHILIGHT
)
1079 SYSCLR(wxSYS_COLOUR_3DDKSHADOW
)
1080 SYSCLR(wxSYS_COLOUR_3DLIGHT
)
1081 SYSCLR(wxSYS_COLOUR_INFOTEXT
)
1082 SYSCLR(wxSYS_COLOUR_INFOBK
)
1083 SYSCLR(wxSYS_COLOUR_LISTBOX
)
1084 SYSCLR(wxSYS_COLOUR_HOTLIGHT
)
1085 SYSCLR(wxSYS_COLOUR_GRADIENTACTIVECAPTION
)
1086 SYSCLR(wxSYS_COLOUR_GRADIENTINACTIVECAPTION
)
1087 SYSCLR(wxSYS_COLOUR_MENUHILIGHT
)
1088 SYSCLR(wxSYS_COLOUR_MENUBAR
)
1092 return wxNullColour
;
1095 wxColour
wxXmlResourceHandler::GetColour(const wxString
& param
, const wxColour
& defaultv
)
1097 wxString v
= GetParamValue(param
);
1104 // wxString -> wxColour conversion
1107 // the colour doesn't use #RRGGBB format, check if it is symbolic
1109 clr
= GetSystemColour(v
);
1113 wxLogError(_("XRC resource: Incorrect colour specification '%s' for attribute '%s'."),
1114 v
.c_str(), param
.c_str());
1115 return wxNullColour
;
1123 wxBitmap
wxXmlResourceHandler::GetBitmap(const wxString
& param
,
1124 const wxArtClient
& defaultArtClient
,
1127 /* If the bitmap is specified as stock item, query wxArtProvider for it: */
1128 wxXmlNode
*bmpNode
= GetParamNode(param
);
1131 wxString sid
= bmpNode
->GetAttribute(wxT("stock_id"), wxEmptyString
);
1134 wxString scl
= bmpNode
->GetAttribute(wxT("stock_client"), wxEmptyString
);
1136 scl
= defaultArtClient
;
1138 scl
= wxART_MAKE_CLIENT_ID_FROM_STR(scl
);
1141 wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(sid
),
1143 if ( stockArt
.Ok() )
1148 /* ...or load the bitmap from file: */
1149 wxString name
= GetParamValue(param
);
1150 if (name
.empty()) return wxNullBitmap
;
1151 #if wxUSE_FILESYSTEM
1152 wxFSFile
*fsfile
= GetCurFileSystem().OpenFile(name
, wxFS_READ
| wxFS_SEEKABLE
);
1155 wxLogError(_("XRC resource: Cannot create bitmap from '%s'."),
1157 return wxNullBitmap
;
1159 wxImage
img(*(fsfile
->GetStream()));
1167 wxLogError(_("XRC resource: Cannot create bitmap from '%s'."),
1169 return wxNullBitmap
;
1171 if (!(size
== wxDefaultSize
)) img
.Rescale(size
.x
, size
.y
);
1172 return wxBitmap(img
);
1176 wxIcon
wxXmlResourceHandler::GetIcon(const wxString
& param
,
1177 const wxArtClient
& defaultArtClient
,
1181 icon
.CopyFromBitmap(GetBitmap(param
, defaultArtClient
, size
));
1187 wxXmlNode
*wxXmlResourceHandler::GetParamNode(const wxString
& param
)
1189 wxCHECK_MSG(m_node
, NULL
, wxT("You can't access handler data before it was initialized!"));
1191 wxXmlNode
*n
= m_node
->GetChildren();
1195 if (n
->GetType() == wxXML_ELEMENT_NODE
&& n
->GetName() == param
)
1204 bool wxXmlResourceHandler::IsOfClass(wxXmlNode
*node
, const wxString
& classname
)
1206 return node
->GetAttribute(wxT("class"), wxEmptyString
) == classname
;
1211 wxString
wxXmlResourceHandler::GetNodeContent(wxXmlNode
*node
)
1213 wxXmlNode
*n
= node
;
1214 if (n
== NULL
) return wxEmptyString
;
1215 n
= n
->GetChildren();
1219 if (n
->GetType() == wxXML_TEXT_NODE
||
1220 n
->GetType() == wxXML_CDATA_SECTION_NODE
)
1221 return n
->GetContent();
1224 return wxEmptyString
;
1229 wxString
wxXmlResourceHandler::GetParamValue(const wxString
& param
)
1232 return GetNodeContent(m_node
);
1234 return GetNodeContent(GetParamNode(param
));
1239 wxSize
wxXmlResourceHandler::GetSize(const wxString
& param
,
1240 wxWindow
*windowToUse
)
1242 wxString s
= GetParamValue(param
);
1243 if (s
.empty()) s
= wxT("-1,-1");
1247 is_dlg
= s
[s
.length()-1] == wxT('d');
1248 if (is_dlg
) s
.RemoveLast();
1250 if (!s
.BeforeFirst(wxT(',')).ToLong(&sx
) ||
1251 !s
.AfterLast(wxT(',')).ToLong(&sy
))
1253 wxLogError(_("Cannot parse coordinates from '%s'."), s
.c_str());
1254 return wxDefaultSize
;
1261 return wxDLG_UNIT(windowToUse
, wxSize(sx
, sy
));
1263 else if (m_parentAsWindow
)
1265 return wxDLG_UNIT(m_parentAsWindow
, wxSize(sx
, sy
));
1269 wxLogError(_("Cannot convert dialog units: dialog unknown."));
1270 return wxDefaultSize
;
1274 return wxSize(sx
, sy
);
1279 wxPoint
wxXmlResourceHandler::GetPosition(const wxString
& param
)
1281 wxSize sz
= GetSize(param
);
1282 return wxPoint(sz
.x
, sz
.y
);
1287 wxCoord
wxXmlResourceHandler::GetDimension(const wxString
& param
,
1289 wxWindow
*windowToUse
)
1291 wxString s
= GetParamValue(param
);
1292 if (s
.empty()) return defaultv
;
1296 is_dlg
= s
[s
.length()-1] == wxT('d');
1297 if (is_dlg
) s
.RemoveLast();
1301 wxLogError(_("Cannot parse dimension from '%s'."), s
.c_str());
1309 return wxDLG_UNIT(windowToUse
, wxSize(sx
, 0)).x
;
1311 else if (m_parentAsWindow
)
1313 return wxDLG_UNIT(m_parentAsWindow
, wxSize(sx
, 0)).x
;
1317 wxLogError(_("Cannot convert dialog units: dialog unknown."));
1326 // Get system font index using indexname
1327 static wxFont
GetSystemFont(const wxString
& name
)
1331 #define SYSFNT(fnt) \
1332 if (name == _T(#fnt)) return wxSystemSettings::GetFont(fnt);
1333 SYSFNT(wxSYS_OEM_FIXED_FONT
)
1334 SYSFNT(wxSYS_ANSI_FIXED_FONT
)
1335 SYSFNT(wxSYS_ANSI_VAR_FONT
)
1336 SYSFNT(wxSYS_SYSTEM_FONT
)
1337 SYSFNT(wxSYS_DEVICE_DEFAULT_FONT
)
1338 SYSFNT(wxSYS_DEFAULT_PALETTE
)
1339 SYSFNT(wxSYS_SYSTEM_FIXED_FONT
)
1340 SYSFNT(wxSYS_DEFAULT_GUI_FONT
)
1347 wxFont
wxXmlResourceHandler::GetFont(const wxString
& param
)
1349 wxXmlNode
*font_node
= GetParamNode(param
);
1350 if (font_node
== NULL
)
1352 wxLogError(_("Cannot find font node '%s'."), param
.c_str());
1356 wxXmlNode
*oldnode
= m_node
;
1363 bool hasSize
= HasParam(wxT("size"));
1365 isize
= GetLong(wxT("size"), -1);
1368 int istyle
= wxNORMAL
;
1369 bool hasStyle
= HasParam(wxT("style"));
1372 wxString style
= GetParamValue(wxT("style"));
1373 if (style
== wxT("italic"))
1375 else if (style
== wxT("slant"))
1380 int iweight
= wxNORMAL
;
1381 bool hasWeight
= HasParam(wxT("weight"));
1384 wxString weight
= GetParamValue(wxT("weight"));
1385 if (weight
== wxT("bold"))
1387 else if (weight
== wxT("light"))
1392 bool hasUnderlined
= HasParam(wxT("underlined"));
1393 bool underlined
= hasUnderlined
? GetBool(wxT("underlined"), false) : false;
1395 // family and facename
1396 int ifamily
= wxDEFAULT
;
1397 bool hasFamily
= HasParam(wxT("family"));
1400 wxString family
= GetParamValue(wxT("family"));
1401 if (family
== wxT("decorative")) ifamily
= wxDECORATIVE
;
1402 else if (family
== wxT("roman")) ifamily
= wxROMAN
;
1403 else if (family
== wxT("script")) ifamily
= wxSCRIPT
;
1404 else if (family
== wxT("swiss")) ifamily
= wxSWISS
;
1405 else if (family
== wxT("modern")) ifamily
= wxMODERN
;
1406 else if (family
== wxT("teletype")) ifamily
= wxTELETYPE
;
1411 bool hasFacename
= HasParam(wxT("face"));
1414 wxString faces
= GetParamValue(wxT("face"));
1415 wxStringTokenizer
tk(faces
, wxT(","));
1417 wxArrayString
facenames(wxFontEnumerator::GetFacenames());
1418 while (tk
.HasMoreTokens())
1420 int index
= facenames
.Index(tk
.GetNextToken(), false);
1421 if (index
!= wxNOT_FOUND
)
1423 facename
= facenames
[index
];
1427 #else // !wxUSE_FONTENUM
1428 // just use the first face name if we can't check its availability:
1429 if (tk
.HasMoreTokens())
1430 facename
= tk
.GetNextToken();
1431 #endif // wxUSE_FONTENUM/!wxUSE_FONTENUM
1435 wxFontEncoding enc
= wxFONTENCODING_DEFAULT
;
1436 bool hasEncoding
= HasParam(wxT("encoding"));
1439 wxString encoding
= GetParamValue(wxT("encoding"));
1440 wxFontMapper mapper
;
1441 if (!encoding
.empty())
1442 enc
= mapper
.CharsetToEncoding(encoding
);
1443 if (enc
== wxFONTENCODING_SYSTEM
)
1444 enc
= wxFONTENCODING_DEFAULT
;
1447 // is this font based on a system font?
1448 wxFont font
= GetSystemFont(GetParamValue(wxT("sysfont")));
1452 if (hasSize
&& isize
!= -1)
1453 font
.SetPointSize(isize
);
1454 else if (HasParam(wxT("relativesize")))
1455 font
.SetPointSize(int(font
.GetPointSize() *
1456 GetFloat(wxT("relativesize"))));
1459 font
.SetStyle(istyle
);
1461 font
.SetWeight(iweight
);
1463 font
.SetUnderlined(underlined
);
1465 font
.SetFamily(ifamily
);
1467 font
.SetFaceName(facename
);
1469 font
.SetDefaultEncoding(enc
);
1471 else // not based on system font
1473 font
= wxFont(isize
== -1 ? wxNORMAL_FONT
->GetPointSize() : isize
,
1474 ifamily
, istyle
, iweight
,
1475 underlined
, facename
, enc
);
1483 void wxXmlResourceHandler::SetupWindow(wxWindow
*wnd
)
1485 //FIXME : add cursor
1487 if (HasParam(wxT("exstyle")))
1488 // Have to OR it with existing style, since
1489 // some implementations (e.g. wxGTK) use the extra style
1491 wnd
->SetExtraStyle(wnd
->GetExtraStyle() | GetStyle(wxT("exstyle")));
1492 if (HasParam(wxT("bg")))
1493 wnd
->SetBackgroundColour(GetColour(wxT("bg")));
1494 if (HasParam(wxT("fg")))
1495 wnd
->SetForegroundColour(GetColour(wxT("fg")));
1496 if (GetBool(wxT("enabled"), 1) == 0)
1498 if (GetBool(wxT("focused"), 0) == 1)
1500 if (GetBool(wxT("hidden"), 0) == 1)
1503 if (HasParam(wxT("tooltip")))
1504 wnd
->SetToolTip(GetText(wxT("tooltip")));
1506 if (HasParam(wxT("font")))
1507 wnd
->SetFont(GetFont());
1508 if (HasParam(wxT("help")))
1509 wnd
->SetHelpText(GetText(wxT("help")));
1513 void wxXmlResourceHandler::CreateChildren(wxObject
*parent
, bool this_hnd_only
)
1515 wxXmlNode
*n
= m_node
->GetChildren();
1519 if (n
->GetType() == wxXML_ELEMENT_NODE
&&
1520 (n
->GetName() == wxT("object") || n
->GetName() == wxT("object_ref")))
1522 m_resource
->CreateResFromNode(n
, parent
, NULL
,
1523 this_hnd_only
? this : NULL
);
1530 void wxXmlResourceHandler::CreateChildrenPrivately(wxObject
*parent
, wxXmlNode
*rootnode
)
1533 if (rootnode
== NULL
) root
= m_node
; else root
= rootnode
;
1534 wxXmlNode
*n
= root
->GetChildren();
1538 if (n
->GetType() == wxXML_ELEMENT_NODE
&& CanHandle(n
))
1540 CreateResource(n
, parent
, NULL
);
1552 // --------------- XRCID implementation -----------------------------
1554 #define XRCID_TABLE_SIZE 1024
1559 /* Hold the id so that once an id is allocated for a name, it
1560 does not get created again by NewControlId at least
1561 until we are done with it */
1567 static XRCID_record
*XRCID_Records
[XRCID_TABLE_SIZE
] = {NULL
};
1569 static int XRCID_Lookup(const char *str_id
, int value_if_not_found
= wxID_NONE
)
1573 for (const char *c
= str_id
; *c
!= '\0'; c
++) index
+= (int)*c
;
1574 index
%= XRCID_TABLE_SIZE
;
1576 XRCID_record
*oldrec
= NULL
;
1577 for (XRCID_record
*rec
= XRCID_Records
[index
]; rec
; rec
= rec
->next
)
1579 if (wxStrcmp(rec
->key
, str_id
) == 0)
1586 XRCID_record
**rec_var
= (oldrec
== NULL
) ?
1587 &XRCID_Records
[index
] : &oldrec
->next
;
1588 *rec_var
= new XRCID_record
;
1589 (*rec_var
)->key
= wxStrdup(str_id
);
1590 (*rec_var
)->next
= NULL
;
1593 if (value_if_not_found
!= wxID_NONE
)
1594 (*rec_var
)->id
= value_if_not_found
;
1597 int asint
= wxStrtol(str_id
, &end
, 10);
1598 if (*str_id
&& *end
== 0)
1600 // if str_id was integer, keep it verbosely:
1601 (*rec_var
)->id
= asint
;
1605 (*rec_var
)->id
= wxWindowBase::NewControlId();
1609 return (*rec_var
)->id
;
1612 static void AddStdXRCID_Records();
1615 int wxXmlResource::DoGetXRCID(const char *str_id
, int value_if_not_found
)
1617 static bool s_stdIDsAdded
= false;
1619 if ( !s_stdIDsAdded
)
1621 s_stdIDsAdded
= true;
1622 AddStdXRCID_Records();
1625 return XRCID_Lookup(str_id
, value_if_not_found
);
1629 static void CleanXRCID_Record(XRCID_record
*rec
)
1633 CleanXRCID_Record(rec
->next
);
1640 static void CleanXRCID_Records()
1642 for (int i
= 0; i
< XRCID_TABLE_SIZE
; i
++)
1644 CleanXRCID_Record(XRCID_Records
[i
]);
1645 XRCID_Records
[i
] = NULL
;
1649 static void AddStdXRCID_Records()
1651 #define stdID(id) XRCID_Lookup(#id, id)
1655 stdID(wxID_SEPARATOR
);
1668 stdID(wxID_PRINT_SETUP
);
1669 stdID(wxID_PAGE_SETUP
);
1670 stdID(wxID_PREVIEW
);
1672 stdID(wxID_HELP_CONTENTS
);
1673 stdID(wxID_HELP_COMMANDS
);
1674 stdID(wxID_HELP_PROCEDURES
);
1675 stdID(wxID_HELP_CONTEXT
);
1676 stdID(wxID_CLOSE_ALL
);
1677 stdID(wxID_PREFERENCES
);
1684 stdID(wxID_DUPLICATE
);
1685 stdID(wxID_SELECTALL
);
1687 stdID(wxID_REPLACE
);
1688 stdID(wxID_REPLACE_ALL
);
1689 stdID(wxID_PROPERTIES
);
1690 stdID(wxID_VIEW_DETAILS
);
1691 stdID(wxID_VIEW_LARGEICONS
);
1692 stdID(wxID_VIEW_SMALLICONS
);
1693 stdID(wxID_VIEW_LIST
);
1694 stdID(wxID_VIEW_SORTDATE
);
1695 stdID(wxID_VIEW_SORTNAME
);
1696 stdID(wxID_VIEW_SORTSIZE
);
1697 stdID(wxID_VIEW_SORTTYPE
);
1713 stdID(wxID_FORWARD
);
1714 stdID(wxID_BACKWARD
);
1715 stdID(wxID_DEFAULT
);
1719 stdID(wxID_CONTEXT_HELP
);
1720 stdID(wxID_YESTOALL
);
1721 stdID(wxID_NOTOALL
);
1730 stdID(wxID_REFRESH
);
1735 stdID(wxID_JUSTIFY_CENTER
);
1736 stdID(wxID_JUSTIFY_FILL
);
1737 stdID(wxID_JUSTIFY_RIGHT
);
1738 stdID(wxID_JUSTIFY_LEFT
);
1739 stdID(wxID_UNDERLINE
);
1741 stdID(wxID_UNINDENT
);
1742 stdID(wxID_ZOOM_100
);
1743 stdID(wxID_ZOOM_FIT
);
1744 stdID(wxID_ZOOM_IN
);
1745 stdID(wxID_ZOOM_OUT
);
1746 stdID(wxID_UNDELETE
);
1747 stdID(wxID_REVERT_TO_SAVED
);
1748 stdID(wxID_SYSTEM_MENU
);
1749 stdID(wxID_CLOSE_FRAME
);
1750 stdID(wxID_MOVE_FRAME
);
1751 stdID(wxID_RESIZE_FRAME
);
1752 stdID(wxID_MAXIMIZE_FRAME
);
1753 stdID(wxID_ICONIZE_FRAME
);
1754 stdID(wxID_RESTORE_FRAME
);
1756 stdID(wxID_CONVERT
);
1757 stdID(wxID_EXECUTE
);
1759 stdID(wxID_HARDDISK
);
1765 stdID(wxID_JUMP_TO
);
1766 stdID(wxID_NETWORK
);
1767 stdID(wxID_SELECT_COLOR
);
1768 stdID(wxID_SELECT_FONT
);
1769 stdID(wxID_SORT_ASCENDING
);
1770 stdID(wxID_SORT_DESCENDING
);
1771 stdID(wxID_SPELL_CHECK
);
1772 stdID(wxID_STRIKETHROUGH
);
1781 // --------------- module and globals -----------------------------
1783 // normally we would do the cleanup from wxXmlResourceModule::OnExit() but it
1784 // can happen that some XRC records have been created because of the use of
1785 // XRCID() in event tables, which happens during static objects initialization,
1786 // but then the application initialization failed and so the wx modules were
1787 // neither initialized nor cleaned up -- this static object does the cleanup in
1789 static struct wxXRCStaticCleanup
1791 ~wxXRCStaticCleanup() { CleanXRCID_Records(); }
1794 class wxXmlResourceModule
: public wxModule
1796 DECLARE_DYNAMIC_CLASS(wxXmlResourceModule
)
1798 wxXmlResourceModule() {}
1801 wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX
);
1806 delete wxXmlResource::Set(NULL
);
1807 if(wxXmlResource::ms_subclassFactories
)
1809 for ( wxXmlSubclassFactories::iterator i
= wxXmlResource::ms_subclassFactories
->begin();
1810 i
!= wxXmlResource::ms_subclassFactories
->end(); ++i
)
1814 wxDELETE(wxXmlResource::ms_subclassFactories
);
1816 CleanXRCID_Records();
1820 IMPLEMENT_DYNAMIC_CLASS(wxXmlResourceModule
, wxModule
)
1823 // When wxXml is loaded dynamically after the application is already running
1824 // then the built-in module system won't pick this one up. Add it manually.
1825 void wxXmlInitResourceModule()
1827 wxModule
* module = new wxXmlResourceModule
;
1829 wxModule::RegisterModule(module);