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

More notification options for Scrollbar.

This commit is contained in:
jules 2012-11-22 15:03:42 +00:00
parent 3d2969e71d
commit 48f2c2734b
2 changed files with 30 additions and 24 deletions

View file

@ -79,20 +79,20 @@ ScrollBar::~ScrollBar()
}
//==============================================================================
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit)
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit, NotificationType notification)
{
if (totalRange != newRangeLimit)
{
totalRange = newRangeLimit;
setCurrentRange (visibleRange);
setCurrentRange (visibleRange, notification);
updateThumbPosition();
}
}
void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum)
void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum, NotificationType notification)
{
jassert (newMaximum >= newMinimum); // these can't be the wrong way round!
setRangeLimits (Range<double> (newMinimum, newMaximum));
setRangeLimits (Range<double> (newMinimum, newMaximum), notification);
}
bool ScrollBar::setCurrentRange (const Range<double>& newRange,
@ -118,14 +118,14 @@ bool ScrollBar::setCurrentRange (const Range<double>& newRange,
return false;
}
void ScrollBar::setCurrentRange (const double newStart, const double newSize)
void ScrollBar::setCurrentRange (const double newStart, const double newSize, NotificationType notification)
{
setCurrentRange (Range<double> (newStart, newStart + newSize));
setCurrentRange (Range<double> (newStart, newStart + newSize), notification);
}
void ScrollBar::setCurrentRangeStart (const double newStart)
void ScrollBar::setCurrentRangeStart (const double newStart, NotificationType notification)
{
setCurrentRange (visibleRange.movedToStartAt (newStart));
setCurrentRange (visibleRange.movedToStartAt (newStart), notification);
}
void ScrollBar::setSingleStepSize (const double newSingleStepSize) noexcept
@ -133,24 +133,24 @@ void ScrollBar::setSingleStepSize (const double newSingleStepSize) noexcept
singleStepSize = newSingleStepSize;
}
bool ScrollBar::moveScrollbarInSteps (const int howManySteps)
bool ScrollBar::moveScrollbarInSteps (const int howManySteps, NotificationType notification)
{
return setCurrentRange (visibleRange + howManySteps * singleStepSize);
return setCurrentRange (visibleRange + howManySteps * singleStepSize, notification);
}
bool ScrollBar::moveScrollbarInPages (const int howManyPages)
bool ScrollBar::moveScrollbarInPages (const int howManyPages, NotificationType notification)
{
return setCurrentRange (visibleRange + howManyPages * visibleRange.getLength());
return setCurrentRange (visibleRange + howManyPages * visibleRange.getLength(), notification);
}
bool ScrollBar::scrollToTop()
bool ScrollBar::scrollToTop (NotificationType notification)
{
return setCurrentRange (visibleRange.movedToStartAt (getMinimumRangeLimit()));
return setCurrentRange (visibleRange.movedToStartAt (getMinimumRangeLimit()), notification);
}
bool ScrollBar::scrollToBottom()
bool ScrollBar::scrollToBottom (NotificationType notification)
{
return setCurrentRange (visibleRange.movedToEndAt (getMaximumRangeLimit()));
return setCurrentRange (visibleRange.movedToEndAt (getMaximumRangeLimit()), notification);
}
void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,

View file

@ -99,7 +99,8 @@ public:
@see setCurrentRange
*/
void setRangeLimits (const Range<double>& newRangeLimit);
void setRangeLimits (const Range<double>& newRangeLimit,
NotificationType notification = sendNotificationAsync);
/** Sets the minimum and maximum values that the bar will move between.
@ -108,7 +109,8 @@ public:
@see setCurrentRange
*/
void setRangeLimits (double minimum, double maximum);
void setRangeLimits (double minimum, double maximum,
NotificationType notification = sendNotificationAsync);
/** Returns the current limits on the thumb position.
@see setRangeLimits
@ -163,7 +165,8 @@ public:
size is beyond these limits, it will be clipped.
@see setCurrentRangeStart, getCurrentRangeStart, getCurrentRangeSize
*/
void setCurrentRange (double newStart, double newSize);
void setCurrentRange (double newStart, double newSize,
NotificationType notification = sendNotificationAsync);
/** Moves the bar's thumb position.
@ -176,7 +179,8 @@ public:
@see setCurrentRange
*/
void setCurrentRangeStart (double newStart);
void setCurrentRangeStart (double newStart,
NotificationType notification = sendNotificationAsync);
/** Returns the current thumb range.
@see getCurrentRange, setCurrentRange
@ -210,7 +214,8 @@ public:
value moves it up or to the left.
@returns true if the scrollbar's position actually changed.
*/
bool moveScrollbarInSteps (int howManySteps);
bool moveScrollbarInSteps (int howManySteps,
NotificationType notification = sendNotificationAsync);
/** Moves the scroll bar up or down in pages.
@ -221,19 +226,20 @@ public:
value moves it up or to the left.
@returns true if the scrollbar's position actually changed.
*/
bool moveScrollbarInPages (int howManyPages);
bool moveScrollbarInPages (int howManyPages,
NotificationType notification = sendNotificationAsync);
/** Scrolls to the top (or left).
This is the same as calling setCurrentRangeStart (getMinimumRangeLimit());
@returns true if the scrollbar's position actually changed.
*/
bool scrollToTop();
bool scrollToTop (NotificationType notification = sendNotificationAsync);
/** Scrolls to the bottom (or right).
This is the same as calling setCurrentRangeStart (getMaximumRangeLimit() - getCurrentRangeSize());
@returns true if the scrollbar's position actually changed.
*/
bool scrollToBottom();
bool scrollToBottom (NotificationType notification = sendNotificationAsync);
/** Changes the delay before the up and down buttons autorepeat when they are held
down.