]> git.saurik.com Git - wxWidgets.git/blame - docs/tech/tn0024.txt
fixing RTTI
[wxWidgets.git] / docs / tech / tn0024.txt
CommitLineData
b0f73b67
VZ
1 How to add a new XRC handler
2 ============================
3
40. Purpose
5----------
6
7This note describes what needs to be done to add a new XRC handler, i.e. add
8support for loading the objects of some class wxFoo from XRC.
9
10
111. Implement the handler
12------------------------
13
14By convention, the XRC handler for a class wxFoo declared in wx/foo.h is called
15wxFooXmlHandler and is declared in the file wx/xrc/xh_foo.h (this last rule
16wasn't always respected in the past, however it's not a reason to not respect
17it in the future). The steps for adding a new handler are:
18
19a) Add handler declaration in include/wx/xrc/xh_foo.h, it will usually be the
20 same as in the other files so you can get inspiration for your brand new
21 handler from e.g. wx/xrc/xh_srchctrl.h. Notice the use of wxUSE_FOO if wxFoo
22 is guarded by this symbol.
23
24b) Add implementation in src/xrc/xh_foo.cpp: again, it will be almost always
25 very similar to the existing controls. You will need to add support for
26 the control-specific styles.
27
28
292. Update the other files
30-------------------------
31
32There are a few other files to update to make wxWidgets aware of the new
33handler:
34
35a) Add the new files created above to build/bakefiles/files.bkl: search for
36 "xh_srchctrl" to see where you need to add them
37
38b) Add #include "wx/xrc/xh_foo.h" to wx/xrc/xh_all.h.
39
40c) Register the new handler in wxXmlResource::InitAllHandlers() in
41 src/xrc/xmlrsall.cpp
42
43
443. Update the sample
45--------------------
46
47Demonstrate that the new handler works by adding a control using it to
48samples/xrc/rc/controls.xrc.
49
50
51=== EOF ===
52
53Author: VZ
54Version: $Id: tn0021.txt 47865 2007-08-03 20:00:32Z VZ $
55