OSDL::Events::Mouse Class Reference

#include <OSDLMouse.h>

Inheritance diagram for OSDL::Events::Mouse:

[legend]
Collaboration diagram for OSDL::Events::Mouse:
[legend]
List of all members.

Detailed Description

Models a basic mouse, including relevant buttons and wheels.

All events for this mouse are propagated to the associated controller, if any, which allows to finely master all available informations, at the expense of a higher complexity on the controller part.

For usual needs, Mouse instances should be set in classical mode : it would be more convenient, since it is a higher-level (but a little less general-purpose) model.

Definition at line 54 of file OSDLMouse.h.

Public Member Functions

 Mouse (MouseNumber index, bool classicalMouseMode=true) throw ()
 Constructs a new mouse instance.
virtual ~Mouse () throw ()
 Virtual destructor, closing corresponding mouse device.
virtual Video::Coordinate getCursorAbscissa () const throw ()
 Returns the absolute abscissa of this mouse cursor.
virtual Video::Coordinate getCursorOrdinate () const throw ()
 Returns the absolute ordinate of this mouse cursor.
virtual void setCursorPosition (const Video::TwoDimensional::Point2D &newPosition) const throw ()
 Sets the cursor position for this mouse.
virtual void setCursorPosition (Video::Coordinate x, Video::Coordinate y) const throw ()
 Sets the cursor position for this mouse.
virtual MouseButtonNumber getNumberOfButtons () const throw ()
 Returns the number of actual mouse buttons, wheels not included.
virtual MouseWheelNumber getNumberOfWheels () const throw ()
 Returns the number of mouse wheels.
virtual bool isLeftButtonPressed () const throw ()
 Tells whether the left button of this mouse is currently pressed.
virtual bool isMiddleButtonPressed () const throw ()
 Tells whether the middle button of this mouse is currently pressed.
virtual bool isRightButtonPressed () const throw ()
 Tells whether the right button of this mouse is currently pressed.
virtual bool isButtonPressed (MouseButtonNumber buttonNumber) const throw ( MouseException )
 Tells whether specified mouse button is pressed.
virtual MouseButtonMask getButtonStates () const throw ()
 Returns the state of all the buttons of this mouse.
virtual void update () throw ()
 Updates the description of this mouse, for relative movements of the cursor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw ()
 Returns an user-friendly description of the state of this object.
virtual OSDL::MVC::ControllergetActualController () const throw ( EventsException )
 Returns the actual (OSDL) controller this input device should be linked to.

Static Public Member Functions

static bool IsPressed (MouseButtonMask mask, MouseButtonNumber buttonToInspect) throw ()
 Reads specified button mask, and tells whether specified mouse button is currently pressed.

Static Public Attributes

static const MouseButtonNumber DefaultButtonTotalNumber
 By default, a mouse is supposed to have 5 buttons : left, middle, right, wheel up and down.
static const MouseButtonNumber DefaultButtonActualNumber
 By default, a mouse is supposed to have 3 actual buttons : left, middle, right.
static const MouseWheelNumber DefaultWheelNumber
 By default, a mouse is supposed to have 1 wheel.

Protected Member Functions

virtual MouseNumber getIndex () const throw ()
 Returns the index of this mouse in the platform list.
virtual void focusGained (const FocusEvent &mouseFocusEvent) throw ()
 Called whenever this mouse gained focus, and notifies the linked controller, if any.
virtual void focusLost (const FocusEvent &mouseFocusEvent) throw ()
 Called whenever this mouse lost focus, and notifies the linked controller, if any.
virtual void mouseMoved (const MouseMotionEvent &mouseEvent) throw ()
 Called whenever this mouse moved, and notifies the linked controller, if any.
virtual void buttonPressed (const MouseButtonEvent &mouseEvent) throw ()
 Called whenever a button of this mouse was pressed, and notifies the linked controller, if any.
virtual void buttonReleased (const MouseButtonEvent &mouseEvent) throw ()
 Called whenever a button of this mouse was released, and notifies the linked controller, if any.

Protected Attributes

MouseNumber _index
 The number of this mouse in platform list.
bool _inClassicalMode
 Tells whether this mouse should be in classical mode.
MouseButtonNumber _buttonTotalCount
 The number of total buttons for this mouse.
Video::Coordinate _lastRelativeAbscissa
 Records the last relative abscissa.
Video::Coordinate _lastRelativeOrdinate
 Records the last relative ordinate.

Private Member Functions

 Mouse (const Mouse &source) throw ()
 Copy constructor made private to ensure that it will never be called.
Mouseoperator= (const Mouse &source) throw ()
 Assignment operator made private to ensure that it will never be called.

Friends

class OSDL::Events::MouseHandler


Constructor & Destructor Documentation

Mouse::Mouse ( MouseNumber  index,
bool  classicalMouseMode = true 
) throw () [explicit]

Constructs a new mouse instance.

Parameters:
index the index of this mouse in platform list.
classicalMouseMode tells whether this mouse should be in classical mode (higher level), or in normal mode (low-level events only are propagated to controllers).

Definition at line 54 of file OSDLMouse.cc.

Mouse::~Mouse (  )  throw () [virtual]

Virtual destructor, closing corresponding mouse device.

Definition at line 66 of file OSDLMouse.cc.

OSDL::Events::Mouse::Mouse ( const Mouse source  )  throw () [explicit, private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

Video::Coordinate Mouse::getCursorAbscissa (  )  const throw () [virtual]

Returns the absolute abscissa of this mouse cursor.

Definition at line 76 of file OSDLMouse.cc.

Video::Coordinate Mouse::getCursorOrdinate (  )  const throw () [virtual]

Returns the absolute ordinate of this mouse cursor.

Definition at line 88 of file OSDLMouse.cc.

void Mouse::setCursorPosition ( const Video::TwoDimensional::Point2D newPosition  )  const throw () [virtual]

Sets the cursor position for this mouse.

Parameters:
newPosition the new cursor position.
Note:
Generation a mouse moved event.

Definition at line 100 of file OSDLMouse.cc.

void Mouse::setCursorPosition ( Video::Coordinate  x,
Video::Coordinate  y 
) const throw () [virtual]

Sets the cursor position for this mouse.

Parameters:
x the new cursor abscissa.
y the new cursor ordinate.
Note:
Generation a mouse moved event.

Definition at line 108 of file OSDLMouse.cc.

MouseButtonNumber Mouse::getNumberOfButtons (  )  const throw () [virtual]

Returns the number of actual mouse buttons, wheels not included.

Definition at line 118 of file OSDLMouse.cc.

References DefaultButtonActualNumber.

MouseWheelNumber Mouse::getNumberOfWheels (  )  const throw () [virtual]

Returns the number of mouse wheels.

Note:
Information not available yet, returns always one.

Definition at line 126 of file OSDLMouse.cc.

References DefaultWheelNumber.

bool Mouse::isLeftButtonPressed (  )  const throw () [virtual]

Tells whether the left button of this mouse is currently pressed.

Returns:
true iff this button is pressed.

Definition at line 136 of file OSDLMouse.cc.

bool Mouse::isMiddleButtonPressed (  )  const throw () [virtual]

Tells whether the middle button of this mouse is currently pressed.

Returns:
true iff this button is pressed.

Definition at line 146 of file OSDLMouse.cc.

bool Mouse::isRightButtonPressed (  )  const throw () [virtual]

Tells whether the right button of this mouse is currently pressed.

Returns:
true iff this button is pressed.

Definition at line 156 of file OSDLMouse.cc.

bool Mouse::isButtonPressed ( MouseButtonNumber  buttonNumber  )  const throw ( MouseException ) [virtual]

Tells whether specified mouse button is pressed.

Parameters:
buttonNumber the number of the button for this mouse, for example 'LeftButton'.
Returns:
true iff the button is currently pressed.
Exceptions:
MouseException if the mouse is not already open or if the button number is out of bounds.

Definition at line 166 of file OSDLMouse.cc.

MouseButtonMask Mouse::getButtonStates (  )  const throw () [virtual]

Returns the state of all the buttons of this mouse.

This includes the wheels.

Returns:
a button mask, each bit of which tells whether the associated button is pressed.
See also:
IsPressed to interpret the button mask.

Definition at line 177 of file OSDLMouse.cc.

void Mouse::update (  )  throw () [virtual]

Updates the description of this mouse, for relative movements of the cursor.

Definition at line 186 of file OSDLMouse.cc.

References _lastRelativeAbscissa, and _lastRelativeOrdinate.

const string Mouse::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const throw () [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Reimplemented from OSDL::Events::InputDevice.

Definition at line 200 of file OSDLMouse.cc.

bool Mouse::IsPressed ( MouseButtonMask  mask,
MouseButtonNumber  buttonToInspect 
) throw () [static]

Reads specified button mask, and tells whether specified mouse button is currently pressed.

Note:
Wheel directions are managed like buttons, if IsPressed( aMask, WheelUp ) is true, then the wheel is up.
Returns:
true iff the button is pressed, according to the mask.
See also:
getButtonStates.

Definition at line 220 of file OSDLMouse.cc.

MouseNumber Mouse::getIndex (  )  const throw () [protected, virtual]

Returns the index of this mouse in the platform list.

Note:
Should be useless.

Definition at line 309 of file OSDLMouse.cc.

References _index.

void Mouse::focusGained ( const FocusEvent mouseFocusEvent  )  throw () [protected, virtual]

Called whenever this mouse gained focus, and notifies the linked controller, if any.

Parameters:
mouseFocusEvent the event about the change in mouse focus.

Definition at line 234 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.

void Mouse::focusLost ( const FocusEvent mouseFocusEvent  )  throw () [protected, virtual]

Called whenever this mouse lost focus, and notifies the linked controller, if any.

Parameters:
mouseFocusEvent the event about the change in mouse focus.

Definition at line 249 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.

void Mouse::mouseMoved ( const MouseMotionEvent mouseEvent  )  throw () [protected, virtual]

Called whenever this mouse moved, and notifies the linked controller, if any.

Parameters:
mouseEvent the corresponding mouse event.

Definition at line 264 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.

void Mouse::buttonPressed ( const MouseButtonEvent mouseEvent  )  throw () [protected, virtual]

Called whenever a button of this mouse was pressed, and notifies the linked controller, if any.

Parameters:
mouseEvent the corresponding mouse event.

Definition at line 279 of file OSDLMouse.cc.

References OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.

void Mouse::buttonReleased ( const MouseButtonEvent mouseEvent  )  throw () [protected, virtual]

Called whenever a button of this mouse was released, and notifies the linked controller, if any.

Parameters:
mouseEvent the corresponding mouse event.

Definition at line 294 of file OSDLMouse.cc.

References OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.

Mouse& OSDL::Events::Mouse::operator= ( const Mouse source  )  throw () [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

OSDL::MVC::Controller & InputDevice::getActualController (  )  const throw ( EventsException ) [virtual, inherited]

Returns the actual (OSDL) controller this input device should be linked to.

Exceptions:
EventException if this input device is not linked to any controller, or if the controller is not an OSDL one.
See also:
isLinkedToController

Definition at line 33 of file OSDLInputDevice.cc.


Friends And Related Function Documentation

friend class OSDL::Events::MouseHandler [friend]

Definition at line 63 of file OSDLMouse.h.


Member Data Documentation

const MouseButtonNumber Mouse::DefaultButtonTotalNumber [static]

By default, a mouse is supposed to have 5 buttons : left, middle, right, wheel up and down.

Definition at line 268 of file OSDLMouse.h.

const MouseButtonNumber Mouse::DefaultButtonActualNumber [static]

By default, a mouse is supposed to have 3 actual buttons : left, middle, right.

Definition at line 276 of file OSDLMouse.h.

Referenced by getNumberOfButtons().

const MouseWheelNumber Mouse::DefaultWheelNumber [static]

By default, a mouse is supposed to have 1 wheel.

Definition at line 283 of file OSDLMouse.h.

Referenced by getNumberOfWheels().

MouseNumber OSDL::Events::Mouse::_index [protected]

The number of this mouse in platform list.

Definition at line 374 of file OSDLMouse.h.

Referenced by getIndex().

bool OSDL::Events::Mouse::_inClassicalMode [protected]

Tells whether this mouse should be in classical mode.

Definition at line 378 of file OSDLMouse.h.

MouseButtonNumber OSDL::Events::Mouse::_buttonTotalCount [protected]

The number of total buttons for this mouse.

Definition at line 382 of file OSDLMouse.h.

Video::Coordinate OSDL::Events::Mouse::_lastRelativeAbscissa [protected]

Records the last relative abscissa.

Definition at line 386 of file OSDLMouse.h.

Referenced by update().

Video::Coordinate OSDL::Events::Mouse::_lastRelativeOrdinate [protected]

Records the last relative ordinate.

Definition at line 389 of file OSDLMouse.h.

Referenced by update().


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 14:47:28 2007 for OSDL by  doxygen 1.5.1