]> git.saurik.com Git - wxWidgets.git/blame - src/xrc/xh_text.cpp
Avoid crash when trying to access m_window from wxScreenDC.
[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
VS
30 XRC_ADD_STYLE(wxTE_NO_VSCROLL);
31 XRC_ADD_STYLE(wxTE_AUTO_SCROLL);
544fee32
VS
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);
df93d8ba
VS
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);
40ff126a 46#if WXWIN_COMPATIBILITY_2_6
df93d8ba 47 XRC_ADD_STYLE(wxTE_LINEWRAP);
40ff126a
WS
48#endif // WXWIN_COMPATIBILITY_2_6
49 XRC_ADD_STYLE(wxTE_CHARWRAP);
df93d8ba 50 XRC_ADD_STYLE(wxTE_WORDWRAP);
78d14f80
VS
51 AddWindowStyles();
52}
53
54wxObject *wxTextCtrlXmlHandler::DoCreateResource()
f80ea77b 55{
544fee32 56 XRC_MAKE_INSTANCE(text, wxTextCtrl)
f2588180 57
544fee32
VS
58 text->Create(m_parentAsWindow,
59 GetID(),
60 GetText(wxT("value")),
61 GetPosition(), GetSize(),
62 GetStyle(),
63 wxDefaultValidator,
64 GetName());
f2588180 65
78d14f80 66 SetupWindow(text);
f80ea77b 67
d09aa882
JS
68 if (HasParam(wxT("maxlength")))
69 text->SetMaxLength(GetLong(wxT("maxlength")));
70
78d14f80
VS
71 return text;
72}
73
78d14f80
VS
74bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
75{
76 return IsOfClass(node, wxT("wxTextCtrl"));
77}
a1e4ec87 78
fec9cc08 79#endif // wxUSE_XRC && wxUSE_TEXTCTRL