]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_text.cpp
give the file name in the error message about failed Unicode conversion
[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 // 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_AUTO_SCROLL);
32 XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
33 XRC_ADD_STYLE(wxTE_PROCESS_TAB);
34 XRC_ADD_STYLE(wxTE_MULTILINE);
35 XRC_ADD_STYLE(wxTE_PASSWORD);
36 XRC_ADD_STYLE(wxTE_READONLY);
37 XRC_ADD_STYLE(wxHSCROLL);
38 XRC_ADD_STYLE(wxTE_RICH);
39 XRC_ADD_STYLE(wxTE_RICH2);
40 XRC_ADD_STYLE(wxTE_AUTO_URL);
41 XRC_ADD_STYLE(wxTE_NOHIDESEL);
42 XRC_ADD_STYLE(wxTE_LEFT);
43 XRC_ADD_STYLE(wxTE_CENTRE);
44 XRC_ADD_STYLE(wxTE_RIGHT);
45 XRC_ADD_STYLE(wxTE_DONTWRAP);
46 #if WXWIN_COMPATIBILITY_2_6
47 XRC_ADD_STYLE(wxTE_LINEWRAP);
48 #endif // WXWIN_COMPATIBILITY_2_6
49 XRC_ADD_STYLE(wxTE_CHARWRAP);
50 XRC_ADD_STYLE(wxTE_WORDWRAP);
51 AddWindowStyles();
52 }
53
54 wxObject *wxTextCtrlXmlHandler::DoCreateResource()
55 {
56 XRC_MAKE_INSTANCE(text, wxTextCtrl)
57
58 text->Create(m_parentAsWindow,
59 GetID(),
60 GetText(wxT("value")),
61 GetPosition(), GetSize(),
62 GetStyle(),
63 wxDefaultValidator,
64 GetName());
65
66 SetupWindow(text);
67
68 if (HasParam(wxT("maxlength")))
69 text->SetMaxLength(GetLong(wxT("maxlength")));
70
71 return text;
72 }
73
74 bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
75 {
76 return IsOfClass(node, wxT("wxTextCtrl"));
77 }
78
79 #endif // wxUSE_XRC && wxUSE_TEXTCTRL