#include <OSDLMouse.h>
Inheritance diagram for OSDL::Events::Mouse:
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::Controller & | getActualController () 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. | |
Mouse & | operator= (const Mouse &source) throw () |
Assignment operator made private to ensure that it will never be called. | |
Friends | |
class | OSDL::Events::MouseHandler |
Mouse::Mouse | ( | MouseNumber | index, | |
bool | classicalMouseMode = true | |||
) | throw () [explicit] |
Constructs a new mouse instance.
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] |
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.
Video::Coordinate Mouse::getCursorAbscissa | ( | ) | const throw () [virtual] |
Video::Coordinate Mouse::getCursorOrdinate | ( | ) | const throw () [virtual] |
void Mouse::setCursorPosition | ( | const Video::TwoDimensional::Point2D & | newPosition | ) | const throw () [virtual] |
Sets the cursor position for this mouse.
newPosition | the new cursor position. |
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.
x | the new cursor abscissa. | |
y | the new cursor ordinate. |
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.
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.
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.
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.
Definition at line 156 of file OSDLMouse.cc.
bool Mouse::isButtonPressed | ( | MouseButtonNumber | buttonNumber | ) | const throw ( MouseException ) [virtual] |
Tells whether specified mouse button is pressed.
buttonNumber | the number of the button for this mouse, for example 'LeftButton'. |
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.
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.
level | the requested verbosity level. |
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.
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.
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.
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.
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.
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.
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.
mouseEvent | the corresponding mouse event. |
Definition at line 294 of file OSDLMouse.cc.
References OSDL::Events::EventsModule::DescribeEvent(), and OSDL_MOUSE_LOG.
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.
EventException | if this input device is not linked to any controller, or if the controller is not an OSDL one. |
Definition at line 33 of file OSDLInputDevice.cc.
friend class OSDL::Events::MouseHandler [friend] |
Definition at line 63 of file OSDLMouse.h.
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] |
Records the last relative abscissa.
Definition at line 386 of file OSDLMouse.h.
Referenced by update().
Records the last relative ordinate.
Definition at line 389 of file OSDLMouse.h.
Referenced by update().