1 How to add a new XRC handler
2 ============================
7 This note describes what needs to be done to add a new XRC handler, i.e. add
8 support for loading the objects of some class wxFoo from XRC.
11 1. Implement the handler
12 ------------------------
14 By convention, the XRC handler for a class wxFoo declared in wx/foo.h is called
15 wxFooXmlHandler and is declared in the file wx/xrc/xh_foo.h (this last rule
16 wasn't always respected in the past, however it's not a reason to not respect
17 it in the future). The steps for adding a new handler are:
19 a) 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.
24 b) 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.
29 2. Update the other files
30 -------------------------
32 There are a few other files to update to make wxWidgets aware of the new
35 a) Add the new files created above to build/bakefiles/files.bkl: search for
36 "xh_srchctrl" to see where you need to add them
38 b) Add #include "wx/xrc/xh_foo.h" to wx/xrc/xh_all.h.
40 c) Register the new handler in wxXmlResource::InitAllHandlers() in
47 Demonstrate that the new handler works by adding a control using it to
48 samples/xrc/rc/controls.xrc.