OSDL::Events::MouseHandler Class Reference

Handler for mice connected to the system, if any. More...

#include <OSDLMouseHandler.h>

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

List of all members.

Public Member Functions

 MouseHandler (bool useClassicalMice=true)
 Constructs a new mouse handler.
virtual ~MouseHandler () throw ()
 Virtual destructor.
bool hasDefaultMouse () const
 Returns whether a default mouse is available.
MousegetDefaultMouse ()
 Returns the default mouse, if any.
virtual void linkToController (OSDL::MVC::Controller &controller)
 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)
 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
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static MouseNumber GetAvailableMiceCount ()
 Returns the number of available mice, i.e.

Protected Member Functions

virtual void focusGained (const FocusEvent &mouseFocusEvent) const
 Called whenever a mouse focus is gained by the application.
virtual void focusLost (const FocusEvent &mouseFocusEvent) const
 Called whenever a mouse focus is lost by the application.
virtual void mouseMoved (const MouseMotionEvent &mouseMovedEvent) const
 Called whenever a mouse is moved, so that its controller, if any, is notified.
virtual void buttonPressed (const MouseButtonEvent &mouseButtonPressedEvent) const
 Called whenever a mouse button was pressed, so that its controller, if any, is notified.
virtual void buttonReleased (const MouseButtonEvent &mouseButtonReleasedEvent) const
 Called whenever a mouse button was released, so that its controller, if any, is notified.
virtual void blank ()
 Blanks this mouse handler, i.e.
virtual void checkMouseAt (MouseNumber index) const
 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)
 Copy constructor made private to ensure that it will never be called.
MouseHandleroperator= (const MouseHandler &source)
 Assignment operator made private to ensure that it will never be called.

Friends

class OSDL::Events::EventsModule

Detailed Description

Handler for mice connected to the system, if any.

Manages the mouse position, its up to three buttons, and a possible mouse wheel (up/down).

Note:
The UseMouse flag must be specified in the call to CommonModule::getCommonModule so that mouse support is enabled.
No multiple mice are managed for the moment.

Definition at line 83 of file OSDLMouseHandler.h.


Constructor & Destructor Documentation

MouseHandler::MouseHandler ( bool  useClassicalMice = true  )  [explicit]

Constructs a new mouse handler.

Parameters:
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).
Exceptions:
InputDeviceHandlerException if the initialization of the mouse subsystem failed.

Definition at line 68 of file OSDLMouseHandler.cc.

References _mice, _miceCount, _useClassicalMice, and GetAvailableMiceCount().

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

Virtual destructor.

Definition at line 103 of file OSDLMouseHandler.cc.

References blank().

OSDL::Events::MouseHandler::MouseHandler ( const MouseHandler source  )  [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

void MouseHandler::blank (  )  [protected, virtual]

Blanks this mouse handler, i.e.

makes it forget all previously known mice.

Definition at line 333 of file OSDLMouseHandler.cc.

References _mice, and _miceCount.

Referenced by ~MouseHandler().

void MouseHandler::buttonPressed ( const MouseButtonEvent mouseButtonPressedEvent  )  const [protected, virtual]

Called whenever a mouse button was pressed, so that its controller, if any, is notified.

Note:
Expected to be triggered by the EventsModule.

Definition at line 296 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 [protected, virtual]

Called whenever a mouse button was released, so that its controller, if any, is notified.

Note:
Expected to be triggered by the EventsModule.

Definition at line 314 of file OSDLMouseHandler.cc.

References _mice, OSDL::Events::Mouse::buttonReleased(), and checkMouseAt().

Referenced by OSDL::Events::EventsModule::onMouseButtonReleased().

void MouseHandler::checkMouseAt ( MouseNumber  index  )  const [protected, virtual]

Checks that the mouse at the specified index exists and is opened.

Parameters:
index the index of the mouse to check.
Note:
Stop in emergency the application if the check failed.

Definition at line 354 of file OSDLMouseHandler.cc.

References _mice, and _miceCount.

Referenced by buttonPressed(), buttonReleased(), focusGained(), focusLost(), and mouseMoved().

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

Called whenever a mouse focus is gained by the application.

Parameters:
mouseFocusEvent the mouse event about gained focus.
Note:
Expected to be triggered by the EventsModule.

Definition at line 245 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 [protected, virtual]

Called whenever a mouse focus is lost by the application.

Parameters:
mouseFocusEvent the mouse event about lost focus.
Note:
Expected to be triggered by the EventsModule.

Definition at line 262 of file OSDLMouseHandler.cc.

References _mice, checkMouseAt(), OSDL::Events::DefaultMouse, and OSDL::Events::Mouse::focusLost().

Referenced by OSDL::Events::EventsModule::onMouseFocusLost().

MouseNumber MouseHandler::GetAvailableMiceCount (  )  [static]

Returns the number of available mice, i.e.

the mice currently attached to the system.

Returns:
always one, for the moment.

Definition at line 226 of file OSDLMouseHandler.cc.

Referenced by linkToController(), and MouseHandler().

Mouse & MouseHandler::getDefaultMouse (  ) 

Returns the default mouse, if any.

Exceptions:
MouseException if no default mouse is available.

Definition at line 128 of file OSDLMouseHandler.cc.

References _mice, _miceCount, and OSDL::Events::DefaultMouse.

bool MouseHandler::hasDefaultMouse (  )  const

Returns whether a default mouse is available.

Returns:
true iff a default mouse is available.

Definition at line 119 of file OSDLMouseHandler.cc.

References _miceCount.

void MouseHandler::linkToController ( MouseNumber  index,
OSDL::MVC::Controller controller 
) [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.

Parameters:
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.
Exceptions:
MouseException if the operation failed.

Definition at line 150 of file OSDLMouseHandler.cc.

References _mice, _miceCount, GetAvailableMiceCount(), and OSDL::Video::Pixels::toString().

void MouseHandler::linkToController ( OSDL::MVC::Controller controller  )  [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.

Parameters:
controller the OSDL controller which will be notified of mouse changes.
Exceptions:
MouseException if the operation failed.

Definition at line 141 of file OSDLMouseHandler.cc.

References OSDL::Events::DefaultMouse.

void MouseHandler::mouseMoved ( const MouseMotionEvent mouseMovedEvent  )  const [protected, virtual]

Called whenever a mouse is moved, so that its controller, if any, is notified.

Note:
Expected to be triggered by the EventsModule.

Definition at line 279 of file OSDLMouseHandler.cc.

References _mice, checkMouseAt(), and OSDL::Events::Mouse::mouseMoved().

Referenced by OSDL::Events::EventsModule::onMouseMotion().

MouseHandler& OSDL::Events::MouseHandler::operator= ( const MouseHandler source  )  [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.

const string MouseHandler::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [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

Definition at line 184 of file OSDLMouseHandler.cc.

References _mice, _miceCount, and OSDL::Video::Pixels::toString().

Referenced by OSDL::Events::EventsModule::toString().


Friends And Related Function Documentation

friend class OSDL::Events::EventsModule [friend]

Definition at line 92 of file OSDLMouseHandler.h.


Member Data Documentation

Records all known mice.

A dynamic array is preferred to a list for performance reasons.

(read it as Mouse * _mice[])

Definition at line 336 of file OSDLMouseHandler.h.

Referenced by blank(), buttonPressed(), buttonReleased(), checkMouseAt(), focusGained(), focusLost(), getDefaultMouse(), linkToController(), MouseHandler(), mouseMoved(), and toString().

Records how many mice are known by this handler.

Definition at line 323 of file OSDLMouseHandler.h.

Referenced by blank(), checkMouseAt(), getDefaultMouse(), hasDefaultMouse(), linkToController(), MouseHandler(), and toString().

Tells whether complex mice (if false) or classical mice (if true) should be created.

Definition at line 345 of file OSDLMouseHandler.h.

Referenced by MouseHandler().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:05:53 2010 for OSDL by  doxygen 1.6.3