OSDL::Video::TwoDimensional::MouseCursor Class Reference

#include <OSDLMouseCursor.h>

Collaboration diagram for OSDL::Video::TwoDimensional::MouseCursor:

[legend]
List of all members.

Detailed Description

Encapsulates a mouse cursor.

There are two types of mouse cursors :

System cursor shapes are specified thanks to background data and a mask, which both represent the same rectangle enclosing the cursor shape, with one bit per pixel, and a width which must be a multiple of 8. On a given coordinate, if the bit in the data is :

OSDL-powered cursor are specified as a colorkeyed surface. Depending on OpenGL being used or not, they are rendered as textured quads or as blitted surfaces.

All cursors must be associated with a hot-spot, which is the point of the cursor shape which will be aligned with the actual mouse pointer. Hence the user will have to align this hot-spot with the target onscreen area to click it, and the cursor shape will be blitted with an offset so that the hotspot matches the actual mouse pointer.

Definition at line 94 of file OSDLMouseCursor.h.

Public Types

enum  CursorType { SystemCursor, BlittedCursor, TexturedCursor }
 Describes the different cursor types :
  • SystemCursor : the cursor is black-and-white, and it is managed by the system directly,
  • BlittedCursor : the cursor is defined by a surface, which is blitted automatically by OSDL whenever associated with a mouse,
  • TexturedCursor : the cursor is rendered automatically by OSDL through OpenGL as a textured quad, whenever associated with a mouse.
More...

Public Member Functions

 MouseCursor (Length width, Length height, const Ceylan::Uint8 &data, const Ceylan::Uint8 &mask, Coordinate hotSpotAbscissa, Coordinate hotSpotOrdinate) throw ( MouseCursorException )
 Creates a new system mouse cursor.
 MouseCursor (const Surface &cursorSurface, Coordinate hotSpotAbscissa, Coordinate hotSpotOrdinate) throw ( MouseCursorException )
 Creates a new OSDL-powered mouse cursor.
virtual ~MouseCursor () throw ()
 Virtual destructor.
CursorType getType () const throw ()
 Returns the type of this mouse cursor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw ()
 Returns an user-friendly description of the state of this object.

Protected Attributes

CursorType _type
SDL_Cursor * _systemCursor
 Back-end cursor, for SystemCursor type.
Length _width
 The width of the cursor, for SystemCursor only.
Length _height
 The height of the cursor, for SystemCursor only.
Surface_surface
 The cursor shape, for BlittedCursor type.
OpenGL::GLTexture_texture
 The cursor shape, for TexturedCursor type.
Coordinate _hotSpotAbscissa
 The abscissa of the cursor hot spot.
Coordinate _hotSpotOrdinate
 The ordinate of the cursor hot spot.

Private Member Functions

 MouseCursor (const MouseCursor &source) throw ()
 Copy constructor made private to ensure that it will never be called.
MouseCursoroperator= (const MouseCursor &source) throw ()
 Assignment operator made private to ensure that it will never be called.


Member Enumeration Documentation

enum OSDL::Video::TwoDimensional::MouseCursor::CursorType

Describes the different cursor types :

Enumerator:
SystemCursor 
BlittedCursor 
TexturedCursor 

Definition at line 113 of file OSDLMouseCursor.h.


Constructor & Destructor Documentation

MouseCursor::MouseCursor ( Length  width,
Length  height,
const Ceylan::Uint8 &  data,
const Ceylan::Uint8 &  mask,
Coordinate  hotSpotAbscissa,
Coordinate  hotSpotOrdinate 
) throw ( MouseCursorException )

Creates a new system mouse cursor.

Parameters:
width the width of the cursor-enclosing rectangle. The width must be a multiple of 8.
height the height of the cursor-enclosing rectangle.
data the bitplane describing the cursor shape. Its size must be width * height bits. The cursor takes ownership of this data.
mask the bitplane describing the cursor mask, which must have the same size as the data bitplane. The cursor takes ownership of this mask.
hotSpotAbscissa the abscissa of the hotspot, which must lie in the cursor-enclosing rectangle ( 0 <= hotSpotAbscissa < width ).
hotSpotOrdinate the ordinate of the hotspot, which must lie in the cursor-enclosing rectangle ( 0 <= hotSpotOrdinate < height ).
Exceptions:
MouseCursorException if the operation failed.

Definition at line 38 of file OSDLMouseCursor.cc.

References OSDL::Utils::getBackendLastError().

MouseCursor::MouseCursor ( const Surface cursorSurface,
Coordinate  hotSpotAbscissa,
Coordinate  hotSpotOrdinate 
) throw ( MouseCursorException )

Creates a new OSDL-powered mouse cursor.

Parameters:
cursorSurface a surface containing the cursor, which should have a colorkey or an alpha channel for transparent parts of the cursor. The cursor takes ownership of this surface.
hotSpotAbscissa the abscissa of the hotspot, which must lie in the cursor-enclosing rectangle ( 0 <= hotSpotAbscissa < surface width).
hotSpotOrdinate the ordinate of the hotspot, which must lie in the cursor-enclosing rectangle ( 0 <= hotSpotOrdinate < surface height).
Exceptions:
MouseCursorException if the operation failed.

Definition at line 68 of file OSDLMouseCursor.cc.

References OSDL::Video::OpenGL::None.

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

Virtual destructor.

Definition at line 104 of file OSDLMouseCursor.cc.

References _surface, _systemCursor, and _texture.

OSDL::Video::TwoDimensional::MouseCursor::MouseCursor ( const MouseCursor 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

MouseCursor::CursorType MouseCursor::getType (  )  const throw ()

Returns the type of this mouse cursor.

See also:
CursorType

Definition at line 121 of file OSDLMouseCursor.cc.

References _type.

const string MouseCursor::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

Definition at line 129 of file OSDLMouseCursor.cc.

MouseCursor& OSDL::Video::TwoDimensional::MouseCursor::operator= ( const MouseCursor 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.


Member Data Documentation

CursorType OSDL::Video::TwoDimensional::MouseCursor::_type [protected]

Definition at line 224 of file OSDLMouseCursor.h.

Referenced by getType().

SDL_Cursor* OSDL::Video::TwoDimensional::MouseCursor::_systemCursor [protected]

Back-end cursor, for SystemCursor type.

Definition at line 231 of file OSDLMouseCursor.h.

Referenced by ~MouseCursor().

Length OSDL::Video::TwoDimensional::MouseCursor::_width [protected]

The width of the cursor, for SystemCursor only.

Definition at line 236 of file OSDLMouseCursor.h.

Length OSDL::Video::TwoDimensional::MouseCursor::_height [protected]

The height of the cursor, for SystemCursor only.

Definition at line 239 of file OSDLMouseCursor.h.

Surface* OSDL::Video::TwoDimensional::MouseCursor::_surface [protected]

The cursor shape, for BlittedCursor type.

Definition at line 247 of file OSDLMouseCursor.h.

Referenced by ~MouseCursor().

OpenGL::GLTexture* OSDL::Video::TwoDimensional::MouseCursor::_texture [protected]

The cursor shape, for TexturedCursor type.

Definition at line 254 of file OSDLMouseCursor.h.

Referenced by ~MouseCursor().

Coordinate OSDL::Video::TwoDimensional::MouseCursor::_hotSpotAbscissa [protected]

The abscissa of the cursor hot spot.

Definition at line 259 of file OSDLMouseCursor.h.

Coordinate OSDL::Video::TwoDimensional::MouseCursor::_hotSpotOrdinate [protected]

The ordinate of the cursor hot spot.

Definition at line 262 of file OSDLMouseCursor.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 14:47:34 2007 for OSDL by  doxygen 1.5.1