Public Member Functions

MouseListener Class Reference

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

Inherited by Component.

List of all members.

Public Member Functions

virtual ~MouseListener ()
 Destructor.
virtual void mouseMove (const MouseEvent &e)
 Called when the mouse moves inside a component.
virtual void mouseEnter (const MouseEvent &e)
 Called when the mouse first enters a component.
virtual void mouseExit (const MouseEvent &e)
 Called when the mouse moves out of a component.
virtual void mouseDown (const MouseEvent &e)
 Called when a mouse button is pressed.
virtual void mouseDrag (const MouseEvent &e)
 Called when the mouse is moved while a button is held down.
virtual void mouseUp (const MouseEvent &e)
 Called when a mouse button is released.
virtual void mouseDoubleClick (const MouseEvent &e)
 Called when a mouse button has been double-clicked on a component.
virtual void mouseWheelMove (const MouseEvent &e, float wheelIncrementX, float wheelIncrementY)
 Called when the mouse-wheel is moved.

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

Constructor & Destructor Documentation

virtual MouseListener::~MouseListener (  ) [virtual]

Destructor.


Member Function Documentation

virtual void MouseListener::mouseMove ( const MouseEvent e ) [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:
edetails 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 ListBox, TableHeaderComponent, Component, ResizableBorderComponent, MenuBarComponent, and MidiKeyboardComponent.

virtual void MouseListener::mouseEnter ( const MouseEvent e ) [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:
edetails 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 Button, TableHeaderComponent, Component, ResizableBorderComponent, MenuBarComponent, and MidiKeyboardComponent.

virtual void MouseListener::mouseExit ( const MouseEvent e ) [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:
edetails 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 Button, ListBox, TableHeaderComponent, Component, MenuBarComponent, and MidiKeyboardComponent.

virtual void MouseListener::mouseDown ( const MouseEvent e ) [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:
edetails 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 Button, CodeEditorComponent, ComboBox, Slider, TableHeaderComponent, TextEditor, Toolbar, Component, ResizableBorderComponent, ResizableCornerComponent, ResizableEdgeComponent, ScrollBar, StretchableLayoutResizerBar, MenuBarComponent, MidiKeyboardComponent, AlertWindow, and ResizableWindow.

virtual void MouseListener::mouseDrag ( const MouseEvent e ) [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:
edetails 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 Button, CodeEditorComponent, ComboBox, Slider, TableHeaderComponent, TextEditor, Component, ResizableBorderComponent, ResizableCornerComponent, ResizableEdgeComponent, ScrollBar, StretchableLayoutResizerBar, MenuBarComponent, MidiKeyboardComponent, AlertWindow, and ResizableWindow.

virtual void MouseListener::mouseUp ( const MouseEvent e ) [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:
edetails 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 Button, CodeEditorComponent, ComboBox, Label, ListBox, Slider, TableHeaderComponent, TextEditor, Component, ResizableBorderComponent, ResizableCornerComponent, ResizableEdgeComponent, ScrollBar, MenuBarComponent, and MidiKeyboardComponent.

virtual void MouseListener::mouseDoubleClick ( const MouseEvent e ) [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:
edetails about the position and status of the mouse event, including the source component in which it occurred
See also:
mouseDown, mouseUp

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

virtual void MouseListener::mouseWheelMove ( const MouseEvent e,
float  wheelIncrementX,
float  wheelIncrementY 
) [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, the 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:
edetails about the position and status of the mouse event, including the source component in which it occurred
wheelIncrementXthe 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
wheelIncrementYthe speed and direction of the vertical scroll-wheel - a positive value means the wheel has been pushed upwards, negative means it was pushed downwards

Reimplemented in CodeEditorComponent, ListBox, Slider, TextEditor, Component, ScrollBar, Viewport, and MidiKeyboardComponent.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines