1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added an option for Viewport subclasses to create custom scrollbars. Also modified Viewport::getVerticalScrollBar() and ListBox::getVerticalScrollBar() to return references instead of pointers

This commit is contained in:
jules 2017-09-25 11:22:03 +01:00
parent 533fd23439
commit a4f5663fce
9 changed files with 138 additions and 121 deletions

View file

@ -231,12 +231,12 @@ public:
/** Returns a pointer to the scrollbar component being used.
Handy if you need to customise the bar somehow.
*/
ScrollBar* getVerticalScrollBar() noexcept { return &verticalScrollBar; }
ScrollBar& getVerticalScrollBar() noexcept { return *verticalScrollBar; }
/** Returns a pointer to the scrollbar component being used.
Handy if you need to customise the bar somehow.
*/
ScrollBar* getHorizontalScrollBar() noexcept { return &horizontalScrollBar; }
ScrollBar& getHorizontalScrollBar() noexcept { return *horizontalScrollBar; }
/** True if there's any off-screen content that could be scrolled vertically,
or false if everything is currently visible.
@ -277,9 +277,16 @@ public:
/** @internal */
static bool respondsToKey (const KeyPress&);
protected:
//==============================================================================
/** Creates the Scrollbar components that will be used for that Viewport.
Subclasses can override this if they need to customise the scroolbars in some way.
*/
virtual ScrollBar* createScrollBarComponent (bool isVertical);
private:
//==============================================================================
ScrollBar verticalScrollBar { true }, horizontalScrollBar { false };
ScopedPointer<ScrollBar> verticalScrollBar, horizontalScrollBar;
Component contentHolder;
WeakReference<Component> contentComp;
Rectangle<int> lastVisibleArea;