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

Encapsulates a mouse cursor. More...

#include <OSDLMouseCursor.h>

Collaboration diagram for OSDL::Video::TwoDimensional::MouseCursor:
Collaboration graph
[legend]

List of all members.

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)
 Creates a new system mouse cursor.
 MouseCursor (const Surface &cursorSurface, Coordinate hotSpotAbscissa, Coordinate hotSpotOrdinate)
 Creates a new OSDL-powered mouse cursor.
virtual ~MouseCursor () throw ()
 Virtual destructor.
CursorType getType () const
 Returns the type of this mouse cursor.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.

Protected Attributes

CursorType _type
 Type of this cursor.
LowLevelCursor_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)
 Copy constructor made private to ensure that it will never be called.
MouseCursoroperator= (const MouseCursor &source)
 Assignment operator made private to ensure that it will never be called.

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 155 of file OSDLMouseCursor.h.


Member Enumeration Documentation

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.

Enumerator:
SystemCursor 
BlittedCursor 
TexturedCursor 

Definition at line 176 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 
)

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 77 of file OSDLMouseCursor.cc.

References _height, _hotSpotAbscissa, _hotSpotOrdinate, _systemCursor, _width, and OSDL::Utils::getBackendLastError().

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

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 116 of file OSDLMouseCursor.cc.

References _texture, and OSDL::Audio::None.

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

Virtual destructor.

Definition at line 160 of file OSDLMouseCursor.cc.

References _surface, _systemCursor, and _texture.

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

MouseCursor::CursorType MouseCursor::getType (  )  const

Returns the type of this mouse cursor.

See also:
CursorType

Definition at line 182 of file OSDLMouseCursor.cc.

References _type.

MouseCursor& OSDL::Video::TwoDimensional::MouseCursor::operator= ( const MouseCursor 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 MouseCursor::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 191 of file OSDLMouseCursor.cc.

References _type, BlittedCursor, SystemCursor, and TexturedCursor.


Member Data Documentation

The height of the cursor, for SystemCursor only.

Definition at line 308 of file OSDLMouseCursor.h.

Referenced by MouseCursor().

The abscissa of the cursor hot spot.

Definition at line 330 of file OSDLMouseCursor.h.

Referenced by MouseCursor().

The ordinate of the cursor hot spot.

Definition at line 334 of file OSDLMouseCursor.h.

Referenced by MouseCursor().

The cursor shape, for BlittedCursor type.

Definition at line 316 of file OSDLMouseCursor.h.

Referenced by ~MouseCursor().

Back-end cursor, for SystemCursor type.

Definition at line 298 of file OSDLMouseCursor.h.

Referenced by MouseCursor(), and ~MouseCursor().

The cursor shape, for TexturedCursor type.

Definition at line 324 of file OSDLMouseCursor.h.

Referenced by MouseCursor(), and ~MouseCursor().

Type of this cursor.

Definition at line 290 of file OSDLMouseCursor.h.

Referenced by getType(), and toString().

The width of the cursor, for SystemCursor only.

Definition at line 304 of file OSDLMouseCursor.h.

Referenced by MouseCursor().


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