Added wxRichTextXMLHandler::RegisterNodeName so custom content classes can be added without

breaking XML loading


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71399 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2012-05-10 11:59:59 +00:00
parent 1e58c8b944
commit 1aca9fcdfc
4 changed files with 46 additions and 18 deletions

View File

@@ -16,6 +16,7 @@
* Includes
*/
#include "wx/hashmap.h"
#include "wx/richtext/richtextbuffer.h"
#include "wx/richtext/richtextstyles.h"
@@ -97,6 +98,17 @@ public:
wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false);
static wxXmlNode* FindNode(wxXmlNode* node, const wxString& name);
/**
Call with XML node name, C++ class name so that wxRTC can read in the node.
If you add a custom object, call this.
*/
static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; }
/**
Cleans up the mapping between node name and C++ class.
*/
static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); }
protected:
#if wxUSE_STREAMS
virtual bool DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& stream);
@@ -108,6 +120,8 @@ protected:
wxMBConv* m_convMem;
wxMBConv* m_convFile;
#endif
static wxStringToStringHashMap sm_nodeNameToClassMap;
};
#endif