]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_text.cpp
Don't document wxSortedArrayString as deriving from wxArrayString.
[wxWidgets.git] / src / xrc / xh_text.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_text.cpp
3 // Purpose: XRC resource for wxTextCtrl
4 // Author: Aleksandras Gluchovas
5 // Created: 2000/03/21
6 // Copyright: (c) 2000 Aleksandras Gluchovas
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_TEXTCTRL
18
19 #include "wx/xrc/xh_text.h"
20
21 #ifndef WX_PRECOMP
22 #include "wx/textctrl.h"
23 #endif
24
25 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrlXmlHandler, wxXmlResourceHandler)
26
27 wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
28 {
29 XRC_ADD_STYLE(wxTE_NO_VSCROLL);
30 XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
31 XRC_ADD_STYLE(wxTE_PROCESS_TAB);
32 XRC_ADD_STYLE(wxTE_MULTILINE);
33 XRC_ADD_STYLE(wxTE_PASSWORD);
34 XRC_ADD_STYLE(wxTE_READONLY);
35 XRC_ADD_STYLE(wxHSCROLL);
36 XRC_ADD_STYLE(wxTE_RICH);
37 XRC_ADD_STYLE(wxTE_RICH2);
38 XRC_ADD_STYLE(wxTE_AUTO_URL);
39 XRC_ADD_STYLE(wxTE_NOHIDESEL);
40 XRC_ADD_STYLE(wxTE_LEFT);
41 XRC_ADD_STYLE(wxTE_CENTRE);
42 XRC_ADD_STYLE(wxTE_RIGHT);
43 XRC_ADD_STYLE(wxTE_DONTWRAP);
44 #if WXWIN_COMPATIBILITY_2_6
45 XRC_ADD_STYLE(wxTE_LINEWRAP);
46 #endif // WXWIN_COMPATIBILITY_2_6
47 XRC_ADD_STYLE(wxTE_CHARWRAP);
48 XRC_ADD_STYLE(wxTE_WORDWRAP);
49
50 // this style doesn't exist since wx 2.9.0 but we still support it (by
51 // ignoring it silently) in XRC files to avoid unimportant warnings when
52 // using XRC produced by old tools
53 AddStyle(wxT("wxTE_AUTO_SCROLL"), 0);
54
55 AddWindowStyles();
56 }
57
58 wxObject *wxTextCtrlXmlHandler::DoCreateResource()
59 {
60 XRC_MAKE_INSTANCE(text, wxTextCtrl)
61
62 text->Create(m_parentAsWindow,
63 GetID(),
64 GetText(wxT("value")),
65 GetPosition(), GetSize(),
66 GetStyle(),
67 wxDefaultValidator,
68 GetName());
69
70 SetupWindow(text);
71
72 if (HasParam(wxT("maxlength")))
73 text->SetMaxLength(GetLong(wxT("maxlength")));
74
75 return text;
76 }
77
78 bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
79 {
80 return IsOfClass(node, wxT("wxTextCtrl"));
81 }
82
83 #endif // wxUSE_XRC && wxUSE_TEXTCTRL