]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/xrc/xmlres.h
Fix html documentation warnings.
[wxWidgets.git] / interface / wx / xrc / xmlres.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: xrc/xmlres.h
e54c96f1 3// Purpose: interface of wxXmlResource
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
18e8e19b
FM
8/**
9 Flags which can be used with wxXmlResource::wxXmlResource.
10*/
11enum wxXmlResourceFlags
12{
13 /** Translatable strings will be translated via _(). */
14 wxXRC_USE_LOCALE = 1,
15
16 /** Subclass property of object nodes will be ignored (useful for previews in XRC editors). */
17 wxXRC_NO_SUBCLASSING = 2,
18
19 /** Prevent the XRC files from being reloaded from disk in case they have been modified there
20 since being last loaded (may slightly speed up loading them). */
21 wxXRC_NO_RELOADING = 4
22};
23
24
23324ae1
FM
25/**
26 @class wxXmlResource
7c913512 27
23324ae1 28 This is the main class for interacting with the XML-based resource system.
7c913512 29
23324ae1
FM
30 The class holds XML resources from one or more .xml files, binary files or zip
31 archive files.
7c913512 32
336aecf1
FM
33 Note that this is a singleton class and you'll never allocate/deallocate it.
34 Just use the static wxXmlResource::Get() getter.
35
41e69d79 36 @see @ref overview_xrc, @ref overview_xrcformat
7c913512 37
23324ae1
FM
38 @library{wxxrc}
39 @category{xrc}
40*/
41class wxXmlResource : public wxObject
42{
43public:
23324ae1
FM
44 /**
45 Constructor.
f41d6c8c 46
18e8e19b
FM
47 @param filemask
48 The XRC file, archive file, or wildcard specification that will be
49 used to load all resource files inside a zip archive.
7c913512 50 @param flags
18e8e19b 51 One or more value of the ::wxXmlResourceFlags enumeration.
7c913512 52 @param domain
18e8e19b
FM
53 The name of the gettext catalog to search for translatable strings.
54 By default all loaded catalogs will be searched.
55 This provides a way to allow the strings to only come from a specific catalog.
23324ae1
FM
56 */
57 wxXmlResource(const wxString& filemask,
58 int flags = wxXRC_USE_LOCALE,
cfbe5614 59 const wxString& domain = wxEmptyString);
76e9224e
FM
60
61 /**
62 Constructor.
63
64 @param flags
65 One or more value of the ::wxXmlResourceFlags enumeration.
66 @param domain
67 The name of the gettext catalog to search for translatable strings.
68 By default all loaded catalogs will be searched.
69 This provides a way to allow the strings to only come from a specific catalog.
70 */
7c913512 71 wxXmlResource(int flags = wxXRC_USE_LOCALE,
cfbe5614 72 const wxString& domain = wxEmptyString);
23324ae1
FM
73
74 /**
75 Destructor.
76 */
adaaa686 77 virtual ~wxXmlResource();
23324ae1
FM
78
79 /**
18e8e19b
FM
80 Initializes only a specific handler (or custom handler).
81 Convention says that the handler name is equal to the control's name plus
82 'XmlHandler', for example wxTextCtrlXmlHandler, wxHtmlWindowXmlHandler.
83
84 The XML resource compiler (wxxrc) can create include file that contains
85 initialization code for all controls used within the resource.
86 Note that this handler must be allocated on the heap, since it will be
87 deleted by ClearHandlers() later.
23324ae1
FM
88 */
89 void AddHandler(wxXmlResourceHandler* handler);
90
c1bd5a6d
RD
91 /**
92 Add a new handler at the begining of the handler list.
93 */
94 void InsertHandler(wxXmlResourceHandler *handler);
95
96
23324ae1
FM
97 /**
98 Attaches an unknown control to the given panel/window/dialog.
18e8e19b 99 Unknown controls are used in conjunction with \<object class="unknown"\>.
23324ae1
FM
100 */
101 bool AttachUnknownControl(const wxString& name,
102 wxWindow* control,
4cc4bfaf 103 wxWindow* parent = NULL);
23324ae1
FM
104
105 /**
18e8e19b
FM
106 Removes all handlers and deletes them (this means that any handlers
107 added using AddHandler() must be allocated on the heap).
23324ae1
FM
108 */
109 void ClearHandlers();
110
c1bd5a6d
RD
111 /**
112 Registers subclasses factory for use in XRC. This is useful only for
113 language bindings developers who need a way to implement subclassing in
114 wxWidgets ports that don't support wxRTTI (e.g. wxPython).
115 */
116 static void AddSubclassFactory(wxXmlSubclassFactory *factory);
117
118
23324ae1 119 /**
18e8e19b
FM
120 Compares the XRC version to the argument.
121
122 Returns -1 if the XRC version is less than the argument,
123 +1 if greater, and 0 if they are equal.
23324ae1 124 */
18e8e19b 125 int CompareVersion(int major, int minor, int release, int revision) const;
23324ae1 126
cc378c2d
VZ
127 /**
128 Returns a string ID corresponding to the given numeric ID.
129
130 The string returned is such that calling GetXRCID() with it as
131 parameter yields @a numId. If there is no string identifier
132 corresponding to the given numeric one, an empty string is returned.
133
134 Notice that, unlike GetXRCID(), this function is slow as it checks all
135 of the identifiers used in XRC.
136
137 @since 2.9.0
138 */
ebd75440 139 static wxString FindXRCIDById(int numId);
cc378c2d 140
23324ae1
FM
141 /**
142 Gets the global resources object or creates one if none exists.
143 */
adaaa686 144 static wxXmlResource* Get();
23324ae1
FM
145
146 /**
147 Returns the domain (message catalog) that will be used to load
148 translatable strings in the XRC.
149 */
95b4a59e 150 const wxString& GetDomain() const;
23324ae1
FM
151
152 /**
18e8e19b
FM
153 Returns flags, which may be a bitlist of ::wxXmlResourceFlags
154 enumeration values.
23324ae1 155 */
adaaa686 156 int GetFlags() const;
23324ae1 157
23239d94
VZ
158 /**
159 Returns the wxXmlNode containing the definition of the object with the
160 given name or @NULL.
161
162 This function recursively searches all the loaded XRC files for an
163 object with the specified @a name. If the object is found, the
164 wxXmlNode corresponding to it is returned, so this function can be used
165 to access additional information defined in the XRC file and not used
166 by wxXmlResource itself, e.g. contents of application-specific XML
167 tags.
168
169 @param name
170 The name of the resource which must be unique for this function to
171 work correctly, if there is more than one resource with the given
172 name the choice of the one returned by this function is undefined.
173 @return
174 The node corresponding to the resource with the given name or @NULL.
175 */
176 const wxXmlNode *GetResourceNode(const wxString& name) const;
177
23324ae1 178 /**
18e8e19b 179 Returns version information (a.b.c.d = d + 256*c + 2562*b + 2563*a).
23324ae1 180 */
328f5751 181 long GetVersion() const;
23324ae1
FM
182
183 /**
18e8e19b
FM
184 Returns a numeric ID that is equivalent to the string ID used in an XML resource.
185
186 If an unknown @a str_id is requested (i.e. other than wxID_XXX or integer),
187 a new record is created which associates the given string with a number.
188
189 If @a value_if_not_found is @c wxID_NONE, the number is obtained via
e54c96f1 190 wxNewId(). Otherwise @a value_if_not_found is used.
e3c3dfb4 191
23324ae1 192 Macro @c XRCID(name) is provided for convenient use in event tables.
e3c3dfb4
VS
193
194 @note IDs returned by XRCID() cannot be used with the <tt>EVT_*_RANGE</tt>
195 macros, because the order in which they are assigned to symbolic @a name
196 values is not guaranteed.
23324ae1 197 */
18e8e19b 198 static int GetXRCID(const wxString& str_id, int value_if_not_found = wxID_NONE);
23324ae1
FM
199
200 /**
18e8e19b
FM
201 Initializes handlers for all supported controls/windows.
202
203 This will make the executable quite big because it forces linking against
23324ae1
FM
204 most of the wxWidgets library.
205 */
206 void InitAllHandlers();
207
208 /**
209 Loads resources from XML files that match given filemask.
336aecf1
FM
210
211 Example:
212 @code
213 if (!wxXmlResource::Get()->Load("rc/*.xrc"))
214 wxLogError("Couldn't load resources!");
215 @endcode
216
04ae32cd
VS
217 @note
218 If wxUSE_FILESYS is enabled, this method understands wxFileSystem URLs
219 (see wxFileSystem::FindFirst()).
220
221 @note
222 If you are sure that the argument is name of single XRC file (rather
223 than an URL or a wildcard), use LoadFile() instead.
224
2bb9a404 225 @see LoadFile(), LoadAllFiles()
23324ae1
FM
226 */
227 bool Load(const wxString& filemask);
228
04ae32cd
VS
229 /**
230 Simpler form of Load() for loading a single XRC file.
231
232 @since 2.9.0
233
2bb9a404 234 @see Load(), LoadAllFiles()
04ae32cd
VS
235 */
236 bool LoadFile(const wxFileName& file);
237
2bb9a404
VS
238 /**
239 Loads all .xrc files from directory @a dirname.
240
241 Tries to load as many files as possible; if there's an error while
242 loading one file, it still attempts to load other files.
243
244 @since 2.9.0
245
246 @see LoadFile(), Load()
247 */
248 bool LoadAllFiles(const wxString& dirname);
249
23324ae1
FM
250 /**
251 Loads a bitmap resource from a file.
252 */
253 wxBitmap LoadBitmap(const wxString& name);
254
23324ae1 255 /**
18e8e19b
FM
256 Loads a dialog. @a parent points to parent window (if any).
257 */
258 wxDialog* LoadDialog(wxWindow* parent, const wxString& name);
259
260 /**
261 Loads a dialog. @a parent points to parent window (if any).
262
23324ae1 263 This form is used to finish creation of an already existing instance (the main
18e8e19b 264 reason for this is that you may want to use derived class with a new event table).
23324ae1 265 Example:
18e8e19b
FM
266
267 @code
268 MyDialog dlg;
336aecf1 269 wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
18e8e19b
FM
270 dlg.ShowModal();
271 @endcode
23324ae1 272 */
18e8e19b 273 bool LoadDialog(wxDialog* dlg, wxWindow* parent, const wxString& name);
23324ae1
FM
274
275 /**
c1bd5a6d
RD
276 Loads a frame from the resource. @a parent points to parent window (if any).
277 */
278 wxFrame *LoadFrame(wxWindow* parent, const wxString& name);
279
280 /**
281 Loads the contents of a frame onto an existing wxFrame.
282
283 This form is used to finish creation of an already existing instance
284 (the main reason for this is that you may want to use derived class
285 with a new event table).
23324ae1
FM
286 */
287 bool LoadFrame(wxFrame* frame, wxWindow* parent,
288 const wxString& name);
289
290 /**
291 Loads an icon resource from a file.
292 */
293 wxIcon LoadIcon(const wxString& name);
294
295 /**
296 Loads menu from resource. Returns @NULL on failure.
297 */
298 wxMenu* LoadMenu(const wxString& name);
299
300 //@{
301 /**
302 Loads a menubar from resource. Returns @NULL on failure.
303 */
304 wxMenuBar* LoadMenuBar(wxWindow* parent, const wxString& name);
7c913512 305 wxMenuBar* LoadMenuBar(const wxString& name);
23324ae1
FM
306 //@}
307
308 //@{
309 /**
310 Load an object from the resource specifying both the resource name and the
311 class name.
18e8e19b
FM
312
313 The first overload lets you load nonstandard container windows and returns
314 @NULL on failure. The second one lets you finish the creation of an existing
23324ae1 315 instance and returns @false on failure.
af0ac990
VZ
316
317 In either case, only the resources defined at the top level of XRC
318 files can be loaded by this function, use LoadObjectRecursively() if
319 you need to load an object defined deeper in the hierarchy.
23324ae1
FM
320 */
321 wxObject* LoadObject(wxWindow* parent, const wxString& name,
322 const wxString& classname);
7c913512
FM
323 bool LoadObject(wxObject* instance, wxWindow* parent,
324 const wxString& name,
325 const wxString& classname);
23324ae1
FM
326 //@}
327
af0ac990
VZ
328 //@{
329 /**
330 Load an object from anywhere in the resource tree.
331
332 These methods are similar to LoadObject() but may be used to load an
333 object from anywhere in the resource tree and not only the top level.
334 Note that you will very rarely need to do this as in normal use the
335 entire container window (defined at the top level) is loaded and not
336 its individual children but this method can be useful in some
337 particular situations.
338
339 @since 2.9.1
340 */
341 wxObject* LoadObjectRecursively(wxWindow* parent,
342 const wxString& name,
343 const wxString& classname);
344 bool LoadObjectRecursively(wxObject* instance, wxWindow* parent,
345 const wxString& name,
346 const wxString& classname);
347 //@}
348
23324ae1 349 /**
e64cadcb 350 Loads a panel. @a parent points to the parent window.
23324ae1
FM
351 */
352 wxPanel* LoadPanel(wxWindow* parent, const wxString& name);
18e8e19b
FM
353
354 /**
e64cadcb 355 Loads a panel. @a parent points to the parent window.
18e8e19b
FM
356 This form is used to finish creation of an already existing instance.
357 */
358 bool LoadPanel(wxPanel* panel, wxWindow* parent, const wxString& name);
23324ae1
FM
359
360 /**
361 Loads a toolbar.
362 */
363 wxToolBar* LoadToolBar(wxWindow* parent, const wxString& name);
364
365 /**
18e8e19b
FM
366 Sets the global resources object and returns a pointer to the previous one
367 (may be @NULL).
23324ae1 368 */
adaaa686 369 static wxXmlResource* Set(wxXmlResource* res);
23324ae1
FM
370
371 /**
372 Sets the domain (message catalog) that will be used to load
373 translatable strings in the XRC.
374 */
95b4a59e 375 void SetDomain(const wxString& domain);
23324ae1
FM
376
377 /**
18e8e19b 378 Sets flags (bitlist of ::wxXmlResourceFlags enumeration values).
23324ae1
FM
379 */
380 void SetFlags(int flags);
381
382 /**
18e8e19b
FM
383 This function unloads a resource previously loaded by Load().
384
23324ae1 385 Returns @true if the resource was successfully unloaded and @false if it
18e8e19b 386 hasn't been found in the list of loaded resources.
23324ae1
FM
387 */
388 bool Unload(const wxString& filename);
819559b2
VS
389
390protected:
391 /**
392 Reports error in XRC resources to the user.
393
394 Any errors in XRC input files should be reported using this method
395 (or its wxXmlResourceHandler::ReportError() equivalent). Unlike
396 wxLogError(), this method presents the error to the user in a more
397 usable form. In particular, the output is compiler-like and contains
398 information about the exact location of the error.
399
400 @param context XML node the error occurred in or relates to. This can
401 be @NULL, but should be the most specific node possible,
402 as its line number is what is reported to the user.
403 @param message Text of the error message. This string should always
404 be in English (i.e. not wrapped in _()). It shouldn't
405 be a sentence -- it should start with lower-case letter
406 and shouldn't have a trailing period or exclamation
407 point.
408
409 @since 2.9.0
410
411 @see wxXmlResourceHandler::ReportError(), DoReportError()
412 */
1f6ea935 413 void ReportError(const wxXmlNode *context, const wxString& message);
819559b2
VS
414
415 /**
416 Implementation of XRC resources errors reporting.
417
418 This method is called by ReportError() and shouldn't be called
419 directly; use ReportError() or wxXmlResourceHandler::ReportError()
420 to log errors.
421
422 Default implementation uses wxLogError().
423
424 @param xrcFile File the error occurred in or empty string if it
425 couldn't be determined.
426 @param position XML node where the error occurred or @NULL if it
427 couldn't be determined.
428 @param message Text of the error message. See ReportError()
429 documentation for details of the string's format.
430
431 @note
432 You may override this method in a derived class to customize errors
433 reporting. If you do so, you'll need to either use the derived class
434 in all your code or call wxXmlResource::Set() to change the global
435 wxXmlResource instance to your class.
436
437 @since 2.9.0
438
439 @see ReportError()
440 */
1f6ea935 441 virtual void DoReportError(const wxString& xrcFile, const wxXmlNode *position,
819559b2 442 const wxString& message);
23324ae1
FM
443};
444
445
e54c96f1 446
23324ae1
FM
447/**
448 @class wxXmlResourceHandler
7c913512 449
23324ae1
FM
450 wxXmlResourceHandler is an abstract base class for resource handlers
451 capable of creating a control from an XML node.
7c913512 452
f41d6c8c 453 See @ref overview_xrc for details.
7c913512 454
23324ae1
FM
455 @library{wxxrc}
456 @category{xrc}
457*/
458class wxXmlResourceHandler : public wxObject
459{
460public:
461 /**
462 Default constructor.
463 */
464 wxXmlResourceHandler();
465
466 /**
467 Destructor.
468 */
adaaa686 469 virtual ~wxXmlResourceHandler();
23324ae1
FM
470
471 /**
95b4a59e
FM
472 Creates an object (menu, dialog, control, ...) from an XML node.
473 Should check for validity. @a parent is a higher-level object
474 (usually window, dialog or panel) that is often necessary to
475 create the resource.
476
477 If @b instance is non-@NULL it should not create a new instance via
478 'new' but should rather use this one, and call its Create method.
23324ae1 479 */
95b4a59e
FM
480 wxObject* CreateResource(wxXmlNode* node, wxObject* parent,
481 wxObject* instance);
23324ae1
FM
482
483 /**
95b4a59e 484 Called from CreateResource after variables were filled.
23324ae1 485 */
95b4a59e 486 virtual wxObject* DoCreateResource() = 0;
23324ae1
FM
487
488 /**
489 Returns @true if it understands this node and can create
490 a resource from it, @false otherwise.
18e8e19b
FM
491
492 @note
493 You must not call any wxXmlResourceHandler methods except IsOfClass()
494 from this method! The instance is not yet initialized with node data
495 at the time CanHandle() is called and it is only safe to operate on
496 node directly or to call IsOfClass().
23324ae1 497 */
95b4a59e
FM
498 virtual bool CanHandle(wxXmlNode* node) = 0;
499
500 /**
501 Sets the parent resource.
502 */
503 void SetParentResource(wxXmlResource* res);
504
505
506protected:
507
508 /**
509 Add a style flag (e.g. @c wxMB_DOCKABLE) to the list of flags
510 understood by this handler.
511 */
512 void AddStyle(const wxString& name, int value);
513
514 /**
515 Add styles common to all wxWindow-derived classes.
516 */
517 void AddWindowStyles();
23324ae1
FM
518
519 /**
520 Creates children.
521 */
4cc4bfaf 522 void CreateChildren(wxObject* parent, bool this_hnd_only = false);
23324ae1
FM
523
524 /**
525 Helper function.
526 */
527 void CreateChildrenPrivately(wxObject* parent,
4cc4bfaf 528 wxXmlNode* rootnode = NULL);
23324ae1
FM
529
530 /**
531 Creates a resource from a node.
532 */
533 wxObject* CreateResFromNode(wxXmlNode* node, wxObject* parent,
4cc4bfaf 534 wxObject* instance = NULL);
23324ae1 535
23324ae1 536 /**
18e8e19b 537 Creates an animation (see wxAnimation) from the filename specified in @a param.
23324ae1 538 */
c6f41dc8 539 wxAnimation* GetAnimation(const wxString& param = "animation");
23324ae1
FM
540
541 /**
23324ae1
FM
542 Gets a bitmap.
543 */
95b4a59e
FM
544 wxBitmap GetBitmap(const wxString& param = "bitmap",
545 const wxArtClient& defaultArtClient = wxART_OTHER,
546 wxSize size = wxDefaultSize);
326462ae
VZ
547 /**
548 Gets a bitmap from an XmlNode.
549
550 @since 2.9.1
551 */
552 wxBitmap GetBitmap(const wxXmlNode* node,
553 const wxArtClient& defaultArtClient = wxART_OTHER,
554 wxSize size = wxDefaultSize);
23324ae1
FM
555
556 /**
f41d6c8c 557 Gets a bool flag (1, t, yes, on, true are @true, everything else is @false).
23324ae1 558 */
4cc4bfaf 559 bool GetBool(const wxString& param, bool defaultv = false);
23324ae1
FM
560
561 /**
3f5506cf 562 Gets colour in HTML syntax (\#RRGGBB).
23324ae1
FM
563 */
564 wxColour GetColour(const wxString& param,
18e8e19b 565 const wxColour& defaultColour = wxNullColour);
23324ae1
FM
566
567 /**
568 Returns the current file system.
569 */
95b4a59e 570 wxFileSystem& GetCurFileSystem();
23324ae1
FM
571
572 /**
573 Gets a dimension (may be in dialog units).
574 */
95b4a59e
FM
575 wxCoord GetDimension(const wxString& param, wxCoord defaultv = 0,
576 wxWindow* windowToUse = 0);
23324ae1 577
50c20291
VZ
578 /**
579 Gets a direction.
580
581 If the given @a param is not present or has empty value, @a dir is
582 returned by default. Otherwise the value of the parameter is parsed and
583 a warning is generated if it's not one of @c wxLEFT, @c wxTOP, @c
584 wxRIGHT or @c wxBOTTOM.
585
586 @since 2.9.3
587 */
588 wxDirection GetDirection(const wxString& param, wxDirection dir = wxLEFT);
589
23324ae1 590 /**
23324ae1
FM
591 Gets a font.
592 */
95b4a59e 593 wxFont GetFont(const wxString& param = "font");
23324ae1
FM
594
595 /**
596 Returns the XRCID.
597 */
4cc4bfaf 598 int GetID();
23324ae1
FM
599
600 /**
23324ae1
FM
601 Returns an icon.
602 */
95b4a59e
FM
603 wxIcon GetIcon(const wxString& param = "icon",
604 const wxArtClient& defaultArtClient = wxART_OTHER,
605 wxSize size = wxDefaultSize);
23324ae1 606
326462ae
VZ
607 /**
608 Gets an icon from an XmlNode.
609
610 @since 2.9.1
611 */
612 wxIcon GetIcon(const wxXmlNode* node,
613 const wxArtClient& defaultArtClient = wxART_OTHER,
614 wxSize size = wxDefaultSize);
615
1c60f644
VS
616 /**
617 Returns an icon bundle.
618
619 @note
620 Bundles can be loaded either with stock IDs or from files that contain
621 more than one image (e.g. Windows icon files). If a file contains only
622 single image, a bundle with only one icon will be created.
623
624 @since 2.9.0
625 */
626 wxIconBundle GetIconBundle(const wxString& param,
627 const wxArtClient& defaultArtClient = wxART_OTHER);
628
326462ae
VZ
629 /**
630 Creates an image list from the @a param markup data.
631
632 @return
633 The new instance of wxImageList or @NULL if no data is found.
634
635 @since 2.9.1
636 */
dec0a353 637 wxImageList *GetImageList(const wxString& param = "imagelist");
326462ae 638
23324ae1
FM
639 /**
640 Gets the integer value from the parameter.
641 */
642 long GetLong(const wxString& param, long defaultv = 0);
643
548b4ce1
VZ
644 /**
645 Gets a float value from the parameter.
646 */
647 float GetFloat(const wxString& param, float defaultv = 0);
648
23324ae1
FM
649 /**
650 Returns the resource name.
651 */
652 wxString GetName();
653
654 /**
655 Gets node content from wxXML_ENTITY_NODE.
656 */
657 wxString GetNodeContent(wxXmlNode* node);
658
659 /**
660 Finds the node or returns @NULL.
661 */
662 wxXmlNode* GetParamNode(const wxString& param);
663
664 /**
665 Finds the parameter value or returns the empty string.
666 */
667 wxString GetParamValue(const wxString& param);
668
326462ae
VZ
669 /**
670 Returns the node parameter value.
671
672 @since 2.9.1
673 */
674 wxString GetParamValue(const wxXmlNode* node);
675
23324ae1 676 /**
23324ae1
FM
677 Gets the position (may be in dialog units).
678 */
f8ebb70d 679 wxPoint GetPosition(const wxString& param = "pos");
23324ae1
FM
680
681 /**
23324ae1
FM
682 Gets the size (may be in dialog units).
683 */
95b4a59e 684 wxSize GetSize(const wxString& param = "size", wxWindow* windowToUse = 0);
23324ae1
FM
685
686 /**
23324ae1 687 Gets style flags from text in form "flag | flag2| flag3 |..."
18e8e19b 688 Only understands flags added with AddStyle().
23324ae1 689 */
f8ebb70d 690 int GetStyle(const wxString& param = "style", int defaults = 0);
23324ae1
FM
691
692 /**
693 Gets text from param and does some conversions:
f41d6c8c
FM
694 - replaces \\n, \\r, \\t by respective characters (according to C syntax)
695 - replaces @c $ by @c and @c $$ by @c $ (needed for @c _File to @c File
696 translation because of XML syntax)
697 - calls wxGetTranslations (unless disabled in wxXmlResource)
23324ae1 698 */
95b4a59e 699 wxString GetText(const wxString& param, bool translate = true);
23324ae1
FM
700
701 /**
702 Check to see if a parameter exists.
703 */
704 bool HasParam(const wxString& param);
705
706 /**
18e8e19b
FM
707 Convenience function.
708 Returns @true if the node has a property class equal to classname,
23324ae1
FM
709 e.g. object class="wxDialog".
710 */
711 bool IsOfClass(wxXmlNode* node, const wxString& classname);
712
23324ae1
FM
713 /**
714 Sets common window options.
715 */
716 void SetupWindow(wxWindow* wnd);
819559b2
VS
717
718 /**
719 Reports error in XRC resources to the user.
720
721 See wxXmlResource::ReportError() for more information.
722
723 @since 2.9.0
724 */
725 void ReportError(wxXmlNode *context, const wxString& message);
726
727 /**
728 Like ReportError(wxXmlNode*, const wxString&), but uses the node
729 of currently processed object (m_node) as the context.
730
731 @since 2.9.0
732 */
733 void ReportError(const wxString& message);
734
735 /**
736 Like ReportError(wxXmlNode*, const wxString&), but uses the node
737 of parameter @a param of the currently processed object as the context.
738 This is convenience function for reporting errors in particular
739 parameters.
740
741 @since 2.9.0
742 */
743 void ReportParamError(const wxString& param, const wxString& message);
c6f41dc8
RD
744
745
746 /**
747 After CreateResource has been called this will return the current
748 wxXmlResource object.
749
750 @since 2.9.5
751 */
752 wxXmlResource* GetResource() const;
753
754 /**
755 After CreateResource has been called this will return the XML node
756 being processed.
757
758 @since 2.9.5
759 */
760 wxXmlNode* GetNode() const;
761
762 /**
763 After CreateResource has been called this will return the class name of
764 the XML resource node being processed.
765
766 @since 2.9.5
767 */
768 wxString GetClass() const;
769
770 /**
771 After CreateResource has been called this will return the current
772 item's parent, if any.
773
774 @since 2.9.5
775 */
776 wxObject* GetParent() const;
777
778 /**
779 After CreateResource has been called this will return the instance that
780 the XML resource content should be created upon, if it has already been
781 created. If @NULL then the handler should create the object itself.
782
783 @since 2.9.5
784 */
785 wxObject* GetInstance() const;
786
787 /**
788 After CreateResource has been called this will return the item's parent
789 as a wxWindow.
790
791 @since 2.9.5
792 */
793 wxWindow* GetParentAsWindow() const;
23324ae1 794};
e54c96f1 795