]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_sttxt.cpp
XRC spec: document wxRibbon* XRC handler.
[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 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC && wxUSE_STATTEXT
18
19 #include "wx/xrc/xh_sttxt.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/stattext.h"
23 #endif
24
25 IMPLEMENT_DYNAMIC_CLASS(wxStaticTextXmlHandler, wxXmlResourceHandler)
26
27 wxStaticTextXmlHandler::wxStaticTextXmlHandler()
28 : wxXmlResourceHandler()
29 {
30 XRC_ADD_STYLE(wxST_NO_AUTORESIZE);
31 XRC_ADD_STYLE(wxALIGN_LEFT);
32 XRC_ADD_STYLE(wxALIGN_RIGHT);
33 XRC_ADD_STYLE(wxALIGN_CENTRE);
34 AddWindowStyles();
35 }
36
37 wxObject *wxStaticTextXmlHandler::DoCreateResource()
38 {
39 XRC_MAKE_INSTANCE(text, wxStaticText)
40
41 text->Create(m_parentAsWindow,
42 GetID(),
43 GetText(wxT("label")),
44 GetPosition(), GetSize(),
45 GetStyle(),
46 GetName());
47
48 SetupWindow(text);
49
50 long wrap = GetDimension(wxT("wrap"), -1);
51 if (wrap != -1)
52 text->Wrap(wrap);
53
54 return text;
55 }
56
57 bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
58 {
59 return IsOfClass(node, wxT("wxStaticText"));
60 }
61
62 #endif // wxUSE_XRC && wxUSE_STATTEXT