]> git.saurik.com Git - wxWidgets.git/blame - wxPython/contrib/xrc/xrc.i
Updated to Scintilla from 1.45 to 1.47
[wxWidgets.git] / wxPython / contrib / xrc / xrc.i
CommitLineData
d56cebe7
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: xrc.i
3// Purpose: Wrappers for the XML based Resource system
4//
5// Author: Robin Dunn
6//
7// Created: 4-June-2001
8// RCS-ID: $Id$
9// Copyright: (c) 2001 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13%module xrc
14
15
16%{
6e2129f9 17#include "wxPython.h"
628c7f79
RD
18#include "pyistream.h"
19#include "wx/xrc/xml.h"
d56cebe7 20#include "wx/xrc/xmlres.h"
cd834e7b
RD
21#include <wx/filesys.h>
22#include <wx/fs_mem.h>
d56cebe7
RD
23%}
24
25//---------------------------------------------------------------------------
26
27%include typemaps.i
28%include my_typemaps.i
29
30%extern wx.i
31%extern windows.i
32%extern _defs.i
33%extern events.i
34%extern controls.i
35
628c7f79
RD
36%extern streams.i
37
d56cebe7 38
628c7f79
RD
39//---------------------------------------------------------------------------
40%{
41 // Put some wx default wxChar* values into wxStrings.
42 static const wxString wxPyEmptyString(wxT(""));
43 static const wxString wxPyUTF8String(wxT("UTF-8"));
44 static const wxString wxPyStyleString(wxT("style"));
45 static const wxString wxPySizeString(wxT("size"));
46 static const wxString wxPyPosString(wxT("pos"));
47 static const wxString wxPyBitmapString(wxT("bitmap"));
48 static const wxString wxPyIconString(wxT("icon"));
49 static const wxString wxPyFontString(wxT("font"));
50%}
d56cebe7
RD
51//---------------------------------------------------------------------------
52
b5a5d647
RD
53enum wxXmlResourceFlags
54{
55 wxXRC_USE_LOCALE = 1,
56 wxXRC_NO_SUBCLASSING = 2
57};
58
59
d56cebe7
RD
60// This class holds XML resources from one or more .xml files
61// (or derived forms, either binary or zipped -- see manual for
62// details).
63
64class wxXmlResource : public wxObject
65{
66public:
cd834e7b 67 // Ctors.
b5a5d647
RD
68 // Flags: wxXRC_USE_LOCALE
69 // translatable strings will be translated via _()
70 // wxXRC_NO_SUBCLASSING
71 // subclass property of object nodes will be ignored
72 // (useful for previews in XRC editors)
cd834e7b
RD
73 wxXmlResource(const wxString& filemask, int flags = wxXRC_USE_LOCALE);
74 %name(wxEmptyXmlResource) wxXmlResource(int flags = wxXRC_USE_LOCALE);
75 %pragma(python) addtomethod = "__init__:self.InitAllHandlers()"
76 %pragma(python) addtomethod = "wxEmptyXmlResource:val.InitAllHandlers()"
d56cebe7
RD
77
78 ~wxXmlResource();
79
80
81 // Loads resources from XML files that match given filemask.
82 // This method understands VFS (see filesys.h).
83 bool Load(const wxString& filemask);
84
cd834e7b
RD
85 %addmethods {
86 bool LoadFromString(const wxString& data) {
87 static int s_memFileIdx = 0;
88
89 // Check for memory FS. If not present, load the handler:
90 wxMemoryFSHandler::AddFile(wxT("XRC_resource/dummy_file"),
91 wxT("dummy data"));
92 wxFileSystem fsys;
93 wxFSFile *f = fsys.OpenFile(wxT("memory:XRC_resource/dummy_file"));
94 wxMemoryFSHandler::RemoveFile(wxT("XRC_resource/dummy_file"));
95 if (f)
96 delete f;
97 else
98 wxFileSystem::AddHandler(new wxMemoryFSHandler);
99
100 // Now put the resource data into the memory FS
101 wxString filename(wxT("XRC_resource/data_string_"));
102 filename << s_memFileIdx;
103 s_memFileIdx += 1;
104 wxMemoryFSHandler::AddFile(filename, data);
105
106 // Load the "file" into the resource object
107 bool retval = self->Load(wxT("memory:") + filename );
108
109 return retval;
110 }
111 }
112
d56cebe7
RD
113 // Initialize handlers for all supported controls/windows. This will
114 // make the executable quite big because it forces linking against
115 // most of wxWin library
116 void InitAllHandlers();
117
118 // Initialize only specific handler (or custom handler). Convention says
119 // that handler name is equal to control's name plus 'XmlHandler', e.g.
120 // wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler. XML resource compiler
121 // (xmlres) can create include file that contains initialization code for
122 // all controls used within the resource.
628c7f79
RD
123 void AddHandler(wxPyXmlResourceHandler *handler);
124
125 // Add a new handler at the begining of the handler list
126 void InsertHandler(wxPyXmlResourceHandler *handler);
d56cebe7
RD
127
128 // Removes all handlers
129 void ClearHandlers();
130
131 // Loads menu from resource. Returns NULL on failure.
132 wxMenu *LoadMenu(const wxString& name);
133
134 // Loads menubar from resource. Returns NULL on failure.
135 wxMenuBar *LoadMenuBar(const wxString& name);
32a85500
RD
136 %name(LoadMenuBarOnFrame) wxMenuBar *LoadMenuBar(wxWindow *parent, const wxString& name);
137
d56cebe7
RD
138
139 // Loads toolbar
140 wxToolBar *LoadToolBar(wxWindow *parent, const wxString& name);
141
142 // Loads dialog. dlg points to parent window (if any). Second form
143 // is used to finish creation of already existing instance (main reason
144 // for this is that you may want to use derived class with new event table)
145 // Example (typical usage):
146 // MyDialog dlg;
147 // wxTheXmlResource->LoadDialog(&dlg, mainFrame, "my_dialog");
148 // dlg->ShowModal();
149 wxDialog *LoadDialog(wxWindow *parent, const wxString& name);
150 %name(LoadOnDialog)bool LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name);
151
152 // Loads panel. panel points to parent window (if any). Second form
153 // is used to finish creation of already existing instance.
154 wxPanel *LoadPanel(wxWindow *parent, const wxString& name);
155 %name(LoadOnPanel)bool LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name);
156
628c7f79
RD
157 // Load a frame's contents from a resource
158 wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
159 %name(LoadOnFrame)bool LoadFrame(wxFrame* frame, wxWindow *parent, const wxString& name);
d56cebe7 160
628c7f79
RD
161 // Load an object from the resource specifying both the resource name and
162 // the classname. This lets you load nonstandard container windows.
163 wxObject *LoadObject(wxWindow *parent, const wxString& name,
164 const wxString& classname);
165
166 // Load an object from the resource specifying both the resource name and
167 // the classname. This form lets you finish the creation of an existing
168 // instance.
169 %name(LoadOnObject)bool LoadObject(wxObject *instance, wxWindow *parent, const wxString& name,
170 const wxString& classname);
171
172 // Loads bitmap or icon resource from file:
d56cebe7
RD
173 wxBitmap LoadBitmap(const wxString& name);
174 wxIcon LoadIcon(const wxString& name);
175
176 // Attaches unknown control into given panel/window/dialog:
177 // (unknown controls are used in conjunction with <object class="unknown">)
178 bool AttachUnknownControl(const wxString& name, wxWindow *control,
179 wxWindow *parent = NULL);
180
181 // Returns numeric ID that is equivalent to string id used in XML
182 // resource. To be used in event tables
183 // Macro XMLID is provided for convenience
1496068d 184 static int GetXRCID(const wxString& str_id);
d56cebe7
RD
185
186 // Returns version info (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a)
187 long GetVersion() const;
188
189 // Compares resources version to argument. Returns -1 if resources version
190 // is less than the argument, +1 if greater and 0 if they equal.
191 int CompareVersion(int major, int minor, int release, int revision) const;
192
d56cebe7 193
ce914f73
RD
194 // Gets global resources object or create one if none exists
195 static wxXmlResource *Get();
196 // Sets global resources object and returns pointer to previous one (may be NULL).
197 static wxXmlResource *Set(wxXmlResource *res);
d56cebe7 198
fd512ba2
RD
199 // Returns flags, which may be a bitlist of wxXRC_USE_LOCALE and wxXRC_NO_SUBCLASSING.
200 int GetFlags();
201
ce914f73 202};
d56cebe7
RD
203
204//----------------------------------------------------------------------
205
206%pragma(python) code = "
c6c593e8
RD
207def XRCID(str_id):
208 return wxXmlResource_GetXRCID(str_id)
d56cebe7 209
c6c593e8
RD
210def XRCCTRL(window, str_id, *ignoreargs):
211 return window.FindWindowById(XRCID(str_id))
d56cebe7 212
c6c593e8
RD
213XMLID = XRCID
214XMLCTRL = XRCCTRL
d56cebe7
RD
215"
216
217//----------------------------------------------------------------------
628c7f79
RD
218//----------------------------------------------------------------------
219// In order to provide wrappers for wxXmlResourceHandler we need to also
220// provide the classes for representing and parsing XML.
221
222
223// Represents XML node type.
224enum wxXmlNodeType
225{
226 // note: values are synchronized with xmlElementType from libxml
227 wxXML_ELEMENT_NODE,
228 wxXML_ATTRIBUTE_NODE,
229 wxXML_TEXT_NODE,
230 wxXML_CDATA_SECTION_NODE,
231 wxXML_ENTITY_REF_NODE,
232 wxXML_ENTITY_NODE,
233 wxXML_PI_NODE,
234 wxXML_COMMENT_NODE,
235 wxXML_DOCUMENT_NODE,
236 wxXML_DOCUMENT_TYPE_NODE,
237 wxXML_DOCUMENT_FRAG_NODE,
238 wxXML_NOTATION_NODE,
239 wxXML_HTML_DOCUMENT_NODE
240};
241
242
243
244// Represents node property(ies).
245// Example: in <img src="hello.gif" id="3"/> "src" is property with value
246// "hello.gif" and "id" is property with value "3".
247class wxXmlProperty
248{
249public:
250 wxXmlProperty(const wxString& name = wxPyEmptyString,
251 const wxString& value = wxPyEmptyString,
252 wxXmlProperty *next = NULL);
253
254 wxString GetName() const;
255 wxString GetValue() const;
256 wxXmlProperty *GetNext() const;
257
258 void SetName(const wxString& name);
259 void SetValue(const wxString& value);
260 void SetNext(wxXmlProperty *next);
261};
262
263
264
265
266// Represents node in XML document. Node has name and may have content
267// and properties. Most common node types are wxXML_TEXT_NODE (name and props
268// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
269// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
270// with content="hi").
271//
272// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load
273// (default is UTF-8).
274class wxXmlNode
275{
276public:
277 wxXmlNode(wxXmlNode *parent = NULL,
278 wxXmlNodeType type = 0,
279 const wxString& name = wxPyEmptyString,
280 const wxString& content = wxPyEmptyString,
281 wxXmlProperty *props = NULL,
282 wxXmlNode *next = NULL);
283 ~wxXmlNode();
284
285
286 // user-friendly creation:
287 %name(wxXmlNodeEasy)wxXmlNode(wxXmlNodeType type, const wxString& name,
288 const wxString& content = wxPyEmptyString);
289
290 void AddChild(wxXmlNode *child);
291 void InsertChild(wxXmlNode *child, wxXmlNode *before_node);
292 bool RemoveChild(wxXmlNode *child);
293 void AddProperty(wxXmlProperty *prop);
294 %name(AddPropertyName)void AddProperty(const wxString& name, const wxString& value);
295 bool DeleteProperty(const wxString& name);
296
297 // access methods:
298 wxXmlNodeType GetType() const;
299 wxString GetName() const;
300 wxString GetContent() const;
301
302 wxXmlNode *GetParent() const;
303 wxXmlNode *GetNext() const;
304 wxXmlNode *GetChildren() const;
305
306 wxXmlProperty *GetProperties() const;
307 wxString GetPropVal(const wxString& propName,
308 const wxString& defaultVal) const;
309 bool HasProp(const wxString& propName) const;
310
311 void SetType(wxXmlNodeType type);
312 void SetName(const wxString& name);
313 void SetContent(const wxString& con);
314
315 void SetParent(wxXmlNode *parent);
316 void SetNext(wxXmlNode *next);
317 void SetChildren(wxXmlNode *child);
318
319 void SetProperties(wxXmlProperty *prop);
320};
321
322
323
324// This class holds XML data/document as parsed by XML parser.
325class wxXmlDocument : public wxObject
326{
327public:
328 wxXmlDocument(const wxString& filename,
329 const wxString& encoding = wxPyUTF8String);
330 %name(wxXmlDocumentFromStream)wxXmlDocument(wxInputStream& stream,
331 const wxString& encoding = wxPyUTF8String);
332 %name(wxEmptyXmlDocument)wxXmlDocument();
333
334 ~wxXmlDocument();
335
336
337 // Parses .xml file and loads data. Returns TRUE on success, FALSE
338 // otherwise.
339 bool Load(const wxString& filename,
340 const wxString& encoding = wxPyUTF8String);
341 %name(LoadFromStream)bool Load(wxInputStream& stream,
342 const wxString& encoding = wxPyUTF8String);
343
344 // Saves document as .xml file.
345 bool Save(const wxString& filename) const;
346 %name(SaveToStream)bool Save(wxOutputStream& stream) const;
347
348 bool IsOk() const;
349
350 // Returns root node of the document.
351 wxXmlNode *GetRoot() const;
352
353 // Returns version of document (may be empty).
354 wxString GetVersion() const;
355
356 // Returns encoding of document (may be empty).
357 // Note: this is the encoding original file was saved in, *not* the
358 // encoding of in-memory representation!
359 wxString GetFileEncoding() const;
360
361 // Write-access methods:
362 void SetRoot(wxXmlNode *node);
363 void SetVersion(const wxString& version);
364 void SetFileEncoding(const wxString& encoding);
365
366 %addmethods {
367 // Returns encoding of in-memory representation of the document (same
368 // as passed to Load or ctor, defaults to UTF-8). NB: this is
369 // meaningless in Unicode build where data are stored as wchar_t*
370 wxString GetEncoding() {
371 #if wxUSE_UNICODE
372 return wxPyEmptyString;
373 #else
374 return self->GetEncoding();
375 #endif
376 }
377 }
378};
379
380
381//----------------------------------------------------------------------
382// And now for wxXmlResourceHandler...
383
384
385
386%{ // C++ version of Python aware wxXmlResourceHandler, for the pure virtual
387 // callbacks, as well as to make some protected things public so they can
388 // be wrapped.
389class wxPyXmlResourceHandler : public wxXmlResourceHandler {
390public:
391 wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
392 //~wxPyXmlResourceHandler();
393
394 // Base class virtuals
395
396 DEC_PYCALLBACK_OBJECT__pure(DoCreateResource);
397 DEC_PYCALLBACK_BOOL_NODE_pure(CanHandle);
398
399// wxObject* DoCreateResource() {
400// wxObject* rv = NULL;
401// wxPyBeginBlockThreads();
402// if (wxPyCBH_findCallback(m_myInst, "DoCreateResource")) {
403// PyObject* ro;
404// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
405// if (ro) {
406// SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");
407// Py_DECREF(ro);
408// }
409// }
410// wxPyEndBlockThreads();
411// return rv;
412// }
413
414// bool CanHandle(wxXmlNode* a) {
415// bool rv=FALSE;
416// wxPyBeginBlockThreads();
417// if (wxPyCBH_findCallback(m_myInst, "CanHandle")) {
418// PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);
419// rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
420// Py_DECREF(obj);
421// }
422// wxPyEndBlockThreads();
423// return rv;
424// }
425
426
427
428 // accessors for protected members
429
430 wxXmlResource* GetResource() { return m_resource; }
431 wxXmlNode* GetNode() { return m_node; }
432 wxString GetClass() { return m_class; }
433 wxObject* GetParent() { return m_parent; }
434 wxObject* GetInstance() { return m_instance; }
435 wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
436 wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
437
438
439 // turn some protected methods into public via delegation
440
441 bool IsOfClass(wxXmlNode *node, const wxString& classname)
442 { return wxXmlResourceHandler::IsOfClass(node, classname); }
443
444 wxString GetNodeContent(wxXmlNode *node)
445 { return wxXmlResourceHandler::GetNodeContent(node); }
446
447 bool HasParam(const wxString& param)
448 { return wxXmlResourceHandler::HasParam(param); }
449
450 wxXmlNode *GetParamNode(const wxString& param)
451 { return wxXmlResourceHandler::GetParamNode(param); }
452
453 wxString GetParamValue(const wxString& param)
454 { return wxXmlResourceHandler::GetParamValue(param); }
455
456 void AddStyle(const wxString& name, int value)
457 { wxXmlResourceHandler::AddStyle(name, value); }
458
459 void AddWindowStyles()
460 { wxXmlResourceHandler::AddWindowStyles(); }
461
462 int GetStyle(const wxString& param = wxT("style"), int defaults = 0)
463 { return wxXmlResourceHandler::GetStyle(param, defaults); }
464
465 wxString GetText(const wxString& param, bool translate = TRUE)
466 { return wxXmlResourceHandler::GetText(param, translate); }
467
468 int GetID()
469 { return wxXmlResourceHandler::GetID(); }
470
471 wxString GetName()
472 { return wxXmlResourceHandler::GetName(); }
473
474 bool GetBool(const wxString& param, bool defaultv = FALSE)
475 { return wxXmlResourceHandler::GetBool(param, defaultv); }
476
477 long GetLong( const wxString& param, long defaultv = 0 )
478 { return wxXmlResourceHandler::GetLong(param, defaultv); }
479
480 wxColour GetColour(const wxString& param)
481 { return wxXmlResourceHandler::GetColour(param); }
482
483 wxSize GetSize(const wxString& param = wxT("size"))
484 { return wxXmlResourceHandler::GetSize(param); }
485
486 wxPoint GetPosition(const wxString& param = wxT("pos"))
487 { return wxXmlResourceHandler::GetPosition(param); }
488
489 wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0)
490 { return wxXmlResourceHandler::GetDimension(param, defaultv); }
491
492 wxBitmap GetBitmap(const wxString& param = wxT("bitmap"),
493 const wxArtClient& defaultArtClient = wxART_OTHER,
494 wxSize size = wxDefaultSize)
495 { return wxXmlResourceHandler::GetBitmap(param, defaultArtClient, size); }
496
497 wxIcon GetIcon(const wxString& param = wxT("icon"),
498 const wxArtClient& defaultArtClient = wxART_OTHER,
499 wxSize size = wxDefaultSize)
500 { return wxXmlResourceHandler::GetIcon(param, defaultArtClient, size); }
501
502 wxFont GetFont(const wxString& param = wxT("font"))
503 { return wxXmlResourceHandler::GetFont(param); }
504
505 void SetupWindow(wxWindow *wnd)
506 { wxXmlResourceHandler::SetupWindow(wnd); }
507
508 void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE)
509 { wxXmlResourceHandler::CreateChildren(parent, this_hnd_only); }
510
511 void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL)
512 { wxXmlResourceHandler::CreateChildrenPrivately(parent, rootnode); }
513
514 wxObject *CreateResFromNode(wxXmlNode *node,
515 wxObject *parent, wxObject *instance = NULL)
516 { return wxXmlResourceHandler::CreateResFromNode(node, parent, instance); }
517
518 wxFileSystem& GetCurFileSystem()
519 { return wxXmlResourceHandler::GetCurFileSystem(); }
520
521
522 PYPRIVATE;
523};
524
525IMP_PYCALLBACK_OBJECT__pure(wxPyXmlResourceHandler, wxXmlResourceHandler, DoCreateResource);
526IMP_PYCALLBACK_BOOL_NODE_pure(wxPyXmlResourceHandler, wxXmlResourceHandler, CanHandle);
527
528%}
529
530
531//----------------------------------------------------------------------
532// Now the version that will be SWIGged.
533
534
535%name(wxXmlResourceHandler) class wxPyXmlResourceHandler : public wxObject {
536public:
537 wxPyXmlResourceHandler() : wxXmlResourceHandler() {}
538 //~wxPyXmlResourceHandler();
539
540 void _setCallbackInfo(PyObject* self, PyObject* _class);
541 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxXmlResourceHandler)"
d56cebe7 542
d56cebe7 543
628c7f79
RD
544
545 // Creates an object (menu, dialog, control, ...) from an XML node.
546 // Should check for validity.
547 // parent is a higher-level object (usually window, dialog or panel)
548 // that is often neccessary to create the resource.
549 // If instance is non-NULL it should not create a new instance via 'new' but
550 // should rather use this one, and call its Create method.
551 wxObject *CreateResource(wxXmlNode *node, wxObject *parent,
552 wxObject *instance);
553
554 // Sets the parent resource.
555 void SetParentResource(wxXmlResource *res);
556
557
558 wxXmlResource* GetResource() { return m_resource; }
559 wxXmlNode* GetNode() { return m_node; }
560 wxString GetClass() { return m_class; }
561 wxObject* GetParent() { return m_parent; }
562 wxObject* GetInstance() { return m_instance; }
563 wxWindow* GetParentAsWindow() { return m_parentAsWindow; }
564 wxWindow* GetInstanceAsWindow() { return m_instanceAsWindow; }
565
566
567 // Returns true if the node has a property class equal to classname,
568 // e.g. <object class="wxDialog">.
569 bool IsOfClass(wxXmlNode *node, const wxString& classname);
570
571 // Gets node content from wxXML_ENTITY_NODE
572 // The problem is, <tag>content<tag> is represented as
573 // wxXML_ENTITY_NODE name="tag", content=""
574 // |-- wxXML_TEXT_NODE or
575 // wxXML_CDATA_SECTION_NODE name="" content="content"
576 wxString GetNodeContent(wxXmlNode *node);
577
578 // Check to see if a parameter exists.
579 bool HasParam(const wxString& param);
580
581 // Finds the node or returns NULL.
582 wxXmlNode *GetParamNode(const wxString& param);
583
584 // Finds the parameter value or returns the empty string.
585 wxString GetParamValue(const wxString& param);
586
587 // Add a style flag (e.g. wxMB_DOCKABLE) to the list of flags
588 // understood by this handler.
589 void AddStyle(const wxString& name, int value);
590
591 // Add styles common to all wxWindow-derived classes.
592 void AddWindowStyles();
593
594 // Gets style flags from text in form "flag | flag2| flag3 |..."
595 // Only understads flags added with AddStyle
596 int GetStyle(const wxString& param = wxPyStyleString, int defaults = 0);
597
598 // Gets text from param and does some conversions:
599 // - replaces \n, \r, \t by respective chars (according to C syntax)
600 // - replaces _ by & and __ by _ (needed for _File => &File because of XML)
601 // - calls wxGetTranslations (unless disabled in wxXmlResource)
602 wxString GetText(const wxString& param, bool translate = TRUE);
603
604 // Returns the XRCID.
605 int GetID();
606
607 // Returns the resource name.
608 wxString GetName();
609
610 // Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE).
611 bool GetBool(const wxString& param, bool defaultv = FALSE);
612
613 // Gets the integer value from the parameter.
614 long GetLong( const wxString& param, long defaultv = 0 );
615
616 // Gets colour in HTML syntax (#RRGGBB).
617 wxColour GetColour(const wxString& param);
618
619 // Gets the size (may be in dialog units).
620 wxSize GetSize(const wxString& param = wxPySizeString);
621
622 // Gets the position (may be in dialog units).
623 wxPoint GetPosition(const wxString& param = wxPyPosString);
624
625 // Gets a dimension (may be in dialog units).
626 wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0);
627
628 // Gets a bitmap.
629 wxBitmap GetBitmap(const wxString& param = wxPyBitmapString,
630 const wxArtClient& defaultArtClient = wxART_OTHER,
631 wxSize size = wxDefaultSize);
632
633 // Gets an icon.
634 wxIcon GetIcon(const wxString& param = wxPyIconString,
635 const wxArtClient& defaultArtClient = wxART_OTHER,
636 wxSize size = wxDefaultSize);
637
638 // Gets a font.
639 wxFont GetFont(const wxString& param = wxPyFontString);
640
641 // Sets common window options.
642 void SetupWindow(wxWindow *wnd);
643
644 // Creates children.
645 void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE);
646
647 // Helper function.
648 void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);
649
650 // Creates a resource from a node.
651 wxObject *CreateResFromNode(wxXmlNode *node,
652 wxObject *parent, wxObject *instance = NULL);
653
654 // helper
655 wxFileSystem& GetCurFileSystem();
656};
657
658
659//----------------------------------------------------------------------
d56cebe7
RD
660//----------------------------------------------------------------------
661
662%init %{
663
664 wxClassInfo::CleanUpClasses();
665 wxClassInfo::InitializeClasses();
666
d56cebe7 667 wxXmlInitResourceModule();
ce914f73 668 wxXmlResource::Get()->InitAllHandlers();
d56cebe7
RD
669
670%}
671
ce914f73
RD
672//----------------------------------------------------------------------
673// This file gets appended to the shadow class file.
674//----------------------------------------------------------------------
675
676%pragma(python) include="_xrcextras.py";
677
678