]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/xrc/xh_clrpicker.cpp
Don't crash if XRC file contains '_' at the end of a string.
[wxWidgets.git] / src / xrc / xh_clrpicker.cpp
... / ...
CommitLineData
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// 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_COLOURPICKERCTRL
19
20#include "wx/xrc/xh_clrpicker.h"
21#include "wx/clrpicker.h"
22
23IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrlXmlHandler, wxXmlResourceHandler)
24
25wxColourPickerCtrlXmlHandler::wxColourPickerCtrlXmlHandler() : wxXmlResourceHandler()
26{
27 XRC_ADD_STYLE(wxCLRP_USE_TEXTCTRL);
28 XRC_ADD_STYLE(wxCLRP_SHOW_LABEL);
29 XRC_ADD_STYLE(wxCLRP_DEFAULT_STYLE);
30 AddWindowStyles();
31}
32
33wxObject *wxColourPickerCtrlXmlHandler::DoCreateResource()
34{
35 XRC_MAKE_INSTANCE(picker, wxColourPickerCtrl)
36
37 picker->Create(m_parentAsWindow,
38 GetID(),
39 GetColour(wxT("value"), *wxBLACK),
40 GetPosition(), GetSize(),
41 GetStyle(wxT("style"), wxCLRP_DEFAULT_STYLE),
42 wxDefaultValidator,
43 GetName());
44
45 SetupWindow(picker);
46
47 return picker;
48}
49
50bool wxColourPickerCtrlXmlHandler::CanHandle(wxXmlNode *node)
51{
52 return IsOfClass(node, wxT("wxColourPickerCtrl"));
53}
54
55#endif // wxUSE_XRC && wxUSE_COLOURPICKERCTRL