mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Changed the signature of MouseListener::mouseWheelMove() to take a struct MouseWheelDetails rather than raw floats. This will require updates in source code that uses mouse-wheel callbacks, but provides some new abilities, including a flag to indicate inverted wheel direction.
This commit is contained in:
parent
cb169b251d
commit
87175c91f5
32 changed files with 265 additions and 210 deletions
|
|
@ -71,17 +71,17 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void mouseWheelMove (const MouseEvent&, float wheelIncrementX, float wheelIncrementY)
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (thumbnail.getTotalLength() > 0)
|
||||
{
|
||||
double newStart = startTime - wheelIncrementX * (endTime - startTime) / 10.0;
|
||||
double newStart = startTime - wheel.deltaX * (endTime - startTime) / 10.0;
|
||||
newStart = jlimit (0.0, jmax (0.0, thumbnail.getTotalLength() - (endTime - startTime)), newStart);
|
||||
endTime = newStart + (endTime - startTime);
|
||||
startTime = newStart;
|
||||
|
||||
if (wheelIncrementY != 0)
|
||||
zoomSlider.setValue (zoomSlider.getValue() - wheelIncrementY);
|
||||
if (wheel.deltaY != 0)
|
||||
zoomSlider.setValue (zoomSlider.getValue() - wheel.deltaY);
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ void JucerDocument::getOptionalMethods (StringArray& baseClasses,
|
|||
addMethod ("Component", "void", "mouseDrag (const MouseEvent& e)", "", baseClasses, returnValues, methods, initialContents);
|
||||
addMethod ("Component", "void", "mouseUp (const MouseEvent& e)", "", baseClasses, returnValues, methods, initialContents);
|
||||
addMethod ("Component", "void", "mouseDoubleClick (const MouseEvent& e)", "", baseClasses, returnValues, methods, initialContents);
|
||||
addMethod ("Component", "void", "mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)", "", baseClasses, returnValues, methods, initialContents);
|
||||
addMethod ("Component", "void", "mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)", "", baseClasses, returnValues, methods, initialContents);
|
||||
|
||||
addMethod ("Component", "bool", "keyPressed (const KeyPress& key)", "return false; // Return true if your handler uses this key event, or false to allow it to be passed-on.", baseClasses, returnValues, methods, initialContents);
|
||||
addMethod ("Component", "bool", "keyStateChanged (const bool isKeyDown)", "return false; // Return true if your handler uses this key event, or false to allow it to be passed-on.", baseClasses, returnValues, methods, initialContents);
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ public:
|
|||
|
||||
~ZoomingViewport() {}
|
||||
|
||||
void mouseWheelMove (const MouseEvent& e, float ix, float iy)
|
||||
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (e.mods.isCtrlDown() || e.mods.isAltDown())
|
||||
if (e.mouseEvent.mods.isCtrlDown() || e.mouseEvent.mods.isAltDown())
|
||||
{
|
||||
const double factor = (iy > 0) ? 2.0 : 0.5;
|
||||
const double factor = (e.wheelDeltaY > 0) ? 2.0 : 0.5;
|
||||
|
||||
panel->setZoom (panel->getZoom() * factor, e.x, e.y);
|
||||
panel->setZoom (panel->getZoom() * factor, e.wheelDeltaX, e.wheelDeltaY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1719,9 +1719,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void mouseWheelMove (const MouseEvent& e,
|
||||
float incrementX,
|
||||
float incrementY)
|
||||
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (pluginWindow != 0)
|
||||
{
|
||||
|
|
@ -1736,7 +1734,7 @@ private:
|
|||
ev.xbutton.x_root = e.getScreenX();
|
||||
ev.xbutton.y_root = e.getScreenY();
|
||||
|
||||
translateJuceToXMouseWheelModifiers (e, incrementY, ev);
|
||||
translateJuceToXMouseWheelModifiers (e, wheel.deltaY, ev);
|
||||
sendEventToChild (&ev);
|
||||
|
||||
// TODO - put a usleep here ?
|
||||
|
|
|
|||
|
|
@ -785,10 +785,11 @@ void MidiKeyboardComponent::mouseExit (const MouseEvent& e)
|
|||
updateNoteUnderMouse (e, false);
|
||||
}
|
||||
|
||||
void MidiKeyboardComponent::mouseWheelMove (const MouseEvent&, float ix, float iy)
|
||||
void MidiKeyboardComponent::mouseWheelMove (const MouseEvent&, const MouseWheelDetails& wheel)
|
||||
{
|
||||
const float amount = (orientation == horizontalKeyboard && ix != 0)
|
||||
? ix : (orientation == verticalKeyboardFacingLeft ? iy : -iy);
|
||||
const float amount = (orientation == horizontalKeyboard && wheel.deltaX != 0)
|
||||
? wheel.deltaX : (orientation == verticalKeyboardFacingLeft ? wheel.deltaY
|
||||
: -wheel.deltaY);
|
||||
|
||||
setLowestVisibleKeyFloat (firstKey - amount * keyWidth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,33 +265,33 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
void paint (Graphics&);
|
||||
/** @internal */
|
||||
void resized();
|
||||
/** @internal */
|
||||
void mouseMove (const MouseEvent& e);
|
||||
void mouseMove (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseDrag (const MouseEvent& e);
|
||||
void mouseDrag (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseDown (const MouseEvent& e);
|
||||
void mouseDown (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseUp (const MouseEvent& e);
|
||||
void mouseUp (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseEnter (const MouseEvent& e);
|
||||
void mouseEnter (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseExit (const MouseEvent& e);
|
||||
void mouseExit (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
void timerCallback();
|
||||
/** @internal */
|
||||
bool keyStateChanged (bool isKeyDown);
|
||||
/** @internal */
|
||||
void focusLost (FocusChangeType cause);
|
||||
void focusLost (FocusChangeType);
|
||||
/** @internal */
|
||||
void handleNoteOn (MidiKeyboardState* source, int midiChannel, int midiNoteNumber, float velocity);
|
||||
void handleNoteOn (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity);
|
||||
/** @internal */
|
||||
void handleNoteOff (MidiKeyboardState* source, int midiChannel, int midiNoteNumber);
|
||||
void handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber);
|
||||
/** @internal */
|
||||
void colourChanged();
|
||||
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
static void sendWheelEvent (Component& comp, Component::BailOutChecker& checker, const MouseEvent& e,
|
||||
const float wheelIncrementX, const float wheelIncrementY)
|
||||
static void sendWheelEvent (Component& comp, Component::BailOutChecker& checker,
|
||||
const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
{
|
||||
MouseListenerList* const list = comp.mouseListeners;
|
||||
|
|
@ -124,7 +124,7 @@ public:
|
|||
{
|
||||
for (int i = list->listeners.size(); --i >= 0;)
|
||||
{
|
||||
list->listeners.getUnchecked(i)->mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
list->listeners.getUnchecked(i)->mouseWheelMove (e, wheel);
|
||||
|
||||
if (checker.shouldBailOut())
|
||||
return;
|
||||
|
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
for (int i = list->numDeepMouseListeners; --i >= 0;)
|
||||
{
|
||||
list->listeners.getUnchecked(i)->mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
list->listeners.getUnchecked(i)->mouseWheelMove (e, wheel);
|
||||
|
||||
if (checker2.shouldBailOut())
|
||||
return;
|
||||
|
|
@ -2176,12 +2176,11 @@ void Component::mouseDrag (const MouseEvent&) {}
|
|||
void Component::mouseMove (const MouseEvent&) {}
|
||||
void Component::mouseDoubleClick (const MouseEvent&) {}
|
||||
|
||||
void Component::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
void Component::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
// the base class just passes this event up to its parent..
|
||||
if (parentComponent != nullptr)
|
||||
parentComponent->mouseWheelMove (e.getEventRelativeTo (parentComponent),
|
||||
wheelIncrementX, wheelIncrementY);
|
||||
parentComponent->mouseWheelMove (e.getEventRelativeTo (parentComponent), wheel);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2485,33 +2484,30 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
|
|||
}
|
||||
|
||||
void Component::internalMouseWheel (MouseInputSource& source, const Point<int>& relativePos,
|
||||
const Time& time, const float amountX, const float amountY)
|
||||
const Time& time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
Desktop& desktop = Desktop::getInstance();
|
||||
BailOutChecker checker (this);
|
||||
|
||||
const float wheelIncrementX = amountX / 256.0f;
|
||||
const float wheelIncrementY = amountY / 256.0f;
|
||||
|
||||
const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
|
||||
this, this, time, relativePos, time, 0, false);
|
||||
|
||||
if (isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
// allow blocked mouse-events to go to global listeners..
|
||||
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheelIncrementX, wheelIncrementY);
|
||||
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheel);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseWheelMove (me, wheelIncrementX, wheelIncrementY);
|
||||
mouseWheelMove (me, wheel);
|
||||
|
||||
if (checker.shouldBailOut())
|
||||
return;
|
||||
|
||||
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheelIncrementX, wheelIncrementY);
|
||||
desktop.mouseListeners.callChecked (checker, &MouseListener::mouseWheelMove, me, wheel);
|
||||
|
||||
if (! checker.shouldBailOut())
|
||||
MouseListenerList::sendWheelEvent (*this, checker, me, wheelIncrementX, wheelIncrementY);
|
||||
MouseListenerList::sendWheelEvent (*this, checker, me, wheel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1464,19 +1464,20 @@ public:
|
|||
|
||||
|
||||
//==============================================================================
|
||||
/** Called when the mouse moves inside this component.
|
||||
/** Called when the mouse moves inside a component.
|
||||
|
||||
If the mouse button isn't pressed and the mouse moves over a component,
|
||||
this will be called to let the component react to this.
|
||||
|
||||
A component will always get a mouseEnter callback before a mouseMove.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseEnter, mouseExit, mouseDrag, contains
|
||||
*/
|
||||
virtual void mouseMove (const MouseEvent& e);
|
||||
virtual void mouseMove (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse first enters this component.
|
||||
/** Called when the mouse first enters a component.
|
||||
|
||||
If the mouse button isn't pressed and the mouse moves into a component,
|
||||
this will be called to let the component react to this.
|
||||
|
|
@ -1486,16 +1487,13 @@ public:
|
|||
mouseDrag messages are sent to the component that the mouse was originally
|
||||
clicked on, until the button is released.
|
||||
|
||||
If you're writing a component that needs to repaint itself when the mouse
|
||||
enters and exits, it might be quicker to use the setRepaintsOnMouseActivity()
|
||||
method.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseExit, mouseDrag, mouseMove, contains
|
||||
*/
|
||||
virtual void mouseEnter (const MouseEvent& e);
|
||||
virtual void mouseEnter (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse moves out of this component.
|
||||
/** Called when the mouse moves out of a component.
|
||||
|
||||
This will be called when the mouse moves off the edge of this
|
||||
component.
|
||||
|
|
@ -1504,16 +1502,13 @@ public:
|
|||
edge of the component and released, then this callback will happen
|
||||
when the button is released, after the mouseUp callback.
|
||||
|
||||
If you're writing a component that needs to repaint itself when the mouse
|
||||
enters and exits, it might be quicker to use the setRepaintsOnMouseActivity()
|
||||
method.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseEnter, mouseDrag, mouseMove, contains
|
||||
*/
|
||||
virtual void mouseExit (const MouseEvent& e);
|
||||
virtual void mouseExit (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button is pressed while it's over this component.
|
||||
/** Called when a mouse button is pressed.
|
||||
|
||||
The MouseEvent object passed in contains lots of methods for finding out
|
||||
which button was pressed, as well as which modifier keys (e.g. shift, ctrl)
|
||||
|
|
@ -1522,10 +1517,11 @@ public:
|
|||
Once a button is held down, the mouseDrag method will be called when the
|
||||
mouse moves, until the button is released.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseUp, mouseDrag, mouseDoubleClick, contains
|
||||
*/
|
||||
virtual void mouseDown (const MouseEvent& e);
|
||||
virtual void mouseDown (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse is moved while a button is held down.
|
||||
|
||||
|
|
@ -1533,14 +1529,11 @@ public:
|
|||
receives mouseDrag callbacks each time the mouse moves, even if the
|
||||
mouse strays outside the component's bounds.
|
||||
|
||||
If you want to be able to drag things off the edge of a component
|
||||
and have the component scroll when you get to the edges, the
|
||||
beginDragAutoRepeat() method might be useful.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@see mouseDown, mouseUp, mouseMove, contains, beginDragAutoRepeat
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseUp, mouseMove, contains, setDragRepeatInterval
|
||||
*/
|
||||
virtual void mouseDrag (const MouseEvent& e);
|
||||
virtual void mouseDrag (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button is released.
|
||||
|
||||
|
|
@ -1551,46 +1544,38 @@ public:
|
|||
The MouseEvent object passed in contains lots of methods for finding out
|
||||
which buttons were down just before they were released.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseDrag, mouseDoubleClick, contains
|
||||
*/
|
||||
virtual void mouseUp (const MouseEvent& e);
|
||||
virtual void mouseUp (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button has been double-clicked in this component.
|
||||
/** Called when a mouse button has been double-clicked on a component.
|
||||
|
||||
The MouseEvent object passed in contains lots of methods for finding out
|
||||
which button was pressed, as well as which modifier keys (e.g. shift, ctrl)
|
||||
were held down at the time.
|
||||
|
||||
For altering the time limit used to detect double-clicks,
|
||||
see MouseEvent::setDoubleClickTimeout.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@see mouseDown, mouseUp, MouseEvent::setDoubleClickTimeout,
|
||||
MouseEvent::getDoubleClickTimeout
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseUp
|
||||
*/
|
||||
virtual void mouseDoubleClick (const MouseEvent& e);
|
||||
virtual void mouseDoubleClick (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse-wheel is moved.
|
||||
|
||||
This callback is sent to the component that the mouse is over when the
|
||||
wheel is moved.
|
||||
|
||||
If not overridden, the component will forward this message to its parent, so
|
||||
If not overridden, a component will forward this message to its parent, so
|
||||
that parent components can collect mouse-wheel messages that happen to
|
||||
child components which aren't interested in them.
|
||||
|
||||
@param e details about the position and status of the mouse event
|
||||
@param wheelIncrementX the speed and direction of the horizontal scroll-wheel - a positive
|
||||
value means the wheel has been pushed to the right, negative means it
|
||||
was pushed to the left
|
||||
@param wheelIncrementY the speed and direction of the vertical scroll-wheel - a positive
|
||||
value means the wheel has been pushed upwards, negative means it
|
||||
was pushed downwards
|
||||
@param event details about the mouse event
|
||||
@param wheel details about the mouse wheel movement
|
||||
*/
|
||||
virtual void mouseWheelMove (const MouseEvent& e,
|
||||
float wheelIncrementX,
|
||||
float wheelIncrementY);
|
||||
virtual void mouseWheelMove (const MouseEvent& event,
|
||||
const MouseWheelDetails& wheel);
|
||||
|
||||
//==============================================================================
|
||||
/** Ensures that a non-stop stream of mouse-drag events will be sent during the
|
||||
|
|
@ -2318,7 +2303,7 @@ private:
|
|||
void internalMouseUp (MouseInputSource&, const Point<int>&, const Time&, const ModifierKeys& oldModifiers);
|
||||
void internalMouseDrag (MouseInputSource&, const Point<int>&, const Time&);
|
||||
void internalMouseMove (MouseInputSource&, const Point<int>&, const Time&);
|
||||
void internalMouseWheel (MouseInputSource&, const Point<int>&, const Time&, float amountX, float amountY);
|
||||
void internalMouseWheel (MouseInputSource&, const Point<int>&, const Time&, const MouseWheelDetails&);
|
||||
void internalBroughtToFront();
|
||||
void internalFocusGain (const FocusChangeType, const WeakReference<Component>&);
|
||||
void internalFocusGain (const FocusChangeType);
|
||||
|
|
|
|||
|
|
@ -380,11 +380,9 @@ void ScrollBar::mouseUp (const MouseEvent&)
|
|||
repaint();
|
||||
}
|
||||
|
||||
void ScrollBar::mouseWheelMove (const MouseEvent&,
|
||||
float wheelIncrementX,
|
||||
float wheelIncrementY)
|
||||
void ScrollBar::mouseWheelMove (const MouseEvent&, const MouseWheelDetails& wheel)
|
||||
{
|
||||
float increment = 10.0f * (vertical ? wheelIncrementY : wheelIncrementX);
|
||||
float increment = 10.0f * (vertical ? wheel.deltaY : wheel.deltaX);
|
||||
|
||||
if (increment < 0)
|
||||
increment = jmin (increment, -1.0f);
|
||||
|
|
|
|||
|
|
@ -289,21 +289,21 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
bool keyPressed (const KeyPress& key);
|
||||
bool keyPressed (const KeyPress&);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
void lookAndFeelChanged();
|
||||
/** @internal */
|
||||
void handleAsyncUpdate();
|
||||
/** @internal */
|
||||
void mouseDown (const MouseEvent& e);
|
||||
void mouseDown (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseDrag (const MouseEvent& e);
|
||||
void mouseDrag (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseUp (const MouseEvent& e);
|
||||
void mouseUp (const MouseEvent&);
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
void paint (Graphics&);
|
||||
/** @internal */
|
||||
void resized();
|
||||
|
||||
|
|
|
|||
|
|
@ -348,13 +348,13 @@ void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRange
|
|||
}
|
||||
}
|
||||
|
||||
void Viewport::mouseWheelMove (const MouseEvent& e, const float wheelIncrementX, const float wheelIncrementY)
|
||||
void Viewport::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (! useMouseWheelMoveIfNeeded (e, wheelIncrementX, wheelIncrementY))
|
||||
Component::mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
if (! useMouseWheelMoveIfNeeded (e, wheel))
|
||||
Component::mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (! (e.mods.isAltDown() || e.mods.isCtrlDown()))
|
||||
{
|
||||
|
|
@ -363,6 +363,9 @@ bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrem
|
|||
|
||||
if (hasHorzBar || hasVertBar)
|
||||
{
|
||||
float wheelIncrementX = wheel.deltaX;
|
||||
float wheelIncrementY = wheel.deltaY;
|
||||
|
||||
if (wheelIncrementX != 0)
|
||||
{
|
||||
wheelIncrementX *= 14.0f * singleStepX;
|
||||
|
|
|
|||
|
|
@ -256,13 +256,13 @@ public:
|
|||
/** @internal */
|
||||
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
bool keyPressed (const KeyPress& key);
|
||||
bool keyPressed (const KeyPress&);
|
||||
/** @internal */
|
||||
void componentMovedOrResized (Component& component, bool wasMoved, bool wasResized);
|
||||
void componentMovedOrResized (Component&, bool wasMoved, bool wasResized);
|
||||
/** @internal */
|
||||
bool useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
bool useMouseWheelMoveIfNeeded (const MouseEvent&, const MouseWheelDetails&);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -1617,7 +1617,7 @@ class SliderLabelComp : public Label
|
|||
public:
|
||||
SliderLabelComp() : Label (String::empty, String::empty) {}
|
||||
|
||||
void mouseWheelMove (const MouseEvent&, float, float) {}
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&) {}
|
||||
};
|
||||
|
||||
Label* LookAndFeel::createSliderTextBox (Slider& slider)
|
||||
|
|
|
|||
|
|
@ -371,9 +371,9 @@ public:
|
|||
void mouseDrag (const MouseEvent&) { timerCallback(); }
|
||||
void mouseUp (const MouseEvent&) { timerCallback(); }
|
||||
|
||||
void mouseWheelMove (const MouseEvent&, float /*amountX*/, float amountY)
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails& wheel)
|
||||
{
|
||||
alterChildYPos (roundToInt (-10.0f * amountY * PopupMenuSettings::scrollZone));
|
||||
alterChildYPos (roundToInt (-10.0f * wheel.deltaY * PopupMenuSettings::scrollZone));
|
||||
lastMousePos = Point<int> (-1, -1);
|
||||
}
|
||||
|
||||
|
|
@ -1471,7 +1471,7 @@ int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentM
|
|||
#if JUCE_MODAL_LOOPS_PERMITTED
|
||||
return (userCallback == nullptr && canBeModal) ? window->runModalLoop() : 0;
|
||||
#else
|
||||
jassert (userCallback != nullptr && canBeModal);
|
||||
jassert (! (userCallback == nullptr && canBeModal));
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1480,7 +1480,7 @@ int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentM
|
|||
#if JUCE_MODAL_LOOPS_PERMITTED
|
||||
int PopupMenu::showMenu (const Options& options)
|
||||
{
|
||||
return showWithOptionalCallback (options, 0, true);
|
||||
return showWithOptionalCallback (options, nullptr, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -319,4 +319,41 @@ private:
|
|||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Contains status information about a mouse wheel event.
|
||||
|
||||
@see MouseListener, MouseEvent
|
||||
*/
|
||||
struct MouseWheelDetails
|
||||
{
|
||||
//==============================================================================
|
||||
/** The amount that the wheel has been moved in the X axis.
|
||||
|
||||
If isReversed is true, then a negative deltaX means that the wheel has been
|
||||
pushed physically to the left.
|
||||
If isReversed is false, then a negative deltaX means that the wheel has been
|
||||
pushed physically to the right.
|
||||
*/
|
||||
float deltaX;
|
||||
|
||||
/** The amount that the wheel has been moved in the Y axis.
|
||||
|
||||
If isReversed is true, then a negative deltaY means that the wheel has been
|
||||
pushed physically upwards.
|
||||
If isReversed is false, then a negative deltaY means that the wheel has been
|
||||
pushed physically downwards.
|
||||
*/
|
||||
float deltaY;
|
||||
|
||||
/** Indicates whether the user has reversed the direction of the wheel.
|
||||
See deltaX and deltaY for an explanation of the effects of this value.
|
||||
*/
|
||||
bool isReversed;
|
||||
|
||||
/** If true, then the wheel has continuous, un-stepped motion. */
|
||||
bool isSmooth;
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_MOUSEEVENT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -120,10 +120,10 @@ public:
|
|||
comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, oldMods);
|
||||
}
|
||||
|
||||
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, float x, float y)
|
||||
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const Time& time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
|
||||
comp->internalMouseWheel (source, comp->getLocalPoint (nullptr, screenPos), time, x, y);
|
||||
comp->internalMouseWheel (source, comp->getLocalPoint (nullptr, screenPos), time, wheel);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -285,7 +285,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const Time& time, float x, float y)
|
||||
void handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer,
|
||||
const Time& time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
jassert (peer != nullptr);
|
||||
lastTime = time;
|
||||
|
|
@ -300,7 +301,7 @@ public:
|
|||
{
|
||||
Component* current = getComponentUnderMouse();
|
||||
if (current != nullptr)
|
||||
sendMouseWheel (current, screenPos, time, x, y);
|
||||
sendMouseWheel (current, screenPos, time, wheel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -522,12 +523,14 @@ void MouseInputSource::hideCursor() { pimpl-
|
|||
void MouseInputSource::revealCursor() { pimpl->revealCursor (false); }
|
||||
void MouseInputSource::forceMouseCursorUpdate() { pimpl->revealCursor (true); }
|
||||
|
||||
void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, const int64 time, const ModifierKeys& mods)
|
||||
void MouseInputSource::handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer,
|
||||
const int64 time, const ModifierKeys& mods)
|
||||
{
|
||||
pimpl->handleEvent (peer, positionWithinPeer, Time (time), mods.withOnlyMouseButtons());
|
||||
}
|
||||
|
||||
void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y)
|
||||
void MouseInputSource::handleWheel (ComponentPeer* const peer, const Point<int>& positionWithinPeer,
|
||||
const int64 time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
pimpl->handleWheel (peer, positionWithinPeer, Time (time), x, y);
|
||||
pimpl->handleWheel (peer, positionWithinPeer, Time (time), wheel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,9 +166,9 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void handleEvent (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys& mods);
|
||||
void handleEvent (ComponentPeer*, const Point<int>& positionWithinPeer, int64 time, const ModifierKeys&);
|
||||
/** @internal */
|
||||
void handleWheel (ComponentPeer* peer, const Point<int>& positionWithinPeer, int64 time, float x, float y);
|
||||
void handleWheel (ComponentPeer*, const Point<int>& positionWithinPeer, int64 time, const MouseWheelDetails&);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -30,4 +30,4 @@ void MouseListener::mouseUp (const MouseEvent&) {}
|
|||
void MouseListener::mouseDrag (const MouseEvent&) {}
|
||||
void MouseListener::mouseMove (const MouseEvent&) {}
|
||||
void MouseListener::mouseDoubleClick (const MouseEvent&) {}
|
||||
void MouseListener::mouseWheelMove (const MouseEvent&, float, float) {}
|
||||
void MouseListener::mouseWheelMove (const MouseEvent&, const MouseWheelDetails&) {}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#define __JUCE_MOUSELISTENER_JUCEHEADER__
|
||||
|
||||
class MouseEvent;
|
||||
struct MouseWheelDetails;
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
|
@ -48,11 +49,11 @@ public:
|
|||
|
||||
A component will always get a mouseEnter callback before a mouseMove.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseEnter, mouseExit, mouseDrag, contains
|
||||
*/
|
||||
virtual void mouseMove (const MouseEvent& e);
|
||||
virtual void mouseMove (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse first enters a component.
|
||||
|
||||
|
|
@ -64,11 +65,11 @@ public:
|
|||
mouseDrag messages are sent to the component that the mouse was originally
|
||||
clicked on, until the button is released.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseExit, mouseDrag, mouseMove, contains
|
||||
*/
|
||||
virtual void mouseEnter (const MouseEvent& e);
|
||||
virtual void mouseEnter (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse moves out of a component.
|
||||
|
||||
|
|
@ -79,11 +80,11 @@ public:
|
|||
edge of the component and released, then this callback will happen
|
||||
when the button is released, after the mouseUp callback.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseEnter, mouseDrag, mouseMove, contains
|
||||
*/
|
||||
virtual void mouseExit (const MouseEvent& e);
|
||||
virtual void mouseExit (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button is pressed.
|
||||
|
||||
|
|
@ -94,11 +95,11 @@ public:
|
|||
Once a button is held down, the mouseDrag method will be called when the
|
||||
mouse moves, until the button is released.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseUp, mouseDrag, mouseDoubleClick, contains
|
||||
*/
|
||||
virtual void mouseDown (const MouseEvent& e);
|
||||
virtual void mouseDown (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse is moved while a button is held down.
|
||||
|
||||
|
|
@ -106,11 +107,11 @@ public:
|
|||
receives mouseDrag callbacks each time the mouse moves, even if the
|
||||
mouse strays outside the component's bounds.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseUp, mouseMove, contains, setDragRepeatInterval
|
||||
*/
|
||||
virtual void mouseDrag (const MouseEvent& e);
|
||||
virtual void mouseDrag (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button is released.
|
||||
|
||||
|
|
@ -121,11 +122,11 @@ public:
|
|||
The MouseEvent object passed in contains lots of methods for finding out
|
||||
which buttons were down just before they were released.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseDrag, mouseDoubleClick, contains
|
||||
*/
|
||||
virtual void mouseUp (const MouseEvent& e);
|
||||
virtual void mouseUp (const MouseEvent& event);
|
||||
|
||||
/** Called when a mouse button has been double-clicked on a component.
|
||||
|
||||
|
|
@ -133,33 +134,34 @@ public:
|
|||
which button was pressed, as well as which modifier keys (e.g. shift, ctrl)
|
||||
were held down at the time.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param event details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@see mouseDown, mouseUp
|
||||
*/
|
||||
virtual void mouseDoubleClick (const MouseEvent& e);
|
||||
virtual void mouseDoubleClick (const MouseEvent& event);
|
||||
|
||||
/** Called when the mouse-wheel is moved.
|
||||
|
||||
This callback is sent to the component that the mouse is over when the
|
||||
wheel is moved.
|
||||
|
||||
If not overridden, the component will forward this message to its parent, so
|
||||
If not overridden, a component will forward this message to its parent, so
|
||||
that parent components can collect mouse-wheel messages that happen to
|
||||
child components which aren't interested in them.
|
||||
|
||||
@param e details about the position and status of the mouse event, including
|
||||
the source component in which it occurred
|
||||
@param wheelIncrementX the speed and direction of the horizontal scroll-wheel - a positive
|
||||
value means the wheel has been pushed to the right, negative means it
|
||||
was pushed to the left
|
||||
@param wheelIncrementY the speed and direction of the vertical scroll-wheel - a positive
|
||||
value means the wheel has been pushed upwards, negative means it
|
||||
was pushed downwards
|
||||
@param event details about the mouse event
|
||||
@param wheel details about the wheel movement
|
||||
*/
|
||||
virtual void mouseWheelMove (const MouseEvent& e,
|
||||
float wheelIncrementX,
|
||||
float wheelIncrementY);
|
||||
virtual void mouseWheelMove (const MouseEvent& event,
|
||||
const MouseWheelDetails& wheel);
|
||||
|
||||
|
||||
private:
|
||||
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE
|
||||
// This is just here to cause a compile error in old code that hasn't been
|
||||
// updated to use the new version of this method.
|
||||
virtual int mouseWheelMove (const MouseEvent&, float, float) { return 0; }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1403,8 +1403,14 @@ public:
|
|||
|
||||
void handleWheelEvent (const XButtonPressedEvent* const buttonPressEvent, const float amount)
|
||||
{
|
||||
MouseWheelDetails wheel;
|
||||
wheel.deltaX = 0.0f;
|
||||
wheel.deltaY = amount;
|
||||
wheel.isReversed = false;
|
||||
wheel.isSmooth = false;
|
||||
|
||||
handleMouseWheel (0, Point<int> (buttonPressEvent->x, buttonPressEvent->y),
|
||||
getEventTime (buttonPressEvent->time), 0, amount);
|
||||
getEventTime (buttonPressEvent->time), wheel);
|
||||
}
|
||||
|
||||
void handleButtonPressEvent (const XButtonPressedEvent* const buttonPressEvent, int buttonModifierFlag)
|
||||
|
|
@ -1421,8 +1427,8 @@ public:
|
|||
|
||||
switch (pointerMap [buttonPressEvent->button - Button1])
|
||||
{
|
||||
case Keys::WheelUp: handleWheelEvent (buttonPressEvent, 84.0f); break;
|
||||
case Keys::WheelDown: handleWheelEvent (buttonPressEvent, -84.0f); break;
|
||||
case Keys::WheelUp: handleWheelEvent (buttonPressEvent, 50.0f / 256.0f); break;
|
||||
case Keys::WheelDown: handleWheelEvent (buttonPressEvent, -50.0f / 256.0f); break;
|
||||
case Keys::LeftButton: handleButtonPressEvent (buttonPressEvent, ModifierKeys::leftButtonModifier); break;
|
||||
case Keys::RightButton: handleButtonPressEvent (buttonPressEvent, ModifierKeys::rightButtonModifier); break;
|
||||
case Keys::MiddleButton: handleButtonPressEvent (buttonPressEvent, ModifierKeys::middleButtonModifier); break;
|
||||
|
|
@ -2509,12 +2515,12 @@ private:
|
|||
void initialisePointerMap()
|
||||
{
|
||||
const int numButtons = XGetPointerMapping (display, 0, 0);
|
||||
pointerMap[2] = pointerMap[3] = pointerMap[4] = Keys::NoButton;
|
||||
|
||||
if (numButtons == 2)
|
||||
{
|
||||
pointerMap[0] = Keys::LeftButton;
|
||||
pointerMap[1] = Keys::RightButton;
|
||||
pointerMap[2] = pointerMap[3] = pointerMap[4] = Keys::NoButton;
|
||||
}
|
||||
else if (numButtons >= 3)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
|
|||
- (CGFloat) scrollingDeltaX;
|
||||
- (CGFloat) scrollingDeltaX;
|
||||
- (BOOL) hasPreciseScrollingDeltas;
|
||||
- (BOOL) isDirectionInvertedFromDevice;
|
||||
#endif
|
||||
@end
|
||||
|
||||
|
|
@ -1580,36 +1581,47 @@ void NSViewComponentPeer::redirectMouseWheel (NSEvent* ev)
|
|||
{
|
||||
updateModifiers (ev);
|
||||
|
||||
float x = 0, y = 0;
|
||||
MouseWheelDetails wheel;
|
||||
wheel.deltaX = 0;
|
||||
wheel.deltaY = 0;
|
||||
wheel.isReversed = false;
|
||||
wheel.isSmooth = false;
|
||||
|
||||
@try
|
||||
{
|
||||
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if ([ev respondsToSelector: @selector (isDirectionInvertedFromDevice)])
|
||||
wheel.isReversed = [ev isDirectionInvertedFromDevice];
|
||||
|
||||
const float scale = 0.5f / 256.0f;
|
||||
|
||||
if ([ev respondsToSelector: @selector (hasPreciseScrollingDeltas)])
|
||||
{
|
||||
if ([ev hasPreciseScrollingDeltas])
|
||||
{
|
||||
x = [ev scrollingDeltaX] * 0.5f;
|
||||
y = [ev scrollingDeltaY] * 0.5f;
|
||||
wheel.deltaX = [ev scrollingDeltaX] * scale;
|
||||
wheel.deltaY = [ev scrollingDeltaY] * scale;
|
||||
wheel.isSmooth = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
x = [ev deviceDeltaX] * 0.5f;
|
||||
y = [ev deviceDeltaY] * 0.5f;
|
||||
wheel.deltaX = [ev deviceDeltaX] * scale;
|
||||
wheel.deltaY = [ev deviceDeltaY] * scale;
|
||||
}
|
||||
}
|
||||
@catch (...)
|
||||
{}
|
||||
|
||||
if (x == 0 && y == 0)
|
||||
if (wheel.deltaX == 0 && wheel.deltaY == 0)
|
||||
{
|
||||
x = [ev deltaX] * 10.0f;
|
||||
y = [ev deltaY] * 10.0f;
|
||||
const float scale = 10.0f / 256.0f;
|
||||
wheel.deltaX = [ev deltaX] * scale;
|
||||
wheel.deltaY = [ev deltaY] * scale;
|
||||
}
|
||||
|
||||
handleMouseWheel (0, getMousePos (ev, view), getMouseTime (ev), x, y);
|
||||
handleMouseWheel (0, getMousePos (ev, view), getMouseTime (ev), wheel);
|
||||
}
|
||||
|
||||
void NSViewComponentPeer::showArrowCursorIfNeeded()
|
||||
|
|
|
|||
|
|
@ -1693,7 +1693,7 @@ private:
|
|||
void doMouseWheel (const Point<int>& globalPos, const WPARAM wParam, const bool isVertical)
|
||||
{
|
||||
updateKeyModifiers();
|
||||
const float amount = jlimit (-1000.0f, 1000.0f, 0.75f * (short) HIWORD (wParam));
|
||||
const float amount = jlimit (-1000.0f, 1000.0f, 0.5f * (short) HIWORD (wParam));
|
||||
|
||||
// Because Windows stupidly sends all wheel events to the window with the keyboard
|
||||
// focus, we have to redirect them here according to the mouse pos..
|
||||
|
|
@ -1703,9 +1703,13 @@ private:
|
|||
if (peer == nullptr)
|
||||
peer = this;
|
||||
|
||||
peer->handleMouseWheel (0, peer->globalToLocal (globalPos), getMouseEventTime(),
|
||||
isVertical ? 0.0f : -amount,
|
||||
isVertical ? amount : 0.0f);
|
||||
MouseWheelDetails wheel;
|
||||
wheel.deltaX = isVertical ? 0.0f : amount / -256.0f;
|
||||
wheel.deltaY = isVertical ? amount / 256.0f : 0.0f;
|
||||
wheel.isReversed = false;
|
||||
wheel.isSmooth = false;
|
||||
|
||||
peer->handleMouseWheel (0, peer->globalToLocal (globalPos), getMouseEventTime(), wheel);
|
||||
}
|
||||
|
||||
void doTouchEvent (const int numInputs, HTOUCHINPUT eventHandle)
|
||||
|
|
|
|||
|
|
@ -755,24 +755,24 @@ bool ListBox::keyStateChanged (const bool isKeyDown)
|
|||
|| KeyPress::isKeyCurrentlyDown (KeyPress::returnKey));
|
||||
}
|
||||
|
||||
void ListBox::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
void ListBox::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
bool eventWasUsed = false;
|
||||
|
||||
if (viewport->getHorizontalScrollBar()->isVisible() && wheelIncrementX != 0)
|
||||
if (viewport->getHorizontalScrollBar()->isVisible() && wheel.deltaX != 0)
|
||||
{
|
||||
eventWasUsed = true;
|
||||
viewport->getHorizontalScrollBar()->mouseWheelMove (e, wheelIncrementX, 0);
|
||||
viewport->getHorizontalScrollBar()->mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
if (viewport->getVerticalScrollBar()->isVisible() && wheelIncrementY != 0)
|
||||
if (viewport->getVerticalScrollBar()->isVisible() && wheel.deltaY != 0)
|
||||
{
|
||||
eventWasUsed = true;
|
||||
viewport->getVerticalScrollBar()->mouseWheelMove (e, 0, wheelIncrementY);
|
||||
viewport->getVerticalScrollBar()->mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
if (! eventWasUsed)
|
||||
Component::mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
Component::mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
void ListBox::mouseMove (const MouseEvent& e)
|
||||
|
|
|
|||
|
|
@ -547,7 +547,7 @@ public:
|
|||
/** @internal */
|
||||
void visibilityChanged();
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent&, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
void mouseMove (const MouseEvent&);
|
||||
/** @internal */
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
bool mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (scrollWheelEnabled
|
||||
&& style != TwoValueHorizontal
|
||||
|
|
@ -954,7 +954,8 @@ public:
|
|||
valueBox->hideEditor (false);
|
||||
|
||||
const double value = (double) currentValue.getValue();
|
||||
const double proportionDelta = (wheelIncrementX != 0 ? -wheelIncrementX : wheelIncrementY) * 0.15f;
|
||||
const double proportionDelta = (wheel.deltaX != 0 ? -wheel.deltaX : wheel.deltaY)
|
||||
* (wheel.isReversed ? -0.15f : 0.15f);
|
||||
const double currentPos = owner.valueToProportionOfLength (value);
|
||||
const double newValue = owner.proportionOfLengthToValue (jlimit (0.0, 1.0, currentPos + proportionDelta));
|
||||
|
||||
|
|
@ -1557,10 +1558,10 @@ void Slider::mouseDoubleClick (const MouseEvent&)
|
|||
pimpl->mouseDoubleClick();
|
||||
}
|
||||
|
||||
void Slider::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
void Slider::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (! (isEnabled() && pimpl->mouseWheelMove (e, wheelIncrementX, wheelIncrementY)))
|
||||
Component::mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
if (! (isEnabled() && pimpl->mouseWheelMove (e, wheel)))
|
||||
Component::mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
void SliderListener::sliderDragStarted (Slider*) {} // (can't write Slider::Listener due to idiotic VC2005 bug)
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ protected:
|
|||
/** @internal */
|
||||
void mouseDoubleClick (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent&, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
void modifierKeysChanged (const ModifierKeys&);
|
||||
/** @internal */
|
||||
|
|
|
|||
|
|
@ -1875,10 +1875,10 @@ void TextEditor::mouseDoubleClick (const MouseEvent& e)
|
|||
moveCaretTo (tokenStart, true);
|
||||
}
|
||||
|
||||
void TextEditor::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
void TextEditor::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if (! viewport->useMouseWheelMoveIfNeeded (e, wheelIncrementX, wheelIncrementY))
|
||||
Component::mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
if (! viewport->useMouseWheelMoveIfNeeded (e, wheel))
|
||||
Component::mouseWheelMove (e, wheel);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ public:
|
|||
/** @internal */
|
||||
void mouseDoubleClick (const MouseEvent& e);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
bool keyPressed (const KeyPress& key);
|
||||
/** @internal */
|
||||
|
|
|
|||
|
|
@ -92,12 +92,12 @@ void ComponentPeer::handleMouseEvent (const int touchIndex, const Point<int>& po
|
|||
mouse->handleEvent (this, positionWithinPeer, time, newMods);
|
||||
}
|
||||
|
||||
void ComponentPeer::handleMouseWheel (const int touchIndex, const Point<int>& positionWithinPeer, const int64 time, const float x, const float y)
|
||||
void ComponentPeer::handleMouseWheel (const int touchIndex, const Point<int>& positionWithinPeer, const int64 time, const MouseWheelDetails& wheel)
|
||||
{
|
||||
MouseInputSource* const mouse = Desktop::getInstance().getMouseSource (touchIndex);
|
||||
jassert (mouse != nullptr); // not enough sources!
|
||||
|
||||
mouse->handleWheel (this, positionWithinPeer, time, x, y);
|
||||
mouse->handleWheel (this, positionWithinPeer, time, wheel);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
void handleMouseEvent (int touchIndex, const Point<int>& positionWithinPeer, const ModifierKeys& newMods, int64 time);
|
||||
void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, float x, float y);
|
||||
void handleMouseWheel (int touchIndex, const Point<int>& positionWithinPeer, int64 time, const MouseWheelDetails&);
|
||||
|
||||
void handleUserClosingWindow();
|
||||
|
||||
|
|
|
|||
|
|
@ -986,17 +986,26 @@ void CodeEditorComponent::mouseDoubleClick (const MouseEvent& e)
|
|||
moveCaretTo (tokenStart, true);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
|
||||
void CodeEditorComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
|
||||
{
|
||||
if ((verticalScrollBar.isVisible() && wheelIncrementY != 0)
|
||||
|| (horizontalScrollBar.isVisible() && wheelIncrementX != 0))
|
||||
if ((verticalScrollBar.isVisible() && wheel.deltaY != 0)
|
||||
|| (horizontalScrollBar.isVisible() && wheel.deltaX != 0))
|
||||
{
|
||||
verticalScrollBar.mouseWheelMove (e, 0, wheelIncrementY);
|
||||
horizontalScrollBar.mouseWheelMove (e, wheelIncrementX, 0);
|
||||
{
|
||||
MouseWheelDetails w (wheel);
|
||||
w.deltaX = 0;
|
||||
verticalScrollBar.mouseWheelMove (e, w);
|
||||
}
|
||||
|
||||
{
|
||||
MouseWheelDetails w (wheel);
|
||||
w.deltaY = 0;
|
||||
horizontalScrollBar.mouseWheelMove (e, w);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Component::mouseWheelMove (e, wheelIncrementX, wheelIncrementY);
|
||||
Component::mouseWheelMove (e, wheel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,27 +221,27 @@ public:
|
|||
/** @internal */
|
||||
void resized();
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
void paint (Graphics&);
|
||||
/** @internal */
|
||||
bool keyPressed (const KeyPress& key);
|
||||
bool keyPressed (const KeyPress&);
|
||||
/** @internal */
|
||||
void mouseDown (const MouseEvent& e);
|
||||
void mouseDown (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseDrag (const MouseEvent& e);
|
||||
void mouseDrag (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseUp (const MouseEvent& e);
|
||||
void mouseUp (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseDoubleClick (const MouseEvent& e);
|
||||
void mouseDoubleClick (const MouseEvent&);
|
||||
/** @internal */
|
||||
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
|
||||
void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&);
|
||||
/** @internal */
|
||||
void focusGained (FocusChangeType cause);
|
||||
void focusGained (FocusChangeType);
|
||||
/** @internal */
|
||||
void focusLost (FocusChangeType cause);
|
||||
void focusLost (FocusChangeType);
|
||||
/** @internal */
|
||||
void timerCallback();
|
||||
/** @internal */
|
||||
void scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart);
|
||||
void scrollBarMoved (ScrollBar*, double newRangeStart);
|
||||
/** @internal */
|
||||
void handleAsyncUpdate();
|
||||
/** @internal */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue