Browse Source

Added a parameter to Slider::setPopupDisplayEnabled() to set the timeout for displaying the popup display on mouse hover

tags/2021-05-28
ed 8 years ago
parent
commit
725947d764
2 changed files with 7 additions and 3 deletions
  1. +5
    -2
      modules/juce_gui_basics/widgets/juce_Slider.cpp
  2. +2
    -1
      modules/juce_gui_basics/widgets/juce_Slider.h

+ 5
- 2
modules/juce_gui_basics/widgets/juce_Slider.cpp View File

@@ -966,7 +966,7 @@ public:
showPopupDisplay(); showPopupDisplay();
if (popupDisplay != nullptr) if (popupDisplay != nullptr)
popupDisplay->startTimer (2000);
popupDisplay->startTimer (popupHoverTimeout);
} }
} }
} }
@@ -1259,6 +1259,8 @@ public:
bool scrollWheelEnabled = true; bool scrollWheelEnabled = true;
bool snapsToMousePos = true; bool snapsToMousePos = true;
int popupHoverTimeout = 2000;
ScopedPointer<Label> valueBox; ScopedPointer<Label> valueBox;
ScopedPointer<Button> incButton, decButton; ScopedPointer<Button> incButton, decButton;
@@ -1446,11 +1448,12 @@ void Slider::setChangeNotificationOnlyOnRelease (bool onlyNotifyOnRelease)
bool Slider::getSliderSnapsToMousePosition() const noexcept { return pimpl->snapsToMousePos; } bool Slider::getSliderSnapsToMousePosition() const noexcept { return pimpl->snapsToMousePos; }
void Slider::setSliderSnapsToMousePosition (const bool shouldSnapToMouse) { pimpl->snapsToMousePos = shouldSnapToMouse; } void Slider::setSliderSnapsToMousePosition (const bool shouldSnapToMouse) { pimpl->snapsToMousePos = shouldSnapToMouse; }
void Slider::setPopupDisplayEnabled (bool showOnDrag, bool showOnHover, Component* parent)
void Slider::setPopupDisplayEnabled (bool showOnDrag, bool showOnHover, Component* parent, int hoverTimeout)
{ {
pimpl->showPopupOnDrag = showOnDrag; pimpl->showPopupOnDrag = showOnDrag;
pimpl->showPopupOnHover = showOnHover; pimpl->showPopupOnHover = showOnHover;
pimpl->parentForPopupDisplay = parent; pimpl->parentForPopupDisplay = parent;
pimpl->popupHoverTimeout = hoverTimeout;
} }
Component* Slider::getCurrentPopupDisplay() const noexcept { return pimpl->popupDisplay.get(); } Component* Slider::getCurrentPopupDisplay() const noexcept { return pimpl->popupDisplay.get(); }


+ 2
- 1
modules/juce_gui_basics/widgets/juce_Slider.h View File

@@ -629,7 +629,8 @@ public:
*/ */
void setPopupDisplayEnabled (bool shouldShowOnMouseDrag, void setPopupDisplayEnabled (bool shouldShowOnMouseDrag,
bool shouldShowOnMouseHover, bool shouldShowOnMouseHover,
Component* parentComponentToUse);
Component* parentComponentToUse,
int hoverTimeout = 2000);
/** If a popup display is enabled and is currently visible, this returns the component /** If a popup display is enabled and is currently visible, this returns the component
that is being shown, or nullptr if none is currently in use. that is being shown, or nullptr if none is currently in use.


Loading…
Cancel
Save