Merged the wxPy_newswig branch into the HEAD branch (main trunk)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
189
wxPython/contrib/xrc/_xml.i
Normal file
189
wxPython/contrib/xrc/_xml.i
Normal file
@@ -0,0 +1,189 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _xml.i
|
||||
// Purpose: SWIG interface for other wxXml classes
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 4-June-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
|
||||
// In order to provide wrappers for wxXmlResourceHandler we need to also
|
||||
// provide the classes for representing and parsing XML.
|
||||
|
||||
|
||||
// Represents XML node type.
|
||||
enum wxXmlNodeType
|
||||
{
|
||||
// note: values are synchronized with xmlElementType from libxml
|
||||
wxXML_ELEMENT_NODE,
|
||||
wxXML_ATTRIBUTE_NODE,
|
||||
wxXML_TEXT_NODE,
|
||||
wxXML_CDATA_SECTION_NODE,
|
||||
wxXML_ENTITY_REF_NODE,
|
||||
wxXML_ENTITY_NODE,
|
||||
wxXML_PI_NODE,
|
||||
wxXML_COMMENT_NODE,
|
||||
wxXML_DOCUMENT_NODE,
|
||||
wxXML_DOCUMENT_TYPE_NODE,
|
||||
wxXML_DOCUMENT_FRAG_NODE,
|
||||
wxXML_NOTATION_NODE,
|
||||
wxXML_HTML_DOCUMENT_NODE
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Represents node property(ies).
|
||||
// Example: in <img src="hello.gif" id="3"/> "src" is property with value
|
||||
// "hello.gif" and "id" is property with value "3".
|
||||
class wxXmlProperty
|
||||
{
|
||||
public:
|
||||
wxXmlProperty(const wxString& name = wxPyEmptyString,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
wxXmlProperty *next = NULL);
|
||||
|
||||
wxString GetName() const;
|
||||
wxString GetValue() const;
|
||||
wxXmlProperty *GetNext() const;
|
||||
|
||||
void SetName(const wxString& name);
|
||||
void SetValue(const wxString& value);
|
||||
void SetNext(wxXmlProperty *next);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Represents node in XML document. Node has name and may have content
|
||||
// and properties. Most common node types are wxXML_TEXT_NODE (name and props
|
||||
// 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
|
||||
// with content="hi").
|
||||
//
|
||||
// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load
|
||||
// (default is UTF-8).
|
||||
class wxXmlNode
|
||||
{
|
||||
public:
|
||||
wxXmlNode(wxXmlNode *parent = NULL,
|
||||
wxXmlNodeType type = 0,
|
||||
const wxString& name = wxPyEmptyString,
|
||||
const wxString& content = wxPyEmptyString,
|
||||
wxXmlProperty *props = NULL,
|
||||
wxXmlNode *next = NULL);
|
||||
~wxXmlNode();
|
||||
|
||||
|
||||
// user-friendly creation:
|
||||
%name(XmlNodeEasy) wxXmlNode(wxXmlNodeType type, const wxString& name,
|
||||
const wxString& content = wxPyEmptyString);
|
||||
|
||||
void AddChild(wxXmlNode *child);
|
||||
void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
|
||||
bool RemoveChild(wxXmlNode *child);
|
||||
void AddProperty(wxXmlProperty *prop);
|
||||
%name(AddPropertyName) void AddProperty(const wxString& name, const wxString& value);
|
||||
bool DeleteProperty(const wxString& name);
|
||||
|
||||
// access methods:
|
||||
wxXmlNodeType GetType() const;
|
||||
wxString GetName() const;
|
||||
wxString GetContent() const;
|
||||
|
||||
wxXmlNode *GetParent() const;
|
||||
wxXmlNode *GetNext() const;
|
||||
wxXmlNode *GetChildren() const;
|
||||
|
||||
wxXmlProperty *GetProperties() const;
|
||||
wxString GetPropVal(const wxString& propName,
|
||||
const wxString& defaultVal) const;
|
||||
bool HasProp(const wxString& propName) const;
|
||||
|
||||
void SetType(wxXmlNodeType type);
|
||||
void SetName(const wxString& name);
|
||||
void SetContent(const wxString& con);
|
||||
|
||||
void SetParent(wxXmlNode *parent);
|
||||
void SetNext(wxXmlNode *next);
|
||||
void SetChildren(wxXmlNode *child);
|
||||
|
||||
void SetProperties(wxXmlProperty *prop);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// This class holds XML data/document as parsed by XML parser.
|
||||
class wxXmlDocument : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlDocument(const wxString& filename,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(XmlDocumentFromStream) wxXmlDocument(wxInputStream& stream,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(EmptyXmlDocument) wxXmlDocument();
|
||||
|
||||
~wxXmlDocument();
|
||||
|
||||
|
||||
// Parses .xml file and loads data. Returns TRUE on success, FALSE
|
||||
// otherwise.
|
||||
bool Load(const wxString& filename,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(LoadFromStream)bool Load(wxInputStream& stream,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
|
||||
// Saves document as .xml file.
|
||||
bool Save(const wxString& filename) const;
|
||||
%name(SaveToStream)bool Save(wxOutputStream& stream) const;
|
||||
|
||||
bool IsOk() const;
|
||||
|
||||
// Returns root node of the document.
|
||||
wxXmlNode *GetRoot() const;
|
||||
|
||||
// Returns version of document (may be empty).
|
||||
wxString GetVersion() const;
|
||||
|
||||
// Returns encoding of document (may be empty).
|
||||
// Note: this is the encoding original file was saved in, *not* the
|
||||
// encoding of in-memory representation!
|
||||
wxString GetFileEncoding() const;
|
||||
|
||||
// Write-access methods:
|
||||
void SetRoot(wxXmlNode *node);
|
||||
void SetVersion(const wxString& version);
|
||||
void SetFileEncoding(const wxString& encoding);
|
||||
|
||||
// %extend {
|
||||
// // Returns encoding of in-memory representation of the document (same
|
||||
// // as passed to Load or ctor, defaults to UTF-8). NB: this is
|
||||
// // meaningless in Unicode build where data are stored as wchar_t*
|
||||
// wxString GetEncoding() {
|
||||
// %#if wxUSE_UNICODE
|
||||
// return wxPyEmptyString;
|
||||
// %#else
|
||||
// return self->GetEncoding();
|
||||
// %#endif
|
||||
// }
|
||||
// void SetEncoding(const wxString& enc) {
|
||||
// %#if wxUSE_UNICODE
|
||||
// // do nothing
|
||||
// %#else
|
||||
// self->SetEncoding(enc);
|
||||
// %#endif
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
266
wxPython/contrib/xrc/_xmlhandler.i
Normal file
266
wxPython/contrib/xrc/_xmlhandler.i
Normal file
@@ -0,0 +1,266 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _xml.i
|
||||
// Purpose: SWIG interface for other wxXml classes
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 4-June-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
|
||||
|
||||
%{ // C++ version of Python aware wxXmlResourceHandler, for the pure virtual
|
||||
// callbacks, as well as to make some protected things public so they can
|
||||
// be wrapped.
|
||||
class wxPyXmlResourceHandler : public wxXmlResourceHandler {
|
||||
public:
|
||||
wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
|
||||
//~wxPyXmlResourceHandler();
|
||||
|
||||
// Base class virtuals
|
||||
|
||||
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
|
||||
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
|
||||
|
||||
|
||||
// accessors for protected members
|
||||
|
||||
wxXmlResource* GetResource() { return m_resource; }
|
||||
wxXmlNode* GetNode() { return m_node; }
|
||||
wxString GetClass() { return m_class; }
|
||||
wxObject* GetParent() { return m_parent; }
|
||||
wxObject* GetInstance() { return m_instance; }
|
||||
wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
|
||||
wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
|
||||
|
||||
|
||||
// turn some protected methods into public via delegation
|
||||
|
||||
bool IsOfClass(wxXmlNode *node, const wxString& classname)
|
||||
{ return wxXmlResourceHandler::IsOfClass(node, classname); }
|
||||
|
||||
wxString GetNodeContent(wxXmlNode *node)
|
||||
{ return wxXmlResourceHandler::GetNodeContent(node); }
|
||||
|
||||
bool HasParam(const wxString& param)
|
||||
{ return wxXmlResourceHandler::HasParam(param); }
|
||||
|
||||
wxXmlNode *GetParamNode(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetParamNode(param); }
|
||||
|
||||
wxString GetParamValue(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetParamValue(param); }
|
||||
|
||||
void AddStyle(const wxString& name, int value)
|
||||
{ wxXmlResourceHandler::AddStyle(name, value); }
|
||||
|
||||
void AddWindowStyles()
|
||||
{ wxXmlResourceHandler::AddWindowStyles(); }
|
||||
|
||||
int GetStyle(const wxString& param = wxT("style"), int defaults = 0)
|
||||
{ return wxXmlResourceHandler::GetStyle(param, defaults); }
|
||||
|
||||
wxString GetText(const wxString& param, bool translate = TRUE)
|
||||
{ return wxXmlResourceHandler::GetText(param, translate); }
|
||||
|
||||
int GetID()
|
||||
{ return wxXmlResourceHandler::GetID(); }
|
||||
|
||||
wxString GetName()
|
||||
{ return wxXmlResourceHandler::GetName(); }
|
||||
|
||||
bool GetBool(const wxString& param, bool defaultv = FALSE)
|
||||
{ return wxXmlResourceHandler::GetBool(param, defaultv); }
|
||||
|
||||
long GetLong( const wxString& param, long defaultv = 0 )
|
||||
{ return wxXmlResourceHandler::GetLong(param, defaultv); }
|
||||
|
||||
wxColour GetColour(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetColour(param); }
|
||||
|
||||
wxSize GetSize(const wxString& param = wxT("size"))
|
||||
{ return wxXmlResourceHandler::GetSize(param); }
|
||||
|
||||
wxPoint GetPosition(const wxString& param = wxT("pos"))
|
||||
{ return wxXmlResourceHandler::GetPosition(param); }
|
||||
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0)
|
||||
{ return wxXmlResourceHandler::GetDimension(param, defaultv); }
|
||||
|
||||
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize)
|
||||
{ return wxXmlResourceHandler::GetBitmap(param, defaultArtClient, size); }
|
||||
|
||||
wxIcon GetIcon(const wxString& param = wxT("icon"),
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize)
|
||||
{ return wxXmlResourceHandler::GetIcon(param, defaultArtClient, size); }
|
||||
|
||||
wxFont GetFont(const wxString& param = wxT("font"))
|
||||
{ return wxXmlResourceHandler::GetFont(param); }
|
||||
|
||||
void SetupWindow(wxWindow *wnd)
|
||||
{ wxXmlResourceHandler::SetupWindow(wnd); }
|
||||
|
||||
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE)
|
||||
{ wxXmlResourceHandler::CreateChildren(parent, this_hnd_only); }
|
||||
|
||||
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL)
|
||||
{ wxXmlResourceHandler::CreateChildrenPrivately(parent, rootnode); }
|
||||
|
||||
wxObject *CreateResFromNode(wxXmlNode *node,
|
||||
wxObject *parent, wxObject *instance = NULL)
|
||||
{ return wxXmlResourceHandler::CreateResFromNode(node, parent, instance); }
|
||||
|
||||
wxFileSystem& GetCurFileSystem()
|
||||
{ return wxXmlResourceHandler::GetCurFileSystem(); }
|
||||
|
||||
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT__pure(wxPyXmlResourceHandler, wxXmlResourceHandler, DoCreateResource);
|
||||
IMP_PYCALLBACK_BOOL_NODE_pure(wxPyXmlResourceHandler, wxXmlResourceHandler, CanHandle);
|
||||
|
||||
%}
|
||||
|
||||
|
||||
// Now the version that will be SWIGged.
|
||||
|
||||
|
||||
%name(XmlResourceHandler) class wxPyXmlResourceHandler : public wxObject {
|
||||
public:
|
||||
%addtofunc wxPyXmlResourceHandler "self._setCallbackInfo(self, XmlResourceHandler)"
|
||||
wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
|
||||
//~wxPyXmlResourceHandler();
|
||||
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
|
||||
|
||||
// Creates an object (menu, dialog, control, ...) from an XML node.
|
||||
// Should check for validity.
|
||||
// parent is a higher-level object (usually window, dialog or panel)
|
||||
// that is often neccessary to create the resource.
|
||||
// If instance is non-NULL it should not create a new instance via 'new' but
|
||||
// should rather use this one, and call its Create method.
|
||||
wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
|
||||
wxObject *instance);
|
||||
|
||||
// Sets the parent resource.
|
||||
void SetParentResource(wxXmlResource *res);
|
||||
|
||||
|
||||
wxXmlResource* GetResource() { return m_resource; }
|
||||
wxXmlNode* GetNode() { return m_node; }
|
||||
wxString GetClass() { return m_class; }
|
||||
wxObject* GetParent() { return m_parent; }
|
||||
wxObject* GetInstance() { return m_instance; }
|
||||
wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
|
||||
wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
|
||||
|
||||
|
||||
// Returns true if the node has a property class equal to classname,
|
||||
// e.g. <object class="wxDialog">.
|
||||
bool IsOfClass(wxXmlNode *node, const wxString& classname);
|
||||
|
||||
// Gets node content from wxXML_ENTITY_NODE
|
||||
// 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);
|
||||
|
||||
// Check to see if a parameter exists.
|
||||
bool HasParam(const wxString& param);
|
||||
|
||||
// Finds the node or returns NULL.
|
||||
wxXmlNode *GetParamNode(const wxString& param);
|
||||
|
||||
// Finds the parameter value or returns the empty string.
|
||||
wxString GetParamValue(const wxString& param);
|
||||
|
||||
// Add a style flag (e.g. wxMB_DOCKABLE) to the 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 = wxPyStyleString, int defaults = 0);
|
||||
|
||||
// Gets text from param and does some conversions:
|
||||
// - 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, bool translate = TRUE);
|
||||
|
||||
// Returns the XRCID.
|
||||
int GetID();
|
||||
|
||||
// Returns the resource name.
|
||||
wxString GetName();
|
||||
|
||||
// Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE).
|
||||
bool GetBool(const wxString& param, bool defaultv = FALSE);
|
||||
|
||||
// Gets the integer value from the parameter.
|
||||
long GetLong( const wxString& param, long defaultv = 0 );
|
||||
|
||||
// Gets colour in HTML syntax (#RRGGBB).
|
||||
wxColour GetColour(const wxString& param);
|
||||
|
||||
// Gets the size (may be in dialog units).
|
||||
wxSize GetSize(const wxString& param = wxPySizeString);
|
||||
|
||||
// Gets the position (may be in dialog units).
|
||||
wxPoint GetPosition(const wxString& param = wxPyPosString);
|
||||
|
||||
// Gets a dimension (may be in dialog units).
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
|
||||
|
||||
// Gets a bitmap.
|
||||
wxBitmap GetBitmap(const wxString& param = wxPyBitmapString,
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize);
|
||||
|
||||
// Gets an icon.
|
||||
wxIcon GetIcon(const wxString& param = wxPyIconString,
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize);
|
||||
|
||||
// Gets a font.
|
||||
wxFont GetFont(const wxString& param = wxPyFontString);
|
||||
|
||||
// Sets common window options.
|
||||
void SetupWindow(wxWindow *wnd);
|
||||
|
||||
// Creates children.
|
||||
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
|
||||
|
||||
// Helper function.
|
||||
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
|
||||
|
||||
// Creates a resource from a node.
|
||||
wxObject *CreateResFromNode(wxXmlNode *node,
|
||||
wxObject *parent, wxObject *instance = NULL);
|
||||
|
||||
// helper
|
||||
wxFileSystem& GetCurFileSystem();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
204
wxPython/contrib/xrc/_xmlres.i
Normal file
204
wxPython/contrib/xrc/_xmlres.i
Normal file
@@ -0,0 +1,204 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _xmlres.i
|
||||
// Purpose: SWIG interface for wxXmlResource
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 4-June-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
|
||||
|
||||
class wxPyXmlSubclassFactory;
|
||||
|
||||
enum {
|
||||
WX_XMLRES_CURRENT_VERSION_MAJOR,
|
||||
WX_XMLRES_CURRENT_VERSION_MINOR,
|
||||
WX_XMLRES_CURRENT_VERSION_RELEASE,
|
||||
WX_XMLRES_CURRENT_VERSION_REVISION,
|
||||
};
|
||||
|
||||
|
||||
enum wxXmlResourceFlags
|
||||
{
|
||||
wxXRC_USE_LOCALE = 1,
|
||||
wxXRC_NO_SUBCLASSING = 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// This class holds XML resources from one or more .xml files
|
||||
// (or derived forms, either binary or zipped -- see manual for
|
||||
// details).
|
||||
|
||||
class wxXmlResource : public wxObject
|
||||
{
|
||||
public:
|
||||
|
||||
%addtofunc wxXmlResource(const wxString& filemask, int flags) "self.InitAllHandlers()"
|
||||
|
||||
%addtofunc wxXmlResource(int flags) "val.InitAllHandlers()"
|
||||
|
||||
// Ctors.
|
||||
// Flags: wxXRC_USE_LOCALE
|
||||
// translatable strings will be translated via _()
|
||||
// wxXRC_NO_SUBCLASSING
|
||||
// subclass property of object nodes will be ignored
|
||||
// (useful for previews in XRC editors)
|
||||
wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE);
|
||||
%name(EmptyXmlResource) wxXmlResource(int flags = wxXRC_USE_LOCALE);
|
||||
~wxXmlResource();
|
||||
|
||||
|
||||
// Loads resources from XML files that match given filemask.
|
||||
// This method understands VFS (see filesys.h).
|
||||
bool Load(const wxString& filemask);
|
||||
|
||||
%extend {
|
||||
bool LoadFromString(const wxString& data) {
|
||||
static int s_memFileIdx = 0;
|
||||
|
||||
// Check for memory FS. If not present, load the handler:
|
||||
wxMemoryFSHandler::AddFile(wxT("XRC_resource/dummy_file"),
|
||||
wxT("dummy data"));
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *f = fsys.OpenFile(wxT("memory:XRC_resource/dummy_file"));
|
||||
wxMemoryFSHandler::RemoveFile(wxT("XRC_resource/dummy_file"));
|
||||
if (f)
|
||||
delete f;
|
||||
else
|
||||
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
||||
|
||||
// Now put the resource data into the memory FS
|
||||
wxString filename(wxT("XRC_resource/data_string_"));
|
||||
filename << s_memFileIdx;
|
||||
s_memFileIdx += 1;
|
||||
wxMemoryFSHandler::AddFile(filename, data);
|
||||
|
||||
// Load the "file" into the resource object
|
||||
bool retval = self->Load(wxT("memory:") + filename );
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize handlers for all supported controls/windows.
|
||||
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(wxPyXmlResourceHandler *handler);
|
||||
|
||||
// Add a new handler at the begining of the handler list
|
||||
void InsertHandler(wxPyXmlResourceHandler *handler);
|
||||
|
||||
// Removes all handlers
|
||||
void ClearHandlers();
|
||||
|
||||
// Registers subclasses factory for use in XRC. This function is not meant
|
||||
// for public use, please see the comment above wxXmlSubclassFactory
|
||||
// definition.
|
||||
static void AddSubclassFactory(wxPyXmlSubclassFactory *factory);
|
||||
|
||||
|
||||
// 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);
|
||||
%name(LoadMenuBarOnFrame) wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
|
||||
|
||||
|
||||
// Loads toolbar
|
||||
wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
|
||||
|
||||
// Loads dialog. dlg points to parent window (if any). Second form
|
||||
// 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)
|
||||
// Example (typical usage):
|
||||
// MyDialog dlg;
|
||||
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
|
||||
// dlg->ShowModal();
|
||||
wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
|
||||
%name(LoadOnDialog)bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Loads panel. panel points to parent window (if any). Second form
|
||||
// is used to finish creation of already existing instance.
|
||||
wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
|
||||
%name(LoadOnPanel)bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Load a frame's contents from a resource
|
||||
wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
|
||||
%name(LoadOnFrame)bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Load an object from the resource specifying both the resource name and
|
||||
// the classname. This lets you load nonstandard container windows.
|
||||
wxObject *LoadObject(wxWindow *parent, const wxString& name,
|
||||
const wxString& classname);
|
||||
|
||||
// Load an object from the resource specifying both the resource name and
|
||||
// the classname. This form lets you finish the creation of an existing
|
||||
// instance.
|
||||
%name(LoadOnObject)bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name,
|
||||
const wxString& classname);
|
||||
|
||||
// Loads a bitmap resource from a file.
|
||||
wxBitmap LoadBitmap(const wxString& name);
|
||||
|
||||
// Loads an icon resource from a file.
|
||||
wxIcon LoadIcon(const wxString& name);
|
||||
|
||||
// Attaches unknown control into given panel/window/dialog:
|
||||
// (unknown controls are used in conjunction with <object class="unknown">)
|
||||
bool AttachUnknownControl(const wxString& name, wxWindow *control,
|
||||
wxWindow *parent = NULL);
|
||||
|
||||
// Returns numeric ID that is equivalent to string id used in XML
|
||||
// resource. To be used in event tables
|
||||
// Macro XMLID is provided for convenience
|
||||
static int GetXRCID(const wxString& str_id);
|
||||
|
||||
// Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
|
||||
long GetVersion() const;
|
||||
|
||||
// Compares resources version to argument. Returns -1 if resources version
|
||||
// is less than the argument, +1 if greater and 0 if they equal.
|
||||
int CompareVersion(int major, int minor, int release, int revision) const;
|
||||
|
||||
|
||||
// Gets global resources object or create one if none exists
|
||||
static wxXmlResource *Get();
|
||||
// Sets global resources object and returns pointer to previous one (may be NULL).
|
||||
static wxXmlResource *Set(wxXmlResource *res);
|
||||
|
||||
// Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
|
||||
int GetFlags();
|
||||
|
||||
// Set flags after construction.
|
||||
void SetFlags(int flags) { m_flags = flags; }
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%pythoncode {
|
||||
def XRCID(str_id):
|
||||
return wxXmlResource_GetXRCID(str_id)
|
||||
|
||||
def XRCCTRL(window, str_id, *ignoreargs):
|
||||
return window.FindWindowById(XRCID(str_id))
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
44
wxPython/contrib/xrc/_xmlsub.i
Normal file
44
wxPython/contrib/xrc/_xmlsub.i
Normal file
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _xmlres.i
|
||||
// Purpose: SWIG interface for wxXmlSubclassFactory
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 4-June-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
|
||||
|
||||
%{
|
||||
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
|
||||
{
|
||||
public:
|
||||
wxPyXmlSubclassFactory() {}
|
||||
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
|
||||
%}
|
||||
|
||||
|
||||
|
||||
%name(XmlSubclassFactory)class wxPyXmlSubclassFactory {
|
||||
public:
|
||||
%addtofunc wxPyXmlSubclassFactory "self._setCallbackInfo(self, XmlSubclassFactory)"
|
||||
wxPyXmlSubclassFactory();
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
@@ -1,14 +1,11 @@
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# The global was removed in favor of static accessor functions. This is for
|
||||
# backwards compatibility:
|
||||
wxTheXmlResource = wxXmlResource_Get()
|
||||
|
||||
wx.wxXmlNodePtr = wxXmlNodePtr
|
||||
TheXmlResource = XmlResource_Get()
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
# Create a factory for handling the subclass property of the object tag.
|
||||
|
||||
|
||||
@@ -20,9 +17,9 @@ def _my_import(name):
|
||||
return mod
|
||||
|
||||
|
||||
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
class XmlSubclassFactory_Python(XmlSubclassFactory):
|
||||
def __init__(self):
|
||||
wxXmlSubclassFactory.__init__(self)
|
||||
XmlSubclassFactory.__init__(self)
|
||||
|
||||
def Create(self, className):
|
||||
assert className.find('.') != -1, "Module name must be specified!"
|
||||
@@ -34,5 +31,6 @@ class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
return inst
|
||||
|
||||
|
||||
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
|
||||
XmlResource_AddSubclassFactory(XmlSubclassFactory_Python())
|
||||
|
||||
#----------------------------------------------------------------------------
|
26
wxPython/contrib/xrc/_xrc_rename.i
Normal file
26
wxPython/contrib/xrc/_xrc_rename.i
Normal file
@@ -0,0 +1,26 @@
|
||||
// A bunch of %rename directives generated by ./distrib/build_renamers.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef SWIGXML
|
||||
|
||||
%rename(XRC_USE_LOCALE) wxXRC_USE_LOCALE;
|
||||
%rename(XRC_NO_SUBCLASSING) wxXRC_NO_SUBCLASSING;
|
||||
%rename(XmlResource) wxXmlResource;
|
||||
%rename(XML_ELEMENT_NODE) wxXML_ELEMENT_NODE;
|
||||
%rename(XML_ATTRIBUTE_NODE) wxXML_ATTRIBUTE_NODE;
|
||||
%rename(XML_TEXT_NODE) wxXML_TEXT_NODE;
|
||||
%rename(XML_CDATA_SECTION_NODE) wxXML_CDATA_SECTION_NODE;
|
||||
%rename(XML_ENTITY_REF_NODE) wxXML_ENTITY_REF_NODE;
|
||||
%rename(XML_ENTITY_NODE) wxXML_ENTITY_NODE;
|
||||
%rename(XML_PI_NODE) wxXML_PI_NODE;
|
||||
%rename(XML_COMMENT_NODE) wxXML_COMMENT_NODE;
|
||||
%rename(XML_DOCUMENT_NODE) wxXML_DOCUMENT_NODE;
|
||||
%rename(XML_DOCUMENT_TYPE_NODE) wxXML_DOCUMENT_TYPE_NODE;
|
||||
%rename(XML_DOCUMENT_FRAG_NODE) wxXML_DOCUMENT_FRAG_NODE;
|
||||
%rename(XML_NOTATION_NODE) wxXML_NOTATION_NODE;
|
||||
%rename(XML_HTML_DOCUMENT_NODE) wxXML_HTML_DOCUMENT_NODE;
|
||||
%rename(XmlProperty) wxXmlProperty;
|
||||
%rename(XmlNode) wxXmlNode;
|
||||
%rename(XmlDocument) wxXmlDocument;
|
||||
|
||||
#endif
|
6
wxPython/contrib/xrc/_xrc_reverse.txt
Normal file
6
wxPython/contrib/xrc/_xrc_reverse.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# Other names that need to be reverse-renamed for the old namespace
|
||||
|
||||
XRCID = wx.xrc.XRCID
|
||||
XRCCTRL = wx.xrc.XRCCTRL
|
||||
|
||||
TheXmlResource
|
File diff suppressed because it is too large
Load Diff
@@ -14,31 +14,13 @@
|
||||
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#include "pyistream.h"
|
||||
#include "wx/xml/xml.h"
|
||||
#include "wx/xrc/xmlres.h"
|
||||
#include <wx/filesys.h>
|
||||
#include <wx/fs_mem.h>
|
||||
%}
|
||||
#include "wx/wxPython/wxPython.h"
|
||||
#include "wx/wxPython/pyclasses.h"
|
||||
#include "wx/wxPython/pyistream.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#include <wx/xml/xml.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern _defs.i
|
||||
%extern events.i
|
||||
%extern controls.i
|
||||
|
||||
%extern streams.i
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%{
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
static const wxString wxPyUTF8String(wxT("UTF-8"));
|
||||
static const wxString wxPyStyleString(wxT("style"));
|
||||
@@ -49,631 +31,23 @@
|
||||
static const wxString wxPyFontString(wxT("font"));
|
||||
%}
|
||||
|
||||
class wxPyXmlSubclassFactory;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum wxXmlResourceFlags
|
||||
{
|
||||
wxXRC_USE_LOCALE = 1,
|
||||
wxXRC_NO_SUBCLASSING = 2
|
||||
};
|
||||
%import core.i
|
||||
%pythoncode { wx = core }
|
||||
|
||||
%include _xrc_rename.i
|
||||
|
||||
// This class holds XML resources from one or more .xml files
|
||||
// (or derived forms, either binary or zipped -- see manual for
|
||||
// details).
|
||||
|
||||
class wxXmlResource : public wxObject
|
||||
{
|
||||
public:
|
||||
// Ctors.
|
||||
// Flags: wxXRC_USE_LOCALE
|
||||
// translatable strings will be translated via _()
|
||||
// wxXRC_NO_SUBCLASSING
|
||||
// subclass property of object nodes will be ignored
|
||||
// (useful for previews in XRC editors)
|
||||
wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE);
|
||||
%name(wxEmptyXmlResource) wxXmlResource(int flags = wxXRC_USE_LOCALE);
|
||||
%pragma(python) addtomethod = "__init__:self.InitAllHandlers()"
|
||||
%pragma(python) addtomethod = "wxEmptyXmlResource:val.InitAllHandlers()"
|
||||
// Include all the files that make up this module
|
||||
%include _xmlres.i
|
||||
%include _xmlsub.i
|
||||
%include _xml.i
|
||||
%include _xmlhandler.i
|
||||
|
||||
~wxXmlResource();
|
||||
|
||||
|
||||
// Loads resources from XML files that match given filemask.
|
||||
// This method understands VFS (see filesys.h).
|
||||
bool Load(const wxString& filemask);
|
||||
|
||||
%addmethods {
|
||||
bool LoadFromString(const wxString& data) {
|
||||
static int s_memFileIdx = 0;
|
||||
|
||||
// Check for memory FS. If not present, load the handler:
|
||||
wxMemoryFSHandler::AddFile(wxT("XRC_resource/dummy_file"),
|
||||
wxT("dummy data"));
|
||||
wxFileSystem fsys;
|
||||
wxFSFile *f = fsys.OpenFile(wxT("memory:XRC_resource/dummy_file"));
|
||||
wxMemoryFSHandler::RemoveFile(wxT("XRC_resource/dummy_file"));
|
||||
if (f)
|
||||
delete f;
|
||||
else
|
||||
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
||||
|
||||
// Now put the resource data into the memory FS
|
||||
wxString filename(wxT("XRC_resource/data_string_"));
|
||||
filename << s_memFileIdx;
|
||||
s_memFileIdx += 1;
|
||||
wxMemoryFSHandler::AddFile(filename, data);
|
||||
|
||||
// Load the "file" into the resource object
|
||||
bool retval = self->Load(wxT("memory:") + filename );
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
// 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(wxPyXmlResourceHandler *handler);
|
||||
|
||||
// Add a new handler at the begining of the handler list
|
||||
void InsertHandler(wxPyXmlResourceHandler *handler);
|
||||
|
||||
// Removes all handlers
|
||||
void ClearHandlers();
|
||||
|
||||
// Registers subclasses factory for use in XRC. This function is not meant
|
||||
// for public use, please see the comment above wxXmlSubclassFactory
|
||||
// definition.
|
||||
static void AddSubclassFactory(wxPyXmlSubclassFactory *factory);
|
||||
|
||||
|
||||
// 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);
|
||||
%name(LoadMenuBarOnFrame) wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
|
||||
|
||||
|
||||
// Loads toolbar
|
||||
wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
|
||||
|
||||
// Loads dialog. dlg points to parent window (if any). Second form
|
||||
// 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)
|
||||
// Example (typical usage):
|
||||
// MyDialog dlg;
|
||||
// wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
|
||||
// dlg->ShowModal();
|
||||
wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
|
||||
%name(LoadOnDialog)bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Loads panel. panel points to parent window (if any). Second form
|
||||
// is used to finish creation of already existing instance.
|
||||
wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
|
||||
%name(LoadOnPanel)bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Load a frame's contents from a resource
|
||||
wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
|
||||
%name(LoadOnFrame)bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
|
||||
|
||||
// Load an object from the resource specifying both the resource name and
|
||||
// the classname. This lets you load nonstandard container windows.
|
||||
wxObject *LoadObject(wxWindow *parent, const wxString& name,
|
||||
const wxString& classname);
|
||||
|
||||
// Load an object from the resource specifying both the resource name and
|
||||
// the classname. This form lets you finish the creation of an existing
|
||||
// instance.
|
||||
%name(LoadOnObject)bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name,
|
||||
const wxString& classname);
|
||||
|
||||
// Loads bitmap or icon resource from file:
|
||||
wxBitmap LoadBitmap(const wxString& name);
|
||||
wxIcon LoadIcon(const wxString& name);
|
||||
|
||||
// Attaches unknown control into given panel/window/dialog:
|
||||
// (unknown controls are used in conjunction with <object class="unknown">)
|
||||
bool AttachUnknownControl(const wxString& name, wxWindow *control,
|
||||
wxWindow *parent = NULL);
|
||||
|
||||
// Returns numeric ID that is equivalent to string id used in XML
|
||||
// resource. To be used in event tables
|
||||
// Macro XMLID is provided for convenience
|
||||
static int GetXRCID(const wxString& str_id);
|
||||
|
||||
// Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
|
||||
long GetVersion() const;
|
||||
|
||||
// Compares resources version to argument. Returns -1 if resources version
|
||||
// is less than the argument, +1 if greater and 0 if they equal.
|
||||
int CompareVersion(int major, int minor, int release, int revision) const;
|
||||
|
||||
|
||||
// Gets global resources object or create one if none exists
|
||||
static wxXmlResource *Get();
|
||||
// Sets global resources object and returns pointer to previous one (may be NULL).
|
||||
static wxXmlResource *Set(wxXmlResource *res);
|
||||
|
||||
// Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
|
||||
int GetFlags();
|
||||
|
||||
// Set flags after construction.
|
||||
void SetFlags(int flags) { m_flags = flags; }
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%pragma(python) code = "
|
||||
def XRCID(str_id):
|
||||
return wxXmlResource_GetXRCID(str_id)
|
||||
|
||||
def XRCCTRL(window, str_id, *ignoreargs):
|
||||
return window.FindWindowById(XRCID(str_id))
|
||||
|
||||
XMLID = XRCID
|
||||
XMLCTRL = XRCCTRL
|
||||
"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// wxXmlSubclassFactory
|
||||
|
||||
|
||||
%{
|
||||
class wxPyXmlSubclassFactory : public wxXmlSubclassFactory
|
||||
{
|
||||
public:
|
||||
wxPyXmlSubclassFactory() {}
|
||||
DEC_PYCALLBACK_OBJECT_STRING_pure(Create);
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT_STRING_pure(wxPyXmlSubclassFactory, wxXmlSubclassFactory, Create);
|
||||
%}
|
||||
|
||||
|
||||
%name(wxXmlSubclassFactory)class wxPyXmlSubclassFactory {
|
||||
public:
|
||||
wxPyXmlSubclassFactory();
|
||||
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlSubclassFactory)"
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// In order to provide wrappers for wxXmlResourceHandler we need to also
|
||||
// provide the classes for representing and parsing XML.
|
||||
|
||||
|
||||
// Represents XML node type.
|
||||
enum wxXmlNodeType
|
||||
{
|
||||
// note: values are synchronized with xmlElementType from libxml
|
||||
wxXML_ELEMENT_NODE,
|
||||
wxXML_ATTRIBUTE_NODE,
|
||||
wxXML_TEXT_NODE,
|
||||
wxXML_CDATA_SECTION_NODE,
|
||||
wxXML_ENTITY_REF_NODE,
|
||||
wxXML_ENTITY_NODE,
|
||||
wxXML_PI_NODE,
|
||||
wxXML_COMMENT_NODE,
|
||||
wxXML_DOCUMENT_NODE,
|
||||
wxXML_DOCUMENT_TYPE_NODE,
|
||||
wxXML_DOCUMENT_FRAG_NODE,
|
||||
wxXML_NOTATION_NODE,
|
||||
wxXML_HTML_DOCUMENT_NODE
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Represents node property(ies).
|
||||
// Example: in <img src="hello.gif" id="3"/> "src" is property with value
|
||||
// "hello.gif" and "id" is property with value "3".
|
||||
class wxXmlProperty
|
||||
{
|
||||
public:
|
||||
wxXmlProperty(const wxString& name = wxPyEmptyString,
|
||||
const wxString& value = wxPyEmptyString,
|
||||
wxXmlProperty *next = NULL);
|
||||
|
||||
wxString GetName() const;
|
||||
wxString GetValue() const;
|
||||
wxXmlProperty *GetNext() const;
|
||||
|
||||
void SetName(const wxString& name);
|
||||
void SetValue(const wxString& value);
|
||||
void SetNext(wxXmlProperty *next);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Represents node in XML document. Node has name and may have content
|
||||
// and properties. Most common node types are wxXML_TEXT_NODE (name and props
|
||||
// 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
|
||||
// with content="hi").
|
||||
//
|
||||
// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load
|
||||
// (default is UTF-8).
|
||||
class wxXmlNode
|
||||
{
|
||||
public:
|
||||
wxXmlNode(wxXmlNode *parent = NULL,
|
||||
wxXmlNodeType type = 0,
|
||||
const wxString& name = wxPyEmptyString,
|
||||
const wxString& content = wxPyEmptyString,
|
||||
wxXmlProperty *props = NULL,
|
||||
wxXmlNode *next = NULL);
|
||||
~wxXmlNode();
|
||||
|
||||
|
||||
// user-friendly creation:
|
||||
%name(wxXmlNodeEasy)wxXmlNode(wxXmlNodeType type, const wxString& name,
|
||||
const wxString& content = wxPyEmptyString);
|
||||
|
||||
void AddChild(wxXmlNode *child);
|
||||
void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
|
||||
bool RemoveChild(wxXmlNode *child);
|
||||
void AddProperty(wxXmlProperty *prop);
|
||||
%name(AddPropertyName)void AddProperty(const wxString& name, const wxString& value);
|
||||
bool DeleteProperty(const wxString& name);
|
||||
|
||||
// access methods:
|
||||
wxXmlNodeType GetType() const;
|
||||
wxString GetName() const;
|
||||
wxString GetContent() const;
|
||||
|
||||
wxXmlNode *GetParent() const;
|
||||
wxXmlNode *GetNext() const;
|
||||
wxXmlNode *GetChildren() const;
|
||||
|
||||
wxXmlProperty *GetProperties() const;
|
||||
wxString GetPropVal(const wxString& propName,
|
||||
const wxString& defaultVal) const;
|
||||
bool HasProp(const wxString& propName) const;
|
||||
|
||||
void SetType(wxXmlNodeType type);
|
||||
void SetName(const wxString& name);
|
||||
void SetContent(const wxString& con);
|
||||
|
||||
void SetParent(wxXmlNode *parent);
|
||||
void SetNext(wxXmlNode *next);
|
||||
void SetChildren(wxXmlNode *child);
|
||||
|
||||
void SetProperties(wxXmlProperty *prop);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// This class holds XML data/document as parsed by XML parser.
|
||||
class wxXmlDocument : public wxObject
|
||||
{
|
||||
public:
|
||||
wxXmlDocument(const wxString& filename,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(wxXmlDocumentFromStream)wxXmlDocument(wxInputStream& stream,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(wxEmptyXmlDocument)wxXmlDocument();
|
||||
|
||||
~wxXmlDocument();
|
||||
|
||||
|
||||
// Parses .xml file and loads data. Returns TRUE on success, FALSE
|
||||
// otherwise.
|
||||
bool Load(const wxString& filename,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
%name(LoadFromStream)bool Load(wxInputStream& stream,
|
||||
const wxString& encoding = wxPyUTF8String);
|
||||
|
||||
// Saves document as .xml file.
|
||||
bool Save(const wxString& filename) const;
|
||||
%name(SaveToStream)bool Save(wxOutputStream& stream) const;
|
||||
|
||||
bool IsOk() const;
|
||||
|
||||
// Returns root node of the document.
|
||||
wxXmlNode *GetRoot() const;
|
||||
|
||||
// Returns version of document (may be empty).
|
||||
wxString GetVersion() const;
|
||||
|
||||
// Returns encoding of document (may be empty).
|
||||
// Note: this is the encoding original file was saved in, *not* the
|
||||
// encoding of in-memory representation!
|
||||
wxString GetFileEncoding() const;
|
||||
|
||||
// Write-access methods:
|
||||
void SetRoot(wxXmlNode *node);
|
||||
void SetVersion(const wxString& version);
|
||||
void SetFileEncoding(const wxString& encoding);
|
||||
|
||||
%addmethods {
|
||||
// Returns encoding of in-memory representation of the document (same
|
||||
// as passed to Load or ctor, defaults to UTF-8). NB: this is
|
||||
// meaningless in Unicode build where data are stored as wchar_t*
|
||||
wxString GetEncoding() {
|
||||
#if wxUSE_UNICODE
|
||||
return wxPyEmptyString;
|
||||
#else
|
||||
return self->GetEncoding();
|
||||
#endif
|
||||
}
|
||||
void SetEncoding(const wxString& enc) {
|
||||
#if wxUSE_UNICODE
|
||||
// do nothing
|
||||
#else
|
||||
self->SetEncoding(enc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// And now for wxXmlResourceHandler...
|
||||
|
||||
|
||||
|
||||
%{ // C++ version of Python aware wxXmlResourceHandler, for the pure virtual
|
||||
// callbacks, as well as to make some protected things public so they can
|
||||
// be wrapped.
|
||||
class wxPyXmlResourceHandler : public wxXmlResourceHandler {
|
||||
public:
|
||||
wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
|
||||
//~wxPyXmlResourceHandler();
|
||||
|
||||
// Base class virtuals
|
||||
|
||||
DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
|
||||
DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
|
||||
|
||||
|
||||
// accessors for protected members
|
||||
|
||||
wxXmlResource* GetResource() { return m_resource; }
|
||||
wxXmlNode* GetNode() { return m_node; }
|
||||
wxString GetClass() { return m_class; }
|
||||
wxObject* GetParent() { return m_parent; }
|
||||
wxObject* GetInstance() { return m_instance; }
|
||||
wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
|
||||
wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
|
||||
|
||||
|
||||
// turn some protected methods into public via delegation
|
||||
|
||||
bool IsOfClass(wxXmlNode *node, const wxString& classname)
|
||||
{ return wxXmlResourceHandler::IsOfClass(node, classname); }
|
||||
|
||||
wxString GetNodeContent(wxXmlNode *node)
|
||||
{ return wxXmlResourceHandler::GetNodeContent(node); }
|
||||
|
||||
bool HasParam(const wxString& param)
|
||||
{ return wxXmlResourceHandler::HasParam(param); }
|
||||
|
||||
wxXmlNode *GetParamNode(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetParamNode(param); }
|
||||
|
||||
wxString GetParamValue(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetParamValue(param); }
|
||||
|
||||
void AddStyle(const wxString& name, int value)
|
||||
{ wxXmlResourceHandler::AddStyle(name, value); }
|
||||
|
||||
void AddWindowStyles()
|
||||
{ wxXmlResourceHandler::AddWindowStyles(); }
|
||||
|
||||
int GetStyle(const wxString& param = wxT("style"), int defaults = 0)
|
||||
{ return wxXmlResourceHandler::GetStyle(param, defaults); }
|
||||
|
||||
wxString GetText(const wxString& param, bool translate = TRUE)
|
||||
{ return wxXmlResourceHandler::GetText(param, translate); }
|
||||
|
||||
int GetID()
|
||||
{ return wxXmlResourceHandler::GetID(); }
|
||||
|
||||
wxString GetName()
|
||||
{ return wxXmlResourceHandler::GetName(); }
|
||||
|
||||
bool GetBool(const wxString& param, bool defaultv = FALSE)
|
||||
{ return wxXmlResourceHandler::GetBool(param, defaultv); }
|
||||
|
||||
long GetLong( const wxString& param, long defaultv = 0 )
|
||||
{ return wxXmlResourceHandler::GetLong(param, defaultv); }
|
||||
|
||||
wxColour GetColour(const wxString& param)
|
||||
{ return wxXmlResourceHandler::GetColour(param); }
|
||||
|
||||
wxSize GetSize(const wxString& param = wxT("size"))
|
||||
{ return wxXmlResourceHandler::GetSize(param); }
|
||||
|
||||
wxPoint GetPosition(const wxString& param = wxT("pos"))
|
||||
{ return wxXmlResourceHandler::GetPosition(param); }
|
||||
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0)
|
||||
{ return wxXmlResourceHandler::GetDimension(param, defaultv); }
|
||||
|
||||
wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize)
|
||||
{ return wxXmlResourceHandler::GetBitmap(param, defaultArtClient, size); }
|
||||
|
||||
wxIcon GetIcon(const wxString& param = wxT("icon"),
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize)
|
||||
{ return wxXmlResourceHandler::GetIcon(param, defaultArtClient, size); }
|
||||
|
||||
wxFont GetFont(const wxString& param = wxT("font"))
|
||||
{ return wxXmlResourceHandler::GetFont(param); }
|
||||
|
||||
void SetupWindow(wxWindow *wnd)
|
||||
{ wxXmlResourceHandler::SetupWindow(wnd); }
|
||||
|
||||
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE)
|
||||
{ wxXmlResourceHandler::CreateChildren(parent, this_hnd_only); }
|
||||
|
||||
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL)
|
||||
{ wxXmlResourceHandler::CreateChildrenPrivately(parent, rootnode); }
|
||||
|
||||
wxObject *CreateResFromNode(wxXmlNode *node,
|
||||
wxObject *parent, wxObject *instance = NULL)
|
||||
{ return wxXmlResourceHandler::CreateResFromNode(node, parent, instance); }
|
||||
|
||||
wxFileSystem& GetCurFileSystem()
|
||||
{ return wxXmlResourceHandler::GetCurFileSystem(); }
|
||||
|
||||
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
IMP_PYCALLBACK_OBJECT__pure(wxPyXmlResourceHandler, wxXmlResourceHandler, DoCreateResource);
|
||||
IMP_PYCALLBACK_BOOL_NODE_pure(wxPyXmlResourceHandler, wxXmlResourceHandler, CanHandle);
|
||||
|
||||
%}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Now the version that will be SWIGged.
|
||||
|
||||
|
||||
%name(wxXmlResourceHandler) class wxPyXmlResourceHandler : public wxObject {
|
||||
public:
|
||||
wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
|
||||
//~wxPyXmlResourceHandler();
|
||||
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlResourceHandler)"
|
||||
|
||||
|
||||
|
||||
// Creates an object (menu, dialog, control, ...) from an XML node.
|
||||
// Should check for validity.
|
||||
// parent is a higher-level object (usually window, dialog or panel)
|
||||
// that is often neccessary to create the resource.
|
||||
// If instance is non-NULL it should not create a new instance via 'new' but
|
||||
// should rather use this one, and call its Create method.
|
||||
wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
|
||||
wxObject *instance);
|
||||
|
||||
// Sets the parent resource.
|
||||
void SetParentResource(wxXmlResource *res);
|
||||
|
||||
|
||||
wxXmlResource* GetResource() { return m_resource; }
|
||||
wxXmlNode* GetNode() { return m_node; }
|
||||
wxString GetClass() { return m_class; }
|
||||
wxObject* GetParent() { return m_parent; }
|
||||
wxObject* GetInstance() { return m_instance; }
|
||||
wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
|
||||
wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
|
||||
|
||||
|
||||
// Returns true if the node has a property class equal to classname,
|
||||
// e.g. <object class="wxDialog">.
|
||||
bool IsOfClass(wxXmlNode *node, const wxString& classname);
|
||||
|
||||
// Gets node content from wxXML_ENTITY_NODE
|
||||
// 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);
|
||||
|
||||
// Check to see if a parameter exists.
|
||||
bool HasParam(const wxString& param);
|
||||
|
||||
// Finds the node or returns NULL.
|
||||
wxXmlNode *GetParamNode(const wxString& param);
|
||||
|
||||
// Finds the parameter value or returns the empty string.
|
||||
wxString GetParamValue(const wxString& param);
|
||||
|
||||
// Add a style flag (e.g. wxMB_DOCKABLE) to the 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 = wxPyStyleString, int defaults = 0);
|
||||
|
||||
// Gets text from param and does some conversions:
|
||||
// - 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, bool translate = TRUE);
|
||||
|
||||
// Returns the XRCID.
|
||||
int GetID();
|
||||
|
||||
// Returns the resource name.
|
||||
wxString GetName();
|
||||
|
||||
// Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE).
|
||||
bool GetBool(const wxString& param, bool defaultv = FALSE);
|
||||
|
||||
// Gets the integer value from the parameter.
|
||||
long GetLong( const wxString& param, long defaultv = 0 );
|
||||
|
||||
// Gets colour in HTML syntax (#RRGGBB).
|
||||
wxColour GetColour(const wxString& param);
|
||||
|
||||
// Gets the size (may be in dialog units).
|
||||
wxSize GetSize(const wxString& param = wxPySizeString);
|
||||
|
||||
// Gets the position (may be in dialog units).
|
||||
wxPoint GetPosition(const wxString& param = wxPyPosString);
|
||||
|
||||
// Gets a dimension (may be in dialog units).
|
||||
wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
|
||||
|
||||
// Gets a bitmap.
|
||||
wxBitmap GetBitmap(const wxString& param = wxPyBitmapString,
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize);
|
||||
|
||||
// Gets an icon.
|
||||
wxIcon GetIcon(const wxString& param = wxPyIconString,
|
||||
const wxArtClient& defaultArtClient = wxART_OTHER,
|
||||
wxSize size = wxDefaultSize);
|
||||
|
||||
// Gets a font.
|
||||
wxFont GetFont(const wxString& param = wxPyFontString);
|
||||
|
||||
// Sets common window options.
|
||||
void SetupWindow(wxWindow *wnd);
|
||||
|
||||
// Creates children.
|
||||
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
|
||||
|
||||
// Helper function.
|
||||
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
|
||||
|
||||
// Creates a resource from a node.
|
||||
wxObject *CreateResFromNode(wxXmlNode *node,
|
||||
wxObject *parent, wxObject *instance = NULL);
|
||||
|
||||
// helper
|
||||
wxFileSystem& GetCurFileSystem();
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
@@ -682,10 +56,8 @@ public:
|
||||
|
||||
%}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// This file gets appended to the shadow class file.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%pragma(python) include="_xrcextras.py";
|
||||
%pythoncode "_xrc_ex.py";
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@@ -1,47 +1,81 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import xrcc
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
from misc import *
|
||||
import _xrc
|
||||
|
||||
from misc2 import *
|
||||
import core
|
||||
wx = core
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
from windows import *
|
||||
WX_XMLRES_CURRENT_VERSION_MAJOR = _xrc.WX_XMLRES_CURRENT_VERSION_MAJOR
|
||||
WX_XMLRES_CURRENT_VERSION_MINOR = _xrc.WX_XMLRES_CURRENT_VERSION_MINOR
|
||||
WX_XMLRES_CURRENT_VERSION_RELEASE = _xrc.WX_XMLRES_CURRENT_VERSION_RELEASE
|
||||
WX_XMLRES_CURRENT_VERSION_REVISION = _xrc.WX_XMLRES_CURRENT_VERSION_REVISION
|
||||
XRC_USE_LOCALE = _xrc.XRC_USE_LOCALE
|
||||
XRC_NO_SUBCLASSING = _xrc.XRC_NO_SUBCLASSING
|
||||
class XmlResource(core.Object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlResource(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self.InitAllHandlers()
|
||||
def __del__(self, destroy=_xrc.delete_XmlResource):
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
def Load(*args, **kwargs): return _xrc.XmlResource_Load(*args, **kwargs)
|
||||
def LoadFromString(*args, **kwargs): return _xrc.XmlResource_LoadFromString(*args, **kwargs)
|
||||
def InitAllHandlers(*args, **kwargs): return _xrc.XmlResource_InitAllHandlers(*args, **kwargs)
|
||||
def AddHandler(*args, **kwargs): return _xrc.XmlResource_AddHandler(*args, **kwargs)
|
||||
def InsertHandler(*args, **kwargs): return _xrc.XmlResource_InsertHandler(*args, **kwargs)
|
||||
def ClearHandlers(*args, **kwargs): return _xrc.XmlResource_ClearHandlers(*args, **kwargs)
|
||||
AddSubclassFactory = staticmethod(_xrc.XmlResource_AddSubclassFactory)
|
||||
def LoadMenu(*args, **kwargs): return _xrc.XmlResource_LoadMenu(*args, **kwargs)
|
||||
def LoadMenuBar(*args, **kwargs): return _xrc.XmlResource_LoadMenuBar(*args, **kwargs)
|
||||
def LoadMenuBarOnFrame(*args, **kwargs): return _xrc.XmlResource_LoadMenuBarOnFrame(*args, **kwargs)
|
||||
def LoadToolBar(*args, **kwargs): return _xrc.XmlResource_LoadToolBar(*args, **kwargs)
|
||||
def LoadDialog(*args, **kwargs): return _xrc.XmlResource_LoadDialog(*args, **kwargs)
|
||||
def LoadOnDialog(*args, **kwargs): return _xrc.XmlResource_LoadOnDialog(*args, **kwargs)
|
||||
def LoadPanel(*args, **kwargs): return _xrc.XmlResource_LoadPanel(*args, **kwargs)
|
||||
def LoadOnPanel(*args, **kwargs): return _xrc.XmlResource_LoadOnPanel(*args, **kwargs)
|
||||
def LoadFrame(*args, **kwargs): return _xrc.XmlResource_LoadFrame(*args, **kwargs)
|
||||
def LoadOnFrame(*args, **kwargs): return _xrc.XmlResource_LoadOnFrame(*args, **kwargs)
|
||||
def LoadObject(*args, **kwargs): return _xrc.XmlResource_LoadObject(*args, **kwargs)
|
||||
def LoadOnObject(*args, **kwargs): return _xrc.XmlResource_LoadOnObject(*args, **kwargs)
|
||||
def LoadBitmap(*args, **kwargs): return _xrc.XmlResource_LoadBitmap(*args, **kwargs)
|
||||
def LoadIcon(*args, **kwargs): return _xrc.XmlResource_LoadIcon(*args, **kwargs)
|
||||
def AttachUnknownControl(*args, **kwargs): return _xrc.XmlResource_AttachUnknownControl(*args, **kwargs)
|
||||
GetXRCID = staticmethod(_xrc.XmlResource_GetXRCID)
|
||||
def GetVersion(*args, **kwargs): return _xrc.XmlResource_GetVersion(*args, **kwargs)
|
||||
def CompareVersion(*args, **kwargs): return _xrc.XmlResource_CompareVersion(*args, **kwargs)
|
||||
Get = staticmethod(_xrc.XmlResource_Get)
|
||||
Set = staticmethod(_xrc.XmlResource_Set)
|
||||
def GetFlags(*args, **kwargs): return _xrc.XmlResource_GetFlags(*args, **kwargs)
|
||||
def SetFlags(*args, **kwargs): return _xrc.XmlResource_SetFlags(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxXmlResource instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
from gdi import *
|
||||
class XmlResourcePtr(XmlResource):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlResource
|
||||
_xrc.XmlResource_swigregister(XmlResourcePtr)
|
||||
|
||||
from fonts import *
|
||||
def EmptyXmlResource(*args, **kwargs):
|
||||
val = _xrc.new_EmptyXmlResource(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
val.InitAllHandlers()
|
||||
return val
|
||||
|
||||
from clip_dnd import *
|
||||
XmlResource_AddSubclassFactory = _xrc.XmlResource_AddSubclassFactory
|
||||
|
||||
from events import *
|
||||
XmlResource_GetXRCID = _xrc.XmlResource_GetXRCID
|
||||
|
||||
from streams import *
|
||||
XmlResource_Get = _xrc.XmlResource_Get
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
XmlResource_Set = _xrc.XmlResource_Set
|
||||
|
||||
def XRCID(str_id):
|
||||
return wxXmlResource_GetXRCID(str_id)
|
||||
@@ -49,512 +83,213 @@ def XRCID(str_id):
|
||||
def XRCCTRL(window, str_id, *ignoreargs):
|
||||
return window.FindWindowById(XRCID(str_id))
|
||||
|
||||
XMLID = XRCID
|
||||
XMLCTRL = XRCCTRL
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class wxXmlResourcePtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlResource):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def Load(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_Load(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadFromString(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadFromString(self, *_args, **_kwargs)
|
||||
return val
|
||||
def InitAllHandlers(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_InitAllHandlers(self, *_args, **_kwargs)
|
||||
return val
|
||||
def AddHandler(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_AddHandler(self, *_args, **_kwargs)
|
||||
return val
|
||||
def InsertHandler(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_InsertHandler(self, *_args, **_kwargs)
|
||||
return val
|
||||
def ClearHandlers(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_ClearHandlers(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadMenu(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadMenu(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadMenuBar(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadMenuBar(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadMenuBarOnFrame(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadMenuBarOnFrame(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadToolBar(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadToolBar(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadDialog(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadDialog(self, *_args, **_kwargs)
|
||||
if val: val = wxDialogPtr(val)
|
||||
return val
|
||||
def LoadOnDialog(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadOnDialog(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadPanel(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadPanel(self, *_args, **_kwargs)
|
||||
if val: val = wxPanelPtr(val)
|
||||
return val
|
||||
def LoadOnPanel(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadOnPanel(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadFrame(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadFrame(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadOnFrame(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadOnFrame(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadObject(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadObject(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadOnObject(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadOnObject(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadBitmap(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadBitmap(self, *_args, **_kwargs)
|
||||
if val: val = wxBitmapPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def LoadIcon(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_LoadIcon(self, *_args, **_kwargs)
|
||||
if val: val = wxIconPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def AttachUnknownControl(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_AttachUnknownControl(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetVersion(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_GetVersion(self, *_args, **_kwargs)
|
||||
return val
|
||||
def CompareVersion(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_CompareVersion(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetFlags(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_GetFlags(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetFlags(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_SetFlags(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlResource instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlResource(wxXmlResourcePtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlResource(*_args,**_kwargs)
|
||||
class XmlSubclassFactory(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlSubclassFactory(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
self.InitAllHandlers()
|
||||
|
||||
|
||||
|
||||
def wxEmptyXmlResource(*_args,**_kwargs):
|
||||
val = wxXmlResourcePtr(xrcc.new_wxEmptyXmlResource(*_args,**_kwargs))
|
||||
val.thisown = 1
|
||||
val.InitAllHandlers()
|
||||
return val
|
||||
|
||||
|
||||
class wxXmlSubclassFactoryPtr :
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlSubclassFactory__setCallbackInfo(self, *_args, **_kwargs)
|
||||
return val
|
||||
del newobj.thisown
|
||||
self._setCallbackInfo(self, XmlSubclassFactory)
|
||||
def _setCallbackInfo(*args, **kwargs): return _xrc.XmlSubclassFactory__setCallbackInfo(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlSubclassFactory instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlSubclassFactory(wxXmlSubclassFactoryPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlSubclassFactory(*_args,**_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxXmlSubclassFactory)
|
||||
return "<%s.%s; proxy of C++ wxPyXmlSubclassFactory instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxXmlPropertyPtr :
|
||||
def __init__(self,this):
|
||||
class XmlSubclassFactoryPtr(XmlSubclassFactory):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def GetName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_GetName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetValue(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_GetValue(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetNext(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_GetNext(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlPropertyPtr(val)
|
||||
return val
|
||||
def SetName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_SetName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetValue(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_SetValue(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetNext(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlProperty_SetNext(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlProperty instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlProperty(wxXmlPropertyPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlProperty(*_args,**_kwargs)
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlSubclassFactory
|
||||
_xrc.XmlSubclassFactory_swigregister(XmlSubclassFactoryPtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
XML_ELEMENT_NODE = _xrc.XML_ELEMENT_NODE
|
||||
XML_ATTRIBUTE_NODE = _xrc.XML_ATTRIBUTE_NODE
|
||||
XML_TEXT_NODE = _xrc.XML_TEXT_NODE
|
||||
XML_CDATA_SECTION_NODE = _xrc.XML_CDATA_SECTION_NODE
|
||||
XML_ENTITY_REF_NODE = _xrc.XML_ENTITY_REF_NODE
|
||||
XML_ENTITY_NODE = _xrc.XML_ENTITY_NODE
|
||||
XML_PI_NODE = _xrc.XML_PI_NODE
|
||||
XML_COMMENT_NODE = _xrc.XML_COMMENT_NODE
|
||||
XML_DOCUMENT_NODE = _xrc.XML_DOCUMENT_NODE
|
||||
XML_DOCUMENT_TYPE_NODE = _xrc.XML_DOCUMENT_TYPE_NODE
|
||||
XML_DOCUMENT_FRAG_NODE = _xrc.XML_DOCUMENT_FRAG_NODE
|
||||
XML_NOTATION_NODE = _xrc.XML_NOTATION_NODE
|
||||
XML_HTML_DOCUMENT_NODE = _xrc.XML_HTML_DOCUMENT_NODE
|
||||
class XmlProperty(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlProperty(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def GetName(*args, **kwargs): return _xrc.XmlProperty_GetName(*args, **kwargs)
|
||||
def GetValue(*args, **kwargs): return _xrc.XmlProperty_GetValue(*args, **kwargs)
|
||||
def GetNext(*args, **kwargs): return _xrc.XmlProperty_GetNext(*args, **kwargs)
|
||||
def SetName(*args, **kwargs): return _xrc.XmlProperty_SetName(*args, **kwargs)
|
||||
def SetValue(*args, **kwargs): return _xrc.XmlProperty_SetValue(*args, **kwargs)
|
||||
def SetNext(*args, **kwargs): return _xrc.XmlProperty_SetNext(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxXmlProperty instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
|
||||
|
||||
|
||||
class wxXmlNodePtr :
|
||||
def __init__(self,this):
|
||||
class XmlPropertyPtr(XmlProperty):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlNode):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def AddChild(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_AddChild(self, *_args, **_kwargs)
|
||||
return val
|
||||
def InsertChild(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_InsertChild(self, *_args, **_kwargs)
|
||||
return val
|
||||
def RemoveChild(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_RemoveChild(self, *_args, **_kwargs)
|
||||
return val
|
||||
def AddProperty(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_AddProperty(self, *_args, **_kwargs)
|
||||
return val
|
||||
def AddPropertyName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_AddPropertyName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def DeleteProperty(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_DeleteProperty(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetType(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetType(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetContent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetContent(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetParent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetParent(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetNext(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetNext(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetChildren(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetChildren(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetProperties(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetProperties(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlPropertyPtr(val)
|
||||
return val
|
||||
def GetPropVal(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_GetPropVal(self, *_args, **_kwargs)
|
||||
return val
|
||||
def HasProp(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_HasProp(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetType(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetType(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetContent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetContent(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetParent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetParent(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetNext(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetNext(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetChildren(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetChildren(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetProperties(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlNode_SetProperties(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlNode instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlNode(wxXmlNodePtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlNode(*_args,**_kwargs)
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlProperty
|
||||
_xrc.XmlProperty_swigregister(XmlPropertyPtr)
|
||||
|
||||
class XmlNode(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlNode(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_xrc.delete_XmlNode):
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
def AddChild(*args, **kwargs): return _xrc.XmlNode_AddChild(*args, **kwargs)
|
||||
def InsertChild(*args, **kwargs): return _xrc.XmlNode_InsertChild(*args, **kwargs)
|
||||
def RemoveChild(*args, **kwargs): return _xrc.XmlNode_RemoveChild(*args, **kwargs)
|
||||
def AddProperty(*args, **kwargs): return _xrc.XmlNode_AddProperty(*args, **kwargs)
|
||||
def AddPropertyName(*args, **kwargs): return _xrc.XmlNode_AddPropertyName(*args, **kwargs)
|
||||
def DeleteProperty(*args, **kwargs): return _xrc.XmlNode_DeleteProperty(*args, **kwargs)
|
||||
def GetType(*args, **kwargs): return _xrc.XmlNode_GetType(*args, **kwargs)
|
||||
def GetName(*args, **kwargs): return _xrc.XmlNode_GetName(*args, **kwargs)
|
||||
def GetContent(*args, **kwargs): return _xrc.XmlNode_GetContent(*args, **kwargs)
|
||||
def GetParent(*args, **kwargs): return _xrc.XmlNode_GetParent(*args, **kwargs)
|
||||
def GetNext(*args, **kwargs): return _xrc.XmlNode_GetNext(*args, **kwargs)
|
||||
def GetChildren(*args, **kwargs): return _xrc.XmlNode_GetChildren(*args, **kwargs)
|
||||
def GetProperties(*args, **kwargs): return _xrc.XmlNode_GetProperties(*args, **kwargs)
|
||||
def GetPropVal(*args, **kwargs): return _xrc.XmlNode_GetPropVal(*args, **kwargs)
|
||||
def HasProp(*args, **kwargs): return _xrc.XmlNode_HasProp(*args, **kwargs)
|
||||
def SetType(*args, **kwargs): return _xrc.XmlNode_SetType(*args, **kwargs)
|
||||
def SetName(*args, **kwargs): return _xrc.XmlNode_SetName(*args, **kwargs)
|
||||
def SetContent(*args, **kwargs): return _xrc.XmlNode_SetContent(*args, **kwargs)
|
||||
def SetParent(*args, **kwargs): return _xrc.XmlNode_SetParent(*args, **kwargs)
|
||||
def SetNext(*args, **kwargs): return _xrc.XmlNode_SetNext(*args, **kwargs)
|
||||
def SetChildren(*args, **kwargs): return _xrc.XmlNode_SetChildren(*args, **kwargs)
|
||||
def SetProperties(*args, **kwargs): return _xrc.XmlNode_SetProperties(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxXmlNode instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
class XmlNodePtr(XmlNode):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlNode
|
||||
_xrc.XmlNode_swigregister(XmlNodePtr)
|
||||
|
||||
|
||||
def wxXmlNodeEasy(*_args,**_kwargs):
|
||||
val = wxXmlNodePtr(xrcc.new_wxXmlNodeEasy(*_args,**_kwargs))
|
||||
def XmlNodeEasy(*args, **kwargs):
|
||||
val = _xrc.new_XmlNodeEasy(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
|
||||
class wxXmlDocumentPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def __del__(self, delfunc=xrcc.delete_wxXmlDocument):
|
||||
if self.thisown == 1:
|
||||
try:
|
||||
delfunc(self)
|
||||
except:
|
||||
pass
|
||||
def Load(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_Load(self, *_args, **_kwargs)
|
||||
return val
|
||||
def LoadFromStream(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_LoadFromStream(self, *_args, **_kwargs)
|
||||
return val
|
||||
def Save(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_Save(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SaveToStream(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_SaveToStream(self, *_args, **_kwargs)
|
||||
return val
|
||||
def IsOk(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_IsOk(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetRoot(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_GetRoot(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetVersion(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_GetVersion(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetFileEncoding(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_GetFileEncoding(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetRoot(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_SetRoot(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetVersion(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_SetVersion(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetFileEncoding(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_SetFileEncoding(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetEncoding(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_GetEncoding(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetEncoding(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlDocument_SetEncoding(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlDocument instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlDocument(wxXmlDocumentPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlDocument(*_args,**_kwargs)
|
||||
class XmlDocument(core.Object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlDocument(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_xrc.delete_XmlDocument):
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
def Load(*args, **kwargs): return _xrc.XmlDocument_Load(*args, **kwargs)
|
||||
def LoadFromStream(*args, **kwargs): return _xrc.XmlDocument_LoadFromStream(*args, **kwargs)
|
||||
def Save(*args, **kwargs): return _xrc.XmlDocument_Save(*args, **kwargs)
|
||||
def SaveToStream(*args, **kwargs): return _xrc.XmlDocument_SaveToStream(*args, **kwargs)
|
||||
def IsOk(*args, **kwargs): return _xrc.XmlDocument_IsOk(*args, **kwargs)
|
||||
def GetRoot(*args, **kwargs): return _xrc.XmlDocument_GetRoot(*args, **kwargs)
|
||||
def GetVersion(*args, **kwargs): return _xrc.XmlDocument_GetVersion(*args, **kwargs)
|
||||
def GetFileEncoding(*args, **kwargs): return _xrc.XmlDocument_GetFileEncoding(*args, **kwargs)
|
||||
def SetRoot(*args, **kwargs): return _xrc.XmlDocument_SetRoot(*args, **kwargs)
|
||||
def SetVersion(*args, **kwargs): return _xrc.XmlDocument_SetVersion(*args, **kwargs)
|
||||
def SetFileEncoding(*args, **kwargs): return _xrc.XmlDocument_SetFileEncoding(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxXmlDocument instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
class XmlDocumentPtr(XmlDocument):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlDocument
|
||||
_xrc.XmlDocument_swigregister(XmlDocumentPtr)
|
||||
|
||||
|
||||
def wxXmlDocumentFromStream(*_args,**_kwargs):
|
||||
val = wxXmlDocumentPtr(xrcc.new_wxXmlDocumentFromStream(*_args,**_kwargs))
|
||||
def XmlDocumentFromStream(*args, **kwargs):
|
||||
val = _xrc.new_XmlDocumentFromStream(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
def wxEmptyXmlDocument(*_args,**_kwargs):
|
||||
val = wxXmlDocumentPtr(xrcc.new_wxEmptyXmlDocument(*_args,**_kwargs))
|
||||
def EmptyXmlDocument(*args, **kwargs):
|
||||
val = _xrc.new_EmptyXmlDocument(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class wxXmlResourceHandlerPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler__setCallbackInfo(self, *_args, **_kwargs)
|
||||
return val
|
||||
def CreateResource(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_CreateResource(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SetParentResource(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_SetParentResource(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetResource(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetResource(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlResourcePtr(val)
|
||||
return val
|
||||
def GetNode(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetNode(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetClass(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetClass(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetParent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetParent(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetInstance(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetInstance(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetParentAsWindow(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetParentAsWindow(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetInstanceAsWindow(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetInstanceAsWindow(self, *_args, **_kwargs)
|
||||
return val
|
||||
def IsOfClass(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_IsOfClass(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetNodeContent(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetNodeContent(self, *_args, **_kwargs)
|
||||
return val
|
||||
def HasParam(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_HasParam(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetParamNode(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetParamNode(self, *_args, **_kwargs)
|
||||
if val: val = wxXmlNodePtr(val)
|
||||
return val
|
||||
def GetParamValue(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetParamValue(self, *_args, **_kwargs)
|
||||
return val
|
||||
def AddStyle(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_AddStyle(self, *_args, **_kwargs)
|
||||
return val
|
||||
def AddWindowStyles(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_AddWindowStyles(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetStyle(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetStyle(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetText(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetText(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetID(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetID(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetName(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetName(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetBool(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetBool(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetLong(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetLong(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetColour(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetColour(self, *_args, **_kwargs)
|
||||
if val: val = wxColourPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetSize(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetSize(self, *_args, **_kwargs)
|
||||
if val: val = wxSizePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetPosition(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetPosition(self, *_args, **_kwargs)
|
||||
if val: val = wxPointPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetDimension(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetDimension(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetBitmap(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetBitmap(self, *_args, **_kwargs)
|
||||
if val: val = wxBitmapPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetIcon(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetIcon(self, *_args, **_kwargs)
|
||||
if val: val = wxIconPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def GetFont(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetFont(self, *_args, **_kwargs)
|
||||
if val: val = wxFontPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def SetupWindow(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_SetupWindow(self, *_args, **_kwargs)
|
||||
return val
|
||||
def CreateChildren(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_CreateChildren(self, *_args, **_kwargs)
|
||||
return val
|
||||
def CreateChildrenPrivately(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_CreateChildrenPrivately(self, *_args, **_kwargs)
|
||||
return val
|
||||
def CreateResFromNode(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_CreateResFromNode(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetCurFileSystem(self, *_args, **_kwargs):
|
||||
val = xrcc.wxXmlResourceHandler_GetCurFileSystem(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxXmlResourceHandler instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxXmlResourceHandler(wxXmlResourceHandlerPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = xrcc.new_wxXmlResourceHandler(*_args,**_kwargs)
|
||||
class XmlResourceHandler(core.Object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _xrc.new_XmlResourceHandler(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxXmlResourceHandler)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
wxXmlResource_AddSubclassFactory = xrcc.wxXmlResource_AddSubclassFactory
|
||||
|
||||
wxXmlResource_GetXRCID = xrcc.wxXmlResource_GetXRCID
|
||||
|
||||
def wxXmlResource_Get(*_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_Get(*_args,**_kwargs)
|
||||
if val: val = wxXmlResourcePtr(val)
|
||||
return val
|
||||
|
||||
def wxXmlResource_Set(*_args, **_kwargs):
|
||||
val = xrcc.wxXmlResource_Set(*_args,**_kwargs)
|
||||
if val: val = wxXmlResourcePtr(val)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
wxXRC_USE_LOCALE = xrcc.wxXRC_USE_LOCALE
|
||||
wxXRC_NO_SUBCLASSING = xrcc.wxXRC_NO_SUBCLASSING
|
||||
wxXML_ELEMENT_NODE = xrcc.wxXML_ELEMENT_NODE
|
||||
wxXML_ATTRIBUTE_NODE = xrcc.wxXML_ATTRIBUTE_NODE
|
||||
wxXML_TEXT_NODE = xrcc.wxXML_TEXT_NODE
|
||||
wxXML_CDATA_SECTION_NODE = xrcc.wxXML_CDATA_SECTION_NODE
|
||||
wxXML_ENTITY_REF_NODE = xrcc.wxXML_ENTITY_REF_NODE
|
||||
wxXML_ENTITY_NODE = xrcc.wxXML_ENTITY_NODE
|
||||
wxXML_PI_NODE = xrcc.wxXML_PI_NODE
|
||||
wxXML_COMMENT_NODE = xrcc.wxXML_COMMENT_NODE
|
||||
wxXML_DOCUMENT_NODE = xrcc.wxXML_DOCUMENT_NODE
|
||||
wxXML_DOCUMENT_TYPE_NODE = xrcc.wxXML_DOCUMENT_TYPE_NODE
|
||||
wxXML_DOCUMENT_FRAG_NODE = xrcc.wxXML_DOCUMENT_FRAG_NODE
|
||||
wxXML_NOTATION_NODE = xrcc.wxXML_NOTATION_NODE
|
||||
wxXML_HTML_DOCUMENT_NODE = xrcc.wxXML_HTML_DOCUMENT_NODE
|
||||
|
||||
|
||||
#-------------- USER INCLUDE -----------------------
|
||||
del newobj.thisown
|
||||
self._setCallbackInfo(self, XmlResourceHandler)
|
||||
def _setCallbackInfo(*args, **kwargs): return _xrc.XmlResourceHandler__setCallbackInfo(*args, **kwargs)
|
||||
def CreateResource(*args, **kwargs): return _xrc.XmlResourceHandler_CreateResource(*args, **kwargs)
|
||||
def SetParentResource(*args, **kwargs): return _xrc.XmlResourceHandler_SetParentResource(*args, **kwargs)
|
||||
def GetResource(*args, **kwargs): return _xrc.XmlResourceHandler_GetResource(*args, **kwargs)
|
||||
def GetNode(*args, **kwargs): return _xrc.XmlResourceHandler_GetNode(*args, **kwargs)
|
||||
def GetClass(*args, **kwargs): return _xrc.XmlResourceHandler_GetClass(*args, **kwargs)
|
||||
def GetParent(*args, **kwargs): return _xrc.XmlResourceHandler_GetParent(*args, **kwargs)
|
||||
def GetInstance(*args, **kwargs): return _xrc.XmlResourceHandler_GetInstance(*args, **kwargs)
|
||||
def GetParentAsWindow(*args, **kwargs): return _xrc.XmlResourceHandler_GetParentAsWindow(*args, **kwargs)
|
||||
def GetInstanceAsWindow(*args, **kwargs): return _xrc.XmlResourceHandler_GetInstanceAsWindow(*args, **kwargs)
|
||||
def IsOfClass(*args, **kwargs): return _xrc.XmlResourceHandler_IsOfClass(*args, **kwargs)
|
||||
def GetNodeContent(*args, **kwargs): return _xrc.XmlResourceHandler_GetNodeContent(*args, **kwargs)
|
||||
def HasParam(*args, **kwargs): return _xrc.XmlResourceHandler_HasParam(*args, **kwargs)
|
||||
def GetParamNode(*args, **kwargs): return _xrc.XmlResourceHandler_GetParamNode(*args, **kwargs)
|
||||
def GetParamValue(*args, **kwargs): return _xrc.XmlResourceHandler_GetParamValue(*args, **kwargs)
|
||||
def AddStyle(*args, **kwargs): return _xrc.XmlResourceHandler_AddStyle(*args, **kwargs)
|
||||
def AddWindowStyles(*args, **kwargs): return _xrc.XmlResourceHandler_AddWindowStyles(*args, **kwargs)
|
||||
def GetStyle(*args, **kwargs): return _xrc.XmlResourceHandler_GetStyle(*args, **kwargs)
|
||||
def GetText(*args, **kwargs): return _xrc.XmlResourceHandler_GetText(*args, **kwargs)
|
||||
def GetID(*args, **kwargs): return _xrc.XmlResourceHandler_GetID(*args, **kwargs)
|
||||
def GetName(*args, **kwargs): return _xrc.XmlResourceHandler_GetName(*args, **kwargs)
|
||||
def GetBool(*args, **kwargs): return _xrc.XmlResourceHandler_GetBool(*args, **kwargs)
|
||||
def GetLong(*args, **kwargs): return _xrc.XmlResourceHandler_GetLong(*args, **kwargs)
|
||||
def GetColour(*args, **kwargs): return _xrc.XmlResourceHandler_GetColour(*args, **kwargs)
|
||||
def GetSize(*args, **kwargs): return _xrc.XmlResourceHandler_GetSize(*args, **kwargs)
|
||||
def GetPosition(*args, **kwargs): return _xrc.XmlResourceHandler_GetPosition(*args, **kwargs)
|
||||
def GetDimension(*args, **kwargs): return _xrc.XmlResourceHandler_GetDimension(*args, **kwargs)
|
||||
def GetBitmap(*args, **kwargs): return _xrc.XmlResourceHandler_GetBitmap(*args, **kwargs)
|
||||
def GetIcon(*args, **kwargs): return _xrc.XmlResourceHandler_GetIcon(*args, **kwargs)
|
||||
def GetFont(*args, **kwargs): return _xrc.XmlResourceHandler_GetFont(*args, **kwargs)
|
||||
def SetupWindow(*args, **kwargs): return _xrc.XmlResourceHandler_SetupWindow(*args, **kwargs)
|
||||
def CreateChildren(*args, **kwargs): return _xrc.XmlResourceHandler_CreateChildren(*args, **kwargs)
|
||||
def CreateChildrenPrivately(*args, **kwargs): return _xrc.XmlResourceHandler_CreateChildrenPrivately(*args, **kwargs)
|
||||
def CreateResFromNode(*args, **kwargs): return _xrc.XmlResourceHandler_CreateResFromNode(*args, **kwargs)
|
||||
def GetCurFileSystem(*args, **kwargs): return _xrc.XmlResourceHandler_GetCurFileSystem(*args, **kwargs)
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxPyXmlResourceHandler instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
|
||||
class XmlResourceHandlerPtr(XmlResourceHandler):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = XmlResourceHandler
|
||||
_xrc.XmlResourceHandler_swigregister(XmlResourceHandlerPtr)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# The global was removed in favor of static accessor functions. This is for
|
||||
# backwards compatibility:
|
||||
wxTheXmlResource = wxXmlResource_Get()
|
||||
|
||||
wx.wxXmlNodePtr = wxXmlNodePtr
|
||||
TheXmlResource = XmlResource_Get()
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
# Create a factory for handling the subclass property of the object tag.
|
||||
|
||||
|
||||
@@ -566,9 +301,9 @@ def _my_import(name):
|
||||
return mod
|
||||
|
||||
|
||||
class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
class XmlSubclassFactory_Python(XmlSubclassFactory):
|
||||
def __init__(self):
|
||||
wxXmlSubclassFactory.__init__(self)
|
||||
XmlSubclassFactory.__init__(self)
|
||||
|
||||
def Create(self, className):
|
||||
assert className.find('.') != -1, "Module name must be specified!"
|
||||
@@ -580,5 +315,8 @@ class wxXmlSubclassFactory_Python(wxXmlSubclassFactory):
|
||||
return inst
|
||||
|
||||
|
||||
wxXmlResource_AddSubclassFactory(wxXmlSubclassFactory_Python())
|
||||
XmlResource_AddSubclassFactory(XmlSubclassFactory_Python())
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
5248
wxPython/contrib/xrc/xrc_wrap.cpp
Normal file
5248
wxPython/contrib/xrc/xrc_wrap.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user