25 #ifndef JUCE_SLIDER_H_INCLUDED
26 #define JUCE_SLIDER_H_INCLUDED
71 RotaryHorizontalVerticalDrag,
122 Slider (SliderStyle style, TextEntryBoxPosition textBoxPosition);
133 void setSliderStyle (SliderStyle newStyle);
138 SliderStyle getSliderStyle() const
noexcept;
154 void setRotaryParameters (
float startAngleRadians,
155 float endAngleRadians,
164 void setMouseDragSensitivity (
int distanceForFullScaleDrag);
167 int getMouseDragSensitivity() const
noexcept;
178 void setVelocityBasedMode (
bool isVelocityBased);
183 bool getVelocityBasedMode() const
noexcept;
198 void setVelocityModeParameters (
double sensitivity = 1.0,
201 bool userCanPressKeyToSwapMode = true);
206 double getVelocitySensitivity() const
noexcept;
211 int getVelocityThreshold() const
noexcept;
216 double getVelocityOffset() const
noexcept;
221 bool getVelocityModeIsSwappable() const
noexcept;
239 void setSkewFactor (
double factor);
248 void setSkewFactorFromMidPoint (
double sliderValueToShowAtMidPoint);
254 double getSkewFactor() const
noexcept;
264 incDecButtonsDraggable_Vertical
277 void setIncDecButtonsMode (IncDecButtonMode mode);
291 void setTextBoxStyle (TextEntryBoxPosition newPosition,
293 int textEntryBoxWidth,
294 int textEntryBoxHeight);
299 TextEntryBoxPosition getTextBoxPosition() const
noexcept;
304 int getTextBoxWidth() const
noexcept;
309 int getTextBoxHeight() const
noexcept;
318 void setTextBoxIsEditable (
bool shouldBeEditable);
323 bool isTextBoxEditable() const
noexcept;
339 void hideTextBox (
bool discardCurrentEditorContents);
359 double getValue() const;
377 void setRange (
double newMinimum,
379 double newInterval = 0);
394 double getInterval() const
noexcept;
405 double getMinValue() const;
433 void setMinValue (
double newValue,
435 bool allowNudgingOfOtherValues = false);
445 double getMaxValue() const;
473 void setMaxValue (
double newValue,
475 bool allowNudgingOfOtherValues = false);
492 void setMinAndMaxValues (
double newMinValue,
double newMaxValue,
520 virtual void sliderValueChanged (
Slider* slider) = 0;
540 void addListener (Listener* listener);
543 void removeListener (Listener* listener);
554 void setDoubleClickReturnValue (
bool shouldDoubleClickBeEnabled,
555 double valueToSetOnDoubleClick);
560 double getDoubleClickReturnValue() const
noexcept;
565 bool isDoubleClickReturnEnabled() const
noexcept;
576 void setChangeNotificationOnlyOnRelease (
bool onlyNotifyOnRelease);
587 void setSliderSnapsToMousePosition (
bool shouldSnapToMouse);
590 bool getSliderSnapsToMousePosition() const
noexcept;
604 void setPopupDisplayEnabled (
bool isEnabled,
Component* parentComponentToUse);
619 void setPopupMenuEnabled (
bool menuEnabled);
624 void setScrollWheelEnabled (
bool enabled);
631 int getThumbBeingDragged() const
noexcept;
637 virtual
void startedDragging();
642 virtual
void stoppedDragging();
647 virtual
void valueChanged();
658 virtual
double getValueFromText (const
String& text);
670 virtual
String getTextFromValue (
double value);
679 void setTextValueSuffix (const
String& suffix);
682 String getTextValueSuffix() const;
689 int getNumDecimalPlacesToDisplay() const
noexcept;
703 virtual
double proportionOfLengthToValue (
double proportion);
718 virtual
double valueToProportionOfLength (
double value);
729 float getPositionOfValue (
double value);
744 virtual
double snapValue (
double attemptedValue, DragMode dragMode);
772 backgroundColourId = 0x1001200,
773 thumbColourId = 0x1001300,
775 trackColourId = 0x1001310,
776 rotarySliderFillColourId = 0x1001311,
777 rotarySliderOutlineColourId = 0x1001312,
779 textBoxTextColourId = 0x1001400,
780 textBoxBackgroundColourId = 0x1001500,
781 textBoxHighlightColourId = 0x1001600,
782 textBoxOutlineColourId = 0x1001700
804 virtual void drawLinearSlider (
Graphics&,
805 int x,
int y,
int width,
int height,
812 virtual void drawLinearSliderBackground (
Graphics&,
813 int x,
int y,
int width,
int height,
820 virtual void drawLinearSliderThumb (
Graphics&,
821 int x,
int y,
int width,
int height,
828 virtual int getSliderThumbRadius (
Slider&) = 0;
830 virtual void drawRotarySlider (
Graphics&,
831 int x,
int y,
int width,
int height,
832 float sliderPosProportional,
833 float rotaryStartAngle,
834 float rotaryEndAngle,
837 virtual Button* createSliderButton (
Slider&,
bool isIncrement) = 0;
842 virtual Font getSliderPopupFont (
Slider&) = 0;
843 virtual int getSliderPopupPlacement (
Slider&) = 0;
847 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
849 virtual void createSliderButton (
bool) {}
850 virtual void getSliderEffect() {}
851 virtual void getSliderPopupFont() {}
852 virtual void getSliderPopupPlacement() {}
860 void resized()
override;
868 void mouseDoubleClick (
const MouseEvent&)
override;
872 void modifierKeysChanged (
const ModifierKeys&)
override;
874 void lookAndFeelChanged()
override;
876 void enablementChanged()
override;
878 void focusOfChildComponentChanged (FocusChangeType)
override;
880 void colourChanged()
override;
891 #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
901 JUCE_DEPRECATED (
void setMinAndMaxValues (
double,
double,
bool,
bool));
903 virtual void snapValue (
double,
bool) {}
912 #endif // JUCE_SLIDER_H_INCLUDED