]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_text.cpp
fix building with WXWIN_COMPATIBILITY_2_8 == 0
[wxWidgets.git] / src / xrc / xh_text.cpp
CommitLineData
78d14f80 1/////////////////////////////////////////////////////////////////////////////
40ff126a 2// Name: src/xrc/xh_text.cpp
b5d6954b 3// Purpose: XRC resource for wxTextCtrl
78d14f80
VS
4// Author: Aleksandras Gluchovas
5// Created: 2000/03/21
78d14f80
VS
6// Copyright: (c) 2000 Aleksandras Gluchovas
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
f80ea77b 9
78d14f80
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14 #pragma hdrstop
15#endif
16
fec9cc08 17#if wxUSE_XRC && wxUSE_TEXTCTRL
a1e4ec87 18
78d14f80 19#include "wx/xrc/xh_text.h"
fec9cc08
WS
20
21#ifndef WX_PRECOMP
22 #include "wx/textctrl.h"
23#endif
78d14f80 24
854e189f
VS
25IMPLEMENT_DYNAMIC_CLASS(wxTextCtrlXmlHandler, wxXmlResourceHandler)
26
f80ea77b 27wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
78d14f80 28{
a1c7668e 29 XRC_ADD_STYLE(wxTE_NO_VSCROLL);
544fee32
VS
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);
df93d8ba
VS
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);
40ff126a 44#if WXWIN_COMPATIBILITY_2_6
df93d8ba 45 XRC_ADD_STYLE(wxTE_LINEWRAP);
40ff126a
WS
46#endif // WXWIN_COMPATIBILITY_2_6
47 XRC_ADD_STYLE(wxTE_CHARWRAP);
df93d8ba 48 XRC_ADD_STYLE(wxTE_WORDWRAP);
053ac76f
VZ
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
9a83f860 53 AddStyle(wxT("wxTE_AUTO_SCROLL"), 0);
053ac76f 54
78d14f80
VS
55 AddWindowStyles();
56}
57
58wxObject *wxTextCtrlXmlHandler::DoCreateResource()
f80ea77b 59{
544fee32 60 XRC_MAKE_INSTANCE(text, wxTextCtrl)
f2588180 61
544fee32
VS
62 text->Create(m_parentAsWindow,
63 GetID(),
64 GetText(wxT("value")),
65 GetPosition(), GetSize(),
66 GetStyle(),
67 wxDefaultValidator,
68 GetName());
f2588180 69
78d14f80 70 SetupWindow(text);
f80ea77b 71
d09aa882
JS
72 if (HasParam(wxT("maxlength")))
73 text->SetMaxLength(GetLong(wxT("maxlength")));
74
78d14f80
VS
75 return text;
76}
77
78d14f80
VS
78bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
79{
80 return IsOfClass(node, wxT("wxTextCtrl"));
81}
a1e4ec87 82
fec9cc08 83#endif // wxUSE_XRC && wxUSE_TEXTCTRL