#include <OSDLMouseHandler.h>


Manages the mouse position, its up to three buttons, and a possible mouse wheel (up/down).
No multiple mice are managed for the moment.
Definition at line 52 of file OSDLMouseHandler.h.
Public Member Functions | |
| MouseHandler (bool useClassicalMice=true) throw ( InputDeviceHandlerException ) | |
| Constructs a new mouse handler. | |
| virtual | ~MouseHandler () throw () |
| Virtual destructor. | |
| virtual void | linkToController (OSDL::MVC::Controller &controller) throw ( MouseException ) |
| Links the default mouse to specified controller, so that any further mouse-related event will be sent to this controller. | |
| virtual void | linkToController (MouseNumber index, OSDL::MVC::Controller &controller) throw ( MouseException ) |
| Links the specified mouse to specified controller, so that any further mouse-related event will be sent to this controller. | |
| virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
| Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
| static MouseNumber | GetAvailableMiceCount () throw () |
| Returns the number of available mice, i.e. | |
Protected Member Functions | |
| virtual void | focusGained (const FocusEvent &mouseFocusEvent) const throw () |
| Called whenever a mouse focus is gained by the application. | |
| virtual void | focusLost (const FocusEvent &mouseFocusEvent) const throw () |
| Called whenever a mouse focus is lost by the application. | |
| virtual void | mouseMoved (const MouseMotionEvent &mouseMovedEvent) const throw () |
| Called whenever a mouse is moved, so that its controller, if any, is notified. | |
| virtual void | buttonPressed (const MouseButtonEvent &mouseButtonPressedEvent) const throw () |
| Called whenever a mouse button was pressed, so that its controller, if any, is notified. | |
| virtual void | buttonReleased (const MouseButtonEvent &mouseButtonReleasedEvent) const throw () |
| Called whenever a mouse button was released, so that its controller, if any, is notified. | |
| virtual void | blank () throw () |
| Blanks this mouse handler, i.e. | |
| virtual void | checkMouseAt (MouseNumber index) const throw () |
| Checks that the mouse at the specified index exists and is opened. | |
Protected Attributes | |
| MouseNumber | _miceCount |
| Records how many mice are known by this handler. | |
| Mouse ** | _mice |
| Records all known mice. | |
| bool | _useClassicalMice |
| Tells whether complex mice (if false) or classical mice (if true) should be created. | |
Private Member Functions | |
| MouseHandler (const MouseHandler &source) throw () | |
| Copy constructor made private to ensure that it will never be called. | |
| MouseHandler & | operator= (const MouseHandler &source) throw () |
| Assignment operator made private to ensure that it will never be called. | |
Friends | |
| class | OSDL::Events::EventsModule |
| MouseHandler::MouseHandler | ( | bool | useClassicalMice = true |
) | throw ( InputDeviceHandlerException ) [explicit] |
Constructs a new mouse handler.
| useClassicalMice | tells whether detected mice should be managed as complex mice (powerful interface, but it requires the controller to take in charge this complexity) or classical mice (for usual needs, comes with preset behaviours which ease controller work). |
| InputDeviceHandlerException | if the initialization of the mouse subsystem failed. |
Definition at line 42 of file OSDLMouseHandler.cc.
| MouseHandler::~MouseHandler | ( | ) | throw () [virtual] |
| OSDL::Events::MouseHandler::MouseHandler | ( | const MouseHandler & | 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.
| void MouseHandler::linkToController | ( | OSDL::MVC::Controller & | controller | ) | throw ( MouseException ) [virtual] |
Links the default mouse to specified controller, so that any further mouse-related event will be sent to this controller.
Removes automatically any link previously defined between the mouse and any other controller.
| controller | the OSDL controller which will be notified of mouse changes. |
| MouseException | if the operation failed. |
Definition at line 94 of file OSDLMouseHandler.cc.
References OSDL::Events::DefaultMouse.
| void MouseHandler::linkToController | ( | MouseNumber | index, | |
| OSDL::MVC::Controller & | controller | |||
| ) | throw ( MouseException ) [virtual] |
Links the specified mouse to specified controller, so that any further mouse-related event will be sent to this controller.
Removes automatically any link previously defined between the mouse and any other controller.
| index | the index of the mouse to link, in case there are other mice than the main default one. | |
| controller | the OSDL controller which will be notified of mouse changes. |
| MouseException | if the operation failed. |
Definition at line 104 of file OSDLMouseHandler.cc.
References _mice, _miceCount, GetAvailableMiceCount(), and OSDL::Video::Pixels::toString().
| const string MouseHandler::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. |
Definition at line 138 of file OSDLMouseHandler.cc.
References _mice, _miceCount, and OSDL::Video::Pixels::toString().
Referenced by OSDL::Events::EventsModule::toString().
| MouseNumber MouseHandler::GetAvailableMiceCount | ( | ) | throw () [static] |
Returns the number of available mice, i.e.
the mice currently attached to the system.
Definition at line 181 of file OSDLMouseHandler.cc.
Referenced by linkToController().
| void MouseHandler::focusGained | ( | const FocusEvent & | mouseFocusEvent | ) | const throw () [protected, virtual] |
Called whenever a mouse focus is gained by the application.
| mouseFocusEvent | the mouse event about gained focus. |
Definition at line 199 of file OSDLMouseHandler.cc.
References _mice, checkMouseAt(), OSDL::Events::DefaultMouse, and OSDL::Events::Mouse::focusGained().
Referenced by OSDL::Events::EventsModule::onMouseFocusGained().
| void MouseHandler::focusLost | ( | const FocusEvent & | mouseFocusEvent | ) | const throw () [protected, virtual] |
Called whenever a mouse focus is lost by the application.
| mouseFocusEvent | the mouse event about lost focus. |
Definition at line 217 of file OSDLMouseHandler.cc.
References _mice, checkMouseAt(), OSDL::Events::DefaultMouse, and OSDL::Events::Mouse::focusLost().
Referenced by OSDL::Events::EventsModule::onMouseFocusLost().
| void MouseHandler::mouseMoved | ( | const MouseMotionEvent & | mouseMovedEvent | ) | const throw () [protected, virtual] |
Called whenever a mouse is moved, so that its controller, if any, is notified.
Definition at line 234 of file OSDLMouseHandler.cc.
References _mice, checkMouseAt(), and OSDL::Events::Mouse::mouseMoved().
Referenced by OSDL::Events::EventsModule::onMouseMotion().
| void MouseHandler::buttonPressed | ( | const MouseButtonEvent & | mouseButtonPressedEvent | ) | const throw () [protected, virtual] |
Called whenever a mouse button was pressed, so that its controller, if any, is notified.
Definition at line 252 of file OSDLMouseHandler.cc.
References _mice, OSDL::Events::Mouse::buttonPressed(), and checkMouseAt().
Referenced by OSDL::Events::EventsModule::onMouseButtonPressed().
| void MouseHandler::buttonReleased | ( | const MouseButtonEvent & | mouseButtonReleasedEvent | ) | const throw () [protected, virtual] |
Called whenever a mouse button was released, so that its controller, if any, is notified.
Definition at line 271 of file OSDLMouseHandler.cc.
References _mice, OSDL::Events::Mouse::buttonReleased(), and checkMouseAt().
Referenced by OSDL::Events::EventsModule::onMouseButtonReleased().
| void MouseHandler::blank | ( | ) | throw () [protected, virtual] |
Blanks this mouse handler, i.e.
makes it forget all previously known mice.
Definition at line 291 of file OSDLMouseHandler.cc.
References _mice, and _miceCount.
Referenced by ~MouseHandler().
| void MouseHandler::checkMouseAt | ( | MouseNumber | index | ) | const throw () [protected, virtual] |
Checks that the mouse at the specified index exists and is opened.
| index | the index of the mouse to check. |
Definition at line 311 of file OSDLMouseHandler.cc.
References _mice, and _miceCount.
Referenced by buttonPressed(), buttonReleased(), focusGained(), focusLost(), and mouseMoved().
| MouseHandler& OSDL::Events::MouseHandler::operator= | ( | const MouseHandler & | 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.
friend class OSDL::Events::EventsModule [friend] |
Definition at line 61 of file OSDLMouseHandler.h.
MouseNumber OSDL::Events::MouseHandler::_miceCount [protected] |
Records how many mice are known by this handler.
Definition at line 263 of file OSDLMouseHandler.h.
Referenced by blank(), checkMouseAt(), linkToController(), and toString().
Mouse** OSDL::Events::MouseHandler::_mice [protected] |
Records all known mice.
A dynamic array is preferred to a list for performance reasons.
(read it as Mouse * _mice[])
Definition at line 275 of file OSDLMouseHandler.h.
Referenced by blank(), buttonPressed(), buttonReleased(), checkMouseAt(), focusGained(), focusLost(), linkToController(), mouseMoved(), and toString().
bool OSDL::Events::MouseHandler::_useClassicalMice [protected] |
Tells whether complex mice (if false) or classical mice (if true) should be created.
Definition at line 283 of file OSDLMouseHandler.h.
1.5.5