X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6460c5990b861a41ea675667b8f40d3f7e1a9b53..33208b4ecb04e5380e6674d71c58e085f803d409:/src/richtext/richtextctrl.cpp diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index f7dfab511d..e8eff5d801 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -356,6 +356,7 @@ void wxRichTextCtrl::Init() m_selectionAnchorObject = NULL; m_selectionState = wxRichTextCtrlSelectionState_Normal; m_editable = true; + m_verticalScrollbarEnabled = true; m_caretAtLineStart = false; m_dragging = false; #if wxUSE_DRAG_AND_DROP @@ -1175,7 +1176,8 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) ScrollIntoView(m_caretPosition, WXK_LEFT); - if (deletions > 0) + // Always send this event; wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED will be sent only if there is an actual deletion. + //if (deletions > 0) { wxRichTextEvent cmdEvent( wxEVT_COMMAND_RICHTEXT_DELETE, @@ -1313,7 +1315,8 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) ScrollIntoView(m_caretPosition, WXK_LEFT); - if (deletions > 0) + // Always send this event; wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED will be sent only if there is an actual deletion. + //if (deletions > 0) { wxRichTextEvent cmdEvent( wxEVT_COMMAND_RICHTEXT_DELETE, @@ -1386,7 +1389,8 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) ScrollIntoView(m_caretPosition, WXK_LEFT); - if (deletions > 0) + // Always send this event; wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED will be sent only if there is an actual deletion. + //if (deletions > 0) { wxRichTextEvent cmdEvent( wxEVT_COMMAND_RICHTEXT_DELETE, @@ -2555,7 +2559,7 @@ void wxRichTextCtrl::SetupScrollbars(bool atTop) if (IsFrozen()) return; - if (GetBuffer().IsEmpty()) + if (GetBuffer().IsEmpty() || !m_verticalScrollbarEnabled) { SetScrollbars(0, 0, 0, 0, 0, 0); return; @@ -4560,6 +4564,12 @@ bool wxRichTextCtrl::CanInsertContent(wxRichTextParagraphLayoutBox& WXUNUSED(con return true; } +void wxRichTextCtrl::EnableVerticalScrollbar(bool enable) +{ + m_verticalScrollbarEnabled = enable; + SetupScrollbars(); +} + #if wxRICHTEXT_USE_OWN_CARET