]> git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_richtext.cpp
Misc validity fixes to samples/xrc/rc/*.xrc.
[wxWidgets.git] / src / xrc / xh_richtext.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_richtext.cpp
3 // Purpose: XRC resource for wxRichTextCtrl
4 // Author: Julian Smart
5 // Created: 2006-11-08
6 // Copyright: (c) 2006 Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16
17 #if wxUSE_XRC && wxUSE_RICHTEXT
18
19 #include "wx/xrc/xh_richtext.h"
20 #include "wx/richtext/richtextctrl.h"
21
22 IMPLEMENT_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler, wxXmlResourceHandler)
23
24 wxRichTextCtrlXmlHandler::wxRichTextCtrlXmlHandler() : wxXmlResourceHandler()
25 {
26 XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
27 XRC_ADD_STYLE(wxTE_PROCESS_TAB);
28 XRC_ADD_STYLE(wxTE_MULTILINE);
29 XRC_ADD_STYLE(wxTE_READONLY);
30 XRC_ADD_STYLE(wxTE_AUTO_URL);
31
32 AddWindowStyles();
33 }
34
35 wxObject *wxRichTextCtrlXmlHandler::DoCreateResource()
36 {
37 XRC_MAKE_INSTANCE(text, wxRichTextCtrl)
38
39 text->Create(m_parentAsWindow,
40 GetID(),
41 GetText(wxT("value")),
42 GetPosition(), GetSize(),
43 GetStyle(),
44 wxDefaultValidator,
45 GetName());
46
47 SetupWindow(text);
48
49 if (HasParam(wxT("maxlength")))
50 text->SetMaxLength(GetLong(wxT("maxlength")));
51
52 return text;
53 }
54
55 bool wxRichTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
56 {
57 return IsOfClass(node, wxT("wxRichTextCtrl"));
58 }
59
60 #endif // wxUSE_XRC && wxUSE_RICHTEXT
61