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

New enum: NotificationType, to indicate whether to send a change message or not (and whether it should be async). Updates to ListBox, TreeView and Slider methods to use this type instead of bools.

This commit is contained in:
jules 2012-10-18 13:53:02 +01:00
parent ab7c03a99e
commit 5ed768e953
17 changed files with 172 additions and 116 deletions

View file

@ -330,7 +330,7 @@ void AudioDemoPlaybackPage::showFile (const File& file)
{
loadFileIntoTransport (file);
zoomSlider->setValue (0, false, false);
zoomSlider->setValue (0, dontSendNotification);
thumbnail->setFile (file);
}

View file

@ -99,7 +99,7 @@ private:
void timerCallback()
{
if (! position.isMouseButtonDown())
position.setValue (dshowComp.getPosition(), false);
position.setValue (dshowComp.getPosition(), dontSendNotification);
}
private:

View file

@ -45,7 +45,7 @@ public:
speedSlider.setRange (-10.0, 10.0, 0.1);
speedSlider.setPopupMenuEnabled (true);
speedSlider.setValue (Random::getSystemRandom().nextDouble() * 3.0, false, false);
speedSlider.setValue (Random::getSystemRandom().nextDouble() * 3.0, dontSendNotification);
speedSlider.setSliderStyle (Slider::LinearHorizontal);
speedSlider.setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
addAndMakeVisible (&speedSlider);
@ -53,7 +53,7 @@ public:
sizeSlider.setRange (0.2, 2.0, 0.01);
sizeSlider.setPopupMenuEnabled (true);
sizeSlider.setValue (Random::getSystemRandom().nextDouble() + 0.5, false, false);
sizeSlider.setValue (Random::getSystemRandom().nextDouble() + 0.5, dontSendNotification);
sizeSlider.setSliderStyle (Slider::LinearHorizontal);
sizeSlider.setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
addAndMakeVisible (&sizeSlider);

View file

@ -360,7 +360,7 @@ private:
else if (v >= slider->getMaximum())
speed = -fabsf (speed);
slider->setValue (v, false);
slider->setValue (v, dontSendNotification);
}
};
@ -536,8 +536,8 @@ RenderingTestComponent::RenderingTestComponent ()
//[Constructor] You can add your own custom stuff here..
testTypeComboBox->setSelectedId (2);
sizeSlider->setValue (1.0, false);
opacitySlider->setValue (1.0, false);
sizeSlider->setValue (1.0, dontSendNotification);
opacitySlider->setValue (1.0, dontSendNotification);
highQualityToggle->setToggleState (true, false);
//[/Constructor]
}

View file

@ -293,7 +293,7 @@ static Component* createSlidersPage()
sliders[i]->setRange (0.0, 100.0, 0.1);
sliders[i]->setPopupMenuEnabled (true);
sliders[i]->setValue (Random::getSystemRandom().nextDouble() * 100.0, false, false);
sliders[i]->setValue (Random::getSystemRandom().nextDouble() * 100.0, dontSendNotification);
}
sliders[0]->setSliderStyle (Slider::LinearVertical);
@ -655,7 +655,7 @@ public:
addAndMakeVisible (&depthSlider);
depthSlider.setRange (10.0, 200.0, 1.0);
depthSlider.setValue (50, false);
depthSlider.setValue (50, dontSendNotification);
depthSlider.setSliderStyle (Slider::LinearHorizontal);
depthSlider.setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
depthSlider.addListener (this);

View file

@ -94,8 +94,8 @@ void JuceDemoPluginAudioProcessorEditor::timerCallback()
if (lastDisplayedPosition != newPos)
displayPositionInfo (newPos);
gainSlider.setValue (ourProcessor->gain, false);
delaySlider.setValue (ourProcessor->delay, false);
gainSlider.setValue (ourProcessor->gain, dontSendNotification);
delaySlider.setValue (ourProcessor->delay, dontSendNotification);
}
// This is our Slider::Listener callback, when the user drags a slider.

View file

@ -316,4 +316,4 @@ void AudioPlayHead::CurrentPositionInfo::resetToDefault()
timeSigNumerator = 4;
timeSigDenominator = 4;
bpm = 120;
}
}

View file

@ -48,7 +48,7 @@ public:
void refresh()
{
paramHasChanged = false;
slider.setValue (owner.getParameter (index), false);
slider.setValue (owner.getParameter (index), dontSendNotification);
}
void audioProcessorChanged (AudioProcessor*) {}

View file

@ -52,6 +52,9 @@ namespace juce
#ifndef __JUCE_MESSAGEMANAGER_JUCEHEADER__
#include "messages/juce_MessageManager.h"
#endif
#ifndef __JUCE_NOTIFICATIONTYPE_JUCEHEADER__
#include "messages/juce_NotificationType.h"
#endif
#ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
#include "broadcasters/juce_ActionBroadcaster.h"
#endif

View file

@ -0,0 +1,43 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_NOTIFICATIONTYPE_JUCEHEADER__
#define __JUCE_NOTIFICATIONTYPE_JUCEHEADER__
//==============================================================================
/**
These enums are used in various classes to indicate whether a notification
event should be sent out.
*/
enum NotificationType
{
dontSendNotification = 0, /**< No notification message should be sent. */
sendNotification = 1, /**< Requests a notification message, either synchronous or not. */
sendNotificationSync, /**< Requests a synchronous notification. */
sendNotificationAsync, /**< Requests a asynchronous notification. */
};
#endif // __JUCE_NOTIFICATIONTYPE_JUCEHEADER__

View file

@ -71,7 +71,7 @@ double SliderPropertyComponent::getValue() const
void SliderPropertyComponent::refresh()
{
slider.setValue (getValue(), false);
slider.setValue (getValue(), dontSendNotification);
}
void SliderPropertyComponent::sliderValueChanged (Slider*)

View file

@ -233,9 +233,8 @@ public:
for (int i = 0; i < numNeeded; ++i)
{
const int row = i + firstIndex;
RowComponent* const rowComp = getComponentForRow (row);
if (rowComp != nullptr)
if (RowComponent* const rowComp = getComponentForRow (row))
{
rowComp->setBounds (0, row * rowH, w, rowH);
rowComp->update (row, owner.isRowSelected (row));
@ -500,7 +499,7 @@ void ListBox::deselectRow (const int row)
}
void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
const bool sendNotificationEventToModel)
const NotificationType sendNotificationEventToModel)
{
selected = setOfRowsToBeSelected;
selected.removeRange (Range <int> (totalItems, std::numeric_limits<int>::max()));
@ -510,7 +509,7 @@ void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
viewport->updateContents();
if ((model != nullptr) && sendNotificationEventToModel)
if ((model != nullptr) && sendNotificationEventToModel == sendNotification)
model->selectedRowsChanged (lastRowSelected);
}
@ -624,8 +623,10 @@ int ListBox::getInsertionIndexForPosition (const int x, const int y) const noexc
Component* ListBox::getComponentForRowNumber (const int row) const noexcept
{
RowComponent* const listRowComp = viewport->getComponentForRowIfOnscreen (row);
return listRowComp != nullptr ? static_cast <Component*> (listRowComp->customComponent) : nullptr;
if (RowComponent* const listRowComp = viewport->getComponentForRowIfOnscreen (row))
return static_cast <Component*> (listRowComp->customComponent);
return nullptr;
}
int ListBox::getRowNumberOfComponent (Component* const rowComponent) const noexcept
@ -907,10 +908,7 @@ Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)
void ListBox::startDragAndDrop (const MouseEvent& e, const var& dragDescription, bool allowDraggingToOtherWindows)
{
DragAndDropContainer* const dragContainer
= DragAndDropContainer::findParentDragContainerFor (this);
if (dragContainer != nullptr)
if (DragAndDropContainer* const dragContainer = DragAndDropContainer::findParentDragContainerFor (this))
{
int x, y;
Image dragImage (createSnapshotOfSelectedRows (x, y));

View file

@ -286,7 +286,7 @@ public:
@see getSelectedRows
*/
void setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
bool sendNotificationEventToModel = true);
NotificationType sendNotificationEventToModel = sendNotification);
/** Checks whether a row is selected.
*/
@ -569,6 +569,11 @@ private:
void selectRowInternal (int rowNumber, bool dontScrollToShowThisRow,
bool deselectOthersFirst, bool isMouseClick);
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// This method's bool parameter has changed: see the new method signature.
JUCE_DEPRECATED (void setSelectedRows (const SparseSet<int>&, bool));
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ListBox);
};

View file

@ -144,12 +144,12 @@ public:
// keep the current values inside the new range..
if (style != TwoValueHorizontal && style != TwoValueVertical)
{
setValue (getValue(), false, false);
setValue (getValue(), dontSendNotification);
}
else
{
setMinValue (getMinValue(), false, false, false);
setMaxValue (getMaxValue(), false, false, false);
setMinValue (getMinValue(), dontSendNotification, false);
setMaxValue (getMaxValue(), dontSendNotification, false);
}
updateText();
@ -165,7 +165,7 @@ public:
return currentValue.getValue();
}
void setValue (double newValue, const bool sendUpdateMessage, const bool sendMessageSynchronously)
void setValue (double newValue, const NotificationType notification)
{
// for a two-value style slider, you should use the setMinValue() and setMaxValue()
// methods to set the two values.
@ -200,13 +200,12 @@ public:
if (popupDisplay != nullptr)
popupDisplay->updatePosition (owner.getTextFromValue (newValue));
if (sendUpdateMessage)
triggerChangeMessage (sendMessageSynchronously);
triggerChangeMessage (notification);
}
}
void setMinValue (double newValue, const bool sendUpdateMessage,
const bool sendMessageSynchronously, const bool allowNudgingOfOtherValues)
void setMinValue (double newValue, const NotificationType notification,
const bool allowNudgingOfOtherValues)
{
// The minimum value only applies to sliders that are in two- or three-value mode.
jassert (style == TwoValueHorizontal || style == TwoValueVertical
@ -217,14 +216,14 @@ public:
if (style == TwoValueHorizontal || style == TwoValueVertical)
{
if (allowNudgingOfOtherValues && newValue > (double) valueMax.getValue())
setMaxValue (newValue, sendUpdateMessage, sendMessageSynchronously, false);
setMaxValue (newValue, notification, false);
newValue = jmin ((double) valueMax.getValue(), newValue);
}
else
{
if (allowNudgingOfOtherValues && newValue > lastCurrentValue)
setValue (newValue, sendUpdateMessage, sendMessageSynchronously);
setValue (newValue, notification);
newValue = jmin (lastCurrentValue, newValue);
}
@ -238,13 +237,12 @@ public:
if (popupDisplay != nullptr)
popupDisplay->updatePosition (owner.getTextFromValue (newValue));
if (sendUpdateMessage)
triggerChangeMessage (sendMessageSynchronously);
triggerChangeMessage (notification);
}
}
void setMaxValue (double newValue, const bool sendUpdateMessage,
const bool sendMessageSynchronously, const bool allowNudgingOfOtherValues)
void setMaxValue (double newValue, const NotificationType notification,
const bool allowNudgingOfOtherValues)
{
// The maximum value only applies to sliders that are in two- or three-value mode.
jassert (style == TwoValueHorizontal || style == TwoValueVertical
@ -255,14 +253,14 @@ public:
if (style == TwoValueHorizontal || style == TwoValueVertical)
{
if (allowNudgingOfOtherValues && newValue < (double) valueMin.getValue())
setMinValue (newValue, sendUpdateMessage, sendMessageSynchronously, false);
setMinValue (newValue, notification, false);
newValue = jmax ((double) valueMin.getValue(), newValue);
}
else
{
if (allowNudgingOfOtherValues && newValue < lastCurrentValue)
setValue (newValue, sendUpdateMessage, sendMessageSynchronously);
setValue (newValue, notification);
newValue = jmax (lastCurrentValue, newValue);
}
@ -276,12 +274,11 @@ public:
if (popupDisplay != nullptr)
popupDisplay->updatePosition (owner.getTextFromValue (valueMax.getValue()));
if (sendUpdateMessage)
triggerChangeMessage (sendMessageSynchronously);
triggerChangeMessage (notification);
}
}
void setMinAndMaxValues (double newMinValue, double newMaxValue, bool sendUpdateMessage, bool sendMessageSynchronously)
void setMinAndMaxValues (double newMinValue, double newMaxValue, const NotificationType notification)
{
// The maximum value only applies to sliders that are in two- or three-value mode.
jassert (style == TwoValueHorizontal || style == TwoValueVertical
@ -301,8 +298,7 @@ public:
valueMax = newMaxValue;
owner.repaint();
if (sendUpdateMessage)
triggerChangeMessage (sendMessageSynchronously);
triggerChangeMessage (notification);
}
}
@ -324,14 +320,17 @@ public:
return valueMax.getValue();
}
void triggerChangeMessage (const bool synchronous)
void triggerChangeMessage (const NotificationType notification)
{
if (synchronous)
handleAsyncUpdate();
else
triggerAsyncUpdate();
if (notification != dontSendNotification)
{
if (notification == sendNotificationSync)
handleAsyncUpdate();
else
triggerAsyncUpdate();
owner.valueChanged();
owner.valueChanged();
}
}
void handleAsyncUpdate()
@ -370,7 +369,7 @@ public:
const double delta = (button == incButton) ? interval : -interval;
sendDragStart();
setValue (owner.snapValue (getValue() + delta, false), true, true);
setValue (owner.snapValue (getValue() + delta, false), sendNotificationSync);
sendDragEnd();
}
}
@ -380,12 +379,12 @@ public:
if (value.refersToSameSourceAs (currentValue))
{
if (style != TwoValueHorizontal && style != TwoValueVertical)
setValue (currentValue.getValue(), false, false);
setValue (currentValue.getValue(), dontSendNotification);
}
else if (value.refersToSameSourceAs (valueMin))
setMinValue (valueMin.getValue(), false, false, true);
setMinValue (valueMin.getValue(), dontSendNotification, true);
else if (value.refersToSameSourceAs (valueMax))
setMaxValue (valueMax.getValue(), false, false, true);
setMaxValue (valueMax.getValue(), dontSendNotification, true);
}
void labelTextChanged (Label* label)
@ -395,7 +394,7 @@ public:
if (newValue != (double) currentValue.getValue())
{
sendDragStart();
setValue (newValue, true, true);
setValue (newValue, sendNotificationSync);
sendDragEnd();
}
@ -905,25 +904,25 @@ public:
if (sliderBeingDragged == 0)
{
setValue (owner.snapValue (valueWhenLastDragged, true),
! sendChangeOnlyOnRelease, true);
sendChangeOnlyOnRelease ? dontSendNotification : sendNotificationSync);
}
else if (sliderBeingDragged == 1)
{
setMinValue (owner.snapValue (valueWhenLastDragged, true),
! sendChangeOnlyOnRelease, false, true);
sendChangeOnlyOnRelease ? dontSendNotification : sendNotificationAsync, true);
if (e.mods.isShiftDown())
setMaxValue (getMinValue() + minMaxDiff, false, false, true);
setMaxValue (getMinValue() + minMaxDiff, dontSendNotification, true);
else
minMaxDiff = (double) valueMax.getValue() - (double) valueMin.getValue();
}
else if (sliderBeingDragged == 2)
{
setMaxValue (owner.snapValue (valueWhenLastDragged, true),
! sendChangeOnlyOnRelease, false, true);
sendChangeOnlyOnRelease ? dontSendNotification : sendNotificationAsync, true);
if (e.mods.isShiftDown())
setMinValue (getMaxValue() - minMaxDiff, false, false, true);
setMinValue (getMaxValue() - minMaxDiff, dontSendNotification, true);
else
minMaxDiff = (double) valueMax.getValue() - (double) valueMin.getValue();
}
@ -942,7 +941,7 @@ public:
restoreMouseIfHidden();
if (sendChangeOnlyOnRelease && valueOnMouseDown != (double) currentValue.getValue())
triggerChangeMessage (false);
triggerChangeMessage (sendNotificationAsync);
sendDragEnd();
popupDisplay = nullptr;
@ -967,7 +966,7 @@ public:
&& maximum >= doubleClickReturnValue)
{
sendDragStart();
setValue (doubleClickReturnValue, true, true);
setValue (doubleClickReturnValue, sendNotificationSync);
sendDragEnd();
}
}
@ -994,7 +993,7 @@ public:
delta = -delta;
sendDragStart();
setValue (owner.snapValue (value + delta, false), true, true);
setValue (owner.snapValue (value + delta, false), sendNotificationSync);
sendDragEnd();
}
@ -1427,27 +1426,27 @@ Value& Slider::getMaxValueObject() noexcept { return pimpl->valueMax; }
double Slider::getValue() const { return pimpl->getValue(); }
void Slider::setValue (double newValue, bool sendUpdateMessage, bool sendMessageSynchronously)
void Slider::setValue (double newValue, const NotificationType notification)
{
pimpl->setValue (newValue, sendUpdateMessage, sendMessageSynchronously);
pimpl->setValue (newValue, notification);
}
double Slider::getMinValue() const { return pimpl->getMinValue(); }
double Slider::getMaxValue() const { return pimpl->getMaxValue(); }
void Slider::setMinValue (double newValue, bool sendUpdateMessage, bool sendMessageSynchronously, bool allowNudgingOfOtherValues)
void Slider::setMinValue (double newValue, const NotificationType notification, bool allowNudgingOfOtherValues)
{
pimpl->setMinValue (newValue, sendUpdateMessage, sendMessageSynchronously, allowNudgingOfOtherValues);
pimpl->setMinValue (newValue, notification, allowNudgingOfOtherValues);
}
void Slider::setMaxValue (double newValue, bool sendUpdateMessage, bool sendMessageSynchronously, bool allowNudgingOfOtherValues)
void Slider::setMaxValue (double newValue, const NotificationType notification, bool allowNudgingOfOtherValues)
{
pimpl->setMaxValue (newValue, sendUpdateMessage, sendMessageSynchronously, allowNudgingOfOtherValues);
pimpl->setMaxValue (newValue, notification, allowNudgingOfOtherValues);
}
void Slider::setMinAndMaxValues (double newMinValue, double newMaxValue, bool sendUpdateMessage, bool sendMessageSynchronously)
void Slider::setMinAndMaxValues (double newMinValue, double newMaxValue, const NotificationType notification)
{
pimpl->setMinAndMaxValues (newMinValue, newMaxValue, sendUpdateMessage, sendMessageSynchronously);
pimpl->setMinAndMaxValues (newMinValue, newMaxValue, notification);
}
void Slider::setDoubleClickReturnValue (bool isDoubleClickEnabled, double valueToSetOnDoubleClick)

View file

@ -125,7 +125,6 @@ public:
void setSliderStyle (SliderStyle newStyle);
/** Returns the slider's current style.
@see setSliderStyle
*/
SliderStyle getSliderStyle() const noexcept;
@ -340,17 +339,14 @@ public:
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the
nearest interval if one has been set
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the
nearest interval if one has been set
@param notification can be one of the NotificationType values, to request
a synchronous or asynchronous call to the valueChanged() method
of any Slider::Listeners that are registered.
*/
void setValue (double newValue,
bool sendUpdateMessage = true,
bool sendMessageSynchronously = false);
void setValue (double newValue, NotificationType notification = sendNotificationAsync);
/** Returns the slider's current value. */
double getValue() const;
@ -415,13 +411,12 @@ public:
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param notification can be one of the NotificationType values, to request
a synchronous or asynchronous call to the valueChanged() method
of any Slider::Listeners that are registered.
@param allowNudgingOfOtherValues if false, this value will be restricted to being below the
max value (in a two-value slider) or the mid value (in a three-value
slider). If true, then if this value goes beyond those values,
@ -429,8 +424,7 @@ public:
@see getMinValue, setMaxValue, setValue
*/
void setMinValue (double newValue,
bool sendUpdateMessage = true,
bool sendMessageSynchronously = false,
NotificationType notification = sendNotificationAsync,
bool allowNudgingOfOtherValues = false);
/** For a slider with two or three thumbs, this returns the higher of its values.
@ -457,13 +451,12 @@ public:
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param newValue the new value to set - this will be restricted by the
minimum and maximum range, and will be snapped to the nearest
interval if one has been set.
@param notification can be one of the NotificationType values, to request
a synchronous or asynchronous call to the valueChanged() method
of any Slider::Listeners that are registered.
@param allowNudgingOfOtherValues if false, this value will be restricted to being above the
min value (in a two-value slider) or the mid value (in a three-value
slider). If true, then if this value goes beyond those values,
@ -471,8 +464,7 @@ public:
@see getMaxValue, setMinValue, setValue
*/
void setMaxValue (double newValue,
bool sendUpdateMessage = true,
bool sendMessageSynchronously = false,
NotificationType notification = sendNotificationAsync,
bool allowNudgingOfOtherValues = false);
/** For a slider with two or three thumbs, this sets the minimum and maximum thumb positions.
@ -481,19 +473,17 @@ public:
that are registered, and will synchronously call the valueChanged() method in case subclasses
want to handle it.
@param newMinValue the new minimum value to set - this will be snapped to the
nearest interval if one has been set.
@param newMaxValue the new minimum value to set - this will be snapped to the
nearest interval if one has been set.
@param sendUpdateMessage if false, a change to the value will not trigger a call to
any Slider::Listeners or the valueChanged() method
@param sendMessageSynchronously if true, then a call to the Slider::Listeners will be made
synchronously; if false, it will be asynchronous
@param newMinValue the new minimum value to set - this will be snapped to the
nearest interval if one has been set.
@param newMaxValue the new minimum value to set - this will be snapped to the
nearest interval if one has been set.
@param notification can be one of the NotificationType values, to request
a synchronous or asynchronous call to the valueChanged() method
of any Slider::Listeners that are registered.
@see setMaxValue, setMinValue, setValue
*/
void setMinAndMaxValues (double newMinValue, double newMaxValue,
bool sendUpdateMessage = true,
bool sendMessageSynchronously = false);
NotificationType notification = sendNotificationAsync);
//==============================================================================
/** A class for receiving callbacks from a Slider.
@ -820,6 +810,20 @@ private:
void init (SliderStyle, TextEntryBoxPosition);
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
// These methods' bool parameters have changed: see the new method signature.
JUCE_DEPRECATED (void setValue (double, bool));
JUCE_DEPRECATED (void setValue (double, bool, bool));
JUCE_DEPRECATED (void setMinValue (double, bool, bool, bool));
JUCE_DEPRECATED (void setMinValue (double, bool, bool));
JUCE_DEPRECATED (void setMinValue (double, bool));
JUCE_DEPRECATED (void setMaxValue (double, bool, bool, bool));
JUCE_DEPRECATED (void setMaxValue (double, bool, bool));
JUCE_DEPRECATED (void setMaxValue (double, bool));
JUCE_DEPRECATED (void setMinAndMaxValues (double, double, bool, bool));
JUCE_DEPRECATED (void setMinAndMaxValues (double, double, bool));
#endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Slider);
};

View file

@ -1271,7 +1271,8 @@ void TreeViewItem::deselectAllRecursively()
}
void TreeViewItem::setSelected (const bool shouldBeSelected,
const bool deselectOtherItemsFirst)
const bool deselectOtherItemsFirst,
const NotificationType notify)
{
if (shouldBeSelected && ! canBeSelected())
return;
@ -1285,7 +1286,8 @@ void TreeViewItem::setSelected (const bool shouldBeSelected,
if (ownerView != nullptr)
ownerView->repaint();
itemSelectionChanged (shouldBeSelected);
if (notify != dontSendNotification)
itemSelectionChanged (shouldBeSelected);
}
}

View file

@ -142,10 +142,12 @@ public:
bool isSelected() const noexcept;
/** Selects or deselects the item.
This will cause a callback to itemSelectionChanged()
If shouldNotify == sendNotification, then a callback will be made
to itemSelectionChanged()
*/
void setSelected (bool shouldBeSelected,
bool deselectOtherItemsFirst);
bool deselectOtherItemsFirst,
NotificationType shouldNotify = sendNotification);
/** Returns the rectangle that this item occupies.