mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-13 00:04:19 +00:00
Updates to Slider to keep the text box editability in sync when the parent is enabled.
This commit is contained in:
parent
cd48446e89
commit
3cee0e2c19
1 changed files with 14 additions and 8 deletions
|
|
@ -521,9 +521,7 @@ public:
|
|||
void setTextBoxIsEditable (const bool shouldBeEditable)
|
||||
{
|
||||
editableText = shouldBeEditable;
|
||||
|
||||
if (valueBox != nullptr)
|
||||
valueBox->setEditable (shouldBeEditable && owner.isEnabled());
|
||||
updateTextBoxEnablement();
|
||||
}
|
||||
|
||||
void showTextBox()
|
||||
|
|
@ -554,6 +552,17 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void updateTextBoxEnablement()
|
||||
{
|
||||
if (valueBox != nullptr)
|
||||
{
|
||||
const bool shouldBeEditable = editableText && owner.isEnabled();
|
||||
|
||||
if (valueBox->isEditable() != shouldBeEditable) // (to avoid changing the single/double click flags unless we need to)
|
||||
valueBox->setEditable (shouldBeEditable);
|
||||
}
|
||||
}
|
||||
|
||||
void lookAndFeelChanged (LookAndFeel& lf)
|
||||
{
|
||||
if (textBoxPos != NoTextBox)
|
||||
|
|
@ -567,10 +576,7 @@ public:
|
|||
valueBox->setWantsKeyboardFocus (false);
|
||||
valueBox->setText (previousTextBoxContent, dontSendNotification);
|
||||
valueBox->setTooltip (owner.getTooltip());
|
||||
|
||||
if (valueBox->isEditable() != editableText) // (avoid overriding the single/double click flags unless we have to)
|
||||
valueBox->setEditable (editableText && owner.isEnabled());
|
||||
|
||||
updateTextBoxEnablement();
|
||||
valueBox->addListener (this);
|
||||
|
||||
if (style == LinearBar || style == LinearBarVertical)
|
||||
|
|
@ -1450,7 +1456,7 @@ Component* Slider::getCurrentPopupDisplay() const noexcept { return pimpl->
|
|||
//==============================================================================
|
||||
void Slider::colourChanged() { lookAndFeelChanged(); }
|
||||
void Slider::lookAndFeelChanged() { pimpl->lookAndFeelChanged (getLookAndFeel()); }
|
||||
void Slider::enablementChanged() { repaint(); }
|
||||
void Slider::enablementChanged() { repaint(); pimpl->updateTextBoxEnablement(); }
|
||||
|
||||
//==============================================================================
|
||||
double Slider::getMaximum() const noexcept { return pimpl->maximum; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue