Now works when derived from wxTextCtrlBase, using wxScrollHelper.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-10-22 13:44:30 +00:00
parent a4f4d548ce
commit 2f36e8dce5
3 changed files with 12 additions and 8 deletions

View File

@@ -383,7 +383,7 @@ public:
/// Layout the buffer: which we must do before certain operations, such as /// Layout the buffer: which we must do before certain operations, such as
/// setting the caret position. /// setting the caret position.
virtual bool Layout(bool onlyVisibleRect = false); virtual bool LayoutContent(bool onlyVisibleRect = false);
/// Move the caret to the given character position /// Move the caret to the given character position
virtual bool MoveCaret(long pos, bool showAtLineStart = false); virtual bool MoveCaret(long pos, bool showAtLineStart = false);
@@ -573,6 +573,10 @@ public:
// Implementation // Implementation
#if wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
WX_FORWARD_TO_SCROLL_HELPER()
#endif
/// Set font, and also default attributes /// Set font, and also default attributes
virtual bool SetFont(const wxFont& font); virtual bool SetFont(const wxFont& font);

View File

@@ -4113,7 +4113,7 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent
m_ctrl->SetCaretPosition(caretPosition); m_ctrl->SetCaretPosition(caretPosition);
if (!m_ctrl->IsFrozen()) if (!m_ctrl->IsFrozen())
{ {
m_ctrl->Layout(); m_ctrl->LayoutContent();
m_ctrl->PositionCaret(); m_ctrl->PositionCaret();
m_ctrl->Refresh(); m_ctrl->Refresh();

View File

@@ -1381,7 +1381,7 @@ void wxRichTextCtrl::OnSize(wxSizeEvent& event)
m_fullLayoutRequired = true; m_fullLayoutRequired = true;
m_fullLayoutTime = wxGetLocalTimeMillis(); m_fullLayoutTime = wxGetLocalTimeMillis();
m_fullLayoutSavedPosition = GetFirstVisiblePosition(); m_fullLayoutSavedPosition = GetFirstVisiblePosition();
Layout(true /* onlyVisibleRect */); LayoutContent(true /* onlyVisibleRect */);
} }
else else
GetBuffer().Invalidate(wxRICHTEXT_ALL); GetBuffer().Invalidate(wxRICHTEXT_ALL);
@@ -1497,7 +1497,7 @@ bool wxRichTextCtrl::LoadFile(const wxString& filename, int type)
DiscardEdits(); DiscardEdits();
SetInsertionPoint(0); SetInsertionPoint(0);
Layout(); LayoutContent();
PositionCaret(); PositionCaret();
SetupScrollbars(true); SetupScrollbars(true);
Refresh(); Refresh();
@@ -1763,7 +1763,7 @@ void wxRichTextCtrl::Cut()
GetBuffer().CopyToClipboard(range); GetBuffer().CopyToClipboard(range);
DeleteSelectedContent(); DeleteSelectedContent();
Layout(); LayoutContent();
Refresh(); Refresh();
} }
} }
@@ -1915,7 +1915,7 @@ void wxRichTextCtrl::Remove(long from, long to)
from, // New caret position from, // New caret position
this); this);
Layout(); LayoutContent();
if (!IsFrozen()) if (!IsFrozen())
Refresh(); Refresh();
} }
@@ -2289,7 +2289,7 @@ wxRichTextLine* wxRichTextCtrl::GetVisibleLineForCaretPosition(long caretPositio
bool wxRichTextCtrl::MoveCaret(long pos, bool showAtLineStart) bool wxRichTextCtrl::MoveCaret(long pos, bool showAtLineStart)
{ {
if (GetBuffer().GetDirty()) if (GetBuffer().GetDirty())
Layout(); LayoutContent();
if (pos <= GetBuffer().GetRange().GetEnd()) if (pos <= GetBuffer().GetRange().GetEnd())
{ {
@@ -2305,7 +2305,7 @@ bool wxRichTextCtrl::MoveCaret(long pos, bool showAtLineStart)
/// Layout the buffer: which we must do before certain operations, such as /// Layout the buffer: which we must do before certain operations, such as
/// setting the caret position. /// setting the caret position.
bool wxRichTextCtrl::Layout(bool onlyVisibleRect) bool wxRichTextCtrl::LayoutContent(bool onlyVisibleRect)
{ {
if (GetBuffer().GetDirty() || onlyVisibleRect) if (GetBuffer().GetDirty() || onlyVisibleRect)
{ {