]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_clrpicker.cpp
XRC spec: relax requirements on some commonly omitted properties.
[wxWidgets.git] / src / xrc / xh_clrpicker.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_clrpicker.cpp
3 // Purpose: XML resource handler for wxColourPickerCtrl
4 // Author: Francesco Montorsi
5 // Created: 2006-04-17
6 // Copyright: (c) 2006 Francesco Montorsi
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC && wxUSE_COLOURPICKERCTRL
18
19 #include "wx/xrc/xh_clrpicker.h"
20 #include "wx/clrpicker.h"
21
22 IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler, wxXmlResourceHandler)
23
24 wxColourPickerCtrlXmlHandler::wxColourPickerCtrlXmlHandler() : wxXmlResourceHandler()
25 {
26 XRC_ADD_STYLE(wxCLRP_USE_TEXTCTRL);
27 XRC_ADD_STYLE(wxCLRP_SHOW_LABEL);
28 XRC_ADD_STYLE(wxCLRP_DEFAULT_STYLE);
29 AddWindowStyles();
30 }
31
32 wxObject *wxColourPickerCtrlXmlHandler::DoCreateResource()
33 {
34 XRC_MAKE_INSTANCE(picker, wxColourPickerCtrl)
35
36 picker->Create(m_parentAsWindow,
37 GetID(),
38 GetColour(wxT("value"), *wxBLACK),
39 GetPosition(), GetSize(),
40 GetStyle(wxT("style"), wxCLRP_DEFAULT_STYLE),
41 wxDefaultValidator,
42 GetName());
43
44 SetupWindow(picker);
45
46 return picker;
47 }
48
49 bool wxColourPickerCtrlXmlHandler::CanHandle(wxXmlNode *node)
50 {
51 return IsOfClass(node, wxT("wxColourPickerCtrl"));
52 }
53
54 #endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL