Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / src / xrc / xh_fontpicker.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_fontpicker.cpp
3 // Purpose: XML resource handler for wxFontPickerCtrl
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_FONTPICKERCTRL
18
19 #include "wx/xrc/xh_fontpicker.h"
20 #include "wx/fontpicker.h"
21
22 IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler, wxXmlResourceHandler)
23
24 wxFontPickerCtrlXmlHandler::wxFontPickerCtrlXmlHandler() : wxXmlResourceHandler()
25 {
26 XRC_ADD_STYLE(wxFNTP_USE_TEXTCTRL);
27 XRC_ADD_STYLE(wxFNTP_FONTDESC_AS_LABEL);
28 XRC_ADD_STYLE(wxFNTP_USEFONT_FOR_LABEL);
29 XRC_ADD_STYLE(wxFNTP_DEFAULT_STYLE);
30 AddWindowStyles();
31 }
32
33 wxObject *wxFontPickerCtrlXmlHandler::DoCreateResource()
34 {
35 XRC_MAKE_INSTANCE(picker, wxFontPickerCtrl)
36
37 wxFont f = *wxNORMAL_FONT;
38 if (HasParam(wxT("value")))
39 f = GetFont(wxT("value"));
40
41 picker->Create(m_parentAsWindow,
42 GetID(),
43 f,
44 GetPosition(), GetSize(),
45 GetStyle(wxT("style"), wxFNTP_DEFAULT_STYLE),
46 wxDefaultValidator,
47 GetName());
48
49 SetupWindow(picker);
50
51 return picker;
52 }
53
54 bool wxFontPickerCtrlXmlHandler::CanHandle(wxXmlNode *node)
55 {
56 return IsOfClass(node, wxT("wxFontPickerCtrl"));
57 }
58
59 #endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL