]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxRichTextCtrl XRC handler
authorJulian Smart <julian@anthemion.co.uk>
Wed, 8 Nov 2006 15:45:11 +0000 (15:45 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 8 Nov 2006 15:45:11 +0000 (15:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/bakefiles/files.bkl
include/wx/xrc/xh_all.h
include/wx/xrc/xh_richtext.h [new file with mode: 0644]
src/xrc/xh_richtext.cpp [new file with mode: 0644]
src/xrc/xmlrsall.cpp

index 6a213b16558647a36c67774289d637b15a3c8b99..640f8765854718c8b3ebf0cd0ce814bd51292984 100644 (file)
@@ -2955,6 +2955,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/xrc/xh_panel.cpp
     src/xrc/xh_radbt.cpp
     src/xrc/xh_radbx.cpp
+    src/xrc/xh_richtext.cpp
     src/xrc/xh_scrol.cpp
     src/xrc/xh_scwin.cpp
     src/xrc/xh_htmllbox.cpp
@@ -3013,6 +3014,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/xrc/xh_panel.h
     wx/xrc/xh_radbt.h
     wx/xrc/xh_radbx.h
+    wx/xrc/xh_richtext.h
     wx/xrc/xh_scrol.h
     wx/xrc/xh_scwin.h
     wx/xrc/xh_htmllbox.h
index 0424611ed3f30911525077144399e5361d930f42..73f64a57ee696a82a02b88430b26f71b1794f592 100644 (file)
@@ -67,5 +67,6 @@
 #include "wx/xrc/xh_bmpcbox.h"
 #include "wx/xrc/xh_animatctrl.h"
 #include "wx/xrc/xh_collpane.h"
+#include "wx/xrc/xh_richtext.h"
 
 #endif // _WX_XH_ALL_H_
diff --git a/include/wx/xrc/xh_richtext.h b/include/wx/xrc/xh_richtext.h
new file mode 100644 (file)
index 0000000..c1c30fc
--- /dev/null
@@ -0,0 +1,30 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/xrc/xh_text.h
+// Purpose:     XML resource handler for wxRichTextCtrl
+// Author:      Julian Smart
+// Created:     2006-11-08
+// RCS-ID:      $Id$
+// Copyright:   (c) 2006 Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_XH_RICHTEXT_H_
+#define _WX_XH_RICHTEXT_H_
+
+#include "wx/xrc/xmlres.h"
+
+#if wxUSE_XRC && wxUSE_RICHTEXT
+
+class WXDLLIMPEXP_XRC wxRichTextCtrlXmlHandler : public wxXmlResourceHandler
+{
+    DECLARE_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler)
+
+public:
+    wxRichTextCtrlXmlHandler();
+    virtual wxObject *DoCreateResource();
+    virtual bool CanHandle(wxXmlNode *node);
+};
+
+#endif // wxUSE_XRC && wxUSE_RICHTEXT
+
+#endif // _WX_XH_RICHTEXT_H_
diff --git a/src/xrc/xh_richtext.cpp b/src/xrc/xh_richtext.cpp
new file mode 100644 (file)
index 0000000..f8b08cc
--- /dev/null
@@ -0,0 +1,63 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/xrc/xh_richtext.cpp
+// Purpose:     XRC resource for wxRichTextCtrl
+// Author:      Julian Smart
+// Created:     2006-11-08
+// RCS-ID:      $Id$
+// Copyright:   (c) 2006 Julian Smart
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#if wxUSE_XRC && wxUSE_RICHTEXT
+
+#include "wx/xrc/xh_richtext.h"
+
+#include "wx/richtext/richtextctrl.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxRichTextCtrlXmlHandler, wxXmlResourceHandler)
+
+wxRichTextCtrlXmlHandler::wxRichTextCtrlXmlHandler() : wxXmlResourceHandler()
+{
+    XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
+    XRC_ADD_STYLE(wxTE_PROCESS_TAB);
+    XRC_ADD_STYLE(wxTE_MULTILINE);
+    XRC_ADD_STYLE(wxTE_READONLY);
+    XRC_ADD_STYLE(wxTE_AUTO_URL);
+
+    AddWindowStyles();
+}
+
+wxObject *wxRichTextCtrlXmlHandler::DoCreateResource()
+{
+    XRC_MAKE_INSTANCE(text, wxRichTextCtrl)
+
+    text->Create(m_parentAsWindow,
+                 GetID(),
+                 GetText(wxT("value")),
+                 GetPosition(), GetSize(),
+                 GetStyle(),
+                 wxDefaultValidator,
+                 GetName());
+
+    SetupWindow(text);
+
+    if (HasParam(wxT("maxlength")))
+        text->SetMaxLength(GetLong(wxT("maxlength")));
+
+    return text;
+}
+
+bool wxRichTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
+{
+    return IsOfClass(node, wxT("wxRichTextCtrl"));
+}
+
+#endif // wxUSE_XRC && wxUSE_RICHTEXT
+
index 47f0292465e37c316d359739e21b366362f35ac5..9f422fce6eb02f0850fa9032c89a00610c94e374 100644 (file)
@@ -128,6 +128,9 @@ void wxXmlResource::InitAllHandlers()
 #if wxUSE_RADIOBTN
     AddHandler(new wxRadioButtonXmlHandler);
 #endif
+#if wxUSE_RICHTEXT
+    AddHandler(new wxRichTextCtrlXmlHandler);
+#endif
 #if wxUSE_SCROLLBAR
     AddHandler(new wxScrollBarXmlHandler);
 #endif