Added wxRichTextCtrl XRC handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2b9aac3387
commit
fd4344d64d
@ -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
|
||||
|
@ -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_
|
||||
|
30
include/wx/xrc/xh_richtext.h
Normal file
30
include/wx/xrc/xh_richtext.h
Normal file
@ -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_
|
63
src/xrc/xh_richtext.cpp
Normal file
63
src/xrc/xh_richtext.cpp
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user