/// Initialisation
void Init();
- /// Clears the buffer and resets the command processor
- virtual void Clear();
-
- /// The same as Clear, and adds an empty paragraph.
- virtual void Reset();
+ /// Clears the buffer, adds an empty paragraph, and clears the command processor.
+ virtual void ResetAndClearCommands();
/// Load a file
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
Clear();
AddParagraph(wxEmptyString);
+
+ Invalidate(wxRICHTEXT_ALL);
}
/// Invalidate the buffer. With no argument, invalidates whole buffer.
ClearEventHandlers();
}
-void wxRichTextBuffer::Clear()
+void wxRichTextBuffer::ResetAndClearCommands()
{
- DeleteChildren();
+ Reset();
+
GetCommandProcessor()->ClearCommands();
- Modify(false);
- Invalidate(wxRICHTEXT_ALL);
-}
-void wxRichTextBuffer::Reset()
-{
- DeleteChildren();
- AddParagraph(wxEmptyString);
- GetCommandProcessor()->ClearCommands();
Modify(false);
Invalidate(wxRICHTEXT_ALL);
}
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
+ GetBuffer().Reset();
GetBuffer().SetRichTextCtrl(this);
if (style & wxTE_READONLY)
/// Clear all text
void wxRichTextCtrl::Clear()
{
- m_buffer.Reset();
+ m_buffer.ResetAndClearCommands();
m_buffer.SetDirty(true);
m_caretPosition = -1;
m_caretPositionForDefaultStyle = -2;
EndBatchUndo();
- // Shouldn't this be in Do()?
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
EndBatchUndo();
- // Shouldn't this be in Do()?
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
if (!stream.IsOk())
return false;
- buffer->Clear();
+ buffer->ResetAndClearCommands();
wxXmlDocument* xmlDoc = new wxXmlDocument;
bool success = true;