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

Added a notification mode to Scrollbar::setCurrentRange()

This commit is contained in:
jules 2012-10-19 18:44:44 +01:00
parent eda5904ba7
commit 769e2a72d1
2 changed files with 13 additions and 3 deletions

View file

@ -95,7 +95,8 @@ void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum
setRangeLimits (Range<double> (newMinimum, newMaximum));
}
bool ScrollBar::setCurrentRange (const Range<double>& newRange)
bool ScrollBar::setCurrentRange (const Range<double>& newRange,
const NotificationType notification)
{
const Range<double> constrainedRange (totalRange.constrainRange (newRange));
@ -104,7 +105,12 @@ bool ScrollBar::setCurrentRange (const Range<double>& newRange)
visibleRange = constrainedRange;
updateThumbPosition();
triggerAsyncUpdate();
if (notification != dontSendNotification)
triggerAsyncUpdate();
if (notification == sendNotificationSync)
handleUpdateNowIfNeeded();
return true;
}

View file

@ -137,10 +137,14 @@ public:
asynchronous call to ScrollBar::Listener::scrollBarMoved() for all the listeners that
are registered.
The notification parameter can be used to optionally send or inhibit a callback to
any scrollbar listeners.
@returns true if the range was changed, or false if nothing was changed.
@see getCurrentRange. setCurrentRangeStart
*/
bool setCurrentRange (const Range<double>& newRange);
bool setCurrentRange (const Range<double>& newRange,
NotificationType notification = sendNotificationAsync);
/** Changes the position of the scrollbar's 'thumb'.