switched wxXML to expat parser; some formatting mods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,18 +20,18 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxBitmapXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxBitmapXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxBitmapXmlHandler();
|
wxBitmapXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxIconXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxIconXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxIconXmlHandler();
|
wxIconXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxBitmapButtonXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxBitmapButtonXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxBitmapButtonXmlHandler();
|
wxBitmapButtonXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxButtonXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxButtonXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxButtonXmlHandler();
|
wxButtonXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxCalendarCtrlXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxCalendarCtrlXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCalendarCtrlXmlHandler();
|
wxCalendarCtrlXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxCheckBoxXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxCheckBoxXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCheckBoxXmlHandler();
|
wxCheckBoxXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxCheckListXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxCheckListXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCheckListXmlHandler();
|
wxCheckListXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
private:
|
private:
|
||||||
bool m_InsideBox;
|
bool m_insideBox;
|
||||||
wxArrayString strList;
|
wxArrayString strList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxChoiceXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxChoiceXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxChoiceXmlHandler();
|
wxChoiceXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
private:
|
private:
|
||||||
bool m_InsideBox;
|
bool m_insideBox;
|
||||||
wxArrayString strList;
|
wxArrayString strList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxComboBoxXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxComboBoxXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxComboBoxXmlHandler();
|
wxComboBoxXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
private:
|
private:
|
||||||
bool m_InsideBox;
|
bool m_insideBox;
|
||||||
wxArrayString strList;
|
wxArrayString strList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxDialogXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxDialogXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDialogXmlHandler();
|
wxDialogXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFrameXmlHandler();
|
wxFrameXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,10 +29,10 @@ class WXDLLEXPORT wxGaugeXmlHandler : public wxXmlResourceHandler
|
|||||||
wxGAUGE_DEFAULT_RANGE = 100
|
wxGAUGE_DEFAULT_RANGE = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxGaugeXmlHandler();
|
wxGaugeXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxHtmlWindowXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxHtmlWindowXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxHtmlWindowXmlHandler();
|
wxHtmlWindowXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxListBoxXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxListBoxXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxListBoxXmlHandler();
|
wxListBoxXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
private:
|
private:
|
||||||
bool m_InsideBox;
|
bool m_insideBox;
|
||||||
wxArrayString strList;
|
wxArrayString strList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxListCtrlXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxListCtrlXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxListCtrlXmlHandler();
|
wxListCtrlXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxMenuXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxMenuXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxMenuXmlHandler();
|
wxMenuXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_InsideMenu;
|
bool m_insideMenu;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxMenuBarXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxMenuBarXmlHandler : public wxXmlResourceHandler
|
||||||
|
@@ -22,14 +22,14 @@ class WXDLLEXPORT wxNotebook;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxNotebookXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxNotebookXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxNotebookXmlHandler();
|
wxNotebookXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_IsInside;
|
bool m_isInside;
|
||||||
wxNotebook *m_Notebook;
|
wxNotebook *m_notebook;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxPanelXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxPanelXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPanelXmlHandler();
|
wxPanelXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRadioButtonXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxRadioButtonXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRadioButtonXmlHandler();
|
wxRadioButtonXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRadioBoxXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxRadioBoxXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRadioBoxXmlHandler();
|
wxRadioBoxXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
private:
|
private:
|
||||||
bool m_InsideBox;
|
bool m_insideBox;
|
||||||
wxArrayString strList;
|
wxArrayString strList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,10 +29,10 @@ class WXDLLEXPORT wxScrollBarXmlHandler : public wxXmlResourceHandler
|
|||||||
wxSL_DEFAULT_MAX = 100
|
wxSL_DEFAULT_MAX = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxScrollBarXmlHandler();
|
wxScrollBarXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -22,16 +22,16 @@ class WXDLLEXPORT wxSizer;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxSizerXmlHandler();
|
wxSizerXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_isInside;
|
||||||
|
wxSizer *m_parentSizer;
|
||||||
|
|
||||||
private:
|
bool IsSizerNode(wxXmlNode *node);
|
||||||
bool m_IsInside;
|
|
||||||
wxSizer *m_ParentSizer;
|
|
||||||
|
|
||||||
bool IsSizerNode(wxXmlNode *node);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,10 +29,10 @@ class WXDLLEXPORT wxSliderXmlHandler : public wxXmlResourceHandler
|
|||||||
wxSL_DEFAULT_MAX = 100
|
wxSL_DEFAULT_MAX = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSliderXmlHandler();
|
wxSliderXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -28,10 +28,10 @@ class WXDLLEXPORT wxSpinButtonXmlHandler : public wxXmlResourceHandler
|
|||||||
wxSP_DEFAULT_MAX = 100
|
wxSP_DEFAULT_MAX = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpinButtonXmlHandler();
|
wxSpinButtonXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ class WXDLLEXPORT wxSpinCtrlXmlHandler : public wxXmlResourceHandler
|
|||||||
wxSP_DEFAULT_MAX = 100
|
wxSP_DEFAULT_MAX = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpinCtrlXmlHandler();
|
wxSpinCtrlXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticBitmapXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxStaticBitmapXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxStaticBitmapXmlHandler();
|
wxStaticBitmapXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticBoxXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxStaticBoxXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxStaticBoxXmlHandler();
|
wxStaticBoxXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticLineXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxStaticLineXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxStaticLineXmlHandler();
|
wxStaticLineXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticTextXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxStaticTextXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxStaticTextXmlHandler();
|
wxStaticTextXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxTextCtrlXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxTextCtrlXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTextCtrlXmlHandler();
|
wxTextCtrlXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,14 +23,14 @@ class WXDLLEXPORT wxToolBar;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxToolBarXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxToolBarXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxToolBarXmlHandler();
|
wxToolBarXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_IsInside;
|
bool m_isInside;
|
||||||
wxToolBar *m_Toolbar;
|
wxToolBar *m_toolbar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxTreeCtrlXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxTreeCtrlXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTreeCtrlXmlHandler();
|
wxTreeCtrlXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
class WXDLLEXPORT wxUnknownWidgetXmlHandler : public wxXmlResourceHandler
|
class WXDLLEXPORT wxUnknownWidgetXmlHandler : public wxXmlResourceHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxUnknownWidgetXmlHandler();
|
wxUnknownWidgetXmlHandler();
|
||||||
virtual wxObject *DoCreateResource();
|
virtual wxObject *DoCreateResource();
|
||||||
virtual bool CanHandle(wxXmlNode *node);
|
virtual bool CanHandle(wxXmlNode *node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -53,10 +53,11 @@ enum wxXmlNodeType
|
|||||||
|
|
||||||
enum wxXmlIOType
|
enum wxXmlIOType
|
||||||
{
|
{
|
||||||
wxXML_IO_AUTO = 0, // detect it automatically
|
wxXML_IO_AUTO = 0, // detect it automatically
|
||||||
wxXML_IO_LIBXML, // use libxml2 to parse/save XML document
|
wxXML_IO_EXPAT, // use Expat to load from text/xml document
|
||||||
wxXML_IO_BIN, // save in binary uncompressed proprietary format
|
wxXML_IO_TEXT_OUTPUT, // generic saver into text/xml
|
||||||
wxXML_IO_BINZ // svae in binary zlib-compressed proprietary format
|
wxXML_IO_BIN, // save in binary uncompressed proprietary format
|
||||||
|
wxXML_IO_BINZ // svae in binary zlib-compressed proprietary format
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -66,24 +67,25 @@ enum wxXmlIOType
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlProperty
|
class WXDLLEXPORT wxXmlProperty
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlProperty() : m_Next(NULL) {}
|
wxXmlProperty() : m_next(NULL) {}
|
||||||
wxXmlProperty(const wxString& name, const wxString& value, wxXmlProperty *next)
|
wxXmlProperty(const wxString& name, const wxString& value,
|
||||||
: m_Name(name), m_Value(value), m_Next(next) {}
|
wxXmlProperty *next)
|
||||||
~wxXmlProperty() { delete m_Next; }
|
: m_name(name), m_value(value), m_next(next) {}
|
||||||
|
~wxXmlProperty() { delete m_next; }
|
||||||
wxString GetName() const { return m_Name; }
|
|
||||||
wxString GetValue() const { return m_Value; }
|
|
||||||
wxXmlProperty *GetNext() const { return m_Next; }
|
|
||||||
|
|
||||||
void SetName(const wxString& name) { m_Name = name; }
|
|
||||||
void SetValue(const wxString& value) { m_Value = value; }
|
|
||||||
void SetNext(wxXmlProperty *next) { m_Next = next; }
|
|
||||||
|
|
||||||
private:
|
wxString GetName() const { return m_name; }
|
||||||
wxString m_Name;
|
wxString GetValue() const { return m_value; }
|
||||||
wxString m_Value;
|
wxXmlProperty *GetNext() const { return m_next; }
|
||||||
wxXmlProperty *m_Next;
|
|
||||||
|
void SetName(const wxString& name) { m_name = name; }
|
||||||
|
void SetValue(const wxString& value) { m_value = value; }
|
||||||
|
void SetNext(wxXmlProperty *next) { m_next = next; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxString m_name;
|
||||||
|
wxString m_value;
|
||||||
|
wxXmlProperty *m_next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -93,66 +95,74 @@ class WXDLLEXPORT wxXmlProperty
|
|||||||
// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
|
// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
|
||||||
// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
|
// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
|
||||||
// with content="hi").
|
// with content="hi").
|
||||||
|
//
|
||||||
|
// If wxUSE_UNICODE is 0, all strings are encoded in UTF-8 encoding (same as
|
||||||
|
// ASCII for characters 0-127). You can use wxMBConvUTF8 to convert then to
|
||||||
|
// desired encoding:
|
||||||
|
//
|
||||||
|
// wxCSConv myConv("iso8859-2");
|
||||||
|
// wxString s(cMB2WC(node->GetContent().c_str()), myConv);
|
||||||
|
|
||||||
class WXDLLEXPORT wxXmlNode
|
class WXDLLEXPORT wxXmlNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlNode() : m_Properties(NULL), m_Parent(NULL),
|
wxXmlNode() : m_properties(NULL), m_parent(NULL),
|
||||||
m_Children(NULL), m_Next(NULL) {}
|
m_children(NULL), m_next(NULL) {}
|
||||||
wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
|
wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
|
||||||
const wxString& name, const wxString& content,
|
const wxString& name, const wxString& content,
|
||||||
wxXmlProperty *props, wxXmlNode *next);
|
wxXmlProperty *props, wxXmlNode *next);
|
||||||
~wxXmlNode() { delete m_Properties; delete m_Next; delete m_Children; }
|
~wxXmlNode() { delete m_properties; delete m_next; delete m_children; }
|
||||||
|
|
||||||
// copy ctor & operator=. Note that this does NOT copy syblings
|
// copy ctor & operator=. Note that this does NOT copy syblings
|
||||||
// and parent pointer, i.e. m_Parent and m_Next will be NULL
|
// and parent pointer, i.e. m_parent and m_next will be NULL
|
||||||
// after using copy ctor and are never unmodified by operator=.
|
// after using copy ctor and are never unmodified by operator=.
|
||||||
// On the other hand, it DOES copy children and properties.
|
// On the other hand, it DOES copy children and properties.
|
||||||
wxXmlNode(const wxXmlNode& node);
|
wxXmlNode(const wxXmlNode& node);
|
||||||
wxXmlNode& operator=(const wxXmlNode& node);
|
wxXmlNode& operator=(const wxXmlNode& node);
|
||||||
|
|
||||||
// user-friendly creation:
|
|
||||||
wxXmlNode(wxXmlNodeType type, const wxString& name,
|
|
||||||
const wxString& content = wxEmptyString);
|
|
||||||
void AddChild(wxXmlNode *child);
|
|
||||||
void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
|
|
||||||
bool RemoveChild(wxXmlNode *child);
|
|
||||||
void AddProperty(const wxString& name, const wxString& value);
|
|
||||||
bool DeleteProperty(const wxString& name);
|
|
||||||
|
|
||||||
// access methods:
|
// user-friendly creation:
|
||||||
wxXmlNodeType GetType() const { return m_Type; }
|
wxXmlNode(wxXmlNodeType type, const wxString& name,
|
||||||
wxString GetName() const { return m_Name; }
|
const wxString& content = wxEmptyString);
|
||||||
wxString GetContent() const { return m_Content; }
|
void AddChild(wxXmlNode *child);
|
||||||
|
void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
|
||||||
wxXmlNode *GetParent() const { return m_Parent; }
|
bool RemoveChild(wxXmlNode *child);
|
||||||
wxXmlNode *GetNext() const { return m_Next; }
|
void AddProperty(const wxString& name, const wxString& value);
|
||||||
wxXmlNode *GetChildren() const { return m_Children; }
|
bool DeleteProperty(const wxString& name);
|
||||||
|
|
||||||
wxXmlProperty *GetProperties() const { return m_Properties; }
|
// access methods:
|
||||||
bool GetPropVal(const wxString& propName, wxString *value) const;
|
wxXmlNodeType GetType() const { return m_type; }
|
||||||
wxString GetPropVal(const wxString& propName, const wxString& defaultVal) const;
|
wxString GetName() const { return m_name; }
|
||||||
bool HasProp(const wxString& propName) const;
|
wxString GetContent() const { return m_content; }
|
||||||
|
|
||||||
void SetType(wxXmlNodeType type) { m_Type = type; }
|
|
||||||
void SetName(const wxString& name) { m_Name = name; }
|
|
||||||
void SetContent(const wxString& con) { m_Content = con; }
|
|
||||||
|
|
||||||
void SetParent(wxXmlNode *parent) { m_Parent = parent; }
|
|
||||||
void SetNext(wxXmlNode *next) { m_Next = next; }
|
|
||||||
void SetChildren(wxXmlNode *child) { m_Children = child; }
|
|
||||||
|
|
||||||
void SetProperties(wxXmlProperty *prop) { m_Properties = prop; }
|
|
||||||
void AddProperty(wxXmlProperty *prop);
|
|
||||||
|
|
||||||
private:
|
wxXmlNode *GetParent() const { return m_parent; }
|
||||||
wxXmlNodeType m_Type;
|
wxXmlNode *GetNext() const { return m_next; }
|
||||||
wxString m_Name;
|
wxXmlNode *GetChildren() const { return m_children; }
|
||||||
wxString m_Content;
|
|
||||||
wxXmlProperty *m_Properties;
|
|
||||||
wxXmlNode *m_Parent, *m_Children, *m_Next;
|
|
||||||
|
|
||||||
void DoCopy(const wxXmlNode& node);
|
wxXmlProperty *GetProperties() const { return m_properties; }
|
||||||
|
bool GetPropVal(const wxString& propName, wxString *value) const;
|
||||||
|
wxString GetPropVal(const wxString& propName,
|
||||||
|
const wxString& defaultVal) const;
|
||||||
|
bool HasProp(const wxString& propName) const;
|
||||||
|
|
||||||
|
void SetType(wxXmlNodeType type) { m_type = type; }
|
||||||
|
void SetName(const wxString& name) { m_name = name; }
|
||||||
|
void SetContent(const wxString& con) { m_content = con; }
|
||||||
|
|
||||||
|
void SetParent(wxXmlNode *parent) { m_parent = parent; }
|
||||||
|
void SetNext(wxXmlNode *next) { m_next = next; }
|
||||||
|
void SetChildren(wxXmlNode *child) { m_children = child; }
|
||||||
|
|
||||||
|
void SetProperties(wxXmlProperty *prop) { m_properties = prop; }
|
||||||
|
void AddProperty(wxXmlProperty *prop);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxXmlNodeType m_type;
|
||||||
|
wxString m_name;
|
||||||
|
wxString m_content;
|
||||||
|
wxXmlProperty *m_properties;
|
||||||
|
wxXmlNode *m_parent, *m_children, *m_next;
|
||||||
|
|
||||||
|
void DoCopy(const wxXmlNode& node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -167,51 +177,61 @@ class WXDLLEXPORT wxXmlNode
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlDocument : public wxObject
|
class WXDLLEXPORT wxXmlDocument : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlDocument() : wxObject(), m_Version(wxT("1.0")), m_Root(NULL) {}
|
wxXmlDocument() : wxObject(), m_version(wxT("1.0")), m_root(NULL) {}
|
||||||
wxXmlDocument(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
|
wxXmlDocument(const wxString& filename,
|
||||||
wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
|
wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||||
~wxXmlDocument() { delete m_Root; }
|
wxXmlDocument(wxInputStream& stream,
|
||||||
|
wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||||
wxXmlDocument(const wxXmlDocument& doc);
|
~wxXmlDocument() { delete m_root; }
|
||||||
wxXmlDocument& operator=(const wxXmlDocument& doc);
|
|
||||||
|
|
||||||
// Parses .xml file and loads data. Returns TRUE on success, FALSE
|
|
||||||
// otherwise.
|
|
||||||
// NOTE: Any call to this method will result into linking against libxml
|
|
||||||
// and app's binary size will grow by ca. 250kB
|
|
||||||
bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
|
|
||||||
bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
|
|
||||||
|
|
||||||
// Saves document as .xml file.
|
|
||||||
bool Save(const wxString& filename, wxXmlIOType io_type) const;
|
|
||||||
bool Save(wxOutputStream& stream, wxXmlIOType io_type) const;
|
|
||||||
|
|
||||||
// Returns root node of the document.
|
|
||||||
wxXmlNode *GetRoot() const { return m_Root; }
|
|
||||||
|
|
||||||
// Returns version of document (may be empty).
|
|
||||||
wxString GetVersion() const { return m_Version; }
|
|
||||||
// Returns encoding of document (may be empty).
|
|
||||||
wxString GetEncoding() const { return m_Encoding; }
|
|
||||||
|
|
||||||
// Write-access methods:
|
|
||||||
void SetRoot(wxXmlNode *node) { delete m_Root ; m_Root = node; }
|
|
||||||
void SetVersion(const wxString& version) { m_Version = version; }
|
|
||||||
void SetEncoding(const wxString& encoding) { m_Encoding = encoding; }
|
|
||||||
|
|
||||||
static void AddHandler(wxXmlIOHandler *handler);
|
wxXmlDocument(const wxXmlDocument& doc);
|
||||||
static void CleanUpHandlers();
|
wxXmlDocument& operator=(const wxXmlDocument& doc);
|
||||||
static void InitStandardHandlers();
|
|
||||||
|
|
||||||
protected:
|
// Parses .xml file and loads data. Returns TRUE on success, FALSE
|
||||||
static wxList *sm_Handlers;
|
// otherwise.
|
||||||
|
// NOTE: Any call to this method will result into linking against libxml
|
||||||
|
// and app's binary size will grow by ca. 250kB
|
||||||
|
bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||||
|
bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
|
||||||
|
|
||||||
private:
|
// Saves document as .xml file.
|
||||||
wxString m_Version, m_Encoding;
|
bool Save(const wxString& filename,
|
||||||
wxXmlNode *m_Root;
|
wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const;
|
||||||
|
bool Save(wxOutputStream& stream,
|
||||||
void DoCopy(const wxXmlDocument& doc);
|
wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const;
|
||||||
|
|
||||||
|
bool IsOk() const { return m_root != NULL; }
|
||||||
|
|
||||||
|
// Returns root node of the document.
|
||||||
|
wxXmlNode *GetRoot() const { return m_root; }
|
||||||
|
|
||||||
|
// Returns version of document (may be empty).
|
||||||
|
wxString GetVersion() const { return m_version; }
|
||||||
|
// Returns encoding of document (may be empty).
|
||||||
|
// Note: this is the encoding original fail was saved in, *not* the
|
||||||
|
// encoding of in-memory representation! Data in wxXmlNode are always
|
||||||
|
// stored in wchar_t (in Unicode build) or UTF-8 encoded
|
||||||
|
// (if wxUSE_UNICODE is 0).
|
||||||
|
wxString GetEncoding() const { return m_encoding; }
|
||||||
|
|
||||||
|
// Write-access methods:
|
||||||
|
void SetRoot(wxXmlNode *node) { delete m_root ; m_root = node; }
|
||||||
|
void SetVersion(const wxString& version) { m_version = version; }
|
||||||
|
void SetEncoding(const wxString& encoding) { m_encoding = encoding; }
|
||||||
|
|
||||||
|
static void AddHandler(wxXmlIOHandler *handler);
|
||||||
|
static void CleanUpHandlers();
|
||||||
|
static void InitStandardHandlers();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static wxList *sm_handlers;
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxString m_version, m_encoding;
|
||||||
|
wxXmlNode *m_root;
|
||||||
|
|
||||||
|
void DoCopy(const wxXmlDocument& doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,21 +20,45 @@
|
|||||||
#include "wx/xml/xml.h"
|
#include "wx/xml/xml.h"
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxXmlIOHandlerExpat : public wxXmlIOHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual wxXmlIOType GetType() { return wxXML_IO_EXPAT; }
|
||||||
|
virtual bool CanLoad(wxInputStream& stream);
|
||||||
|
virtual bool CanSave() { return FALSE; }
|
||||||
|
|
||||||
|
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||||
|
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) { return FALSE; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; }
|
||||||
|
virtual bool CanLoad(wxInputStream& stream) { return FALSE; }
|
||||||
|
virtual bool CanSave() { return TRUE; }
|
||||||
|
|
||||||
|
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) { return FALSE; }
|
||||||
|
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler
|
class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlIOHandlerBin() {}
|
wxXmlIOHandlerBin() {}
|
||||||
|
|
||||||
virtual wxXmlIOType GetType() { return wxXML_IO_BIN; }
|
virtual wxXmlIOType GetType() { return wxXML_IO_BIN; }
|
||||||
virtual bool CanLoad(wxInputStream& stream);
|
virtual bool CanLoad(wxInputStream& stream);
|
||||||
virtual bool CanSave() { return TRUE; }
|
virtual bool CanSave() { return TRUE; }
|
||||||
|
|
||||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString ReadHeader(wxInputStream& stream);
|
wxString ReadHeader(wxInputStream& stream);
|
||||||
void WriteHeader(wxOutputStream& stream, const wxString& header);
|
void WriteHeader(wxOutputStream& stream, const wxString& header);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -43,30 +67,17 @@ class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin
|
class WXDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlIOHandlerBinZ() {}
|
wxXmlIOHandlerBinZ() {}
|
||||||
|
|
||||||
virtual wxXmlIOType GetType() { return wxXML_IO_BINZ; }
|
virtual wxXmlIOType GetType() { return wxXML_IO_BINZ; }
|
||||||
virtual bool CanLoad(wxInputStream& stream);
|
virtual bool CanLoad(wxInputStream& stream);
|
||||||
|
|
||||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
||||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxXmlIOHandlerLibxml : public wxXmlIOHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual wxXmlIOType GetType() { return wxXML_IO_LIBXML; }
|
|
||||||
virtual bool CanLoad(wxInputStream& stream);
|
|
||||||
virtual bool CanSave();
|
|
||||||
|
|
||||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
|
||||||
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _WX_XMLIO_H_
|
#endif // _WX_XMLIO_H_
|
||||||
|
@@ -40,13 +40,13 @@ class WXDLLEXPORT wxXmlResourceHandler;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlResourceDataRecord
|
class WXDLLEXPORT wxXmlResourceDataRecord
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {}
|
wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {}
|
||||||
~wxXmlResourceDataRecord() {delete Doc;}
|
~wxXmlResourceDataRecord() {delete Doc;}
|
||||||
|
|
||||||
wxString File;
|
wxString File;
|
||||||
wxXmlDocument *Doc;
|
wxXmlDocument *Doc;
|
||||||
wxDateTime Time;
|
wxDateTime Time;
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DECLARE_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
|
WX_DECLARE_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
|
||||||
@@ -57,97 +57,97 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlResource : public wxObject
|
class WXDLLEXPORT wxXmlResource : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Ctor. If use_locale is TRUE, translatable strings are
|
// Ctor. If use_locale is TRUE, translatable strings are
|
||||||
// translated via _(). You can disable it by passing use_locale=FALSE
|
// translated via _(). You can disable it by passing use_locale=FALSE
|
||||||
// (for example if you provide resource file for each locale)
|
// (for example if you provide resource file for each locale)
|
||||||
wxXmlResource(bool use_locale = TRUE);
|
wxXmlResource(bool use_locale = TRUE);
|
||||||
wxXmlResource(const wxString& filemask, bool use_locale = TRUE);
|
wxXmlResource(const wxString& filemask, bool use_locale = TRUE);
|
||||||
~wxXmlResource();
|
~wxXmlResource();
|
||||||
|
|
||||||
// Loads resources from XML files that match given filemask.
|
// Loads resources from XML files that match given filemask.
|
||||||
// This method understands VFS (see filesys.h).
|
// This method understands VFS (see filesys.h).
|
||||||
bool Load(const wxString& filemask);
|
bool Load(const wxString& filemask);
|
||||||
|
|
||||||
// Initialize handlers for all supported controls/windows. This will
|
|
||||||
// make the executable quite big because it forces linking against
|
|
||||||
// most of wxWin library
|
|
||||||
void InitAllHandlers();
|
|
||||||
|
|
||||||
// Initialize only specific handler (or custom handler). Convention says
|
|
||||||
// that handler name is equal to control's name plus 'XmlHandler', e.g.
|
|
||||||
// wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
|
|
||||||
// (xmlres) can create include file that contains initialization code for
|
|
||||||
// all controls used within the resource.
|
|
||||||
void AddHandler(wxXmlResourceHandler *handler);
|
|
||||||
|
|
||||||
// Removes all handlers
|
|
||||||
void ClearHandlers();
|
|
||||||
|
|
||||||
// Loads menu from resource. Returns NULL on failure.
|
|
||||||
wxMenu *LoadMenu(const wxString& name);
|
|
||||||
|
|
||||||
// Loads menubar from resource. Returns NULL on failure.
|
// Initialize handlers for all supported controls/windows. This will
|
||||||
wxMenuBar *LoadMenuBar(const wxString& name);
|
// make the executable quite big because it forces linking against
|
||||||
|
// most of wxWin library
|
||||||
|
void InitAllHandlers();
|
||||||
|
|
||||||
|
// Initialize only specific handler (or custom handler). Convention says
|
||||||
|
// that handler name is equal to control's name plus 'XmlHandler', e.g.
|
||||||
|
// wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
|
||||||
|
// (xmlres) can create include file that contains initialization code for
|
||||||
|
// all controls used within the resource.
|
||||||
|
void AddHandler(wxXmlResourceHandler *handler);
|
||||||
|
|
||||||
|
// Removes all handlers
|
||||||
|
void ClearHandlers();
|
||||||
|
|
||||||
|
// Loads menu from resource. Returns NULL on failure.
|
||||||
|
wxMenu *LoadMenu(const wxString& name);
|
||||||
|
|
||||||
|
// Loads menubar from resource. Returns NULL on failure.
|
||||||
|
wxMenuBar *LoadMenuBar(const wxString& name);
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
// Loads toolbar
|
// Loads toolbar
|
||||||
wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
|
wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Loads dialog. dlg points to parent window (if any). Second form
|
// Loads dialog. dlg points to parent window (if any). Second form
|
||||||
// is used to finish creation of already existing instance (main reason
|
// is used to finish creation of already existing instance (main reason
|
||||||
// for this is that you may want to use derived class with new event table)
|
// for this is that you may want to use derived class with new event table)
|
||||||
// Example (typical usage):
|
// Example (typical usage):
|
||||||
// MyDialog dlg;
|
// MyDialog dlg;
|
||||||
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
|
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
|
||||||
// dlg->ShowModal();
|
// dlg->ShowModal();
|
||||||
wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
|
wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
|
||||||
bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
|
bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
// Loads panel. panel points to parent window (if any). Second form
|
// Loads panel. panel points to parent window (if any). Second form
|
||||||
// is used to finish creation of already existing instance.
|
// is used to finish creation of already existing instance.
|
||||||
wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
|
wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
|
||||||
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
||||||
|
|
||||||
// Loads bitmap or icon resource from file:
|
// Loads bitmap or icon resource from file:
|
||||||
wxBitmap LoadBitmap(const wxString& name);
|
wxBitmap LoadBitmap(const wxString& name);
|
||||||
wxIcon LoadIcon(const wxString& name);
|
wxIcon LoadIcon(const wxString& name);
|
||||||
|
|
||||||
// Returns numeric ID that is equivalent to string id used in XML
|
// Returns numeric ID that is equivalent to string id used in XML
|
||||||
// resource. To be used in event tables
|
// resource. To be used in event tables
|
||||||
// Macro XMLID is provided for convenience
|
// Macro XMLID is provided for convenience
|
||||||
static int GetXMLID(const char *str_id);
|
static int GetXMLID(const char *str_id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Scans resources list for unloaded files and loads them. Also reloads
|
// Scans resources list for unloaded files and loads them. Also reloads
|
||||||
// files that have been modified since last loading.
|
// files that have been modified since last loading.
|
||||||
void UpdateResources();
|
void UpdateResources();
|
||||||
|
|
||||||
// Finds resource (calls UpdateResources) and returns node containing it
|
|
||||||
wxXmlNode *FindResource(const wxString& name, const wxString& classname);
|
|
||||||
|
|
||||||
// Creates resource from info in given node:
|
|
||||||
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
|
|
||||||
|
|
||||||
// Remove nodes with property "platform" that does not
|
// Finds resource (calls UpdateResources) and returns node containing it
|
||||||
// match current platform
|
wxXmlNode *FindResource(const wxString& name, const wxString& classname);
|
||||||
void ProcessPlatformProperty(wxXmlNode *node);
|
|
||||||
|
|
||||||
bool GetUseLocale() { return m_UseLocale; }
|
|
||||||
|
|
||||||
private:
|
// Creates resource from info in given node:
|
||||||
bool m_UseLocale;
|
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL);
|
||||||
wxList m_Handlers;
|
|
||||||
wxXmlResourceDataRecords m_Data;
|
// Remove nodes with property "platform" that does not
|
||||||
|
// match current platform
|
||||||
|
void ProcessPlatformProperty(wxXmlNode *node);
|
||||||
|
|
||||||
|
bool GetUseLocale() { return m_useLocale; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_useLocale;
|
||||||
|
wxList m_handlers;
|
||||||
|
wxXmlResourceDataRecords m_data;
|
||||||
#if wxUSE_FILESYSTEM
|
#if wxUSE_FILESYSTEM
|
||||||
wxFileSystem m_CurFileSystem;
|
wxFileSystem m_curFileSystem;
|
||||||
wxFileSystem& GetCurFileSystem() { return m_CurFileSystem; }
|
wxFileSystem& GetCurFileSystem() { return m_curFileSystem; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class wxXmlResourceHandler;
|
friend class wxXmlResourceHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -184,116 +184,120 @@ extern wxXmlResource *wxTheXmlResource;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxXmlResourceHandler : public wxObject
|
class WXDLLEXPORT wxXmlResourceHandler : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxXmlResourceHandler();
|
wxXmlResourceHandler();
|
||||||
virtual ~wxXmlResourceHandler() {}
|
virtual ~wxXmlResourceHandler() {}
|
||||||
|
|
||||||
// Creates object (menu, dialog, control, ...) from XML node.
|
// Creates object (menu, dialog, control, ...) from XML node.
|
||||||
// Should check for validity.
|
// Should check for validity.
|
||||||
// parent is higher-level object (usually window, dialog or panel)
|
// parent is higher-level object (usually window, dialog or panel)
|
||||||
// that is often neccessary to create resource
|
// that is often neccessary to create resource
|
||||||
// if instance != NULL it should not create new instance via 'new' but
|
// if instance != NULL it should not create new instance via 'new' but
|
||||||
// rather use this one and call its Create method
|
// rather use this one and call its Create method
|
||||||
wxObject *CreateResource(wxXmlNode *node, wxObject *parent, wxObject *instance);
|
wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
|
||||||
|
wxObject *instance);
|
||||||
|
|
||||||
// This one is called from CreateResource after variables
|
// This one is called from CreateResource after variables
|
||||||
// were filled
|
// were filled
|
||||||
virtual wxObject *DoCreateResource() = 0;
|
virtual wxObject *DoCreateResource() = 0;
|
||||||
|
|
||||||
// Returns TRUE if it understands this node and can create
|
|
||||||
// resource from it, FALSE otherwise.
|
|
||||||
virtual bool CanHandle(wxXmlNode *node) = 0;
|
|
||||||
|
|
||||||
void SetParentResource(wxXmlResource *res) { m_Resource = res; }
|
// Returns TRUE if it understands this node and can create
|
||||||
|
// resource from it, FALSE otherwise.
|
||||||
|
virtual bool CanHandle(wxXmlNode *node) = 0;
|
||||||
|
|
||||||
|
void SetParentResource(wxXmlResource *res) { m_resource = res; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
wxXmlResource *m_Resource;
|
wxXmlResource *m_resource;
|
||||||
wxArrayString m_StyleNames;
|
wxArrayString m_styleNames;
|
||||||
wxArrayInt m_StyleValues;
|
wxArrayInt m_styleValues;
|
||||||
|
|
||||||
// Variables (filled by CreateResource)
|
// Variables (filled by CreateResource)
|
||||||
wxXmlNode *m_Node;
|
wxXmlNode *m_node;
|
||||||
wxString m_Class;
|
wxString m_class;
|
||||||
wxObject *m_Parent, *m_Instance;
|
wxObject *m_parent, *m_instance;
|
||||||
wxWindow *m_ParentAsWindow, *m_InstanceAsWindow;
|
wxWindow *m_parentAsWindow, *m_instanceAsWindow;
|
||||||
|
|
||||||
// --- Handy methods:
|
|
||||||
|
|
||||||
// Returns true if the node has property class equal to classname,
|
// --- Handy methods:
|
||||||
// e.g. <object class="wxDialog">
|
|
||||||
bool IsOfClass(wxXmlNode *node, const wxString& classname)
|
|
||||||
{ return node->GetPropVal(wxT("class"), wxEmptyString) == classname; }
|
|
||||||
|
|
||||||
// Gets node content from wxXML_ENTITY_NODE
|
// Returns true if the node has property class equal to classname,
|
||||||
// (the problem is, <tag>content<tag> is represented as
|
// e.g. <object class="wxDialog">
|
||||||
// wxXML_ENTITY_NODE name="tag", content=""
|
bool IsOfClass(wxXmlNode *node, const wxString& classname)
|
||||||
// |-- wxXML_TEXT_NODE or
|
{ return node->GetPropVal(wxT("class"), wxEmptyString) == classname; }
|
||||||
// wxXML_CDATA_SECTION_NODE name="" content="content"
|
|
||||||
wxString GetNodeContent(wxXmlNode *node);
|
|
||||||
|
|
||||||
// Check to see if a param exists
|
// Gets node content from wxXML_ENTITY_NODE
|
||||||
bool HasParam(const wxString& param);
|
// (the problem is, <tag>content<tag> is represented as
|
||||||
|
// wxXML_ENTITY_NODE name="tag", content=""
|
||||||
|
// |-- wxXML_TEXT_NODE or
|
||||||
|
// wxXML_CDATA_SECTION_NODE name="" content="content"
|
||||||
|
wxString GetNodeContent(wxXmlNode *node);
|
||||||
|
|
||||||
// Finds the node or returns NULL
|
// Check to see if a param exists
|
||||||
wxXmlNode *GetParamNode(const wxString& param);
|
bool HasParam(const wxString& param);
|
||||||
wxString GetParamValue(const wxString& param);
|
|
||||||
|
|
||||||
// Add style flag (e.g. wxMB_DOCKABLE) to list of flags
|
|
||||||
// understood by this handler
|
|
||||||
void AddStyle(const wxString& name, int value);
|
|
||||||
|
|
||||||
// Add styles common to all wxWindow-derived classes
|
|
||||||
void AddWindowStyles();
|
|
||||||
|
|
||||||
// Gets style flags from text in form "flag | flag2| flag3 |..."
|
|
||||||
// Only understads flags added with AddStyle
|
|
||||||
int GetStyle(const wxString& param = wxT("style"), int defaults = 0);
|
|
||||||
|
|
||||||
// Gets text from param and does some convertions:
|
|
||||||
// - replaces \n, \r, \t by respective chars (according to C syntax)
|
|
||||||
// - replaces $ by & and $$ by $ (needed for $File => &File because of XML)
|
|
||||||
// - calls wxGetTranslations (unless disabled in wxXmlResource)
|
|
||||||
wxString GetText(const wxString& param);
|
|
||||||
|
|
||||||
// Return XMLID
|
// Finds the node or returns NULL
|
||||||
int GetID();
|
wxXmlNode *GetParamNode(const wxString& param);
|
||||||
wxString GetName();
|
wxString GetParamValue(const wxString& param);
|
||||||
|
|
||||||
// Get bool flag (1,t,yes,on,true are TRUE, everything else is FALSE)
|
// Add style flag (e.g. wxMB_DOCKABLE) to list of flags
|
||||||
bool GetBool(const wxString& param, bool defaultv = FALSE);
|
// understood by this handler
|
||||||
|
void AddStyle(const wxString& name, int value);
|
||||||
|
|
||||||
// Get integer value from param
|
// Add styles common to all wxWindow-derived classes
|
||||||
long GetLong( const wxString& param, long defaultv = 0 );
|
void AddWindowStyles();
|
||||||
|
|
||||||
// Get colour in HTML syntax (#RRGGBB)
|
|
||||||
wxColour GetColour(const wxString& param);
|
|
||||||
|
|
||||||
// Get size/position (may be in dlg units):
|
|
||||||
wxSize GetSize(const wxString& param = wxT("size"));
|
|
||||||
wxPoint GetPosition(const wxString& param = wxT("pos"));
|
|
||||||
|
|
||||||
// Get dimension (may be in dlg units):
|
// Gets style flags from text in form "flag | flag2| flag3 |..."
|
||||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
|
// Only understads flags added with AddStyle
|
||||||
|
int GetStyle(const wxString& param = wxT("style"), int defaults = 0);
|
||||||
// Get bitmap:
|
|
||||||
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"), wxSize size = wxDefaultSize);
|
|
||||||
wxIcon GetIcon(const wxString& param = wxT("icon"), wxSize size = wxDefaultSize);
|
|
||||||
|
|
||||||
// Get font:
|
|
||||||
wxFont GetFont(const wxString& param = wxT("font"));
|
|
||||||
|
|
||||||
// Sets common window options:
|
|
||||||
void SetupWindow(wxWindow *wnd);
|
|
||||||
|
|
||||||
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
|
|
||||||
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
|
|
||||||
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL)
|
|
||||||
{ return m_Resource->CreateResFromNode(node, parent, instance); }
|
|
||||||
|
|
||||||
// helper
|
// Gets text from param and does some convertions:
|
||||||
wxFileSystem& GetCurFileSystem() { return m_Resource->GetCurFileSystem(); }
|
// - replaces \n, \r, \t by respective chars (according to C syntax)
|
||||||
|
// - replaces $ by & and $$ by $ (needed for $File => &File because of XML)
|
||||||
|
// - calls wxGetTranslations (unless disabled in wxXmlResource)
|
||||||
|
wxString GetText(const wxString& param);
|
||||||
|
|
||||||
|
// Return XMLID
|
||||||
|
int GetID();
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
// Get bool flag (1,t,yes,on,true are TRUE, everything else is FALSE)
|
||||||
|
bool GetBool(const wxString& param, bool defaultv = FALSE);
|
||||||
|
|
||||||
|
// Get integer value from param
|
||||||
|
long GetLong( const wxString& param, long defaultv = 0 );
|
||||||
|
|
||||||
|
// Get colour in HTML syntax (#RRGGBB)
|
||||||
|
wxColour GetColour(const wxString& param);
|
||||||
|
|
||||||
|
// Get size/position (may be in dlg units):
|
||||||
|
wxSize GetSize(const wxString& param = wxT("size"));
|
||||||
|
wxPoint GetPosition(const wxString& param = wxT("pos"));
|
||||||
|
|
||||||
|
// Get dimension (may be in dlg units):
|
||||||
|
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
|
||||||
|
|
||||||
|
// Get bitmap:
|
||||||
|
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
|
||||||
|
wxSize size = wxDefaultSize);
|
||||||
|
wxIcon GetIcon(const wxString& param = wxT("icon"),
|
||||||
|
wxSize size = wxDefaultSize);
|
||||||
|
|
||||||
|
// Get font:
|
||||||
|
wxFont GetFont(const wxString& param = wxT("font"));
|
||||||
|
|
||||||
|
// Sets common window options:
|
||||||
|
void SetupWindow(wxWindow *wnd);
|
||||||
|
|
||||||
|
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
|
||||||
|
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
|
||||||
|
wxObject *CreateResFromNode(wxXmlNode *node,
|
||||||
|
wxObject *parent, wxObject *instance = NULL)
|
||||||
|
{ return m_resource->CreateResFromNode(node, parent, instance); }
|
||||||
|
|
||||||
|
// helper
|
||||||
|
wxFileSystem& GetCurFileSystem() { return m_resource->GetCurFileSystem(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ADD_STYLE(style) AddStyle(wxT(#style), style)
|
#define ADD_STYLE(style) AddStyle(wxT(#style), style)
|
||||||
|
Reference in New Issue
Block a user