]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_sttxt.cpp
fix crash which happened if you called SetAttr(NULL) followed by SetAttr(attr) (...
[wxWidgets.git] / src / xrc / xh_sttxt.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
ccdc11bb 2// Name: src/xrc/xh_sttxt.cpp
b5d6954b 3// Purpose: XRC resource for wxStaticText
78d14f80
VS
4// Author: Bob Mitchell
5// Created: 2000/03/21
6// RCS-ID: $Id$
7// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
f80ea77b 10
78d14f80
VS
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
ccdc11bb 18#if wxUSE_XRC && wxUSE_STATTEXT
a1e4ec87 19
78d14f80 20#include "wx/xrc/xh_sttxt.h"
ccdc11bb
WS
21
22#ifndef WX_PRECOMP
23 #include "wx/stattext.h"
24#endif
78d14f80 25
854e189f
VS
26IMPLEMENT_DYNAMIC_CLASS(wxStaticTextXmlHandler, wxXmlResourceHandler)
27
f80ea77b
WS
28wxStaticTextXmlHandler::wxStaticTextXmlHandler()
29: wxXmlResourceHandler()
78d14f80 30{
544fee32
VS
31 XRC_ADD_STYLE(wxST_NO_AUTORESIZE);
32 XRC_ADD_STYLE(wxALIGN_LEFT);
33 XRC_ADD_STYLE(wxALIGN_RIGHT);
34 XRC_ADD_STYLE(wxALIGN_CENTRE);
78d14f80
VS
35 AddWindowStyles();
36}
37
38wxObject *wxStaticTextXmlHandler::DoCreateResource()
f80ea77b 39{
544fee32 40 XRC_MAKE_INSTANCE(text, wxStaticText)
f2588180
VS
41
42 text->Create(m_parentAsWindow,
ccdc11bb
WS
43 GetID(),
44 GetText(wxT("label")),
45 GetPosition(), GetSize(),
46 GetStyle(),
47 GetName());
f2588180 48
78d14f80 49 SetupWindow(text);
f80ea77b 50
30aaee95
RD
51 long wrap = GetLong(wxT("wrap"), -1);
52 if (wrap != -1)
53 text->Wrap(wrap);
54
78d14f80
VS
55 return text;
56}
57
78d14f80
VS
58bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
59{
60 return IsOfClass(node, wxT("wxStaticText"));
61}
a1e4ec87 62
ccdc11bb 63#endif // wxUSE_XRC && wxUSE_STATTEXT