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