OSDL::Events::Mouse Class Reference

#include <OSDLMouse.h>

Inheritance diagram for OSDL::Events::Mouse:

Inheritance graph
[legend]
Collaboration diagram for OSDL::Events::Mouse:

Collaboration graph
[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 ( MouseException )
 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 = 5
 By default, a mouse is supposed to have 5 buttons: left, middle, right, wheel up and down.
static const MouseButtonNumber DefaultButtonActualNumber = 3
 By default, a mouse is supposed to have 3 actual buttons: left, middle, right.
static const MouseWheelNumber DefaultWheelNumber = 1
 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 ( MouseException ) [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).
Exceptions:
MouseException if the operation failed or is not supported.

Definition at line 64 of file OSDLMouse.cc.

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

Virtual destructor, closing corresponding mouse device.

Definition at line 84 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 94 of file OSDLMouse.cc.

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

Returns the absolute ordinate of this mouse cursor.

Definition at line 114 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 134 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 142 of file OSDLMouse.cc.

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

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

Definition at line 156 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 164 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 174 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 192 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 210 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 228 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 247 of file OSDLMouse.cc.

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

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

Definition at line 264 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 282 of file OSDLMouse.cc.

References _buttonTotalCount, and _inClassicalMode.

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 302 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 399 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 324 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), OSDL::Events::InputDevice::getActualController(), OSDL::MVC::Controller::mouseFocusGained(), and OSDL_MOUSE_LOG.

Referenced by OSDL::Events::MouseHandler::focusGained().

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 339 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), OSDL::Events::InputDevice::getActualController(), OSDL::MVC::Controller::mouseFocusLost(), and OSDL_MOUSE_LOG.

Referenced by OSDL::Events::MouseHandler::focusLost().

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 354 of file OSDLMouse.cc.

References OSDL::Events::DefaultMouse, OSDL::Events::EventsModule::DescribeEvent(), OSDL::Events::InputDevice::getActualController(), OSDL::MVC::Controller::mouseMoved(), and OSDL_MOUSE_LOG.

Referenced by OSDL::Events::MouseHandler::mouseMoved().

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 369 of file OSDLMouse.cc.

References OSDL::Events::EventsModule::DescribeEvent(), OSDL::Events::InputDevice::getActualController(), OSDL::MVC::Controller::mouseButtonPressed(), and OSDL_MOUSE_LOG.

Referenced by OSDL::Events::MouseHandler::buttonPressed().

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 384 of file OSDLMouse.cc.

References OSDL::Events::EventsModule::DescribeEvent(), OSDL::Events::InputDevice::getActualController(), OSDL::MVC::Controller::mouseButtonReleased(), and OSDL_MOUSE_LOG.

Referenced by OSDL::Events::MouseHandler::buttonReleased().

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.

Referenced by OSDL::Events::Joystick::axisChanged(), OSDL::Events::ClassicalJoystick::axisChanged(), buttonPressed(), OSDL::Events::Joystick::buttonPressed(), OSDL::Events::ClassicalJoystick::buttonPressed(), buttonReleased(), OSDL::Events::Joystick::buttonReleased(), OSDL::Events::ClassicalJoystick::buttonReleased(), focusGained(), focusLost(), OSDL::Events::Joystick::hatChanged(), mouseMoved(), and OSDL::Events::Joystick::trackballChanged().


Friends And Related Function Documentation

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

Definition at line 63 of file OSDLMouse.h.


Member Data Documentation

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

Definition at line 271 of file OSDLMouse.h.

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

Definition at line 279 of file OSDLMouse.h.

Referenced by getNumberOfButtons().

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

Definition at line 286 of file OSDLMouse.h.

Referenced by getNumberOfWheels().

The number of this mouse in platform list.

Definition at line 377 of file OSDLMouse.h.

Referenced by getIndex().

Tells whether this mouse should be in classical mode.

Definition at line 381 of file OSDLMouse.h.

Referenced by toString().

The number of total buttons for this mouse.

Definition at line 385 of file OSDLMouse.h.

Referenced by toString().

Records the last relative abscissa.

Definition at line 389 of file OSDLMouse.h.

Referenced by update().

Records the last relative ordinate.

Definition at line 392 of file OSDLMouse.h.

Referenced by update().


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

Generated on Fri Aug 1 14:46:19 2008 for OSDL by  doxygen 1.5.5