Loading...
Searching...
No Matches
juce::MouseListener Class Reference

## Detailed Description

A MouseListener can be registered with a component to receive callbacks about mouse events that happen to that component.

See also
  Component::addMouseListener, Component::removeMouseListener

The documentation for this class was generated from the following file:

- juce_gui_basics/mouse/juce_MouseListener.h

Inheritance diagram for juce::MouseListener:

## Public Member Functions

virtual | ~MouseListener ()=default
| Destructor.
virtual void | mouseMove (const MouseEvent &event)
| Called when the mouse moves inside a component.
virtual void | mouseEnter (const MouseEvent &event)
| Called when the mouse first enters a component.
virtual void | mouseExit (const MouseEvent &event)
| Called when the mouse moves out of a component.
virtual void | mouseDown (const MouseEvent &event)
| Called when a mouse button is pressed.
virtual void | mouseDrag (const MouseEvent &event)
| Called when the mouse is moved while a button is held down.
virtual void | mouseUp (const MouseEvent &event)
| Called when a mouse button is released.
virtual void | mouseDoubleClick (const MouseEvent &event)
| Called when a mouse button has been double-clicked on a component.
virtual void | mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel)
| Called when the mouse-wheel is moved.
virtual void | mouseMagnify (const MouseEvent &event, float scaleFactor)
| Called when a pinch-to-zoom mouse-gesture is used.

## Constructors and Destructors

## ~MouseListener()

virtual juce::MouseListener::~MouseListener | ( |  | ) |

virtual default

Destructor.

## Member Functions

## mouseMove()

virtual void juce::MouseListener::mouseMove | ( | const MouseEvent & | event | ) |

virtual

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.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseEnter, mouseExit, mouseDrag, contains

Reimplemented in juce::Component, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::ResizableBorderComponent, juce::Slider, and juce::TableHeaderComponent.

## mouseEnter()

virtual void juce::MouseListener::mouseEnter | ( | const MouseEvent & | event | ) |

virtual

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.

When the mouse button is pressed and held down while being moved in or out of a component, no mouseEnter or mouseExit callbacks are made - only mouseDrag messages are sent to the component that the mouse was originally clicked on, until the button is released.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseExit, mouseDrag, mouseMove, contains

Reimplemented in juce::Button, juce::Component, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::ResizableBorderComponent, juce::Slider, and juce::TableHeaderComponent.

## mouseExit()

virtual void juce::MouseListener::mouseExit | ( | const MouseEvent & | event | ) |

virtual

Called when the mouse moves out of a component.

This will be called when the mouse moves off the edge of this component.

If the mouse button was pressed, and it was then dragged off the edge of the component and released, then this callback will happen when the button is released, after the mouseUp callback.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseEnter, mouseDrag, mouseMove, contains

Reimplemented in juce::Button, juce::Component, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::Slider, and juce::TableHeaderComponent.

## mouseDown()

virtual void juce::MouseListener::mouseDown | ( | const MouseEvent & | event | ) |

virtual

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) were held down at the time.

Once a button is held down, the mouseDrag method will be called when the mouse moves, until the button is released.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseUp, mouseDrag, mouseDoubleClick, contains

Reimplemented in juce::AlertWindow, juce::Button, juce::CodeEditorComponent, juce::ComboBox, juce::Component, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::MPEKeyboardComponent, juce::ResizableBorderComponent, juce::ResizableCornerComponent, juce::ResizableEdgeComponent, juce::ResizableWindow, juce::ScrollBar, juce::Slider, juce::StretchableLayoutResizerBar, juce::TableHeaderComponent, juce::TextEditor, juce::Toolbar, and juce::Viewport.

## mouseDrag()

virtual void juce::MouseListener::mouseDrag | ( | const MouseEvent & | event | ) |

virtual

Called when the mouse is moved while a button is held down.

When a mouse button is pressed inside a component, that component receives mouseDrag callbacks each time the mouse moves, even if the mouse strays outside the component's bounds.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseDown, mouseUp, mouseMove, contains, setDragRepeatInterval

Reimplemented in juce::AlertWindow, juce::Button, juce::CodeEditorComponent, juce::ComboBox, juce::Component, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::MPEKeyboardComponent, juce::ResizableBorderComponent, juce::ResizableCornerComponent, juce::ResizableEdgeComponent, juce::ResizableWindow, juce::ScrollBar, juce::SidePanel, juce::Slider, juce::StretchableLayoutResizerBar, juce::TableHeaderComponent, and juce::TextEditor.

## mouseUp()

virtual void juce::MouseListener::mouseUp | ( | const MouseEvent & | event | ) |

virtual

Called when a mouse button is released.

A mouseUp callback is sent to the component in which a button was pressed even if the mouse is actually over a different component when the button is released.

The MouseEvent object passed in contains lots of methods for finding out which buttons were down just before they were released.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseDown, mouseDrag, mouseDoubleClick, contains

Reimplemented in juce::Button, juce::CodeEditorComponent, juce::ComboBox, juce::Component, juce::Label, juce::ListBox, juce::MenuBarComponent, juce::MidiKeyboardComponent, juce::MPEKeyboardComponent, juce::ResizableBorderComponent, juce::ResizableCornerComponent, juce::ResizableEdgeComponent, juce::ResizableWindow, juce::ScrollBar, juce::SidePanel, juce::Slider, juce::TableHeaderComponent, and juce::TextEditor.

## mouseDoubleClick()

virtual void juce::MouseListener::mouseDoubleClick | ( | const MouseEvent & | event | ) |

virtual

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.

Parameters

  event | details about the position and status of the mouse event, including the source component in which it occurred

See also
  mouseDown, mouseUp

Reimplemented in juce::CodeEditorComponent, juce::Component, juce::Label, juce::Slider, and juce::TextEditor.

## mouseWheelMove()

virtual void juce::MouseListener::mouseWheelMove | ( | const MouseEvent & | event,
|  | const MouseWheelDetails & | wheel )

virtual

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, 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.

Parameters

  event | details about the mouse event
  wheel | details about the wheel movement

Reimplemented in juce::CodeEditorComponent, juce::ComboBox, juce::Component, juce::KeyboardComponentBase, juce::ListBox, juce::ScrollBar, juce::Slider, juce::TextEditor, and juce::Viewport.

## mouseMagnify()

virtual void juce::MouseListener::mouseMagnify | ( | const MouseEvent & | event,
|  | float | scaleFactor )

virtual

Called when a pinch-to-zoom mouse-gesture is used.

If not overridden, a component will forward this message to its parent, so that parent components can collect gesture messages that are unused by child components.

Parameters

  event | details about the mouse event
  scaleFactor | a multiplier to indicate by how much the size of the target should be changed. A value of 1.0 would indicate no change, values greater than 1.0 mean it should be enlarged.

Reimplemented in juce::Component.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited