]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
Fix most of the Objective-C GC problems by using the stronger CFRetain/CFRelease...
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index 6acea71f6c7bdf6f8473d68cd6d806a5d700bf37..252cfe22afc281c70f3c4f6b636791f3abecb948 100644 (file)
@@ -54,6 +54,7 @@ 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)
 
 IMPLEMENT_CLASS( wxRichTextCtrl, wxControl )
 
@@ -140,12 +141,6 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
         SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
     }
 
-    GetBuffer().Reset();
-    GetBuffer().SetRichTextCtrl(this);
-
-    SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
-    GetCaret()->Show();
-
     if (style & wxTE_READONLY)
         SetEditable(false);
 
@@ -170,6 +165,12 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
     SetBackgroundStyle(wxBG_STYLE_CUSTOM);
 
+    GetBuffer().Reset();
+    GetBuffer().SetRichTextCtrl(this);
+
+    SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
+    GetCaret()->Show();
+
     // Tell the sizers to use the given or best size
     SetInitialSize(size);
 
@@ -235,6 +236,8 @@ void wxRichTextCtrl::Clear()
     m_caretAtLineStart = false;
     m_selectionRange.SetRange(-2, -2);
 
+    Scroll(0,0);
+
     if (!IsFrozen())
     {
         LayoutContent();
@@ -2238,6 +2241,8 @@ void wxRichTextCtrl::SetInsertionPoint(long pos)
     SelectNone();
 
     m_caretPosition = pos - 1;
+
+    PositionCaret();
 }
 
 void wxRichTextCtrl::SetInsertionPointEnd()