#include <OSDLMouseCursor.h>
Collaboration diagram for OSDL::Video::TwoDimensional::MouseCursor:
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 :
| |
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. | |
MouseCursor & | operator= (const MouseCursor &source) throw () |
Assignment operator made private to ensure that it will never be called. |
Describes the different cursor types :
Definition at line 113 of file OSDLMouseCursor.h.
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.
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 ). |
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.
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). |
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.
MouseCursor::CursorType MouseCursor::getType | ( | ) | const throw () |
Returns the type of this mouse cursor.
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.
level | the requested verbosity level. |
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.
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().
The cursor shape, for BlittedCursor type.
Definition at line 247 of file OSDLMouseCursor.h.
Referenced by ~MouseCursor().
The cursor shape, for TexturedCursor type.
Definition at line 254 of file OSDLMouseCursor.h.
Referenced by ~MouseCursor().