]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_fontpicker.cpp
Added selection API.
[wxWidgets.git] / src / xrc / xh_fontpicker.cpp
CommitLineData
ec376c8f 1/////////////////////////////////////////////////////////////////////////////
42c09d20
VS
2// Name: src/xrc/xh_fontpicker.cpp
3// Purpose: XML resource handler for wxFontPickerCtrl
ec376c8f
VZ
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
23IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrlXmlHandler, wxXmlResourceHandler)
24
25wxFontPickerCtrlXmlHandler::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
34wxObject *wxFontPickerCtrlXmlHandler::DoCreateResource()
35{
36 XRC_MAKE_INSTANCE(picker, wxFontPickerCtrl)
37
38 wxFont f = *wxNORMAL_FONT;
374caf23
VS
39 if (HasParam(wxT("value")))
40 f = GetFont(wxT("value"));
ec376c8f
VZ
41
42 picker->Create(m_parentAsWindow,
43 GetID(),
44 f,
45 GetPosition(), GetSize(),
46 GetStyle(_T("style"), wxFNTP_DEFAULT_STYLE),
47 wxDefaultValidator,
48 GetName());
49
50 SetupWindow(picker);
51
52 return picker;
53}
54
55bool wxFontPickerCtrlXmlHandler::CanHandle(wxXmlNode *node)
56{
57 return IsOfClass(node, wxT("wxFontPickerCtrl"));
58}
59
60#endif // wxUSE_XRC && wxUSE_FONTPICKERCTRL