Changed WXDLLEXPORT's to WXXMLDLLEXPORT so the xmlres library can be

used from wx DLL without it being a DLL also.  Some work will still
need to be done for making xmlres be a DLL...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-06-05 22:03:02 +00:00
parent a763ac036b
commit ea89ec1760
34 changed files with 102 additions and 89 deletions

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxBitmapXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxBitmapXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxBitmapXmlHandler(); wxBitmapXmlHandler();
@@ -26,7 +26,7 @@ public:
virtual bool CanHandle(wxXmlNode *node); virtual bool CanHandle(wxXmlNode *node);
}; };
class WXDLLEXPORT wxIconXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxIconXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxIconXmlHandler(); wxIconXmlHandler();

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxBitmapButtonXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxBitmapButtonXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxBitmapButtonXmlHandler(); wxBitmapButtonXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxButtonXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxButtonXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxButtonXmlHandler(); wxButtonXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxCalendarCtrlXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxCalendarCtrlXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxCalendarCtrlXmlHandler(); wxCalendarCtrlXmlHandler();

View File

@@ -20,7 +20,7 @@
#if wxUSE_CHECKBOX #if wxUSE_CHECKBOX
class WXDLLEXPORT wxCheckBoxXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxCheckBoxXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxCheckBoxXmlHandler(); wxCheckBoxXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxCheckListXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxCheckListXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxCheckListXmlHandler(); wxCheckListXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxChoiceXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxChoiceXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxChoiceXmlHandler(); wxChoiceXmlHandler();

View File

@@ -19,7 +19,7 @@
#if wxUSE_COMBOBOX #if wxUSE_COMBOBOX
class WXDLLEXPORT wxComboBoxXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxComboBoxXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxComboBoxXmlHandler(); wxComboBoxXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxDialogXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxDialogXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxDialogXmlHandler(); wxDialogXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxFrameXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxFrameXmlHandler(); wxFrameXmlHandler();

View File

@@ -22,9 +22,9 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxGaugeXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxGaugeXmlHandler : public wxXmlResourceHandler
{ {
enum enum
{ {
wxGAUGE_DEFAULT_RANGE = 100 wxGAUGE_DEFAULT_RANGE = 100
}; };

View File

@@ -21,7 +21,7 @@
#if wxUSE_HTML #if wxUSE_HTML
class WXDLLEXPORT wxHtmlWindowXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxHtmlWindowXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxHtmlWindowXmlHandler(); wxHtmlWindowXmlHandler();

View File

@@ -19,7 +19,7 @@
#if wxUSE_LISTBOX #if wxUSE_LISTBOX
class WXDLLEXPORT wxListBoxXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxListBoxXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxListBoxXmlHandler(); wxListBoxXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxListCtrlXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxListCtrlXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxListCtrlXmlHandler(); wxListCtrlXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxMenuXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxMenuXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxMenuXmlHandler(); wxMenuXmlHandler();
@@ -28,7 +28,7 @@ private:
bool m_insideMenu; bool m_insideMenu;
}; };
class WXDLLEXPORT wxMenuBarXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxMenuBarXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxMenuBarXmlHandler(); wxMenuBarXmlHandler();

View File

@@ -20,7 +20,7 @@
class WXDLLEXPORT wxNotebook; class WXDLLEXPORT wxNotebook;
class WXDLLEXPORT wxNotebookXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxNotebookXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxNotebookXmlHandler(); wxNotebookXmlHandler();

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxPanelXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxPanelXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxPanelXmlHandler(); wxPanelXmlHandler();

View File

@@ -20,7 +20,7 @@
#if wxUSE_RADIOBOX #if wxUSE_RADIOBOX
class WXDLLEXPORT wxRadioButtonXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxRadioButtonXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxRadioButtonXmlHandler(); wxRadioButtonXmlHandler();

View File

@@ -19,7 +19,7 @@
#if wxUSE_RADIOBOX #if wxUSE_RADIOBOX
class WXDLLEXPORT wxRadioBoxXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxRadioBoxXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxRadioBoxXmlHandler(); wxRadioBoxXmlHandler();

View File

@@ -20,9 +20,9 @@
class WXDLLEXPORT wxScrollBarXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxScrollBarXmlHandler : public wxXmlResourceHandler
{ {
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,
wxSL_DEFAULT_MIN = 0, wxSL_DEFAULT_MIN = 0,

View File

@@ -20,7 +20,7 @@
class WXDLLEXPORT wxSizer; class WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxSizerXmlHandler(); wxSizerXmlHandler();
@@ -30,7 +30,7 @@ public:
private: private:
bool m_isInside; bool m_isInside;
wxSizer *m_parentSizer; wxSizer *m_parentSizer;
bool IsSizerNode(wxXmlNode *node); bool IsSizerNode(wxXmlNode *node);
}; };

View File

@@ -20,9 +20,9 @@
#if wxUSE_SLIDER #if wxUSE_SLIDER
class WXDLLEXPORT wxSliderXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxSliderXmlHandler : public wxXmlResourceHandler
{ {
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,
wxSL_DEFAULT_MIN = 0, wxSL_DEFAULT_MIN = 0,

View File

@@ -19,9 +19,9 @@
#include "wx/defs.h" #include "wx/defs.h"
#if wxUSE_SPINBTN #if wxUSE_SPINBTN
class WXDLLEXPORT wxSpinButtonXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxSpinButtonXmlHandler : public wxXmlResourceHandler
{ {
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,
wxSP_DEFAULT_MIN = 0, wxSP_DEFAULT_MIN = 0,
@@ -36,9 +36,9 @@ public:
#endif #endif
#if wxUSE_SPINCTRL #if wxUSE_SPINCTRL
class WXDLLEXPORT wxSpinCtrlXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxSpinCtrlXmlHandler : public wxXmlResourceHandler
{ {
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,
wxSP_DEFAULT_MIN = 0, wxSP_DEFAULT_MIN = 0,

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxStaticBitmapXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxStaticBitmapXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxStaticBitmapXmlHandler(); wxStaticBitmapXmlHandler();

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxStaticBoxXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxStaticBoxXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxStaticBoxXmlHandler(); wxStaticBoxXmlHandler();

View File

@@ -19,7 +19,7 @@
#if wxUSE_STATLINE #if wxUSE_STATLINE
class WXDLLEXPORT wxStaticLineXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxStaticLineXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxStaticLineXmlHandler(); wxStaticLineXmlHandler();

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxStaticTextXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxStaticTextXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxStaticTextXmlHandler(); wxStaticTextXmlHandler();

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxTextCtrlXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxTextCtrlXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxTextCtrlXmlHandler(); wxTextCtrlXmlHandler();

View File

@@ -21,13 +21,13 @@
class WXDLLEXPORT wxToolBar; class WXDLLEXPORT wxToolBar;
class WXDLLEXPORT wxToolBarXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT 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;

View File

@@ -17,7 +17,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxTreeCtrlXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxTreeCtrlXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxTreeCtrlXmlHandler(); wxTreeCtrlXmlHandler();

View File

@@ -18,7 +18,7 @@
#include "wx/xml/xmlres.h" #include "wx/xml/xmlres.h"
class WXDLLEXPORT wxUnknownWidgetXmlHandler : public wxXmlResourceHandler class WXXMLDLLEXPORT wxUnknownWidgetXmlHandler : public wxXmlResourceHandler
{ {
public: public:
wxUnknownWidgetXmlHandler(); wxUnknownWidgetXmlHandler();

View File

@@ -20,11 +20,16 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/list.h" #include "wx/list.h"
#ifdef WXXMLISDLL
#define WXXMLDLLEXPORT WXDLLEXPORT
#else
#define WXXMLDLLEXPORT
#endif
class WXDLLEXPORT wxXmlNode; class WXXMLDLLEXPORT wxXmlNode;
class WXDLLEXPORT wxXmlProperty; class WXXMLDLLEXPORT wxXmlProperty;
class WXDLLEXPORT wxXmlDocument; class WXXMLDLLEXPORT wxXmlDocument;
class WXDLLEXPORT wxXmlIOHandler; class WXXMLDLLEXPORT wxXmlIOHandler;
class WXDLLEXPORT wxInputStream; class WXDLLEXPORT wxInputStream;
class WXDLLEXPORT wxOutputStream; class WXDLLEXPORT wxOutputStream;
@@ -65,11 +70,11 @@ enum wxXmlIOType
// Example: in <img src="hello.gif" id="3"/> "src" is property with value // Example: in <img src="hello.gif" id="3"/> "src" is property with value
// "hello.gif" and "id" is prop. with value "3". // "hello.gif" and "id" is prop. with value "3".
class WXDLLEXPORT wxXmlProperty class WXXMLDLLEXPORT wxXmlProperty
{ {
public: public:
wxXmlProperty() : m_next(NULL) {} wxXmlProperty() : m_next(NULL) {}
wxXmlProperty(const wxString& name, const wxString& value, wxXmlProperty(const wxString& name, const wxString& value,
wxXmlProperty *next) wxXmlProperty *next)
: m_name(name), m_value(value), m_next(next) {} : m_name(name), m_value(value), m_next(next) {}
~wxXmlProperty() { delete m_next; } ~wxXmlProperty() { delete m_next; }
@@ -97,18 +102,18 @@ private:
// with content="hi"). // with content="hi").
// //
// If wxUSE_UNICODE is 0, all strings are encoded in UTF-8 encoding (same as // 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 // ASCII for characters 0-127). You can use wxMBConvUTF8 to convert then to
// desired encoding: // desired encoding:
// //
// wxCSConv myConv("iso8859-2"); // wxCSConv myConv("iso8859-2");
// wxString s(cMB2WC(node->GetContent().c_str()), myConv); // wxString s(cMB2WC(node->GetContent().c_str()), myConv);
class WXDLLEXPORT wxXmlNode class WXXMLDLLEXPORT 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; }
@@ -121,7 +126,7 @@ public:
wxXmlNode& operator=(const wxXmlNode& node); wxXmlNode& operator=(const wxXmlNode& node);
// user-friendly creation: // user-friendly creation:
wxXmlNode(wxXmlNodeType type, const wxString& name, wxXmlNode(wxXmlNodeType type, const wxString& name,
const wxString& content = wxEmptyString); const wxString& content = wxEmptyString);
void AddChild(wxXmlNode *child); void AddChild(wxXmlNode *child);
void InsertChild(wxXmlNode *child, wxXmlNode *before_node); void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
@@ -140,7 +145,7 @@ public:
wxXmlProperty *GetProperties() const { return m_properties; } wxXmlProperty *GetProperties() const { return m_properties; }
bool GetPropVal(const wxString& propName, wxString *value) const; bool GetPropVal(const wxString& propName, wxString *value) const;
wxString GetPropVal(const wxString& propName, wxString GetPropVal(const wxString& propName,
const wxString& defaultVal) const; const wxString& defaultVal) const;
bool HasProp(const wxString& propName) const; bool HasProp(const wxString& propName) const;
@@ -171,17 +176,17 @@ private:
// This class holds XML data/document as parsed by libxml. Note that // This class holds XML data/document as parsed by libxml. Note that
// internal representation is independant on libxml and you can use // internal representation is independant on libxml and you can use
// it without libxml (see Load/SaveBinary). // it without libxml (see Load/SaveBinary).
class WXDLLEXPORT wxXmlDocument : public wxObject class WXXMLDLLEXPORT 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, wxXmlDocument(const wxString& filename,
wxXmlIOType io_type = wxXML_IO_AUTO); wxXmlIOType io_type = wxXML_IO_AUTO);
wxXmlDocument(wxInputStream& stream, wxXmlDocument(wxInputStream& stream,
wxXmlIOType io_type = wxXML_IO_AUTO); wxXmlIOType io_type = wxXML_IO_AUTO);
~wxXmlDocument() { delete m_root; } ~wxXmlDocument() { delete m_root; }
@@ -189,16 +194,16 @@ public:
wxXmlDocument& operator=(const wxXmlDocument& doc); wxXmlDocument& operator=(const wxXmlDocument& doc);
// Parses .xml file and loads data. Returns TRUE on success, FALSE // Parses .xml file and loads data. Returns TRUE on success, FALSE
// otherwise. // otherwise.
// NOTE: Any call to this method will result into linking against libxml // NOTE: Any call to this method will result into linking against libxml
// and app's binary size will grow by ca. 250kB // and app's binary size will grow by ca. 250kB
bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO); bool Load(const wxString& filename, wxXmlIOType io_type = wxXML_IO_AUTO);
bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO); bool Load(wxInputStream& stream, wxXmlIOType io_type = wxXML_IO_AUTO);
// Saves document as .xml file. // Saves document as .xml file.
bool Save(const wxString& filename, bool Save(const wxString& filename,
wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const; wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const;
bool Save(wxOutputStream& stream, bool Save(wxOutputStream& stream,
wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const; wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const;
bool IsOk() const { return m_root != NULL; } bool IsOk() const { return m_root != NULL; }
@@ -211,7 +216,7 @@ public:
// Returns encoding of document (may be empty). // Returns encoding of document (may be empty).
// Note: this is the encoding original fail was saved in, *not* the // Note: this is the encoding original fail was saved in, *not* the
// encoding of in-memory representation! Data in wxXmlNode are always // encoding of in-memory representation! Data in wxXmlNode are always
// stored in wchar_t (in Unicode build) or UTF-8 encoded // stored in wchar_t (in Unicode build) or UTF-8 encoded
// (if wxUSE_UNICODE is 0). // (if wxUSE_UNICODE is 0).
wxString GetEncoding() const { return m_encoding; } wxString GetEncoding() const { return m_encoding; }
@@ -239,21 +244,21 @@ private:
// wxXmlIOHandler takes care of loading and/or saving XML data. // wxXmlIOHandler takes care of loading and/or saving XML data.
// see xmlio.h for available handlers // see xmlio.h for available handlers
class WXDLLEXPORT wxXmlIOHandler : public wxObject class WXXMLDLLEXPORT wxXmlIOHandler : public wxObject
{ {
public: public:
wxXmlIOHandler() {} wxXmlIOHandler() {}
virtual wxXmlIOType GetType() = 0; virtual wxXmlIOType GetType() = 0;
virtual bool CanLoad(wxInputStream& stream) = 0; virtual bool CanLoad(wxInputStream& stream) = 0;
virtual bool CanSave() = 0; virtual bool CanSave() = 0;
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) = 0; virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) = 0;
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) = 0; virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) = 0;
}; };
void wxXmlInitXmlModule();
#endif // _WX_XML_H_ #endif // _WX_XML_H_

View File

@@ -20,7 +20,7 @@
#include "wx/xml/xml.h" #include "wx/xml/xml.h"
class WXDLLEXPORT wxXmlIOHandlerExpat : public wxXmlIOHandler class WXXMLDLLEXPORT wxXmlIOHandlerExpat : public wxXmlIOHandler
{ {
public: public:
virtual wxXmlIOType GetType() { return wxXML_IO_EXPAT; } virtual wxXmlIOType GetType() { return wxXML_IO_EXPAT; }
@@ -32,7 +32,7 @@ public:
}; };
class WXDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler class WXXMLDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler
{ {
public: public:
virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; } virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; }
@@ -44,7 +44,7 @@ public:
}; };
class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler class WXXMLDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler
{ {
public: public:
wxXmlIOHandlerBin() {} wxXmlIOHandlerBin() {}
@@ -56,7 +56,7 @@ public:
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);
}; };
@@ -65,7 +65,7 @@ protected:
#if wxUSE_ZLIB #if wxUSE_ZLIB
class WXDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin class WXXMLDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin
{ {
public: public:
wxXmlIOHandlerBinZ() {} wxXmlIOHandlerBinZ() {}

View File

@@ -25,6 +25,8 @@
#include "wx/bitmap.h" #include "wx/bitmap.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/xml/xml.h"
class WXDLLEXPORT wxMenu; class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxDialog; class WXDLLEXPORT wxDialog;
@@ -33,9 +35,8 @@ class WXDLLEXPORT wxWindow;
class WXDLLEXPORT wxFrame; class WXDLLEXPORT wxFrame;
class WXDLLEXPORT wxToolBar; class WXDLLEXPORT wxToolBar;
class WXDLLEXPORT wxXmlResourceHandler; class WXXMLDLLEXPORT wxXmlResourceHandler;
#include "wx/xml/xml.h"
// These macros indicate current version of XML resources (this information is // These macros indicate current version of XML resources (this information is
// encoded in root node of XRC file as "version" property). // encoded in root node of XRC file as "version" property).
@@ -61,7 +62,7 @@ class WXDLLEXPORT wxXmlResourceHandler;
WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \ WX_XMLRES_CURRENT_VERSION_RELEASE * 256 + \
WX_XMLRES_CURRENT_VERSION_REVISION) WX_XMLRES_CURRENT_VERSION_REVISION)
class WXDLLEXPORT wxXmlResourceDataRecord class WXXMLDLLEXPORT wxXmlResourceDataRecord
{ {
public: public:
wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {} wxXmlResourceDataRecord() : Doc(NULL), Time(wxDateTime::Now()) {}
@@ -72,13 +73,19 @@ public:
wxDateTime Time; wxDateTime Time;
}; };
#ifdef WXXMLISDLL
WX_DECLARE_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords); WX_DECLARE_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
#else
WX_DECLARE_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords);
#endif
// This class holds XML resources from one or more .xml files
// This class holds XML resources from one or more .xml files
// (or derived forms, either binary or zipped -- see manual for // (or derived forms, either binary or zipped -- see manual for
// details). // details).
class WXDLLEXPORT wxXmlResource : public wxObject class WXXMLDLLEXPORT wxXmlResource : public wxObject
{ {
public: public:
// Ctor. If use_locale is TRUE, translatable strings are // Ctor. If use_locale is TRUE, translatable strings are
@@ -100,7 +107,7 @@ public:
// Initialize only specific handler (or custom handler). Convention says // Initialize only specific handler (or custom handler). Convention says
// that handler name is equal to control's name plus 'XmlHandler', e.g. // that handler name is equal to control's name plus 'XmlHandler', e.g.
// wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler // wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
// (xmlres) can create include file that contains initialization code for // (xmlres) can create include file that contains initialization code for
// all controls used within the resource. // all controls used within the resource.
void AddHandler(wxXmlResourceHandler *handler); void AddHandler(wxXmlResourceHandler *handler);
@@ -138,7 +145,7 @@ public:
// 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);
// Attaches unknown control into given panel/window/dialog: // Attaches unknown control into given panel/window/dialog:
// (unknown controls are used in conjunction with <object class="unknown">) // (unknown controls are used in conjunction with <object class="unknown">)
bool AttachUnknownControl(const wxString& name, wxWindow *control, bool AttachUnknownControl(const wxString& name, wxWindow *control,
@@ -148,14 +155,14 @@ public:
// 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);
// Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a) // Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
long GetVersion() const { return m_version; } long GetVersion() const { return m_version; }
// Compares resources version to argument. Returns -1 if resources version // Compares resources version to argument. Returns -1 if resources version
// is less than the argument, +1 if greater and 0 if they equal. // is less than the argument, +1 if greater and 0 if they equal.
int CompareVersion(int major, int minor, int release, int revision) const int CompareVersion(int major, int minor, int release, int revision) const
{ return GetVersion() - { return GetVersion() -
(major*256*256*256 + minor*256*256 + release*256 + revision); } (major*256*256*256 + minor*256*256 + release*256 + revision); }
protected: protected:
@@ -177,7 +184,7 @@ protected:
private: private:
long m_version; long m_version;
bool m_useLocale; bool m_useLocale;
wxList m_handlers; wxList m_handlers;
wxXmlResourceDataRecords m_data; wxXmlResourceDataRecords m_data;
@@ -202,7 +209,7 @@ extern wxXmlResource *wxTheXmlResource;
// EVT_MENU(XMLID("about"), MyFrame::OnAbout) // EVT_MENU(XMLID("about"), MyFrame::OnAbout)
// EVT_MENU(XMLID("new"), MyFrame::OnNew) // EVT_MENU(XMLID("new"), MyFrame::OnNew)
// EVT_MENU(XMLID("open"), MyFrame::OnOpen) // EVT_MENU(XMLID("open"), MyFrame::OnOpen)
// END_EVENT_TABLE() // END_EVENT_TABLE()
#define XMLID(str_id) \ #define XMLID(str_id) \
wxXmlResource::GetXMLID(wxT(str_id)) wxXmlResource::GetXMLID(wxT(str_id))
@@ -225,7 +232,7 @@ extern wxXmlResource *wxTheXmlResource;
#endif #endif
class WXDLLEXPORT wxXmlResourceHandler : public wxObject class WXXMLDLLEXPORT wxXmlResourceHandler : public wxObject
{ {
public: public:
wxXmlResourceHandler(); wxXmlResourceHandler();
@@ -237,7 +244,7 @@ public:
// 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 *CreateResource(wxXmlNode *node, wxObject *parent,
wxObject *instance); wxObject *instance);
// This one is called from CreateResource after variables // This one is called from CreateResource after variables
@@ -273,12 +280,12 @@ protected:
// Gets node content from wxXML_ENTITY_NODE // Gets node content from wxXML_ENTITY_NODE
// (the problem is, <tag>content<tag> is represented as // (the problem is, <tag>content<tag> is represented as
// wxXML_ENTITY_NODE name="tag", content="" // wxXML_ENTITY_NODE name="tag", content=""
// |-- wxXML_TEXT_NODE or // |-- wxXML_TEXT_NODE or
// wxXML_CDATA_SECTION_NODE name="" content="content" // wxXML_CDATA_SECTION_NODE name="" content="content"
wxString GetNodeContent(wxXmlNode *node); wxString GetNodeContent(wxXmlNode *node);
// Check to see if a param exists // Check to see if a param exists
bool HasParam(const wxString& param); bool HasParam(const wxString& param);
// Finds the node or returns NULL // Finds the node or returns NULL
wxXmlNode *GetParamNode(const wxString& param); wxXmlNode *GetParamNode(const wxString& param);
@@ -335,7 +342,7 @@ protected:
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE); void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
wxObject *CreateResFromNode(wxXmlNode *node, wxObject *CreateResFromNode(wxXmlNode *node,
wxObject *parent, wxObject *instance = NULL) wxObject *parent, wxObject *instance = NULL)
{ return m_resource->CreateResFromNode(node, parent, instance); } { return m_resource->CreateResFromNode(node, parent, instance); }
@@ -346,5 +353,6 @@ protected:
#define ADD_STYLE(style) AddStyle(wxT(#style), style) #define ADD_STYLE(style) AddStyle(wxT(#style), style)
void wxXmlInitResourceModule();
#endif // _WX_XMLRES_H_ #endif // _WX_XMLRES_H_