Browse Source

Added Slider method to modify the number of decimal places that are displayed in a slider's text box

tags/2021-05-28
hogliux 7 years ago
parent
commit
c72cf7ed64
2 changed files with 15 additions and 0 deletions
  1. +6
    -0
      modules/juce_gui_basics/widgets/juce_Slider.cpp
  2. +9
    -0
      modules/juce_gui_basics/widgets/juce_Slider.h

+ 6
- 0
modules/juce_gui_basics/widgets/juce_Slider.cpp View File

@@ -1615,6 +1615,12 @@ double Slider::snapValue (double attemptedValue, DragMode)
int Slider::getNumDecimalPlacesToDisplay() const noexcept { return pimpl->numDecimalPlaces; } int Slider::getNumDecimalPlacesToDisplay() const noexcept { return pimpl->numDecimalPlaces; }
void Slider::setNumDecimalPlacesToDisplay (int decimalPlacesToDisplay)
{
pimpl->numDecimalPlaces = decimalPlacesToDisplay;
updateText();
}
//============================================================================== //==============================================================================
int Slider::getThumbBeingDragged() const noexcept { return pimpl->sliderBeingDragged; } int Slider::getThumbBeingDragged() const noexcept { return pimpl->sliderBeingDragged; }
void Slider::startedDragging() {} void Slider::startedDragging() {}


+ 9
- 0
modules/juce_gui_basics/widgets/juce_Slider.h View File

@@ -746,9 +746,18 @@ public:
slider's value. slider's value.
It calculates the fewest decimal places needed to represent numbers with It calculates the fewest decimal places needed to represent numbers with
the slider's interval setting. the slider's interval setting.
@see setNumDecimalPlacesToDisplay
*/ */
int getNumDecimalPlacesToDisplay() const noexcept; int getNumDecimalPlacesToDisplay() const noexcept;
/** Modifies the best number of decimal places to use when displaying this
slider's value.
@see getNumDecimalPlacesToDisplay
*/
void setNumDecimalPlacesToDisplay (int decimalPlacesToDisplay);
//============================================================================== //==============================================================================
/** Allows a user-defined mapping of distance along the slider to its value. /** Allows a user-defined mapping of distance along the slider to its value.


Loading…
Cancel
Save