LMMS
Loading...
Searching...
No Matches
juce_Slider.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29static double getStepSize (const Slider& slider)
30{
31 const auto interval = slider.getInterval();
32
33 return interval != 0.0 ? interval
34 : slider.getRange().getLength() * 0.01;
35}
36
37class Slider::Pimpl : public AsyncUpdater, // this needs to be public otherwise it will cause an
38 // error when JUCE_DLL_BUILD=1
39 private Value::Listener
40{
41public:
42 Pimpl (Slider& s, SliderStyle sliderStyle, TextEntryBoxPosition textBoxPosition)
43 : owner (s),
44 style (sliderStyle),
45 textBoxPos (textBoxPosition)
46 {
47 rotaryParams.startAngleRadians = MathConstants<float>::pi * 1.2f;
48 rotaryParams.endAngleRadians = MathConstants<float>::pi * 2.8f;
49 rotaryParams.stopAtEnd = true;
50 }
51
52 ~Pimpl() override
53 {
54 currentValue.removeListener (this);
55 valueMin.removeListener (this);
56 valueMax.removeListener (this);
57 popupDisplay.reset();
58 }
59
60 //==============================================================================
62 {
63 currentValue.addListener (this);
64 valueMin.addListener (this);
65 valueMax.addListener (this);
66 }
67
75
83
91
93 {
94 return style == LinearBar
96 }
97
99 {
100 return style == TwoValueHorizontal
102 }
103
105 {
108 }
109
115
116 float getPositionOfValue (double value) const
117 {
118 if (isHorizontal() || isVertical())
119 return getLinearSliderPos (value);
120
121 jassertfalse; // not a valid call on a slider that doesn't work linearly!
122 return 0.0f;
123 }
124
126 {
127 // figure out the number of DPs needed to display all values at this
128 // interval setting.
130
131 if (normRange.interval != 0.0)
132 {
133 int v = std::abs (roundToInt (normRange.interval * 10000000));
134
135 while ((v % 10) == 0 && numDecimalPlaces > 0)
136 {
138 v /= 10;
139 }
140 }
141
142 // keep the current values inside the new range..
144 {
146 }
147 else
148 {
151 }
152
153 updateText();
154 }
155
156 void setRange (double newMin, double newMax, double newInt)
157 {
158 normRange = NormalisableRange<double> (newMin, newMax, newInt,
159 normRange.skew, normRange.symmetricSkew);
160 updateRange();
161 }
162
164 {
165 normRange = newRange;
166 updateRange();
167 }
168
169 double getValue() const
170 {
171 // for a two-value style slider, you should use the getMinValue() and getMaxValue()
172 // methods to get the two values.
174
175 return currentValue.getValue();
176 }
177
178 void setValue (double newValue, NotificationType notification)
179 {
180 // for a two-value style slider, you should use the setMinValue() and setMaxValue()
181 // methods to set the two values.
183
184 newValue = constrainedValue (newValue);
185
187 {
188 jassert (static_cast<double> (valueMin.getValue()) <= static_cast<double> (valueMax.getValue()));
189
190 newValue = jlimit (static_cast<double> (valueMin.getValue()),
191 static_cast<double> (valueMax.getValue()),
192 newValue);
193 }
194
195 if (newValue != lastCurrentValue)
196 {
197 if (valueBox != nullptr)
198 valueBox->hideEditor (true);
199
200 lastCurrentValue = newValue;
201
202 // Need to do this comparison because the Value will use equalsWithSameType to compare
203 // the new and old values, so will generate unwanted change events if the type changes.
204 // Cast to double before comparing, to prevent comparing as another type (e.g. String).
205 if (static_cast<double> (currentValue.getValue()) != newValue)
206 currentValue = newValue;
207
208 updateText();
209 owner.repaint();
210 updatePopupDisplay (newValue);
211
212 triggerChangeMessage (notification);
213 }
214 }
215
216 void setMinValue (double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
217 {
218 // The minimum value only applies to sliders that are in two- or three-value mode.
221
222 newValue = constrainedValue (newValue);
223
225 {
226 if (allowNudgingOfOtherValues && newValue > static_cast<double> (valueMax.getValue()))
227 setMaxValue (newValue, notification, false);
228
229 newValue = jmin (static_cast<double> (valueMax.getValue()), newValue);
230 }
231 else
232 {
233 if (allowNudgingOfOtherValues && newValue > lastCurrentValue)
234 setValue (newValue, notification);
235
236 newValue = jmin (lastCurrentValue, newValue);
237 }
238
239 if (lastValueMin != newValue)
240 {
241 lastValueMin = newValue;
242 valueMin = newValue;
243 owner.repaint();
244 updatePopupDisplay (newValue);
245
246 triggerChangeMessage (notification);
247 }
248 }
249
250 void setMaxValue (double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
251 {
252 // The maximum value only applies to sliders that are in two- or three-value mode.
255
256 newValue = constrainedValue (newValue);
257
259 {
260 if (allowNudgingOfOtherValues && newValue < static_cast<double> (valueMin.getValue()))
261 setMinValue (newValue, notification, false);
262
263 newValue = jmax (static_cast<double> (valueMin.getValue()), newValue);
264 }
265 else
266 {
267 if (allowNudgingOfOtherValues && newValue < lastCurrentValue)
268 setValue (newValue, notification);
269
270 newValue = jmax (lastCurrentValue, newValue);
271 }
272
273 if (lastValueMax != newValue)
274 {
275 lastValueMax = newValue;
276 valueMax = newValue;
277 owner.repaint();
278 updatePopupDisplay (valueMax.getValue());
279
280 triggerChangeMessage (notification);
281 }
282 }
283
284 void setMinAndMaxValues (double newMinValue, double newMaxValue, NotificationType notification)
285 {
286 // The maximum value only applies to sliders that are in two- or three-value mode.
289
290 if (newMaxValue < newMinValue)
291 std::swap (newMaxValue, newMinValue);
292
293 newMinValue = constrainedValue (newMinValue);
294 newMaxValue = constrainedValue (newMaxValue);
295
296 if (lastValueMax != newMaxValue || lastValueMin != newMinValue)
297 {
298 lastValueMax = newMaxValue;
299 lastValueMin = newMinValue;
300 valueMin = newMinValue;
301 valueMax = newMaxValue;
302 owner.repaint();
303
304 triggerChangeMessage (notification);
305 }
306 }
307
308 double getMinValue() const
309 {
310 // The minimum value only applies to sliders that are in two- or three-value mode.
313
314 return valueMin.getValue();
315 }
316
317 double getMaxValue() const
318 {
319 // The maximum value only applies to sliders that are in two- or three-value mode.
322
323 return valueMax.getValue();
324 }
325
327 {
328 if (notification != dontSendNotification)
329 {
330 owner.valueChanged();
331
332 if (notification == sendNotificationSync)
334 else
336 }
337 }
338
339 void handleAsyncUpdate() override
340 {
342
344 listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderValueChanged (&owner); });
345
346 if (checker.shouldBailOut())
347 return;
348
349 if (owner.onValueChange != nullptr)
350 owner.onValueChange();
351
352 if (auto* handler = owner.getAccessibilityHandler())
353 handler->notifyAccessibilityEvent (AccessibilityEvent::valueChanged);
354 }
355
357 {
358 owner.startedDragging();
359
361 listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderDragStarted (&owner); });
362
363 if (checker.shouldBailOut())
364 return;
365
366 if (owner.onDragStart != nullptr)
367 owner.onDragStart();
368 }
369
371 {
372 owner.stoppedDragging();
374
376 listeners.callChecked (checker, [&] (Slider::Listener& l) { l.sliderDragEnded (&owner); });
377
378 if (checker.shouldBailOut())
379 return;
380
381 if (owner.onDragEnd != nullptr)
382 owner.onDragEnd();
383 }
384
385 void incrementOrDecrement (double delta)
386 {
387 if (style == IncDecButtons)
388 {
389 auto newValue = owner.snapValue (getValue() + delta, notDragging);
390
391 if (currentDrag != nullptr)
392 {
393 setValue (newValue, sendNotificationSync);
394 }
395 else
396 {
398 setValue (newValue, sendNotificationSync);
399 }
400 }
401 }
402
403 void valueChanged (Value& value) override
404 {
405 if (value.refersToSameSourceAs (currentValue))
406 {
409 }
410 else if (value.refersToSameSourceAs (valueMin))
411 {
412 setMinValue (valueMin.getValue(), dontSendNotification, true);
413 }
414 else if (value.refersToSameSourceAs (valueMax))
415 {
416 setMaxValue (valueMax.getValue(), dontSendNotification, true);
417 }
418 }
419
421 {
422 auto newValue = owner.snapValue (owner.getValueFromText (valueBox->getText()), notDragging);
423
424 if (newValue != static_cast<double> (currentValue.getValue()))
425 {
427 setValue (newValue, sendNotificationSync);
428 }
429
430 updateText(); // force a clean-up of the text, needed in case setValue() hasn't done this.
431 }
432
434 {
435 if (valueBox != nullptr)
436 {
437 auto newValue = owner.getTextFromValue (currentValue.getValue());
438
439 if (newValue != valueBox->getText())
440 valueBox->setText (newValue, dontSendNotification);
441 }
442 }
443
444 double constrainedValue (double value) const
445 {
446 return normRange.snapToLegalValue (value);
447 }
448
449 float getLinearSliderPos (double value) const
450 {
451 double pos;
452
453 if (normRange.end <= normRange.start)
454 pos = 0.5;
455 else if (value < normRange.start)
456 pos = 0.0;
457 else if (value > normRange.end)
458 pos = 1.0;
459 else
460 pos = owner.valueToProportionOfLength (value);
461
462 if (isVertical() || style == IncDecButtons)
463 pos = 1.0 - pos;
464
465 jassert (pos >= 0 && pos <= 1.0);
466 return (float) (sliderRegionStart + pos * sliderRegionSize);
467 }
468
470 {
471 if (style != newStyle)
472 {
473 style = newStyle;
474
475 owner.repaint();
476 owner.lookAndFeelChanged();
477 owner.invalidateAccessibilityHandler();
478 }
479 }
480
481 void setVelocityModeParameters (double sensitivity, int threshold,
482 double offset, bool userCanPressKeyToSwapMode,
483 ModifierKeys::Flags newModifierToSwapModes)
484 {
485 velocityModeSensitivity = sensitivity;
486 velocityModeOffset = offset;
487 velocityModeThreshold = threshold;
488 userKeyOverridesVelocity = userCanPressKeyToSwapMode;
489 modifierToSwapModes = newModifierToSwapModes;
490 }
491
493 {
494 if (incDecButtonMode != mode)
495 {
497 owner.lookAndFeelChanged();
498 }
499 }
500
502 bool isReadOnly,
503 int textEntryBoxWidth,
504 int textEntryBoxHeight)
505 {
506 if (textBoxPos != newPosition
507 || editableText != (! isReadOnly)
508 || textBoxWidth != textEntryBoxWidth
509 || textBoxHeight != textEntryBoxHeight)
510 {
511 textBoxPos = newPosition;
512 editableText = ! isReadOnly;
513 textBoxWidth = textEntryBoxWidth;
514 textBoxHeight = textEntryBoxHeight;
515
516 owner.repaint();
517 owner.lookAndFeelChanged();
518 }
519 }
520
521 void setTextBoxIsEditable (bool shouldBeEditable)
522 {
523 editableText = shouldBeEditable;
525 }
526
528 {
529 jassert (editableText); // this should probably be avoided in read-only sliders.
530
531 if (valueBox != nullptr)
532 valueBox->showEditor();
533 }
534
535 void hideTextBox (bool discardCurrentEditorContents)
536 {
537 if (valueBox != nullptr)
538 {
539 valueBox->hideEditor (discardCurrentEditorContents);
540
541 if (discardCurrentEditorContents)
542 updateText();
543 }
544 }
545
546 void setTextValueSuffix (const String& suffix)
547 {
548 if (textSuffix != suffix)
549 {
550 textSuffix = suffix;
551 updateText();
552 }
553 }
554
556 {
557 if (valueBox != nullptr)
558 {
559 bool shouldBeEditable = editableText && owner.isEnabled();
560
561 if (valueBox->isEditable() != shouldBeEditable) // (to avoid changing the single/double click flags unless we need to)
562 valueBox->setEditable (shouldBeEditable);
563 }
564 }
565
567 {
568 if (textBoxPos != NoTextBox)
569 {
570 auto previousTextBoxContent = (valueBox != nullptr ? valueBox->getText()
571 : owner.getTextFromValue (currentValue.getValue()));
572
573 valueBox.reset();
575 owner.addAndMakeVisible (valueBox.get());
576
577 valueBox->setWantsKeyboardFocus (false);
578 valueBox->setText (previousTextBoxContent, dontSendNotification);
579 valueBox->setTooltip (owner.getTooltip());
581 valueBox->onTextChange = [this] { textChanged(); };
582
584 {
585 valueBox->addMouseListener (&owner, false);
586 valueBox->setMouseCursor (MouseCursor::ParentCursor);
587 }
588 }
589 else
590 {
591 valueBox.reset();
592 }
593
594 if (style == IncDecButtons)
595 {
596 incButton.reset (lf.createSliderButton (owner, true));
597 decButton.reset (lf.createSliderButton (owner, false));
598
599 auto tooltip = owner.getTooltip();
600
601 auto setupButton = [&] (Button& b, bool isIncrement)
602 {
603 owner.addAndMakeVisible (b);
604 b.onClick = [this, isIncrement] { incrementOrDecrement (isIncrement ? normRange.interval : -normRange.interval); };
605
607 b.addMouseListener (&owner, false);
608 else
609 b.setRepeatSpeed (300, 100, 20);
610
611 b.setTooltip (tooltip);
612 b.setAccessible (false);
613 };
614
615 setupButton (*incButton, true);
616 setupButton (*decButton, false);
617 }
618 else
619 {
620 incButton.reset();
621 decButton.reset();
622 }
623
624 owner.setComponentEffect (lf.getSliderEffect (owner));
625
626 owner.resized();
627 owner.repaint();
628 }
629
631 {
632 PopupMenu m;
633 m.setLookAndFeel (&owner.getLookAndFeel());
634 m.addItem (1, TRANS ("Velocity-sensitive mode"), true, isVelocityBased);
635 m.addSeparator();
636
637 if (isRotary())
638 {
639 PopupMenu rotaryMenu;
640 rotaryMenu.addItem (2, TRANS ("Use circular dragging"), true, style == Rotary);
641 rotaryMenu.addItem (3, TRANS ("Use left-right dragging"), true, style == RotaryHorizontalDrag);
642 rotaryMenu.addItem (4, TRANS ("Use up-down dragging"), true, style == RotaryVerticalDrag);
643 rotaryMenu.addItem (5, TRANS ("Use left-right/up-down dragging"), true, style == RotaryHorizontalVerticalDrag);
644
645 m.addSubMenu (TRANS ("Rotary mode"), rotaryMenu);
646 }
647
648 m.showMenuAsync (PopupMenu::Options(),
650 }
651
652 static void sliderMenuCallback (int result, Slider* slider)
653 {
654 if (slider != nullptr)
655 {
656 switch (result)
657 {
658 case 1: slider->setVelocityBasedMode (! slider->getVelocityBasedMode()); break;
659 case 2: slider->setSliderStyle (Rotary); break;
660 case 3: slider->setSliderStyle (RotaryHorizontalDrag); break;
661 case 4: slider->setSliderStyle (RotaryVerticalDrag); break;
662 case 5: slider->setSliderStyle (RotaryHorizontalVerticalDrag); break;
663 default: break;
664 }
665 }
666 }
667
669 {
670 if (isTwoValue() || isThreeValue())
671 {
672 auto mousePos = isVertical() ? e.position.y : e.position.x;
673
674 auto normalPosDistance = std::abs (getLinearSliderPos (currentValue.getValue()) - mousePos);
675 auto minPosDistance = std::abs (getLinearSliderPos (valueMin.getValue()) + (isVertical() ? 0.1f : -0.1f) - mousePos);
676 auto maxPosDistance = std::abs (getLinearSliderPos (valueMax.getValue()) + (isVertical() ? -0.1f : 0.1f) - mousePos);
677
678 if (isTwoValue())
679 return maxPosDistance <= minPosDistance ? 2 : 1;
680
681 if (normalPosDistance >= minPosDistance && maxPosDistance >= minPosDistance)
682 return 1;
683
684 if (normalPosDistance >= maxPosDistance)
685 return 2;
686 }
687
688 return 0;
689 }
690
691 //==============================================================================
693 {
694 auto dx = e.position.x - (float) sliderRect.getCentreX();
695 auto dy = e.position.y - (float) sliderRect.getCentreY();
696
697 if (dx * dx + dy * dy > 25.0f)
698 {
699 auto angle = std::atan2 ((double) dx, (double) -dy);
700
701 while (angle < 0.0)
703
704 if (rotaryParams.stopAtEnd && e.mouseWasDraggedSinceMouseDown())
705 {
706 if (std::abs (angle - lastAngle) > MathConstants<double>::pi)
707 {
708 if (angle >= lastAngle)
710 else
712 }
713
714 if (angle >= lastAngle)
715 angle = jmin (angle, (double) jmax (rotaryParams.startAngleRadians, rotaryParams.endAngleRadians));
716 else
717 angle = jmax (angle, (double) jmin (rotaryParams.startAngleRadians, rotaryParams.endAngleRadians));
718 }
719 else
720 {
721 while (angle < rotaryParams.startAngleRadians)
723
724 if (angle > rotaryParams.endAngleRadians)
725 {
726 if (smallestAngleBetween (angle, rotaryParams.startAngleRadians)
727 <= smallestAngleBetween (angle, rotaryParams.endAngleRadians))
728 angle = rotaryParams.startAngleRadians;
729 else
730 angle = rotaryParams.endAngleRadians;
731 }
732 }
733
734 auto proportion = (angle - rotaryParams.startAngleRadians) / (rotaryParams.endAngleRadians - rotaryParams.startAngleRadians);
735 valueWhenLastDragged = owner.proportionOfLengthToValue (jlimit (0.0, 1.0, proportion));
736 lastAngle = angle;
737 }
738 }
739
741 {
742 auto mousePos = (isHorizontal() || style == RotaryHorizontalDrag) ? e.position.x : e.position.y;
743 double newPos = 0;
744
747 || style == IncDecButtons
749 && ! snapsToMousePos))
750 {
751 auto mouseDiff = (style == RotaryHorizontalDrag
753 || style == LinearBar
755 ? e.position.x - mouseDragStartPos.x
756 : mouseDragStartPos.y - e.position.y;
757
758 newPos = owner.valueToProportionOfLength (valueOnMouseDown)
759 + mouseDiff * (1.0 / pixelsForFullDragExtent);
760
761 if (style == IncDecButtons)
762 {
763 incButton->setState (mouseDiff < 0 ? Button::buttonNormal : Button::buttonDown);
764 decButton->setState (mouseDiff > 0 ? Button::buttonNormal : Button::buttonDown);
765 }
766 }
768 {
769 auto mouseDiff = (e.position.x - mouseDragStartPos.x)
770 + (mouseDragStartPos.y - e.position.y);
771
772 newPos = owner.valueToProportionOfLength (valueOnMouseDown)
773 + mouseDiff * (1.0 / pixelsForFullDragExtent);
774 }
775 else
776 {
777 newPos = (mousePos - (float) sliderRegionStart) / (double) sliderRegionSize;
778
779 if (isVertical())
780 newPos = 1.0 - newPos;
781 }
782
783 newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
784 : jlimit (0.0, 1.0, newPos);
785 valueWhenLastDragged = owner.proportionOfLengthToValue (newPos);
786 }
787
789 {
790 bool hasHorizontalStyle =
793
794 auto mouseDiff = style == RotaryHorizontalVerticalDrag
795 ? (e.position.x - mousePosWhenLastDragged.x) + (mousePosWhenLastDragged.y - e.position.y)
796 : (hasHorizontalStyle ? e.position.x - mousePosWhenLastDragged.x
797 : e.position.y - mousePosWhenLastDragged.y);
798
799 auto maxSpeed = jmax (200.0, (double) sliderRegionSize);
800 auto speed = jlimit (0.0, maxSpeed, (double) std::abs (mouseDiff));
801
802 if (speed != 0.0)
803 {
804 speed = 0.2 * velocityModeSensitivity
805 * (1.0 + std::sin (MathConstants<double>::pi * (1.5 + jmin (0.5, velocityModeOffset
806 + jmax (0.0, (double) (speed - velocityModeThreshold))
807 / maxSpeed))));
808
809 if (mouseDiff < 0)
810 speed = -speed;
811
814 speed = -speed;
815
816 auto newPos = owner.valueToProportionOfLength (valueWhenLastDragged) + speed;
817 newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
818 : jlimit (0.0, 1.0, newPos);
819 valueWhenLastDragged = owner.proportionOfLengthToValue (newPos);
820
821 e.source.enableUnboundedMouseMovement (true, false);
822 }
823 }
824
825 void mouseDown (const MouseEvent& e)
826 {
827 incDecDragged = false;
828 useDragEvents = false;
830 currentDrag.reset();
831 popupDisplay.reset();
832
833 if (owner.isEnabled())
834 {
835 if (e.mods.isPopupMenu() && menuEnabled)
836 {
838 }
839 else if (canDoubleClickToValue()
840 && (singleClickModifiers != ModifierKeys() && e.mods.withoutMouseButtons() == singleClickModifiers))
841 {
843 }
844 else if (normRange.end > normRange.start)
845 {
846 useDragEvents = true;
847
848 if (valueBox != nullptr)
849 valueBox->hideEditor (true);
850
852
853 minMaxDiff = static_cast<double> (valueMax.getValue()) - static_cast<double> (valueMin.getValue());
854
855 if (! isTwoValue())
856 lastAngle = rotaryParams.startAngleRadians
857 + (rotaryParams.endAngleRadians - rotaryParams.startAngleRadians)
858 * owner.valueToProportionOfLength (currentValue.getValue());
859
864
866 {
868
869 if (popupDisplay != nullptr)
870 popupDisplay->stopTimer();
871 }
872
873 currentDrag = std::make_unique<ScopedDragNotification> (owner);
874 mouseDrag (e);
875 }
876 }
877 }
878
879 void mouseDrag (const MouseEvent& e)
880 {
881 if (useDragEvents && normRange.end > normRange.start
882 && ! ((style == LinearBar || style == LinearBarVertical)
883 && e.mouseWasClicked() && valueBox != nullptr && valueBox->isEditable()))
884 {
885 DragMode dragMode = notDragging;
886
887 if (style == Rotary)
888 {
890 }
891 else
892 {
894 {
895 if (e.getDistanceFromDragStart() < 10 || ! e.mouseWasDraggedSinceMouseDown())
896 return;
897
898 incDecDragged = true;
899 mouseDragStartPos = e.position;
900 }
901
902 if (isAbsoluteDragMode (e.mods) || (normRange.end - normRange.start) / sliderRegionSize < normRange.interval)
903 {
904 dragMode = absoluteDrag;
906 }
907 else
908 {
909 dragMode = velocityDrag;
911 }
912 }
913
915
916 if (sliderBeingDragged == 0)
917 {
918 setValue (owner.snapValue (valueWhenLastDragged, dragMode),
920 }
921 else if (sliderBeingDragged == 1)
922 {
923 setMinValue (owner.snapValue (valueWhenLastDragged, dragMode),
925
926 if (e.mods.isShiftDown())
928 else
929 minMaxDiff = static_cast<double> (valueMax.getValue()) - static_cast<double> (valueMin.getValue());
930 }
931 else if (sliderBeingDragged == 2)
932 {
933 setMaxValue (owner.snapValue (valueWhenLastDragged, dragMode),
935
936 if (e.mods.isShiftDown())
938 else
939 minMaxDiff = static_cast<double> (valueMax.getValue()) - static_cast<double> (valueMin.getValue());
940 }
941
942 mousePosWhenLastDragged = e.position;
943 }
944 }
945
946 void mouseUp()
947 {
948 if (owner.isEnabled()
950 && (normRange.end > normRange.start)
952 {
954
955 if (sendChangeOnlyOnRelease && valueOnMouseDown != static_cast<double> (currentValue.getValue()))
957
958 currentDrag.reset();
959 popupDisplay.reset();
960
961 if (style == IncDecButtons)
962 {
965 }
966 }
967 else if (popupDisplay != nullptr)
968 {
969 popupDisplay->startTimer (200);
970 }
971
972 currentDrag.reset();
973 }
974
976 {
977 // this is a workaround for a bug where the popup display being dismissed triggers
978 // a mouse move causing it to never be hidden
979 auto shouldShowPopup = showPopupOnHover
981
982 if (shouldShowPopup
983 && ! isTwoValue()
984 && ! isThreeValue())
985 {
986 if (owner.isMouseOver (true))
987 {
988 if (popupDisplay == nullptr)
990
991 if (popupDisplay != nullptr && popupHoverTimeout != -1)
992 popupDisplay->startTimer (popupHoverTimeout);
993 }
994 }
995 }
996
998 {
999 popupDisplay.reset();
1000 }
1001
1003 {
1004 if (key.getModifiers().isAnyModifierKeyDown())
1005 return false;
1006
1007 const auto getInterval = [this]
1008 {
1009 if (auto* accessibility = owner.getAccessibilityHandler())
1010 if (auto* valueInterface = accessibility->getValueInterface())
1011 return valueInterface->getRange().getInterval();
1012
1013 return getStepSize (owner);
1014 };
1015
1016 const auto valueChange = [&]
1017 {
1019 return getInterval();
1020
1022 return -getInterval();
1023
1024 return 0.0;
1025 }();
1026
1027 if (valueChange == 0.0)
1028 return false;
1029
1030 setValue (getValue() + valueChange, sendNotificationSync);
1031 return true;
1032 }
1033
1035 {
1036 if (style == IncDecButtons)
1037 return;
1038
1039 if (popupDisplay == nullptr)
1040 {
1042
1043 if (parentForPopupDisplay != nullptr)
1044 parentForPopupDisplay->addChildComponent (popupDisplay.get());
1045 else
1049
1052 {
1054 : getMinValue());
1055 }
1056 else
1057 {
1059 }
1060
1061 popupDisplay->setVisible (true);
1062 }
1063 }
1064
1065 void updatePopupDisplay (double valueToShow)
1066 {
1067 if (popupDisplay != nullptr)
1068 popupDisplay->updatePosition (owner.getTextFromValue (valueToShow));
1069 }
1070
1072 {
1073 return doubleClickToValue
1074 && style != IncDecButtons
1077 }
1078
1087
1088 double getMouseWheelDelta (double value, double wheelAmount)
1089 {
1090 if (style == IncDecButtons)
1091 return normRange.interval * wheelAmount;
1092
1093 auto proportionDelta = wheelAmount * 0.15;
1094 auto currentPos = owner.valueToProportionOfLength (value);
1095 auto newPos = currentPos + proportionDelta;
1096 newPos = (isRotary() && ! rotaryParams.stopAtEnd) ? newPos - std::floor (newPos)
1097 : jlimit (0.0, 1.0, newPos);
1098 return owner.proportionOfLengthToValue (newPos) - value;
1099 }
1100
1101 bool mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
1102 {
1105 && style != TwoValueVertical)
1106 {
1107 // sometimes duplicate wheel events seem to be sent, so since we're going to
1108 // bump the value by a minimum of the interval, avoid doing this twice..
1109 if (e.eventTime != lastMouseWheelTime)
1110 {
1111 lastMouseWheelTime = e.eventTime;
1112
1113 if (normRange.end > normRange.start && ! e.mods.isAnyMouseButtonDown())
1114 {
1115 if (valueBox != nullptr)
1116 valueBox->hideEditor (false);
1117
1118 auto value = static_cast<double> (currentValue.getValue());
1119 auto delta = getMouseWheelDelta (value, (std::abs (wheel.deltaX) > std::abs (wheel.deltaY)
1120 ? -wheel.deltaX : wheel.deltaY)
1121 * (wheel.isReversed ? -1.0f : 1.0f));
1122 if (delta != 0.0)
1123 {
1124 auto newValue = value + jmax (normRange.interval, std::abs (delta)) * (delta < 0 ? -1.0 : 1.0);
1125
1127 setValue (owner.snapValue (newValue, notDragging), sendNotificationSync);
1128 }
1129 }
1130 }
1131
1132 return true;
1133 }
1134
1135 return false;
1136 }
1137
1138 void modifierKeysChanged (const ModifierKeys& modifiers)
1139 {
1140 if (style != IncDecButtons && style != Rotary && isAbsoluteDragMode (modifiers))
1142 }
1143
1148
1150 {
1151 for (auto& ms : Desktop::getInstance().getMouseSources())
1152 {
1153 if (ms.isUnboundedMouseMovementEnabled())
1154 {
1155 ms.enableUnboundedMouseMovement (false);
1156
1157 auto pos = sliderBeingDragged == 2 ? getMaxValue()
1159 : static_cast<double> (currentValue.getValue()));
1160 Point<float> mousePos;
1161
1162 if (isRotary())
1163 {
1164 mousePos = ms.getLastMouseDownPosition();
1165
1166 auto delta = (float) (pixelsForFullDragExtent * (owner.valueToProportionOfLength (valueOnMouseDown)
1167 - owner.valueToProportionOfLength (pos)));
1168
1169 if (style == RotaryHorizontalDrag) mousePos += Point<float> (-delta, 0.0f);
1170 else if (style == RotaryVerticalDrag) mousePos += Point<float> (0.0f, delta);
1171 else mousePos += Point<float> (delta / -2.0f, delta / 2.0f);
1172
1173 mousePos = owner.getScreenBounds().reduced (4).toFloat().getConstrainedPoint (mousePos);
1174 mouseDragStartPos = mousePosWhenLastDragged = owner.getLocalPoint (nullptr, mousePos);
1176 }
1177 else
1178 {
1179 auto pixelPos = (float) getLinearSliderPos (pos);
1180
1181 mousePos = owner.localPointToGlobal (Point<float> (isHorizontal() ? pixelPos : ((float) owner.getWidth() / 2.0f),
1182 isVertical() ? pixelPos : ((float) owner.getHeight() / 2.0f)));
1183 }
1184
1185 const_cast <MouseInputSource&> (ms).setScreenPosition (mousePos);
1186 }
1187 }
1188 }
1189
1190 //==============================================================================
1192 {
1193 if (style != IncDecButtons)
1194 {
1195 if (isRotary())
1196 {
1197 auto sliderPos = (float) owner.valueToProportionOfLength (lastCurrentValue);
1198 jassert (sliderPos >= 0 && sliderPos <= 1.0f);
1199
1200 lf.drawRotarySlider (g,
1201 sliderRect.getX(), sliderRect.getY(),
1202 sliderRect.getWidth(), sliderRect.getHeight(),
1203 sliderPos, rotaryParams.startAngleRadians,
1204 rotaryParams.endAngleRadians, owner);
1205 }
1206 else
1207 {
1208 lf.drawLinearSlider (g,
1209 sliderRect.getX(), sliderRect.getY(),
1210 sliderRect.getWidth(), sliderRect.getHeight(),
1214 style, owner);
1215 }
1216
1217 if ((style == LinearBar || style == LinearBarVertical) && valueBox == nullptr)
1218 {
1219 g.setColour (owner.findColour (Slider::textBoxOutlineColourId));
1220 g.drawRect (0, 0, owner.getWidth(), owner.getHeight(), 1);
1221 }
1222 }
1223 }
1224
1225 //==============================================================================
1227 {
1228 auto layout = lf.getSliderLayout (owner);
1229 sliderRect = layout.sliderBounds;
1230
1231 if (valueBox != nullptr)
1232 valueBox->setBounds (layout.textBoxBounds);
1233
1234 if (isHorizontal())
1235 {
1236 sliderRegionStart = layout.sliderBounds.getX();
1237 sliderRegionSize = layout.sliderBounds.getWidth();
1238 }
1239 else if (isVertical())
1240 {
1241 sliderRegionStart = layout.sliderBounds.getY();
1242 sliderRegionSize = layout.sliderBounds.getHeight();
1243 }
1244 else if (style == IncDecButtons)
1245 {
1247 }
1248 }
1249
1250 //==============================================================================
1252 {
1253 auto buttonRect = sliderRect;
1254
1256 buttonRect.expand (-2, 0);
1257 else
1258 buttonRect.expand (0, -2);
1259
1260 incDecButtonsSideBySide = buttonRect.getWidth() > buttonRect.getHeight();
1261
1263 {
1264 decButton->setBounds (buttonRect.removeFromLeft (buttonRect.getWidth() / 2));
1265 decButton->setConnectedEdges (Button::ConnectedOnRight);
1266 incButton->setConnectedEdges (Button::ConnectedOnLeft);
1267 }
1268 else
1269 {
1270 decButton->setBounds (buttonRect.removeFromBottom (buttonRect.getHeight() / 2));
1271 decButton->setConnectedEdges (Button::ConnectedOnTop);
1272 incButton->setConnectedEdges (Button::ConnectedOnBottom);
1273 }
1274
1275 incButton->setBounds (buttonRect);
1276 }
1277
1278 //==============================================================================
1281
1297 std::unique_ptr<ScopedDragNotification> currentDrag;
1298
1305
1306 bool editableText = true;
1308 bool isVelocityBased = false;
1312 bool showPopupOnDrag = false;
1313 bool showPopupOnHover = false;
1314 bool menuEnabled = false;
1315 bool useDragEvents = false;
1316 bool incDecDragged = false;
1318 bool snapsToMousePos = true;
1319
1322
1324
1325 std::unique_ptr<Label> valueBox;
1326 std::unique_ptr<Button> incButton, decButton;
1327
1328 //==============================================================================
1330 public Timer
1331 {
1333 : owner (s),
1334 font (s.getLookAndFeel().getSliderPopupFont (s))
1335 {
1336 if (isOnDesktop)
1338
1339 setAlwaysOnTop (true);
1340 setAllowedPlacement (owner.getLookAndFeel().getSliderPopupPlacement (s));
1341 setLookAndFeel (&s.getLookAndFeel());
1342 }
1343
1345 {
1346 if (owner.pimpl != nullptr)
1347 owner.pimpl->lastPopupDismissal = Time::getMillisecondCounterHiRes();
1348 }
1349
1350 void paintContent (Graphics& g, int w, int h) override
1351 {
1352 g.setFont (font);
1353 g.setColour (owner.findColour (TooltipWindow::textColourId, true));
1354 g.drawFittedText (text, Rectangle<int> (w, h), Justification::centred, 1);
1355 }
1356
1357 void getContentSize (int& w, int& h) override
1358 {
1359 w = font.getStringWidth (text) + 18;
1360 h = (int) (font.getHeight() * 1.6f);
1361 }
1362
1363 void updatePosition (const String& newText)
1364 {
1365 text = newText;
1367 repaint();
1368 }
1369
1370 void timerCallback() override
1371 {
1372 stopTimer();
1373 owner.pimpl->popupDisplay.reset();
1374 }
1375
1376 private:
1377 //==============================================================================
1381
1383 };
1384
1385 std::unique_ptr<PopupDisplayComponent> popupDisplay;
1387
1388 //==============================================================================
1389 static double smallestAngleBetween (double a1, double a2) noexcept
1390 {
1391 return jmin (std::abs (a1 - a2),
1392 std::abs (a1 + MathConstants<double>::twoPi - a2),
1393 std::abs (a2 + MathConstants<double>::twoPi - a1));
1394 }
1395};
1396
1397//==============================================================================
1403
1405{
1406 if (sliderBeingDragged.pimpl != nullptr)
1407 sliderBeingDragged.pimpl->sendDragEnd();
1408}
1409
1410//==============================================================================
1415
1420
1422{
1423 init (style, textBoxPos);
1424}
1425
1427{
1428 setWantsKeyboardFocus (false);
1430
1431 pimpl.reset (new Pimpl (*this, style, textBoxPos));
1432
1434 updateText();
1435
1436 pimpl->registerListeners();
1437}
1438
1440
1441//==============================================================================
1442void Slider::addListener (Listener* l) { pimpl->listeners.add (l); }
1443void Slider::removeListener (Listener* l) { pimpl->listeners.remove (l); }
1444
1445//==============================================================================
1447void Slider::setSliderStyle (SliderStyle newStyle) { pimpl->setSliderStyle (newStyle); }
1448
1450{
1451 // make sure the values are sensible..
1452 jassert (p.startAngleRadians >= 0 && p.endAngleRadians >= 0);
1453 jassert (p.startAngleRadians < MathConstants<float>::pi * 4.0f
1454 && p.endAngleRadians < MathConstants<float>::pi * 4.0f);
1455
1456 pimpl->rotaryParams = p;
1457}
1458
1459void Slider::setRotaryParameters (float startAngleRadians, float endAngleRadians, bool stopAtEnd) noexcept
1460{
1461 setRotaryParameters ({ startAngleRadians, endAngleRadians, stopAtEnd });
1462}
1463
1468
1469void Slider::setVelocityBasedMode (bool vb) { pimpl->isVelocityBased = vb; }
1470bool Slider::getVelocityBasedMode() const noexcept { return pimpl->isVelocityBased; }
1471bool Slider::getVelocityModeIsSwappable() const noexcept { return pimpl->userKeyOverridesVelocity; }
1472int Slider::getVelocityThreshold() const noexcept { return pimpl->velocityModeThreshold; }
1473double Slider::getVelocitySensitivity() const noexcept { return pimpl->velocityModeSensitivity; }
1474double Slider::getVelocityOffset() const noexcept { return pimpl->velocityModeOffset; }
1475
1476void Slider::setVelocityModeParameters (double sensitivity, int threshold,
1477 double offset, bool userCanPressKeyToSwapMode,
1478 ModifierKeys::Flags modifierToSwapModes)
1479{
1480 jassert (threshold >= 0);
1481 jassert (sensitivity > 0);
1482 jassert (offset >= 0);
1483
1484 pimpl->setVelocityModeParameters (sensitivity, threshold, offset,
1485 userCanPressKeyToSwapMode, modifierToSwapModes);
1486}
1487
1488double Slider::getSkewFactor() const noexcept { return pimpl->normRange.skew; }
1489bool Slider::isSymmetricSkew() const noexcept { return pimpl->normRange.symmetricSkew; }
1490
1491void Slider::setSkewFactor (double factor, bool symmetricSkew)
1492{
1493 pimpl->normRange.skew = factor;
1494 pimpl->normRange.symmetricSkew = symmetricSkew;
1495}
1496
1497void Slider::setSkewFactorFromMidPoint (double sliderValueToShowAtMidPoint)
1498{
1499 pimpl->normRange.setSkewForCentre (sliderValueToShowAtMidPoint);
1500}
1501
1502int Slider::getMouseDragSensitivity() const noexcept { return pimpl->pixelsForFullDragExtent; }
1503
1504void Slider::setMouseDragSensitivity (int distanceForFullScaleDrag)
1505{
1506 jassert (distanceForFullScaleDrag > 0);
1507
1508 pimpl->pixelsForFullDragExtent = distanceForFullScaleDrag;
1509}
1510
1512
1514int Slider::getTextBoxWidth() const noexcept { return pimpl->textBoxWidth; }
1515int Slider::getTextBoxHeight() const noexcept { return pimpl->textBoxHeight; }
1516
1517void Slider::setTextBoxStyle (TextEntryBoxPosition newPosition, bool isReadOnly, int textEntryBoxWidth, int textEntryBoxHeight)
1518{
1519 pimpl->setTextBoxStyle (newPosition, isReadOnly, textEntryBoxWidth, textEntryBoxHeight);
1520}
1521
1522bool Slider::isTextBoxEditable() const noexcept { return pimpl->editableText; }
1523void Slider::setTextBoxIsEditable (const bool shouldBeEditable) { pimpl->setTextBoxIsEditable (shouldBeEditable); }
1524void Slider::showTextBox() { pimpl->showTextBox(); }
1525void Slider::hideTextBox (bool discardCurrentEditorContents) { pimpl->hideTextBox (discardCurrentEditorContents); }
1526
1527void Slider::setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease)
1528{
1529 pimpl->sendChangeOnlyOnRelease = onlyNotifyOnRelease;
1530}
1531
1533void Slider::setSliderSnapsToMousePosition (bool shouldSnapToMouse) { pimpl->snapsToMousePos = shouldSnapToMouse; }
1534
1535void Slider::setPopupDisplayEnabled (bool showOnDrag, bool showOnHover, Component* parent, int hoverTimeout)
1536{
1537 pimpl->showPopupOnDrag = showOnDrag;
1538 pimpl->showPopupOnHover = showOnHover;
1539 pimpl->parentForPopupDisplay = parent;
1540 pimpl->popupHoverTimeout = hoverTimeout;
1541}
1542
1544
1545//==============================================================================
1547void Slider::lookAndFeelChanged() { pimpl->lookAndFeelChanged (getLookAndFeel()); }
1548void Slider::enablementChanged() { repaint(); pimpl->updateTextBoxEnablement(); }
1549
1550//==============================================================================
1551Range<double> Slider::getRange() const noexcept { return { pimpl->normRange.start, pimpl->normRange.end }; }
1552double Slider::getMaximum() const noexcept { return pimpl->normRange.end; }
1553double Slider::getMinimum() const noexcept { return pimpl->normRange.start; }
1554double Slider::getInterval() const noexcept { return pimpl->normRange.interval; }
1555
1556void Slider::setRange (double newMin, double newMax, double newInt) { pimpl->setRange (newMin, newMax, newInt); }
1557void Slider::setRange (Range<double> newRange, double newInt) { pimpl->setRange (newRange.getStart(), newRange.getEnd(), newInt); }
1558void Slider::setNormalisableRange (NormalisableRange<double> newRange) { pimpl->setNormalisableRange (newRange); }
1559
1560double Slider::getValue() const { return pimpl->getValue(); }
1561Value& Slider::getValueObject() noexcept { return pimpl->currentValue; }
1564
1565void Slider::setValue (double newValue, NotificationType notification)
1566{
1567 pimpl->setValue (newValue, notification);
1568}
1569
1570double Slider::getMinValue() const { return pimpl->getMinValue(); }
1571double Slider::getMaxValue() const { return pimpl->getMaxValue(); }
1572
1573void Slider::setMinValue (double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
1574{
1575 pimpl->setMinValue (newValue, notification, allowNudgingOfOtherValues);
1576}
1577
1578void Slider::setMaxValue (double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
1579{
1580 pimpl->setMaxValue (newValue, notification, allowNudgingOfOtherValues);
1581}
1582
1583void Slider::setMinAndMaxValues (double newMinValue, double newMaxValue, NotificationType notification)
1584{
1585 pimpl->setMinAndMaxValues (newMinValue, newMaxValue, notification);
1586}
1587
1588void Slider::setDoubleClickReturnValue (bool isDoubleClickEnabled, double valueToSetOnDoubleClick, ModifierKeys mods)
1589{
1590 pimpl->doubleClickToValue = isDoubleClickEnabled;
1591 pimpl->doubleClickReturnValue = valueToSetOnDoubleClick;
1592 pimpl->singleClickModifiers = mods;
1593}
1594
1595double Slider::getDoubleClickReturnValue() const noexcept { return pimpl->doubleClickReturnValue; }
1596bool Slider::isDoubleClickReturnEnabled() const noexcept { return pimpl->doubleClickToValue; }
1597
1599{
1600 pimpl->updateText();
1601}
1602
1604{
1605 pimpl->setTextValueSuffix (suffix);
1606}
1607
1609{
1610 return pimpl->textSuffix;
1611}
1612
1614{
1615 auto getText = [this] (double val)
1616 {
1617 if (textFromValueFunction != nullptr)
1618 return textFromValueFunction (val);
1619
1622
1623 return String (roundToInt (val));
1624 };
1625
1626 return getText (v) + getTextValueSuffix();
1627}
1628
1630{
1631 auto t = text.trimStart();
1632
1633 if (t.endsWith (getTextValueSuffix()))
1634 t = t.substring (0, t.length() - getTextValueSuffix().length());
1635
1636 if (valueFromTextFunction != nullptr)
1637 return valueFromTextFunction (t);
1638
1639 while (t.startsWithChar ('+'))
1640 t = t.substring (1).trimStart();
1641
1642 return t.initialSectionContainingOnly ("0123456789.,-")
1643 .getDoubleValue();
1644}
1645
1646double Slider::proportionOfLengthToValue (double proportion)
1647{
1648 return pimpl->normRange.convertFrom0to1 (proportion);
1649}
1650
1652{
1653 return pimpl->normRange.convertTo0to1 (value);
1654}
1655
1656double Slider::snapValue (double attemptedValue, DragMode)
1657{
1658 return attemptedValue;
1659}
1660
1662
1663void Slider::setNumDecimalPlacesToDisplay (int decimalPlacesToDisplay)
1664{
1665 pimpl->numDecimalPlaces = decimalPlacesToDisplay;
1666 updateText();
1667}
1668
1669//==============================================================================
1670int Slider::getThumbBeingDragged() const noexcept { return pimpl->sliderBeingDragged; }
1674
1675//==============================================================================
1676void Slider::setPopupMenuEnabled (bool menuEnabled) { pimpl->menuEnabled = menuEnabled; }
1677void Slider::setScrollWheelEnabled (bool enabled) { pimpl->scrollWheelEnabled = enabled; }
1678
1679bool Slider::isScrollWheelEnabled() const noexcept { return pimpl->scrollWheelEnabled; }
1680bool Slider::isHorizontal() const noexcept { return pimpl->isHorizontal(); }
1681bool Slider::isVertical() const noexcept { return pimpl->isVertical(); }
1682bool Slider::isRotary() const noexcept { return pimpl->isRotary(); }
1683bool Slider::isBar() const noexcept { return pimpl->isBar(); }
1684bool Slider::isTwoValue() const noexcept { return pimpl->isTwoValue(); }
1685bool Slider::isThreeValue() const noexcept { return pimpl->isThreeValue(); }
1686
1687float Slider::getPositionOfValue (double value) const { return pimpl->getPositionOfValue (value); }
1688
1689//==============================================================================
1691void Slider::resized() { pimpl->resized (getLookAndFeel()); }
1692
1694
1695void Slider::mouseDown (const MouseEvent& e) { pimpl->mouseDown (e); }
1696void Slider::mouseUp (const MouseEvent&) { pimpl->mouseUp(); }
1697void Slider::mouseMove (const MouseEvent&) { pimpl->mouseMove(); }
1698void Slider::mouseExit (const MouseEvent&) { pimpl->mouseExit(); }
1699
1700// If popup display is enabled and set to show on mouse hover, this makes sure
1701// it is shown when dragging the mouse over a slider and releasing
1702void Slider::mouseEnter (const MouseEvent&) { pimpl->mouseMove(); }
1703
1705bool Slider::keyPressed (const KeyPress& k) { return pimpl->keyPressed (k); }
1706
1708{
1709 if (isEnabled())
1710 pimpl->modifierKeysChanged (modifiers);
1711}
1712
1714{
1715 if (isEnabled())
1716 pimpl->mouseDrag (e);
1717}
1718
1720{
1721 if (isEnabled())
1722 pimpl->mouseDoubleClick();
1723}
1724
1726{
1727 if (! (isEnabled() && pimpl->mouseWheelMove (e, wheel)))
1729}
1730
1731//==============================================================================
1733{
1734public:
1735 explicit SliderAccessibilityHandler (Slider& sliderToWrap)
1736 : AccessibilityHandler (sliderToWrap,
1739 AccessibilityHandler::Interfaces { std::make_unique<ValueInterface> (sliderToWrap) }),
1740 slider (sliderToWrap)
1741 {
1742 }
1743
1744 String getHelp() const override { return slider.getTooltip(); }
1745
1746private:
1748 {
1749 public:
1750 explicit ValueInterface (Slider& sliderToWrap)
1751 : slider (sliderToWrap),
1752 useMaxValue (slider.isTwoValue())
1753 {
1754 }
1755
1756 bool isReadOnly() const override { return false; }
1757
1758 double getCurrentValue() const override
1759 {
1760 return useMaxValue ? slider.getMaximum()
1761 : slider.getValue();
1762 }
1763
1764 void setValue (double newValue) override
1765 {
1767
1768 if (useMaxValue)
1769 slider.setMaxValue (newValue, sendNotificationSync);
1770 else
1771 slider.setValue (newValue, sendNotificationSync);
1772 }
1773
1774 String getCurrentValueAsString() const override { return slider.getTextFromValue (getCurrentValue()); }
1775 void setValueAsString (const String& newValue) override { setValue (slider.getValueFromText (newValue)); }
1776
1778 {
1779 return { { slider.getMinimum(), slider.getMaximum() },
1780 getStepSize (slider) };
1781 }
1782
1783 private:
1785 const bool useMaxValue;
1786
1787 //==============================================================================
1789 };
1790
1792
1793 //==============================================================================
1795};
1796
1797std::unique_ptr<AccessibilityHandler> Slider::createAccessibilityHandler()
1798{
1799 return std::make_unique<SliderAccessibilityHandler> (*this);
1800}
1801
1802} // namespace juce
Type jmin(const Type a, const Type b)
Definition MathsFunctions.h:60
Type jmax(const Type a, const Type b)
Definition MathsFunctions.h:48
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_AccessibilityActions.h:73
AccessibilityHandler(Component &componentToWrap, AccessibilityRole accessibilityRole, AccessibilityActions actions={}, Interfaces interfaces={})
Definition juce_AccessibilityHandler.cpp:55
Definition juce_AccessibilityValueInterface.h:84
Definition juce_AccessibilityValueInterface.h:46
static AffineTransform scale(float factorX, float factorY) noexcept
Definition juce_AffineTransform.cpp:141
void triggerAsyncUpdate()
Definition juce_AsyncUpdater.cpp:62
void cancelPendingUpdate() noexcept
Definition juce_AsyncUpdater.cpp:74
AsyncUpdater()
Definition juce_AsyncUpdater.cpp:44
BubbleComponent()
Definition juce_BubbleComponent.cpp:29
void setPosition(Component *componentToPointTo, int distanceFromTarget=15, int arrowLength=10)
Definition juce_BubbleComponent.cpp:57
void setAllowedPlacement(int newPlacement)
Definition juce_BubbleComponent.cpp:51
Definition juce_Button.h:43
@ ConnectedOnBottom
Definition juce_Button.h:325
@ ConnectedOnLeft
Definition juce_Button.h:322
@ ConnectedOnRight
Definition juce_Button.h:323
@ ConnectedOnTop
Definition juce_Button.h:324
@ buttonDown
Definition juce_Button.h:371
@ buttonNormal
Definition juce_Button.h:369
Definition juce_Component.h:2331
bool shouldBailOut() const noexcept
Definition juce_Component.cpp:3252
void setLookAndFeel(LookAndFeel *newLookAndFeel)
Definition juce_Component.cpp:2182
void setTransform(const AffineTransform &transform)
Definition juce_Component.cpp:1341
void setRepaintsOnMouseActivity(bool shouldRepaint) noexcept
Definition juce_Component.cpp:1881
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent(const Component *targetComponent)
Definition juce_Component.cpp:1383
FocusChangeType
Definition juce_Component.h:1890
void setAlwaysOnTop(bool shouldStayOnTop)
Definition juce_Component.cpp:1074
void repaint()
Definition juce_Component.cpp:1917
Component() noexcept
Definition juce_Component.cpp:517
bool isOnDesktop() const noexcept
Definition juce_Component.cpp:796
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Definition juce_Component.cpp:2842
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel) override
Definition juce_Component.cpp:2303
bool isEnabled() const noexcept
Definition juce_Component.cpp:3104
LookAndFeel & getLookAndFeel() const noexcept
Definition juce_Component.cpp:2173
@ windowIsTemporary
Definition juce_ComponentPeer.h:52
@ windowIgnoresKeyPresses
Definition juce_ComponentPeer.h:71
@ windowIgnoresMouseClicks
Definition juce_ComponentPeer.h:54
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
Definition juce_Font.h:42
Definition juce_GraphicsContext.h:45
@ centred
Definition juce_Justification.h:138
Definition juce_KeyPress.h:40
static const int upKey
Definition juce_KeyPress.h:198
static const int rightKey
Definition juce_KeyPress.h:201
static const int downKey
Definition juce_KeyPress.h:199
static const int leftKey
Definition juce_KeyPress.h:200
Definition juce_ListenerList.h:70
Definition juce_LookAndFeel.h:108
static ModalComponentManager::Callback * forComponent(void(*functionToCall)(int, ComponentType *), ComponentType *component)
Definition juce_ModalComponentManager.h:276
Definition juce_ModifierKeys.h:41
bool testFlags(int flagsToTest) const noexcept
Definition juce_ModifierKeys.h:182
Flags
Definition juce_ModifierKeys.h:116
@ ctrlAltCommandModifiers
Definition juce_ModifierKeys.h:161
@ ParentCursor
Definition juce_MouseCursor.h:45
Definition juce_MouseEvent.h:39
Definition juce_MouseInputSource.h:52
Definition juce_NormalisableRange.h:40
Definition juce_Point.h:42
Definition juce_PopupMenu.h:457
Definition juce_PopupMenu.h:80
void addItem(Item newItem)
Definition juce_PopupMenu.cpp:1753
Definition juce_Range.h:40
constexpr ValueType getStart() const noexcept
Definition juce_Range.h:80
constexpr ValueType getEnd() const noexcept
Definition juce_Range.h:86
Definition juce_Rectangle.h:67
Definition juce_Slider.h:556
Definition juce_Slider.cpp:40
double getValue() const
Definition juce_Slider.cpp:169
void setVelocityModeParameters(double sensitivity, int threshold, double offset, bool userCanPressKeyToSwapMode, ModifierKeys::Flags newModifierToSwapModes)
Definition juce_Slider.cpp:481
double getMouseWheelDelta(double value, double wheelAmount)
Definition juce_Slider.cpp:1088
void setMinAndMaxValues(double newMinValue, double newMaxValue, NotificationType notification)
Definition juce_Slider.cpp:284
void updatePopupDisplay(double valueToShow)
Definition juce_Slider.cpp:1065
void incrementOrDecrement(double delta)
Definition juce_Slider.cpp:385
void setRange(double newMin, double newMax, double newInt)
Definition juce_Slider.cpp:156
Point< float > mousePosWhenLastDragged
Definition juce_Slider.cpp:1291
static double smallestAngleBetween(double a1, double a2) noexcept
Definition juce_Slider.cpp:1389
int popupHoverTimeout
Definition juce_Slider.cpp:1320
void lookAndFeelChanged(LookAndFeel &lf)
Definition juce_Slider.cpp:566
std::unique_ptr< PopupDisplayComponent > popupDisplay
Definition juce_Slider.cpp:1385
bool scrollWheelEnabled
Definition juce_Slider.cpp:1317
std::unique_ptr< Label > valueBox
Definition juce_Slider.cpp:1325
std::unique_ptr< Button > incButton
Definition juce_Slider.cpp:1326
double getMinValue() const
Definition juce_Slider.cpp:308
void setValue(double newValue, NotificationType notification)
Definition juce_Slider.cpp:178
bool useDragEvents
Definition juce_Slider.cpp:1315
Value currentValue
Definition juce_Slider.cpp:1283
void setMaxValue(double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
Definition juce_Slider.cpp:250
bool sendChangeOnlyOnRelease
Definition juce_Slider.cpp:1311
Component * parentForPopupDisplay
Definition juce_Slider.cpp:1386
void handleAsyncUpdate() override
Definition juce_Slider.cpp:339
void showPopupMenu()
Definition juce_Slider.cpp:630
std::unique_ptr< Button > decButton
Definition juce_Slider.cpp:1326
void mouseDoubleClick()
Definition juce_Slider.cpp:1079
void mouseExit()
Definition juce_Slider.cpp:997
bool keyPressed(const KeyPress &key)
Definition juce_Slider.cpp:1002
void updateText()
Definition juce_Slider.cpp:433
Value valueMax
Definition juce_Slider.cpp:1283
double valueWhenLastDragged
Definition juce_Slider.cpp:1287
ModifierKeys singleClickModifiers
Definition juce_Slider.cpp:1323
Point< float > mouseDragStartPos
Definition juce_Slider.cpp:1291
void restoreMouseIfHidden()
Definition juce_Slider.cpp:1149
void handleVelocityDrag(const MouseEvent &e)
Definition juce_Slider.cpp:788
void setTextBoxIsEditable(bool shouldBeEditable)
Definition juce_Slider.cpp:521
RotaryParameters rotaryParams
Definition juce_Slider.cpp:1290
double lastValueMin
Definition juce_Slider.cpp:1284
void registerListeners()
Definition juce_Slider.cpp:61
bool userKeyOverridesVelocity
Definition juce_Slider.cpp:1309
bool incDecDragged
Definition juce_Slider.cpp:1316
void handleRotaryDrag(const MouseEvent &e)
Definition juce_Slider.cpp:692
double lastPopupDismissal
Definition juce_Slider.cpp:1321
bool canDoubleClickToValue() const
Definition juce_Slider.cpp:1071
bool isThreeValue() const noexcept
Definition juce_Slider.cpp:104
void setTextValueSuffix(const String &suffix)
Definition juce_Slider.cpp:546
bool isBar() const noexcept
Definition juce_Slider.cpp:92
void textChanged()
Definition juce_Slider.cpp:420
double constrainedValue(double value) const
Definition juce_Slider.cpp:444
Value valueMin
Definition juce_Slider.cpp:1283
double lastValueMax
Definition juce_Slider.cpp:1284
void resizeIncDecButtons()
Definition juce_Slider.cpp:1251
double velocityModeOffset
Definition juce_Slider.cpp:1288
bool doubleClickToValue
Definition juce_Slider.cpp:1307
int sliderBeingDragged
Definition juce_Slider.cpp:1293
double velocityModeSensitivity
Definition juce_Slider.cpp:1288
void valueChanged(Value &value) override
Definition juce_Slider.cpp:403
Time lastMouseWheelTime
Definition juce_Slider.cpp:1295
bool isHorizontal() const noexcept
Definition juce_Slider.cpp:68
void setMinValue(double newValue, NotificationType notification, bool allowNudgingOfOtherValues)
Definition juce_Slider.cpp:216
String textSuffix
Definition juce_Slider.cpp:1300
void sendDragStart()
Definition juce_Slider.cpp:356
void resized(LookAndFeel &lf)
Definition juce_Slider.cpp:1226
double minMaxDiff
Definition juce_Slider.cpp:1288
void handleAbsoluteDrag(const MouseEvent &e)
Definition juce_Slider.cpp:740
bool isVertical() const noexcept
Definition juce_Slider.cpp:76
bool isAbsoluteDragMode(ModifierKeys mods) const
Definition juce_Slider.cpp:1144
NormalisableRange< double > normRange
Definition juce_Slider.cpp:1285
int velocityModeThreshold
Definition juce_Slider.cpp:1289
ListenerList< Slider::Listener > listeners
Definition juce_Slider.cpp:1282
double doubleClickReturnValue
Definition juce_Slider.cpp:1286
void setIncDecButtonsMode(IncDecButtonMode mode)
Definition juce_Slider.cpp:492
int textBoxHeight
Definition juce_Slider.cpp:1302
bool snapsToMousePos
Definition juce_Slider.cpp:1318
static void sliderMenuCallback(int result, Slider *slider)
Definition juce_Slider.cpp:652
int getThumbIndexAt(const MouseEvent &e)
Definition juce_Slider.cpp:668
bool editableText
Definition juce_Slider.cpp:1306
bool showPopupOnDrag
Definition juce_Slider.cpp:1312
Rectangle< int > sliderRect
Definition juce_Slider.cpp:1296
void mouseDrag(const MouseEvent &e)
Definition juce_Slider.cpp:879
bool isTwoValue() const noexcept
Definition juce_Slider.cpp:98
int pixelsForFullDragExtent
Definition juce_Slider.cpp:1294
bool incDecDragDirectionIsHorizontal() const noexcept
Definition juce_Slider.cpp:110
bool showPopupOnHover
Definition juce_Slider.cpp:1313
void modifierKeysChanged(const ModifierKeys &modifiers)
Definition juce_Slider.cpp:1138
void updateRange()
Definition juce_Slider.cpp:125
double lastAngle
Definition juce_Slider.cpp:1287
ModifierKeys::Flags modifierToSwapModes
Definition juce_Slider.cpp:1304
TextEntryBoxPosition textBoxPos
Definition juce_Slider.cpp:1299
IncDecButtonMode incDecButtonMode
Definition juce_Slider.cpp:1303
bool isVelocityBased
Definition juce_Slider.cpp:1308
int sliderRegionStart
Definition juce_Slider.cpp:1292
SliderStyle style
Definition juce_Slider.cpp:1280
~Pimpl() override
Definition juce_Slider.cpp:52
void setNormalisableRange(NormalisableRange< double > newRange)
Definition juce_Slider.cpp:163
std::unique_ptr< ScopedDragNotification > currentDrag
Definition juce_Slider.cpp:1297
int sliderRegionSize
Definition juce_Slider.cpp:1292
void paint(Graphics &g, LookAndFeel &lf)
Definition juce_Slider.cpp:1191
void mouseUp()
Definition juce_Slider.cpp:946
double getMaxValue() const
Definition juce_Slider.cpp:317
Pimpl(Slider &s, SliderStyle sliderStyle, TextEntryBoxPosition textBoxPosition)
Definition juce_Slider.cpp:42
int textBoxWidth
Definition juce_Slider.cpp:1302
void mouseDown(const MouseEvent &e)
Definition juce_Slider.cpp:825
double valueOnMouseDown
Definition juce_Slider.cpp:1287
Slider & owner
Definition juce_Slider.cpp:1279
void triggerChangeMessage(NotificationType notification)
Definition juce_Slider.cpp:326
void updateTextBoxEnablement()
Definition juce_Slider.cpp:555
bool isRotary() const noexcept
Definition juce_Slider.cpp:84
bool menuEnabled
Definition juce_Slider.cpp:1314
void hideTextBox(bool discardCurrentEditorContents)
Definition juce_Slider.cpp:535
double lastCurrentValue
Definition juce_Slider.cpp:1284
void setTextBoxStyle(TextEntryBoxPosition newPosition, bool isReadOnly, int textEntryBoxWidth, int textEntryBoxHeight)
Definition juce_Slider.cpp:501
int numDecimalPlaces
Definition juce_Slider.cpp:1301
float getLinearSliderPos(double value) const
Definition juce_Slider.cpp:449
float getPositionOfValue(double value) const
Definition juce_Slider.cpp:116
void mouseMove()
Definition juce_Slider.cpp:975
bool mouseWheelMove(const MouseEvent &e, const MouseWheelDetails &wheel)
Definition juce_Slider.cpp:1101
void showTextBox()
Definition juce_Slider.cpp:527
void setSliderStyle(SliderStyle newStyle)
Definition juce_Slider.cpp:469
void sendDragEnd()
Definition juce_Slider.cpp:370
void showPopupDisplay()
Definition juce_Slider.cpp:1034
bool incDecButtonsSideBySide
Definition juce_Slider.cpp:1310
Definition juce_Slider.h:898
~ScopedDragNotification()
Definition juce_Slider.cpp:1404
Slider & sliderBeingDragged
Definition juce_Slider.h:904
ScopedDragNotification(Slider &)
Definition juce_Slider.cpp:1398
double getCurrentValue() const override
Definition juce_Slider.cpp:1758
const bool useMaxValue
Definition juce_Slider.cpp:1785
Slider & slider
Definition juce_Slider.cpp:1784
ValueInterface(Slider &sliderToWrap)
Definition juce_Slider.cpp:1750
String getCurrentValueAsString() const override
Definition juce_Slider.cpp:1774
void setValueAsString(const String &newValue) override
Definition juce_Slider.cpp:1775
void setValue(double newValue) override
Definition juce_Slider.cpp:1764
bool isReadOnly() const override
Definition juce_Slider.cpp:1756
AccessibleValueRange getRange() const override
Definition juce_Slider.cpp:1777
SliderAccessibilityHandler(Slider &sliderToWrap)
Definition juce_Slider.cpp:1735
Slider & slider
Definition juce_Slider.cpp:1791
String getHelp() const override
Definition juce_Slider.cpp:1744
Definition juce_Slider.h:54
int getVelocityThreshold() const noexcept
Definition juce_Slider.cpp:1472
void setSliderStyle(SliderStyle newStyle)
Definition juce_Slider.cpp:1447
DragMode
Definition juce_Slider.h:106
@ notDragging
Definition juce_Slider.h:107
@ velocityDrag
Definition juce_Slider.h:109
@ absoluteDrag
Definition juce_Slider.h:108
void setPopupDisplayEnabled(bool shouldShowOnMouseDrag, bool shouldShowOnMouseHover, Component *parentComponentToUse, int hoverTimeout=2000)
Definition juce_Slider.cpp:1535
int getTextBoxWidth() const noexcept
Definition juce_Slider.cpp:1514
double getMinimum() const noexcept
Definition juce_Slider.cpp:1553
double getVelocityOffset() const noexcept
Definition juce_Slider.cpp:1474
void setMaxValue(double newValue, NotificationType notification=sendNotificationAsync, bool allowNudgingOfOtherValues=false)
Definition juce_Slider.cpp:1578
void setMinAndMaxValues(double newMinValue, double newMaxValue, NotificationType notification=sendNotificationAsync)
Definition juce_Slider.cpp:1583
bool isRotary() const noexcept
Definition juce_Slider.cpp:1682
double getMaxValue() const
Definition juce_Slider.cpp:1571
virtual String getTextFromValue(double value)
Definition juce_Slider.cpp:1613
void addListener(Listener *listener)
Definition juce_Slider.cpp:1442
Value & getMaxValueObject() noexcept
Definition juce_Slider.cpp:1563
void setDoubleClickReturnValue(bool shouldDoubleClickBeEnabled, double valueToSetOnDoubleClick, ModifierKeys singleClickModifiers=ModifierKeys::altModifier)
Definition juce_Slider.cpp:1588
float getPositionOfValue(double value) const
Definition juce_Slider.cpp:1687
void focusOfChildComponentChanged(FocusChangeType) override
Definition juce_Slider.cpp:1693
IncDecButtonMode
Definition juce_Slider.h:291
@ incDecButtonsDraggable_AutoDirection
Definition juce_Slider.h:293
@ incDecButtonsDraggable_Horizontal
Definition juce_Slider.h:294
@ incDecButtonsNotDraggable
Definition juce_Slider.h:292
bool getSliderSnapsToMousePosition() const noexcept
Definition juce_Slider.cpp:1532
void setRotaryParameters(RotaryParameters newParameters) noexcept
Definition juce_Slider.cpp:1449
void setVelocityModeParameters(double sensitivity=1.0, int threshold=1, double offset=0.0, bool userCanPressKeyToSwapMode=true, ModifierKeys::Flags modifiersToSwapModes=ModifierKeys::ctrlAltCommandModifiers)
Definition juce_Slider.cpp:1476
virtual double valueToProportionOfLength(double value)
Definition juce_Slider.cpp:1651
std::function< String(double)> textFromValueFunction
Definition juce_Slider.h:611
bool getVelocityBasedMode() const noexcept
Definition juce_Slider.cpp:1470
std::unique_ptr< Pimpl > pimpl
Definition juce_Slider.h:1015
double getDoubleClickReturnValue() const noexcept
Definition juce_Slider.cpp:1595
Range< double > getRange() const noexcept
Definition juce_Slider.cpp:1551
void setSkewFactor(double factor, bool symmetricSkew=false)
Definition juce_Slider.cpp:1491
virtual double proportionOfLengthToValue(double proportion)
Definition juce_Slider.cpp:1646
int getMouseDragSensitivity() const noexcept
Definition juce_Slider.cpp:1502
void colourChanged() override
Definition juce_Slider.cpp:1546
void setTextBoxIsEditable(bool shouldBeEditable)
Definition juce_Slider.cpp:1523
void mouseDrag(const MouseEvent &) override
Definition juce_Slider.cpp:1713
void setScrollWheelEnabled(bool enabled)
Definition juce_Slider.cpp:1677
void setChangeNotificationOnlyOnRelease(bool onlyNotifyOnRelease)
Definition juce_Slider.cpp:1527
double getSkewFactor() const noexcept
Definition juce_Slider.cpp:1488
void hideTextBox(bool discardCurrentEditorContents)
Definition juce_Slider.cpp:1525
void lookAndFeelChanged() override
Definition juce_Slider.cpp:1547
String getTextValueSuffix() const
Definition juce_Slider.cpp:1608
virtual double snapValue(double attemptedValue, DragMode dragMode)
Definition juce_Slider.cpp:1656
bool isDoubleClickReturnEnabled() const noexcept
Definition juce_Slider.cpp:1596
bool getVelocityModeIsSwappable() const noexcept
Definition juce_Slider.cpp:1471
void setIncDecButtonsMode(IncDecButtonMode mode)
Definition juce_Slider.cpp:1511
double getInterval() const noexcept
Definition juce_Slider.cpp:1554
void mouseMove(const MouseEvent &) override
Definition juce_Slider.cpp:1697
void setVelocityBasedMode(bool isVelocityBased)
Definition juce_Slider.cpp:1469
double getMaximum() const noexcept
Definition juce_Slider.cpp:1552
Component * getCurrentPopupDisplay() const noexcept
Definition juce_Slider.cpp:1543
void mouseExit(const MouseEvent &) override
Definition juce_Slider.cpp:1698
double getValue() const
Definition juce_Slider.cpp:1560
void showTextBox()
Definition juce_Slider.cpp:1524
void resized() override
Definition juce_Slider.cpp:1691
~Slider() override
Definition juce_Slider.cpp:1439
bool isHorizontal() const noexcept
Definition juce_Slider.cpp:1680
SliderStyle
Definition juce_Slider.h:62
@ LinearBarVertical
Definition juce_Slider.h:66
@ IncDecButtons
Definition juce_Slider.h:75
@ ThreeValueHorizontal
Definition juce_Slider.h:82
@ TwoValueHorizontal
Definition juce_Slider.h:77
@ Rotary
Definition juce_Slider.h:67
@ LinearBar
Definition juce_Slider.h:65
@ LinearHorizontal
Definition juce_Slider.h:63
@ RotaryVerticalDrag
Definition juce_Slider.h:71
@ LinearVertical
Definition juce_Slider.h:64
@ RotaryHorizontalDrag
Definition juce_Slider.h:69
@ ThreeValueVertical
Definition juce_Slider.h:85
@ RotaryHorizontalVerticalDrag
Definition juce_Slider.h:73
@ TwoValueVertical
Definition juce_Slider.h:79
double getMinValue() const
Definition juce_Slider.cpp:1570
void mouseDoubleClick(const MouseEvent &) override
Definition juce_Slider.cpp:1719
bool keyPressed(const KeyPress &) override
Definition juce_Slider.cpp:1705
bool isSymmetricSkew() const noexcept
Definition juce_Slider.cpp:1489
void mouseDown(const MouseEvent &) override
Definition juce_Slider.cpp:1695
Value & getMinValueObject() noexcept
Definition juce_Slider.cpp:1562
void enablementChanged() override
Definition juce_Slider.cpp:1548
bool isThreeValue() const noexcept
Definition juce_Slider.cpp:1685
bool isVertical() const noexcept
Definition juce_Slider.cpp:1681
int getTextBoxHeight() const noexcept
Definition juce_Slider.cpp:1515
bool isScrollWheelEnabled() const noexcept
Definition juce_Slider.cpp:1679
void removeListener(Listener *listener)
Definition juce_Slider.cpp:1443
void mouseUp(const MouseEvent &) override
Definition juce_Slider.cpp:1696
void setNumDecimalPlacesToDisplay(int decimalPlacesToDisplay)
Definition juce_Slider.cpp:1663
void modifierKeysChanged(const ModifierKeys &) override
Definition juce_Slider.cpp:1707
std::function< double(const String &)> valueFromTextFunction
Definition juce_Slider.h:608
virtual void stoppedDragging()
Definition juce_Slider.cpp:1672
bool isBar() const noexcept
Definition juce_Slider.cpp:1683
void setPopupMenuEnabled(bool menuEnabled)
Definition juce_Slider.cpp:1676
virtual void valueChanged()
Definition juce_Slider.cpp:1673
bool isTextBoxEditable() const noexcept
Definition juce_Slider.cpp:1522
void setMinValue(double newValue, NotificationType notification=sendNotificationAsync, bool allowNudgingOfOtherValues=false)
Definition juce_Slider.cpp:1573
@ textBoxOutlineColourId
Definition juce_Slider.h:876
TextEntryBoxPosition getTextBoxPosition() const noexcept
Definition juce_Slider.cpp:1513
void setTextBoxStyle(TextEntryBoxPosition newPosition, bool isReadOnly, int textEntryBoxWidth, int textEntryBoxHeight)
Definition juce_Slider.cpp:1517
RotaryParameters getRotaryParameters() const noexcept
Definition juce_Slider.cpp:1464
virtual double getValueFromText(const String &text)
Definition juce_Slider.cpp:1629
void setValue(double newValue, NotificationType notification=sendNotificationAsync)
Definition juce_Slider.cpp:1565
int getThumbBeingDragged() const noexcept
Definition juce_Slider.cpp:1670
void setSkewFactorFromMidPoint(double sliderValueToShowAtMidPoint)
Definition juce_Slider.cpp:1497
Value & getValueObject() noexcept
Definition juce_Slider.cpp:1561
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_Slider.cpp:1797
virtual void startedDragging()
Definition juce_Slider.cpp:1671
void paint(Graphics &) override
Definition juce_Slider.cpp:1690
void init(SliderStyle, TextEntryBoxPosition)
Definition juce_Slider.cpp:1426
Slider()
Definition juce_Slider.cpp:1411
void setTextValueSuffix(const String &suffix)
Definition juce_Slider.cpp:1603
void setSliderSnapsToMousePosition(bool shouldSnapToMouse)
Definition juce_Slider.cpp:1533
TextEntryBoxPosition
Definition juce_Slider.h:94
@ TextBoxRight
Definition juce_Slider.h:97
@ NoTextBox
Definition juce_Slider.h:95
@ TextBoxLeft
Definition juce_Slider.h:96
void mouseWheelMove(const MouseEvent &, const MouseWheelDetails &) override
Definition juce_Slider.cpp:1725
double getVelocitySensitivity() const noexcept
Definition juce_Slider.cpp:1473
SliderStyle getSliderStyle() const noexcept
Definition juce_Slider.cpp:1446
int getNumDecimalPlacesToDisplay() const noexcept
Definition juce_Slider.cpp:1661
void setRange(double newMinimum, double newMaximum, double newInterval=0)
Definition juce_Slider.cpp:1556
void setMouseDragSensitivity(int distanceForFullScaleDrag)
Definition juce_Slider.cpp:1504
bool isTwoValue() const noexcept
Definition juce_Slider.cpp:1684
void updateText()
Definition juce_Slider.cpp:1598
void setNormalisableRange(NormalisableRange< double > newNormalisableRange)
Definition juce_Slider.cpp:1558
void mouseEnter(const MouseEvent &) override
Definition juce_Slider.cpp:1702
Definition juce_String.h:53
Definition juce_Time.h:37
static double getMillisecondCounterHiRes() noexcept
Definition juce_linux_SystemStats.cpp:334
void stopTimer() noexcept
Definition juce_Timer.cpp:357
Timer() noexcept
Definition juce_Timer.cpp:316
@ textColourId
Definition juce_TooltipWindow.h:115
Definition juce_Value.h:139
Definition juce_Value.h:51
* e
Definition inflate.c:1404
UINT_D64 w
Definition inflate.c:942
int * l
Definition inflate.c:1579
unsigned * m
Definition inflate.c:1559
struct huft * t
Definition inflate.c:943
register unsigned k
Definition inflate.c:946
unsigned v[N_MAX]
Definition inflate.c:1584
int g
Definition inflate.c:1573
unsigned s
Definition inflate.c:1555
static PuglViewHint int value
Definition pugl.h:1708
static const char * name
Definition pugl.h:1582
static uintptr_t parent
Definition pugl.h:1644
int val
Definition jpeglib.h:956
#define TRANS(stringLiteral)
Definition juce_LocalisedStrings.h:208
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define jassertfalse
static const SerdStyle style
Definition sratom.c:36
Definition carla_juce.cpp:31
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
constexpr Type jmax(Type a, Type b)
Definition juce_MathsFunctions.h:94
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Definition juce_MathsFunctions.h:262
@ valueChanged
Definition juce_AccessibilityEvent.h:44
NotificationType
Definition juce_NotificationType.h:32
@ sendNotificationAsync
Definition juce_NotificationType.h:36
@ sendNotificationSync
Definition juce_NotificationType.h:35
@ dontSendNotification
Definition juce_NotificationType.h:33
static double getStepSize(const Slider &slider)
Definition juce_Slider.cpp:29
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
AccessibilityRole
Definition juce_AccessibilityRole.h:37
@ slider
Definition juce_AccessibilityRole.h:43
@ tooltip
Definition juce_AccessibilityRole.h:65
Definition juce_Uuid.h:141
png_uint_32 length
Definition png.c:2247
png_structrp int mode
Definition png.h:1139
Definition juce_AccessibilityHandler.h:49
static constexpr FloatType twoPi
Definition juce_MathsFunctions.h:385
static constexpr FloatType pi
Definition juce_MathsFunctions.h:382
Definition juce_MouseEvent.h:392
bool isReversed
Definition juce_MouseEvent.h:415
float deltaY
Definition juce_MouseEvent.h:410
float deltaX
Definition juce_MouseEvent.h:401
virtual Button * createSliderButton(Slider &, bool isIncrement)=0
virtual SliderLayout getSliderLayout(Slider &)=0
virtual void drawLinearSlider(Graphics &, int x, int y, int width, int height, float sliderPos, float minSliderPos, float maxSliderPos, const Slider::SliderStyle, Slider &)=0
virtual ImageEffectFilter * getSliderEffect(Slider &)=0
virtual Label * createSliderTextBox(Slider &)=0
virtual void drawRotarySlider(Graphics &, int x, int y, int width, int height, float sliderPosProportional, float rotaryStartAngle, float rotaryEndAngle, Slider &)=0
Definition juce_Slider.cpp:1331
~PopupDisplayComponent() override
Definition juce_Slider.cpp:1344
Slider & owner
Definition juce_Slider.cpp:1378
void paintContent(Graphics &g, int w, int h) override
Definition juce_Slider.cpp:1350
PopupDisplayComponent(Slider &s, bool isOnDesktop)
Definition juce_Slider.cpp:1332
Font font
Definition juce_Slider.cpp:1379
void timerCallback() override
Definition juce_Slider.cpp:1370
void getContentSize(int &w, int &h) override
Definition juce_Slider.cpp:1357
void updatePosition(const String &newText)
Definition juce_Slider.cpp:1363
String text
Definition juce_Slider.cpp:1380
Definition juce_Slider.h:145
const char * text
Definition swell-functions.h:167
uch * p
Definition crypt.c:594
ZCONST char * key
Definition crypt.c:587
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
b
Definition crypt.c:628
ZCONST uch * init
Definition extract.c:2392
void handler(int signal)
Definition fileio.c:1632
int result
Definition process.c:1455
typedef int(UZ_EXP MsgFn)()
dy
Definition zipinfo.c:2288
#define const
Definition zconf.h:137