Merge in from trunk r68684 - r69046
[wxWidgets.git] / src / xrc / xh_sttxt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_sttxt.cpp
3 // Purpose: XRC resource for wxStaticText
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 /////////////////////////////////////////////////////////////////////////////
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_STATTEXT
19
20 #include "wx/xrc/xh_sttxt.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/stattext.h"
24 #endif
25
26 IMPLEMENT_DYNAMIC_CLASS(wxStaticTextXmlHandler, wxXmlResourceHandler)
27
28 wxStaticTextXmlHandler::wxStaticTextXmlHandler()
29 : wxXmlResourceHandler()
30 {
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);
35 AddWindowStyles();
36 }
37
38 wxObject *wxStaticTextXmlHandler::DoCreateResource()
39 {
40 XRC_MAKE_INSTANCE(text, wxStaticText)
41
42 text->Create(m_parentAsWindow,
43 GetID(),
44 GetText(wxT("label")),
45 GetPosition(), GetSize(),
46 GetStyle(),
47 GetName());
48
49 SetupWindow(text);
50
51 long wrap = GetLong(wxT("wrap"), -1);
52 if (wrap != -1)
53 text->Wrap(wrap);
54
55 return text;
56 }
57
58 bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
59 {
60 return IsOfClass(node, wxT("wxStaticText"));
61 }
62
63 #endif // wxUSE_XRC && wxUSE_STATTEXT