]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_fontpicker.cpp
supporting full style mask
[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 // RCS-ID: $Id$
7 // Copyright: (c) 2006 Francesco Montorsi
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_XRC && wxUSE_FONTPICKERCTRL
19
20 #include "wx/xrc/xh_fontpicker.h"
21 #include "wx/fontpicker.h"
22
23 IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler, wxXmlResourceHandler)
24
25 wxFontPickerCtrlXmlHandler::wxFontPickerCtrlXmlHandler() : wxXmlResourceHandler()
26 {
27 XRC_ADD_STYLE(wxFNTP_USE_TEXTCTRL);
28 XRC_ADD_STYLE(wxFNTP_FONTDESC_AS_LABEL);
29 XRC_ADD_STYLE(wxFNTP_USEFONT_FOR_LABEL);
30 XRC_ADD_STYLE(wxFNTP_DEFAULT_STYLE);
31 AddWindowStyles();
32 }
33
34 wxObject *wxFontPickerCtrlXmlHandler::DoCreateResource()
35 {
36 XRC_MAKE_INSTANCE(picker, wxFontPickerCtrl)
37
38 wxFont f = *wxNORMAL_FONT;
39 if (HasParam(wxT("value")))
40 f = GetFont(wxT("value"));
41
42 picker->Create(m_parentAsWindow,
43 GetID(),
44 f,
45 GetPosition(), GetSize(),
46 GetStyle(wxT("style"), wxFNTP_DEFAULT_STYLE),
47 wxDefaultValidator,
48 GetName());
49
50 SetupWindow(picker);
51
52 return picker;
53 }
54
55 bool wxFontPickerCtrlXmlHandler::CanHandle(wxXmlNode *node)
56 {
57 return IsOfClass(node, wxT("wxFontPickerCtrl"));
58 }
59
60 #endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL