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