#include "wx/app.h"
WX_CHECK_BUILD_OPTIONS("wxRichTextCtrl")
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_LEFT_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_RETURN)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_CHARACTER)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_DELETE)
-
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED)
-
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_RICHTEXT_BUFFER_RESET)
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_RETURN, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_CHARACTER, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_DELETE, wxRichTextEvent )
+
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, wxRichTextEvent )
+
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, wxRichTextEvent )
#if wxRICHTEXT_USE_OWN_CARET
};
#endif
-IMPLEMENT_CLASS( wxRichTextCtrl, wxControl )
+IMPLEMENT_DYNAMIC_CLASS( wxRichTextCtrl, wxControl )
-IMPLEMENT_CLASS( wxRichTextEvent, wxNotifyEvent )
+IMPLEMENT_DYNAMIC_CLASS( wxRichTextEvent, wxNotifyEvent )
BEGIN_EVENT_TABLE( wxRichTextCtrl, wxControl )
EVT_PAINT(wxRichTextCtrl::OnPaint)
GetBuffer().AddEventHandler(this);
// Accelerators
- wxAcceleratorEntry entries[4];
+ wxAcceleratorEntry entries[6];
entries[0].Set(wxACCEL_CMD, (int) 'C', wxID_COPY);
entries[1].Set(wxACCEL_CMD, (int) 'X', wxID_CUT);
entries[2].Set(wxACCEL_CMD, (int) 'V', wxID_PASTE);
entries[3].Set(wxACCEL_CMD, (int) 'A', wxID_SELECTALL);
+ entries[4].Set(wxACCEL_CMD, (int) 'Z', wxID_UNDO);
+ entries[5].Set(wxACCEL_CMD, (int) 'Y', wxID_REDO);
- wxAcceleratorTable accel(4, entries);
+ wxAcceleratorTable accel(6, entries);
SetAcceleratorTable(accel);
return true;
long newPos = m_caretPosition;
- DeleteSelectedContent(& newPos);
+ bool processed = DeleteSelectedContent(& newPos);
// Submit range in character positions, which are greater than caret positions,
// so subtract 1 for deleted character and add 1 for conversion to character position.
if (newPos > -1)
{
- bool processed = false;
if (event.CmdDown())
{
long pos = wxRichTextCtrl::FindNextWordPosition(-1);
long newPos = m_caretPosition;
- DeleteSelectedContent(& newPos);
+ bool processed = DeleteSelectedContent(& newPos);
// Submit range in character positions, which are greater than caret positions,
// so subtract 1 for deleted character and add 1 for conversion to character position.
if (newPos > -1)
{
- bool processed = false;
if (event.CmdDown())
{
long pos = wxRichTextCtrl::FindNextWordPosition(-1);
long newPos = m_caretPosition;
- DeleteSelectedContent(& newPos);
+ bool processed = DeleteSelectedContent(& newPos);
// Submit range in character positions, which are greater than caret positions,
if (newPos < GetBuffer().GetRange().GetEnd()+1)
{
- bool processed = false;
if (event.CmdDown())
{
long pos = wxRichTextCtrl::FindNextWordPosition(1);
wxTextAttr attr;
wxRichTextRange range = GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
- attr.SetFontWeight(wxBOLD);
+ attr.SetFontWeight(wxFONTWEIGHT_BOLD);
return HasCharacterAttributes(range, attr);
}
{
if (IsDefaultStyleShowing())
wxRichTextApplyStyle(attr, GetDefaultStyleEx());
- return attr.GetFontWeight() == wxBOLD;
+ return attr.GetFontWeight() == wxFONTWEIGHT_BOLD;
}
}
return false;
wxRichTextRange range = GetSelectionRange();
wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
- attr.SetFontStyle(wxITALIC);
+ attr.SetFontStyle(wxFONTSTYLE_ITALIC);
return HasCharacterAttributes(range, attr);
}
{
if (IsDefaultStyleShowing())
wxRichTextApplyStyle(attr, GetDefaultStyleEx());
- return attr.GetFontStyle() == wxITALIC;
+ return attr.GetFontStyle() == wxFONTSTYLE_ITALIC;
}
}
return false;
{
wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
- attr.SetFontWeight(IsSelectionBold() ? wxNORMAL : wxBOLD);
+ attr.SetFontWeight(IsSelectionBold() ? wxFONTWEIGHT_NORMAL : wxFONTWEIGHT_BOLD);
if (HasSelection())
return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);
{
wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
- attr.SetFontStyle(IsSelectionItalics() ? wxNORMAL : wxITALIC);
+ attr.SetFontStyle(IsSelectionItalics() ? wxFONTSTYLE_NORMAL : wxFONTSTYLE_ITALIC);
if (HasSelection())
return SetStyleEx(GetSelectionRange(), attr, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE|wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY);