#include <OSDLMouse.h>


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::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 = 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. | |
| 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 ( MouseException ) [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). |
| MouseException | if the operation failed or is not supported. |
Definition at line 64 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 134 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 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.
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.
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.
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.
Definition at line 210 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 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.
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.
| level | the requested verbosity level. |
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.
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.
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.
| 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.
| 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.
| 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.
| 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.
| 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().
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.
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().
friend class OSDL::Events::MouseHandler [friend] |
Definition at line 63 of file OSDLMouse.h.
const MouseButtonNumber Mouse::DefaultButtonTotalNumber = 5 [static] |
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.
const MouseButtonNumber Mouse::DefaultButtonActualNumber = 3 [static] |
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().
const MouseWheelNumber Mouse::DefaultWheelNumber = 1 [static] |
By default, a mouse is supposed to have 1 wheel.
Definition at line 286 of file OSDLMouse.h.
Referenced by getNumberOfWheels().
MouseNumber OSDL::Events::Mouse::_index [protected] |
The number of this mouse in platform list.
Definition at line 377 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 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().
1.5.5