EVT_KILL_FOCUS(wxRichTextCtrl::OnKillFocus)
EVT_MOUSE_CAPTURE_LOST(wxRichTextCtrl::OnCaptureLost)
EVT_CONTEXT_MENU(wxRichTextCtrl::OnContextMenu)
+ EVT_SYS_COLOUR_CHANGED(wxRichTextCtrl::OnSysColourChanged)
EVT_MENU(wxID_UNDO, wxRichTextCtrl::OnUndo)
EVT_UPDATE_UI(wxID_UNDO, wxRichTextCtrl::OnUpdateUndo)
bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
- if (!wxTextCtrlBase::Create(parent, id, pos, size,
- style|wxFULL_REPAINT_ON_RESIZE,
- validator, name))
+ if (!wxControl::Create(parent, id, pos, size,
+ style|wxFULL_REPAINT_ON_RESIZE,
+ validator, name))
return false;
if (!GetFont().Ok())
GetBuffer().Reset();
GetBuffer().SetRichTextCtrl(this);
-
+
SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
GetCaret()->Show();
SetEditable(false);
// The base attributes must all have default values
- wxTextAttrEx attributes;
+ wxTextAttr attributes;
attributes.SetFont(GetFont());
- attributes.SetTextColour(*wxBLACK);
- attributes.SetBackgroundColour(*wxWHITE);
+ attributes.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
attributes.SetAlignment(wxTEXT_ALIGNMENT_LEFT);
attributes.SetLineSpacing(10);
attributes.SetParagraphSpacingAfter(10);
// The default attributes will be merged with base attributes, so
// can be empty to begin with
- wxTextAttrEx defaultAttributes;
+ wxTextAttr defaultAttributes;
SetDefaultStyle(defaultAttributes);
- SetBackgroundColour(*wxWHITE);
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
// Tell the sizers to use the given or best size
wxRichTextCtrl::~wxRichTextCtrl()
{
GetBuffer().RemoveEventHandler(this);
-
+
delete m_contextMenu;
}
if (m_freezeCount == 0)
{
- SetupScrollbars();
+ if (GetBuffer().GetDirty())
+ LayoutContent();
+ else
+ SetupScrollbars();
Refresh(false);
}
}
m_caretAtLineStart = false;
m_selectionRange.SetRange(-2, -2);
- SetScrollbars(0, 0, 0, 0, 0, 0);
-
if (m_freezeCount == 0)
{
- SetupScrollbars();
+ LayoutContent();
Refresh(false);
}
- SendTextUpdatedEvent();
+
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
/// Painting
void wxRichTextCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
{
- m_dragging = false;
+ m_dragging = false;
}
/// Left-click
long position = 0;
wxPoint logicalPt = event.GetLogicalPosition(dc);
int hit = GetBuffer().HitTest(dc, logicalPt, position);
-
+
if (hit != wxRICHTEXT_HITTEST_NONE)
{
- wxTextAttrEx attr;
- if (GetStyle(position, attr))
+ wxRichTextEvent cmdEvent(
+ wxEVT_COMMAND_RICHTEXT_LEFT_CLICK,
+ GetId());
+ cmdEvent.SetEventObject(this);
+ cmdEvent.SetPosition(m_caretPosition+1);
+
+ if (!GetEventHandler()->ProcessEvent(cmdEvent))
{
- if (attr.HasFlag(wxTEXT_ATTR_URL))
+ wxTextAttr attr;
+ if (GetStyle(position, attr))
{
- wxString urlTarget = attr.GetURL();
- if (!urlTarget.IsEmpty())
+ if (attr.HasFlag(wxTEXT_ATTR_URL))
{
- wxMouseEvent mouseEvent(event);
-
- long startPos = 0, endPos = 0;
- wxRichTextObject* obj = GetBuffer().GetLeafObjectAtPosition(position);
- if (obj)
+ wxString urlTarget = attr.GetURL();
+ if (!urlTarget.IsEmpty())
{
- startPos = obj->GetRange().GetStart();
- endPos = obj->GetRange().GetEnd();
- }
-
- wxTextUrlEvent urlEvent(GetId(), mouseEvent, startPos, endPos);
- InitCommandEvent(urlEvent);
-
- urlEvent.SetString(urlTarget);
-
- GetEventHandler()->ProcessEvent(urlEvent);
+ wxMouseEvent mouseEvent(event);
+
+ long startPos = 0, endPos = 0;
+ wxRichTextObject* obj = GetBuffer().GetLeafObjectAtPosition(position);
+ if (obj)
+ {
+ startPos = obj->GetRange().GetStart();
+ endPos = obj->GetRange().GetEnd();
+ }
+
+ wxTextUrlEvent urlEvent(GetId(), mouseEvent, startPos, endPos);
+ InitCommandEvent(urlEvent);
+
+ urlEvent.SetString(urlTarget);
+
+ GetEventHandler()->ProcessEvent(urlEvent);
+ }
}
}
}
long position = 0;
wxPoint logicalPt = event.GetLogicalPosition(dc);
int hit = GetBuffer().HitTest(dc, logicalPt, position);
-
+
// See if we need to change the cursor
-
+
{
if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
{
- wxTextAttrEx attr;
+ wxTextAttr attr;
if (GetStyle(position, attr))
{
if (attr.HasFlag(wxTEXT_ATTR_URL))
void wxRichTextCtrl::OnRightClick(wxMouseEvent& event)
{
SetFocus();
- event.Skip();
+
+ wxRichTextEvent cmdEvent(
+ wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK,
+ GetId());
+ cmdEvent.SetEventObject(this);
+ cmdEvent.SetPosition(m_caretPosition+1);
+
+ if (!GetEventHandler()->ProcessEvent(cmdEvent))
+ event.Skip();
}
/// Left-double-click
-void wxRichTextCtrl::OnLeftDClick(wxMouseEvent& event)
+void wxRichTextCtrl::OnLeftDClick(wxMouseEvent& WXUNUSED(event))
{
- SelectWord(GetCaretPosition()+1);
- event.Skip();
+ wxRichTextEvent cmdEvent(
+ wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK,
+ GetId());
+ cmdEvent.SetEventObject(this);
+ cmdEvent.SetPosition(m_caretPosition+1);
+
+ if (!GetEventHandler()->ProcessEvent(cmdEvent))
+ {
+ SelectWord(GetCaretPosition()+1);
+ }
}
/// Middle-click
void wxRichTextCtrl::OnMiddleClick(wxMouseEvent& event)
{
- event.Skip();
+ wxRichTextEvent cmdEvent(
+ wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK,
+ GetId());
+ cmdEvent.SetEventObject(this);
+ cmdEvent.SetPosition(m_caretPosition+1);
+
+ if (!GetEventHandler()->ProcessEvent(cmdEvent))
+ event.Skip();
}
/// Key press
// Generate conventional event
wxCommandEvent textEvent(wxEVT_COMMAND_TEXT_ENTER, GetId());
InitCommandEvent(textEvent);
-
+
GetEventHandler()->ProcessEvent(textEvent);
}
Update();
else if (event.GetKeyCode() == WXK_BACK)
{
BeginBatchUndo(_("Delete Text"));
-
+
// 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 (m_caretPosition > -1 && !HasSelection())
switch ( keycode )
{
case WXK_ESCAPE:
- // case WXK_SPACE:
case WXK_DELETE:
case WXK_START:
case WXK_LBUTTON:
case WXK_NUMPAD_SEPARATOR:
case WXK_NUMPAD_SUBTRACT:
case WXK_NUMPAD_DECIMAL:
+ case WXK_WINDOWS_LEFT:
{
event.Skip();
return;
GetId());
cmdEvent.SetEventObject(this);
cmdEvent.SetFlags(flags);
+#if wxUSE_UNICODE
+ cmdEvent.SetCharacter(event.GetUnicodeKey());
+#else
cmdEvent.SetCharacter((wxChar) keycode);
+#endif
cmdEvent.SetPosition(m_caretPosition+1);
-
+
if (keycode == wxT('\t'))
{
// See if we need to promote or demote the selection or paragraph at the cursor
long newPos = m_caretPosition;
DeleteSelectedContent(& newPos);
+#if wxUSE_UNICODE
+ wxString str = event.GetUnicodeKey();
+#else
wxString str = (wxChar) event.GetKeyCode();
+#endif
GetBuffer().InsertTextWithUndo(newPos+1, str, this, 0);
EndBatchUndo();
SetDefaultStyleToCursorStyle();
ScrollIntoView(m_caretPosition, WXK_RIGHT);
-
+
GetEventHandler()->ProcessEvent(cmdEvent);
Update();
// Going down
if (keyCode == WXK_DOWN || keyCode == WXK_NUMPAD_DOWN ||
- keyCode == WXK_RIGHT || keyCode == WXK_NUMPAD_DOWN ||
+ keyCode == WXK_RIGHT || keyCode == WXK_NUMPAD_RIGHT ||
keyCode == WXK_END || keyCode == WXK_NUMPAD_END ||
keyCode == WXK_PAGEDOWN || keyCode == WXK_NUMPAD_PAGEDOWN)
{
startX = 0;
startY = startY * ppuY;
- int sx = 0, sy = 0;
- GetVirtualSize(& sx, & sy);
- sx = 0;
- if (ppuY != 0)
- sy = sy/ppuY;
-
wxRect rect = line->GetRect();
-
wxSize clientSize = GetClientSize();
- return !(((rect.y + rect.height) > (clientSize.y + startY)) || rect.y < startY);
+ return (rect.GetBottom() > startY) && (rect.GetTop() < (startY + clientSize.y));
}
void wxRichTextCtrl::SetCaretPosition(long position, bool showAtLineStart)
return false;
}
+static bool wxRichTextCtrlIsWhitespace(const wxString& str)
+{
+ return str == wxT(" ") || str == wxT("\t");
+}
+
// Finds the caret position for the next word
long wxRichTextCtrl::FindNextWordPosition(int direction) const
{
{
// i is in character, not caret positions
wxString text = GetBuffer().GetTextForRange(wxRichTextRange(i, i));
- if (text != wxT(" ") && !text.empty())
+ wxRichTextLine* line = GetBuffer().GetLineAtPosition(i, false);
+ if (line && (i == line->GetAbsoluteRange().GetEnd()))
+ {
+ break;
+ }
+ else if (!wxRichTextCtrlIsWhitespace(text) && !text.empty())
i += direction;
else
{
{
// i is in character, not caret positions
wxString text = GetBuffer().GetTextForRange(wxRichTextRange(i, i));
+ wxRichTextLine* line = GetBuffer().GetLineAtPosition(i, false);
+ if (line && (i == line->GetAbsoluteRange().GetEnd()))
+ return wxMax(-1, i);
+
if (text.empty()) // End of paragraph, or maybe an image
return wxMax(-1, i - 1);
- else if (text == wxT(" ") || text.empty())
+ else if (wxRichTextCtrlIsWhitespace(text) || text.empty())
i += direction;
else
{
{
// i is in character, not caret positions
wxString text = GetBuffer().GetTextForRange(wxRichTextRange(i, i));
- if (text.empty()) // End of paragraph, or maybe an image
+ wxRichTextLine* line = GetBuffer().GetLineAtPosition(i, false);
+
+ if (text.empty() || (line && (i == line->GetAbsoluteRange().GetStart()))) // End of paragraph, or maybe an image
break;
- else if (text == wxT(" ") || text.empty())
+ else if (wxRichTextCtrlIsWhitespace(text) || text.empty())
i += direction;
else
break;
{
// i is in character, not caret positions
wxString text = GetBuffer().GetTextForRange(wxRichTextRange(i, i));
- if (text != wxT(" ") /* && !text.empty() */)
+ wxRichTextLine* line = GetBuffer().GetLineAtPosition(i, false);
+ if (line && line->GetAbsoluteRange().GetStart() == i)
+ return i-1;
+
+ if (!wxRichTextCtrlIsWhitespace(text) /* && !text.empty() */)
i += direction;
else
{
PositionCaret();
SetupScrollbars(true);
Refresh(false);
- SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(this);
if (success)
return true;
return wxTE_HT_BEFORE;
else if ((hit & wxRICHTEXT_HITTEST_AFTER) && (hit & wxRICHTEXT_HITTEST_OUTSIDE))
return wxTE_HT_BEYOND;
- else if (hit & wxRICHTEXT_HITTEST_BEFORE|wxRICHTEXT_HITTEST_AFTER)
+ else if (hit & (wxRICHTEXT_HITTEST_BEFORE|wxRICHTEXT_HITTEST_AFTER))
return wxTE_HT_ON_TEXT;
return wxTE_HT_UNKNOWN;
{
Clear();
- // if the text is long enough, it's faster to just set it instead of first
- // comparing it with the old one (chances are that it will be different
- // anyhow, this comparison is there to avoid flicker for small single-line
- // edit controls mostly)
- if ( (value.length() > 0x400) || (value != GetValue()) )
+ if (!value.IsEmpty())
{
+ // Remove empty paragraph
+ GetBuffer().Clear();
DoWriteText(value);
// for compatibility, don't move the cursor when doing SetValue()
SetInsertionPoint(0);
}
- else // same text
+ else
{
- if ( flags & SetValue_SendEvent )
- {
- // still send an event for consistency
- SendTextUpdatedEvent();
- }
+ // still send an event for consistency
+ if (flags & SetValue_SendEvent)
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
-
- // we should reset the modified flag even if the value didn't really change
-
- // mark the control as being not dirty - we changed its text, not the
- // user
DiscardEdits();
}
GetBuffer().InsertTextWithUndo(m_caretPosition+1, valueUnix, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
if ( flags & SetValue_SendEvent )
- SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
void wxRichTextCtrl::AppendText(const wxString& text)
event.Enable(GetLastPosition() > 0);
}
-void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& WXUNUSED(event))
+void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
+ if (event.GetEventObject() != this)
+ {
+ event.Skip();
+ return;
+ }
+
if (!m_contextMenu)
{
m_contextMenu = new wxMenu;
return;
}
-bool wxRichTextCtrl::SetStyle(long start, long end, const wxTextAttrEx& style)
-{
- return GetBuffer().SetStyle(wxRichTextRange(start, end-1), style);
-}
-
bool wxRichTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
- return GetBuffer().SetStyle(wxRichTextRange(start, end-1), wxTextAttrEx(style));
+ return GetBuffer().SetStyle(wxRichTextRange(start, end-1), wxTextAttr(style));
}
-bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style)
+bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxTextAttr& style)
{
return GetBuffer().SetStyle(range.ToInternal(), style);
}
// extended style setting operation with flags including:
// wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY.
// see richtextbuffer.h for more details.
-bool wxRichTextCtrl::SetStyleEx(long start, long end, const wxTextAttrEx& style, int flags)
-{
- return GetBuffer().SetStyle(wxRichTextRange(start, end-1), style, flags);
-}
-bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxTextAttrEx& style, int flags)
+bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxTextAttr& style, int flags)
{
return GetBuffer().SetStyle(range.ToInternal(), style, flags);
}
-bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags)
-{
- return GetBuffer().SetStyle(range.ToInternal(), style, flags);
-}
-
-bool wxRichTextCtrl::SetDefaultStyle(const wxTextAttrEx& style)
-{
- return GetBuffer().SetDefaultStyle(style);
-}
-
bool wxRichTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{
- return GetBuffer().SetDefaultStyle(wxTextAttrEx(style));
-}
-
-const wxTextAttrEx& wxRichTextCtrl::GetDefaultStyleEx() const
-{
- return GetBuffer().GetDefaultStyle();
+ return GetBuffer().SetDefaultStyle(wxTextAttr(style));
}
const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const
}
bool wxRichTextCtrl::GetStyle(long position, wxTextAttr& style)
-{
- wxTextAttrEx attr(style);
- if (GetBuffer().GetStyle(position, attr))
- {
- style = attr;
- return true;
- }
- else
- return false;
-}
-
-bool wxRichTextCtrl::GetStyle(long position, wxTextAttrEx& style)
-{
- return GetBuffer().GetStyle(position, style);
-}
-
-bool wxRichTextCtrl::GetStyle(long position, wxRichTextAttr& style)
{
return GetBuffer().GetStyle(position, style);
}
// get the common set of styles for the range
-bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style)
-{
- wxTextAttrEx styleEx;
- if (GetBuffer().GetStyleForRange(range.ToInternal(), styleEx))
- {
- style = styleEx;
- return true;
- }
- else
- return false;
-}
-
-bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style)
+bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style)
{
return GetBuffer().GetStyleForRange(range.ToInternal(), style);
}
/// Get the content (uncombined) attributes for this position.
-
bool wxRichTextCtrl::GetUncombinedStyle(long position, wxTextAttr& style)
-{
- wxTextAttrEx attr(style);
- if (GetBuffer().GetUncombinedStyle(position, attr))
- {
- style = attr;
- return true;
- }
- else
- return false;
-}
-
-bool wxRichTextCtrl::GetUncombinedStyle(long position, wxTextAttrEx& style)
-{
- return GetBuffer().GetUncombinedStyle(position, style);
-}
-
-bool wxRichTextCtrl::GetUncombinedStyle(long position, wxRichTextAttr& style)
{
return GetBuffer().GetUncombinedStyle(position, style);
}
{
wxControl::SetFont(font);
- wxTextAttrEx attr = GetBuffer().GetAttributes();
+ wxTextAttr attr = GetBuffer().GetAttributes();
attr.SetFont(font);
GetBuffer().SetBasicStyle(attr);
wxRect caretRect;
if (GetCaretPositionForIndex(GetCaretPosition(), caretRect))
{
- wxPoint originalPt = caretRect.GetPosition();
- wxPoint pt = GetPhysicalPoint(originalPt);
- if (GetCaret()->GetPosition() != pt)
+ wxPoint newPt = caretRect.GetPosition();
+ wxSize newSz = caretRect.GetSize();
+ wxPoint pt = GetPhysicalPoint(newPt);
+ if (GetCaret()->GetPosition() != pt || GetCaret()->GetSize() != newSz)
{
GetCaret()->Move(pt);
- GetCaret()->SetSize(caretRect.GetSize());
+ GetCaret()->SetSize(newSz);
}
}
}
if (GetBuffer().FindPosition(dc, position, pt, & height, m_caretAtLineStart))
{
+ // Caret height can't be zero
+ if (height == 0)
+ height = dc.GetCharHeight();
+
rect = wxRect(pt, wxSize(wxRICHTEXT_DEFAULT_CARET_WIDTH, height));
return true;
}
{
if (HasSelection())
{
- wxRichTextAttr attr;
+ wxTextAttr attr;
wxRichTextRange range = GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(wxBOLD);
{
// If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing.
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
long pos = GetAdjustedCaretPosition(GetCaretPosition());
if (HasSelection())
{
wxRichTextRange range = GetSelectionRange();
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(wxITALIC);
{
// If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing.
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
long pos = GetAdjustedCaretPosition(GetCaretPosition());
if (HasSelection())
{
wxRichTextRange range = GetSelectionRange();
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
attr.SetFontUnderlined(true);
{
// If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing.
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
long pos = GetAdjustedCaretPosition(GetCaretPosition());
/// Apply bold to the selection
bool wxRichTextCtrl::ApplyBoldToSelection()
{
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(IsSelectionBold() ? wxNORMAL : wxBOLD);
/// Apply italic to the selection
bool wxRichTextCtrl::ApplyItalicToSelection()
{
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(IsSelectionItalics() ? wxNORMAL : wxITALIC);
/// Apply underline to the selection
bool wxRichTextCtrl::ApplyUnderlineToSelection()
{
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
attr.SetFontUnderlined(!IsSelectionUnderlined());
else
range = wxRichTextRange(GetCaretPosition()+1, GetCaretPosition()+2);
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetAlignment(alignment);
return HasParagraphAttributes(range, attr);
/// Apply alignment to the selection
bool wxRichTextCtrl::ApplyAlignmentToSelection(wxTextAttrAlignment alignment)
{
- wxRichTextAttr attr;
+ wxTextAttr attr;
attr.SetAlignment(alignment);
if (HasSelection())
return SetStyle(GetSelectionRange(), attr);
{
// Flags are defined within each definition, so only certain
// attributes are applied.
- wxRichTextAttr attr(GetStyleSheet() ? def->GetStyleMergedWithBase(GetStyleSheet()) : def->GetStyle());
+ wxTextAttr attr(GetStyleSheet() ? def->GetStyleMergedWithBase(GetStyleSheet()) : def->GetStyle());
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE;
/// Sets the default style to the style under the cursor
bool wxRichTextCtrl::SetDefaultStyleToCursorStyle()
{
- wxTextAttrEx attr;
+ wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_CHARACTER);
// If at the start of a paragraph, use the next position.
sm_availableFontNames.Clear();
}
+void wxRichTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
+{
+ //wxLogDebug(wxT("wxRichTextCtrl::OnSysColourChanged"));
+
+ wxTextAttrEx basicStyle = GetBasicStyle();
+ basicStyle.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+ SetBasicStyle(basicStyle);
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+
+ Refresh();
+}
+
#endif
// wxUSE_RICHTEXT