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