@@ -207,7 +207,7 @@ void JuceUpdater::updateInstallButtonStatus() | |||
{ | |||
const int numChecked = getNumCheckedModules(); | |||
installButton.setEnabled (numChecked > 0); | |||
selectAllButton.setToggleState (numChecked > latestList.modules.size() / 2, false); | |||
selectAllButton.setToggleState (numChecked > latestList.modules.size() / 2, dontSendNotification); | |||
} | |||
void JuceUpdater::filenameComponentChanged (FilenameComponent*) | |||
@@ -320,7 +320,7 @@ public: | |||
addAndMakeVisible (&caseButton); | |||
caseButton.setColour (ToggleButton::textColourId, Colours::white); | |||
caseButton.setToggleState (isCaseSensitiveSearch(), false); | |||
caseButton.setToggleState (isCaseSensitiveSearch(), dontSendNotification); | |||
caseButton.addListener (this); | |||
findPrev.setConnectedEdges (Button::ConnectedOnRight); | |||
@@ -62,7 +62,7 @@ public: | |||
if (! ButtonHandler::restoreFromXml (xml, comp, layout)) | |||
return false; | |||
tb->setToggleState (xml.getBoolAttribute ("state", false), false); | |||
tb->setToggleState (xml.getBoolAttribute ("state", false), dontSendNotification); | |||
return true; | |||
} | |||
@@ -75,7 +75,7 @@ public: | |||
String s; | |||
if (tb->getToggleState()) | |||
s << memberVariableName << "->setToggleState (true, false);\n"; | |||
s << memberVariableName << "->setToggleState (true, dontSendNotification);\n"; | |||
s << getColourIntialisationCode (component, memberVariableName) | |||
<< '\n'; | |||
@@ -117,7 +117,7 @@ private: | |||
bool perform() | |||
{ | |||
showCorrectTab(); | |||
getComponent()->setToggleState (newState, false); | |||
getComponent()->setToggleState (newState, dontSendNotification); | |||
changed(); | |||
return true; | |||
} | |||
@@ -125,7 +125,7 @@ private: | |||
bool undo() | |||
{ | |||
showCorrectTab(); | |||
getComponent()->setToggleState (oldState, false); | |||
getComponent()->setToggleState (oldState, dontSendNotification); | |||
changed(); | |||
return true; | |||
} | |||
@@ -42,7 +42,7 @@ struct NewProjectWizardClasses | |||
setupComp.addChildAndSetID (c, "filesToCreate"); | |||
c->addItemList (fileOptions, 1); | |||
c->setSelectedId (1, false); | |||
c->setSelectedId (1, dontSendNotification); | |||
Label* l = new Label (String::empty, TRANS("Files to Auto-Generate") + ":"); | |||
l->attachToComponent (c, true); | |||
@@ -482,7 +482,7 @@ struct NewProjectWizardClasses | |||
addChildAndSetID (&projectType, "projectType"); | |||
projectType.addItemList (getWizardNames(), 1); | |||
projectType.setSelectedId (1, true); | |||
projectType.setSelectedId (1, dontSendNotification); | |||
projectType.setBounds ("100, projectName.bottom + 4, projectName.right, top + 22"); | |||
typeLabel.attachToComponent (&projectType, true); | |||
projectType.addListener (this); | |||
@@ -253,7 +253,7 @@ AudioDemoSynthPage::AudioDemoSynthPage (AudioDeviceManager& deviceManager_) | |||
sineButton->setButtonText ("Use sine wave"); | |||
sineButton->setRadioGroupId (321); | |||
sineButton->addListener (this); | |||
sineButton->setToggleState (true, false); | |||
sineButton->setToggleState (true, dontSendNotification); | |||
addAndMakeVisible (sampledButton = new ToggleButton (String::empty)); | |||
sampledButton->setButtonText ("Use sampled sound"); | |||
@@ -520,7 +520,7 @@ RenderingTestComponent::RenderingTestComponent () | |||
testTypeComboBox->setSelectedId (2); | |||
sizeSlider->setValue (1.0, dontSendNotification); | |||
opacitySlider->setValue (1.0, dontSendNotification); | |||
highQualityToggle->setToggleState (true, false); | |||
highQualityToggle->setToggleState (true, dontSendNotification); | |||
//[/Constructor] | |||
} | |||
@@ -242,7 +242,7 @@ private: | |||
{ | |||
row = newRow; | |||
columnId = newColumn; | |||
comboBox.setSelectedId (owner.getRating (row), true); | |||
comboBox.setSelectedId (owner.getRating (row), dontSendNotification); | |||
} | |||
void comboBoxChanged (ComboBox* /*comboBoxThatHasChanged*/) | |||
@@ -399,7 +399,7 @@ static Component* createRadioButtonPage() | |||
tb->setTooltip ("a set of mutually-exclusive radio buttons"); | |||
if (i == 0) | |||
tb->setToggleState (true, false); | |||
tb->setToggleState (true, dontSendNotification); | |||
} | |||
for (int i = 0; i < 4; ++i) | |||
@@ -429,7 +429,7 @@ static Component* createRadioButtonPage() | |||
db->setBounds (25 + i * buttonSize, 180, buttonSize, buttonSize); | |||
if (i == 0) | |||
db->setToggleState (true, false); | |||
db->setToggleState (true, dontSendNotification); | |||
} | |||
for (int i = 0; i < 4; ++i) | |||
@@ -447,7 +447,7 @@ static Component* createRadioButtonPage() | |||
| ((i != 3) ? Button::ConnectedOnRight : 0)); | |||
if (i == 0) | |||
tb->setToggleState (true, false); | |||
tb->setToggleState (true, dontSendNotification); | |||
} | |||
return page; | |||
@@ -1074,7 +1074,7 @@ public: | |||
addAndMakeVisible (&enableButton); | |||
enableButton.setBounds (230, 10, 180, 24); | |||
enableButton.setTooltip ("Enables/disables all the components"); | |||
enableButton.setToggleState (true, false); | |||
enableButton.setToggleState (true, dontSendNotification); | |||
enableButton.addListener (this); | |||
addAndMakeVisible (&transformSlider); | |||
@@ -465,10 +465,10 @@ public: | |||
bufferSizeDropDown = nullptr; | |||
if (outputDeviceDropDown != nullptr) | |||
outputDeviceDropDown->setSelectedId (-1, true); | |||
outputDeviceDropDown->setSelectedId (-1, dontSendNotification); | |||
if (inputDeviceDropDown != nullptr) | |||
inputDeviceDropDown->setSelectedId (-1, true); | |||
inputDeviceDropDown->setSelectedId (-1, dontSendNotification); | |||
} | |||
resized(); | |||
@@ -498,7 +498,7 @@ private: | |||
const int index = type->getIndexOfDevice (currentDevice, isInput); | |||
box->setSelectedId (index + 1, true); | |||
box->setSelectedId (index + 1, dontSendNotification); | |||
if (testButton != nullptr && ! isInput) | |||
testButton->setEnabled (index >= 0); | |||
@@ -509,13 +509,13 @@ private: | |||
{ | |||
const StringArray devs (type->getDeviceNames (isInputs)); | |||
combo.clear (true); | |||
combo.clear (dontSendNotification); | |||
for (int i = 0; i < devs.size(); ++i) | |||
combo.addItem (devs[i], i + 1); | |||
combo.addItem (getNoDeviceString(), -1); | |||
combo.setSelectedId (-1, true); | |||
combo.setSelectedId (-1, dontSendNotification); | |||
} | |||
int getLowestY() const | |||
@@ -617,7 +617,7 @@ private: | |||
sampleRateDropDown->addItem (String (rate) + " Hz", rate); | |||
} | |||
sampleRateDropDown->setSelectedId (roundToInt (currentDevice->getCurrentSampleRate()), true); | |||
sampleRateDropDown->setSelectedId (roundToInt (currentDevice->getCurrentSampleRate()), dontSendNotification); | |||
sampleRateDropDown->addListener (this); | |||
} | |||
@@ -651,7 +651,7 @@ private: | |||
bs); | |||
} | |||
bufferSizeDropDown->setSelectedId (currentDevice->getCurrentBufferSizeSamples(), true); | |||
bufferSizeDropDown->setSelectedId (currentDevice->getCurrentBufferSizeSamples(), dontSendNotification); | |||
bufferSizeDropDown->addListener (this); | |||
} | |||
@@ -1059,7 +1059,7 @@ void AudioDeviceSelectorComponent::changeListenerCallback (ChangeBroadcaster*) | |||
void AudioDeviceSelectorComponent::updateAllControls() | |||
{ | |||
if (deviceTypeDropDown != nullptr) | |||
deviceTypeDropDown->setText (deviceManager.getCurrentAudioDeviceType(), false); | |||
deviceTypeDropDown->setText (deviceManager.getCurrentAudioDeviceType(), dontSendNotification); | |||
if (audioDeviceSettingsComp == nullptr | |||
|| audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType()) | |||
@@ -1112,7 +1112,7 @@ void AudioDeviceSelectorComponent::updateAllControls() | |||
if (deviceManager.getDefaultMidiOutput() != nullptr) | |||
current = 1 + midiOuts.indexOf (deviceManager.getDefaultMidiOutputName()); | |||
midiOutputSelector->setSelectedId (current, true); | |||
midiOutputSelector->setSelectedId (current, dontSendNotification); | |||
} | |||
resized(); | |||
@@ -271,10 +271,12 @@ namespace juce | |||
//============================================================================== | |||
// Cross-compiler deprecation macros.. | |||
#if DOXYGEN || (JUCE_MSVC && ! JUCE_NO_DEPRECATION_WARNINGS) | |||
/** This can be used to wrap a function which has been deprecated. */ | |||
#ifdef DOXYGEN | |||
/** This macro can be used to wrap a function which has been deprecated. */ | |||
#define JUCE_DEPRECATED(functionDef) | |||
#elif JUCE_MSVC && ! JUCE_NO_DEPRECATION_WARNINGS | |||
#define JUCE_DEPRECATED(functionDef) __declspec(deprecated) functionDef | |||
#elif JUCE_GCC && ! JUCE_NO_DEPRECATION_WARNINGS | |||
#elif JUCE_GCC && ! JUCE_NO_DEPRECATION_WARNINGS | |||
#define JUCE_DEPRECATED(functionDef) functionDef __attribute__ ((deprecated)) | |||
#else | |||
#define JUCE_DEPRECATED(functionDef) functionDef | |||
@@ -1224,7 +1224,7 @@ private: | |||
explicit String (const PreallocationBytes&); // This constructor preallocates a certain amount of memory | |||
void appendFixedLength (const char* text, int numExtraChars); | |||
size_t getByteOffsetOfEnd() const noexcept; | |||
JUCE_DEPRECATED (String (const String& stringToCopy, size_t charsToAllocate)); | |||
JUCE_DEPRECATED (String (const String&, size_t)); | |||
// This private cast operator should prevent strings being accidentally cast | |||
// to bools (this is possible because the compiler can add an implicit cast | |||
@@ -124,7 +124,7 @@ void Button::setConnectedEdges (const int connectedEdgeFlags_) | |||
//============================================================================== | |||
void Button::setToggleState (const bool shouldBeOn, | |||
const bool sendChangeNotification) | |||
const NotificationType notification) | |||
{ | |||
if (shouldBeOn != lastToggleState) | |||
{ | |||
@@ -136,8 +136,11 @@ void Button::setToggleState (const bool shouldBeOn, | |||
WeakReference<Component> deletionWatcher (this); | |||
if (sendChangeNotification) | |||
if (notification != dontSendNotification) | |||
{ | |||
// async callbacks aren't possible here | |||
jassert (notification != sendNotificationAsync); | |||
sendClickMessage (ModifierKeys()); | |||
if (deletionWatcher == nullptr) | |||
@@ -146,7 +149,7 @@ void Button::setToggleState (const bool shouldBeOn, | |||
if (lastToggleState) | |||
{ | |||
turnOffOtherButtonsInGroup (sendChangeNotification); | |||
turnOffOtherButtonsInGroup (notification); | |||
if (deletionWatcher == nullptr) | |||
return; | |||
@@ -156,6 +159,11 @@ void Button::setToggleState (const bool shouldBeOn, | |||
} | |||
} | |||
void Button::setToggleState (const bool shouldBeOn, bool sendChange) | |||
{ | |||
setToggleState (shouldBeOn, sendChange ? sendNotification : dontSendNotification); | |||
} | |||
void Button::setClickingTogglesState (const bool shouldToggle) noexcept | |||
{ | |||
clickTogglesState = shouldToggle; | |||
@@ -175,7 +183,7 @@ bool Button::getClickingTogglesState() const noexcept | |||
void Button::valueChanged (Value& value) | |||
{ | |||
if (value.refersToSameSourceAs (isOn)) | |||
setToggleState (isOn.getValue(), true); | |||
setToggleState (isOn.getValue(), sendNotification); | |||
} | |||
void Button::setRadioGroupId (const int newGroupId) | |||
@@ -185,11 +193,11 @@ void Button::setRadioGroupId (const int newGroupId) | |||
radioGroupId = newGroupId; | |||
if (lastToggleState) | |||
turnOffOtherButtonsInGroup (true); | |||
turnOffOtherButtonsInGroup (sendNotification); | |||
} | |||
} | |||
void Button::turnOffOtherButtonsInGroup (const bool sendChangeNotification) | |||
void Button::turnOffOtherButtonsInGroup (const NotificationType notification) | |||
{ | |||
if (Component* const p = getParentComponent()) | |||
{ | |||
@@ -207,7 +215,7 @@ void Button::turnOffOtherButtonsInGroup (const bool sendChangeNotification) | |||
{ | |||
if (b->getRadioGroupId() == radioGroupId) | |||
{ | |||
b->setToggleState (false, sendChangeNotification); | |||
b->setToggleState (false, notification); | |||
if (deletionWatcher == nullptr) | |||
return; | |||
@@ -309,7 +317,7 @@ void Button::triggerClick() | |||
void Button::internalClickCallback (const ModifierKeys& modifiers) | |||
{ | |||
if (clickTogglesState) | |||
setToggleState ((radioGroupId != 0) || ! lastToggleState, false); | |||
setToggleState ((radioGroupId != 0) || ! lastToggleState, dontSendNotification); | |||
sendClickMessage (modifiers); | |||
} | |||
@@ -351,9 +359,6 @@ void Button::removeListener (ButtonListener* const listener) | |||
buttonListeners.remove (listener); | |||
} | |||
void Button::addButtonListener (ButtonListener* l) { addListener (l); } | |||
void Button::removeButtonListener (ButtonListener* l) { removeListener (l); } | |||
void Button::sendClickMessage (const ModifierKeys& modifiers) | |||
{ | |||
Component::BailOutChecker checker (this); | |||
@@ -523,7 +528,7 @@ void Button::applicationCommandListChanged() | |||
setEnabled (target != nullptr && (info.flags & ApplicationCommandInfo::isDisabled) == 0); | |||
if (target != nullptr) | |||
setToggleState ((info.flags & ApplicationCommandInfo::isTicked) != 0, false); | |||
setToggleState ((info.flags & ApplicationCommandInfo::isTicked) != 0, dontSendNotification); | |||
} | |||
} | |||
@@ -90,17 +90,17 @@ public: | |||
an action you won't change this. Toggle buttons, however will want to | |||
change their state when turned on or off. | |||
@param shouldBeOn whether to set the button's toggle state to be on or | |||
off. If it's a member of a button group, this will | |||
always try to turn it on, and to turn off any other | |||
buttons in the group | |||
@param sendChangeNotification if true, a callback will be made to clicked(); if false | |||
the button will be repainted but no notification will | |||
be sent | |||
@param shouldBeOn whether to set the button's toggle state to be on or | |||
off. If it's a member of a button group, this will | |||
always try to turn it on, and to turn off any other | |||
buttons in the group | |||
@param notification determines the behaviour if the value changes - this | |||
can invoke a synchronous call to clicked(), but | |||
sendNotificationAsync is not supported | |||
@see getToggleState, setRadioGroupId | |||
*/ | |||
void setToggleState (bool shouldBeOn, | |||
bool sendChangeNotification); | |||
NotificationType notification); | |||
/** Returns true if the button is 'on'. | |||
@@ -353,6 +353,8 @@ public: | |||
*/ | |||
void setState (const ButtonState newState); | |||
// This method's parameters have changed - see the new version. | |||
JUCE_DEPRECATED (void setToggleState (bool, bool)); | |||
protected: | |||
//============================================================================== | |||
@@ -474,16 +476,12 @@ private: | |||
ButtonState updateState(); | |||
ButtonState updateState (bool isOver, bool isDown); | |||
bool isShortcutPressed() const; | |||
void turnOffOtherButtonsInGroup (bool sendChangeNotification); | |||
void turnOffOtherButtonsInGroup (NotificationType); | |||
void flashButtonState(); | |||
void sendClickMessage (const ModifierKeys&); | |||
void sendStateMessage(); | |||
// These are deprecated - please use addListener() and removeListener() instead! | |||
JUCE_DEPRECATED (void addButtonListener (Listener*)); | |||
JUCE_DEPRECATED (void removeButtonListener (Listener*)); | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Button) | |||
}; | |||
@@ -2214,12 +2214,10 @@ public: | |||
CachedComponentImage* getCachedComponentImage() const noexcept { return cachedImage; } | |||
//============================================================================== | |||
#ifndef DOXYGEN | |||
// These methods are deprecated - use localPointToGlobal, getLocalPoint, getLocalPoint, etc instead. | |||
JUCE_DEPRECATED (Point<int> relativePositionToGlobal (Point<int>) const); | |||
JUCE_DEPRECATED (Point<int> globalPositionToRelative (Point<int>) const); | |||
JUCE_DEPRECATED (Point<int> relativePositionToOtherComponent (const Component*, Point<int>) const); | |||
#endif | |||
private: | |||
//============================================================================== | |||
@@ -244,7 +244,7 @@ void FileBrowserComponent::setRoot (const File& newRootDirectory) | |||
if (currentRootName.isEmpty()) | |||
currentRootName = File::separatorString; | |||
currentPathBox.setText (currentRootName, true); | |||
currentPathBox.setText (currentRootName, dontSendNotification); | |||
goUpButton->setEnabled (currentRoot.getParentDirectory().isDirectory() | |||
&& currentRoot.getParentDirectory() != currentRoot); | |||
@@ -174,7 +174,7 @@ void FilenameComponent::setCurrentFile (File newFile, | |||
if (addToRecentlyUsedList) | |||
addRecentlyUsedFile (newFile); | |||
filenameBox.setText (lastFilename, true); | |||
filenameBox.setText (lastFilename, dontSendNotification); | |||
if (notification != dontSendNotification) | |||
{ | |||
@@ -321,7 +321,7 @@ void TabbedButtonBar::setCurrentTabIndex (int newIndex, const bool sendChangeMes | |||
for (int i = 0; i < tabs.size(); ++i) | |||
{ | |||
TabBarButton* tb = tabs.getUnchecked(i)->button; | |||
tb->setToggleState (i == newIndex, false); | |||
tb->setToggleState (i == newIndex, dontSendNotification); | |||
} | |||
resized(); | |||
@@ -54,7 +54,7 @@ BooleanPropertyComponent::~BooleanPropertyComponent() | |||
void BooleanPropertyComponent::setState (const bool newState) | |||
{ | |||
button.setToggleState (newState, true); | |||
button.setToggleState (newState, sendNotification); | |||
} | |||
bool BooleanPropertyComponent::getState() const | |||
@@ -75,7 +75,7 @@ void BooleanPropertyComponent::paint (Graphics& g) | |||
void BooleanPropertyComponent::refresh() | |||
{ | |||
button.setToggleState (getState(), false); | |||
button.setToggleState (getState(), dontSendNotification); | |||
button.setButtonText (button.getToggleState() ? onText : offText); | |||
} | |||
@@ -136,7 +136,7 @@ void ChoicePropertyComponent::refresh() | |||
comboBox.addListener (this); | |||
} | |||
comboBox.setSelectedId (getIndex() + 1, true); | |||
comboBox.setSelectedId (getIndex() + 1, dontSendNotification); | |||
} | |||
} | |||
@@ -165,13 +165,13 @@ void ComboBox::changeItemText (const int itemId, const String& newText) | |||
jassertfalse; | |||
} | |||
void ComboBox::clear (const bool dontSendChangeMessage) | |||
void ComboBox::clear (const NotificationType notification) | |||
{ | |||
items.clear(); | |||
separatorPending = false; | |||
if (! label->isEditable()) | |||
setSelectedItemIndex (-1, dontSendChangeMessage); | |||
setSelectedItemIndex (-1, notification); | |||
} | |||
//============================================================================== | |||
@@ -257,9 +257,9 @@ int ComboBox::getSelectedItemIndex() const | |||
return index; | |||
} | |||
void ComboBox::setSelectedItemIndex (const int index, const bool dontSendChangeMessage) | |||
void ComboBox::setSelectedItemIndex (const int index, const NotificationType notification) | |||
{ | |||
setSelectedId (getItemId (index), dontSendChangeMessage); | |||
setSelectedId (getItemId (index), notification); | |||
} | |||
int ComboBox::getSelectedId() const noexcept | |||
@@ -269,21 +269,20 @@ int ComboBox::getSelectedId() const noexcept | |||
return (item != nullptr && getText() == item->name) ? item->itemId : 0; | |||
} | |||
void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMessage) | |||
void ComboBox::setSelectedId (const int newItemId, const NotificationType notification) | |||
{ | |||
const ItemInfo* const item = getItemForId (newItemId); | |||
const String newItemText (item != nullptr ? item->name : String::empty); | |||
if (lastCurrentId != newItemId || label->getText() != newItemText) | |||
{ | |||
if (! dontSendChangeMessage) | |||
triggerAsyncUpdate(); | |||
label->setText (newItemText, dontSendNotification); | |||
lastCurrentId = newItemId; | |||
currentId = newItemId; | |||
repaint(); // for the benefit of the 'none selected' text | |||
sendChange (notification); | |||
} | |||
} | |||
@@ -304,7 +303,7 @@ bool ComboBox::selectIfEnabled (const int index) | |||
void ComboBox::valueChanged (Value&) | |||
{ | |||
if (lastCurrentId != (int) currentId.getValue()) | |||
setSelectedId (currentId.getValue(), false); | |||
setSelectedId (currentId.getValue()); | |||
} | |||
//============================================================================== | |||
@@ -313,7 +312,7 @@ String ComboBox::getText() const | |||
return label->getText(); | |||
} | |||
void ComboBox::setText (const String& newText, const bool dontSendChangeMessage) | |||
void ComboBox::setText (const String& newText, const NotificationType notification) | |||
{ | |||
for (int i = items.size(); --i >= 0;) | |||
{ | |||
@@ -322,23 +321,20 @@ void ComboBox::setText (const String& newText, const bool dontSendChangeMessage) | |||
if (item->isRealItem() | |||
&& item->name == newText) | |||
{ | |||
setSelectedId (item->itemId, dontSendChangeMessage); | |||
setSelectedId (item->itemId, notification); | |||
return; | |||
} | |||
} | |||
lastCurrentId = 0; | |||
currentId = 0; | |||
repaint(); | |||
if (label->getText() != newText) | |||
{ | |||
label->setText (newText, dontSendNotification); | |||
if (! dontSendChangeMessage) | |||
triggerAsyncUpdate(); | |||
sendChange (notification); | |||
} | |||
repaint(); | |||
} | |||
void ComboBox::showEditor() | |||
@@ -594,3 +590,18 @@ void ComboBox::handleAsyncUpdate() | |||
Component::BailOutChecker checker (this); | |||
listeners.callChecked (checker, &ComboBoxListener::comboBoxChanged, this); // (can't use ComboBox::Listener due to idiotic VC2005 bug) | |||
} | |||
void ComboBox::sendChange (const NotificationType notification) | |||
{ | |||
if (notification != dontSendNotification) | |||
triggerAsyncUpdate(); | |||
if (notification == sendNotificationSync) | |||
handleUpdateNowIfNeeded(); | |||
} | |||
// Old deprecated methods - remove eventually... | |||
void ComboBox::clear (const bool dontSendChange) { clear (dontSendChange ? dontSendNotification : sendNotification); } | |||
void ComboBox::setSelectedItemIndex (const int index, const bool dontSendChange) { setSelectedItemIndex (index, dontSendChange ? dontSendNotification : sendNotification); } | |||
void ComboBox::setSelectedId (const int newItemId, const bool dontSendChange) { setSelectedId (newItemId, dontSendChange ? dontSendNotification : sendNotification); } | |||
void ComboBox::setText (const String& newText, const bool dontSendChange) { setText (newText, dontSendChange ? dontSendNotification : sendNotification); } |
@@ -141,12 +141,12 @@ public: | |||
/** Removes all the items from the drop-down list. | |||
If this call causes the content to be cleared, then a change-message | |||
will be broadcast unless dontSendChangeMessage is true. | |||
If this call causes the content to be cleared, and a change-message | |||
will be broadcast according to the notification parameter. | |||
@see addItem, removeItem, getNumItems | |||
*/ | |||
void clear (bool dontSendChangeMessage = false); | |||
void clear (NotificationType notification = sendNotificationAsync); | |||
/** Returns the number of items that have been added to the list. | |||
@@ -196,12 +196,13 @@ public: | |||
This will set the ComboBox's text to that of the item that matches | |||
this ID. | |||
@param newItemId the new item to select | |||
@param dontSendChangeMessage if set to true, this method won't trigger a | |||
change notification | |||
@param newItemId the new item to select | |||
@param notification determines the type of change notification that will | |||
be sent to listeners if the value changes | |||
@see getSelectedId, setSelectedItemIndex, setText | |||
*/ | |||
void setSelectedId (int newItemId, bool dontSendChangeMessage = false); | |||
void setSelectedId (int newItemId, | |||
NotificationType notification = sendNotificationAsync); | |||
//============================================================================== | |||
/** Returns the index of the item that's currently shown in the box. | |||
@@ -219,12 +220,13 @@ public: | |||
This will set the ComboBox's text to that of the item at the given | |||
index in the list. | |||
@param newItemIndex the new item to select | |||
@param dontSendChangeMessage if set to true, this method won't trigger a | |||
change notification | |||
@param newItemIndex the new item to select | |||
@param notification determines the type of change notification that will | |||
be sent to listeners if the value changes | |||
@see getSelectedItemIndex, setSelectedId, setText | |||
*/ | |||
void setSelectedItemIndex (int newItemIndex, bool dontSendChangeMessage = false); | |||
void setSelectedItemIndex (int newItemIndex, | |||
NotificationType notification = sendNotificationAsync); | |||
//============================================================================== | |||
/** Returns the text that is currently shown in the combo-box's text field. | |||
@@ -244,12 +246,13 @@ public: | |||
items, then getSelectedId() will return -1, otherwise it wil return | |||
the approriate ID. | |||
@param newText the text to select | |||
@param dontSendChangeMessage if set to true, this method won't trigger a | |||
change notification | |||
@param newText the text to select | |||
@param notification determines the type of change notification that will | |||
be sent to listeners if the text changes | |||
@see getText | |||
*/ | |||
void setText (const String& newText, bool dontSendChangeMessage = false); | |||
void setText (const String& newText, | |||
NotificationType notification = sendNotificationAsync); | |||
/** Programmatically opens the text editor to allow the user to edit the current item. | |||
@@ -371,6 +374,12 @@ public: | |||
/** @internal */ | |||
void valueChanged (Value&) override; | |||
// These methods' bool parameters have changed: see their new method signatures. | |||
JUCE_DEPRECATED (void clear (bool)); | |||
JUCE_DEPRECATED (void setSelectedId (int, bool)); | |||
JUCE_DEPRECATED (void setSelectedItemIndex (int, bool)); | |||
JUCE_DEPRECATED (void setText (const String&, bool)); | |||
private: | |||
//============================================================================== | |||
struct ItemInfo | |||
@@ -395,6 +404,7 @@ private: | |||
ItemInfo* getItemForId (int itemId) const noexcept; | |||
ItemInfo* getItemForIndex (int index) const noexcept; | |||
bool selectIfEnabled (int index); | |||
void sendChange (NotificationType); | |||
static void popupMenuFinishedCallback (int, ComboBox*); | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComboBox) | |||
@@ -232,7 +232,7 @@ void DocumentWindow::resized() | |||
ResizableWindow::resized(); | |||
if (Button* const b = getMaximiseButton()) | |||
b->setToggleState (isFullScreen(), false); | |||
b->setToggleState (isFullScreen(), dontSendNotification); | |||
const Rectangle<int> titleBarArea (getTitleBarArea()); | |||
@@ -312,7 +312,7 @@ public: | |||
}; | |||
//============================================================================== | |||
/** @deprecated - use setContentOwned() and setContentNonOwned() instead. */ | |||
// Deprecated: use setContentOwned() and setContentNonOwned() instead. | |||
JUCE_DEPRECATED (void setContentComponent (Component* newContentComponent, | |||
bool deleteOldOne = true, | |||
bool resizeToFit = false)); | |||
@@ -130,7 +130,7 @@ void PreferencesPanel::setCurrentPage (const String& pageName) | |||
{ | |||
if (buttons.getUnchecked(i)->getName() == pageName) | |||
{ | |||
buttons.getUnchecked(i)->setToggleState (true, false); | |||
buttons.getUnchecked(i)->setToggleState (true, dontSendNotification); | |||
break; | |||
} | |||
} | |||