]> git.saurik.com Git - wxWidgets.git/commitdiff
Added functionality for disabling the vertical scrollbar.
authorJulian Smart <julian@anthemion.co.uk>
Thu, 23 Feb 2012 17:01:30 +0000 (17:01 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 23 Feb 2012 17:01:30 +0000 (17:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/richtext/richtextctrl.h
interface/wx/richtext/richtextctrl.h
src/richtext/richtextctrl.cpp

index 68a7453d0f81f744d27fa0a683536e8c4f269983..fa3779e269084a5a101afc65a5da9dd74ae9e303 100644 (file)
@@ -1676,6 +1676,16 @@ public:
     */
     virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const;
 
+    /**
+        Enable or disable the vertical scrollbar.
+    */
+    virtual void EnableVerticalScrollbar(bool enable);
+
+    /**
+        Returns @true if the vertical scrollbar is enabled.
+    */
+    virtual bool GetVerticalScrollbarEnabled() const { return m_verticalScrollbarEnabled; }
+
 // Command handlers
 
     /**
@@ -2159,6 +2169,9 @@ protected:
     /// Are we editable?
     bool                    m_editable;
 
+    /// Is the vertical scrollbar enabled?
+    bool                    m_verticalScrollbarEnabled;
+
     /// Are we showing the caret position at the start of a line
     /// instead of at the end of the previous one?
     bool                    m_caretAtLineStart;
index c6ad67f802adac2416d712e2c0861d369b319c17..b341941c6099cafe386a7891c69ea0b75cf9ee9c 100644 (file)
@@ -1635,6 +1635,16 @@ public:
     */
     virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const;
 
+    /**
+        Enable or disable the vertical scrollbar.
+    */
+    virtual void EnableVerticalScrollbar(bool enable);
+
+    /**
+        Returns @true if the vertical scrollbar is enabled.
+    */
+    virtual bool GetVerticalScrollbarEnabled() const;
+
 // Command handlers
 
     /**
index f7dfab511dd82861f348c32d322adb66fcfc6236..cb0d915f8b3f4c3fa01935c0cc5ce94a6f518f0c 100644 (file)
@@ -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
@@ -2555,7 +2556,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 +4561,12 @@ bool wxRichTextCtrl::CanInsertContent(wxRichTextParagraphLayoutBox& WXUNUSED(con
     return true;
 }
 
+void wxRichTextCtrl::EnableVerticalScrollbar(bool enable)
+{
+    m_verticalScrollbarEnabled = enable;
+    SetupScrollbars();
+}
+
 
 #if wxRICHTEXT_USE_OWN_CARET