Encapsulates a mouse cursor. More...
#include <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) | |
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. | |
MouseCursor & | operator= (const MouseCursor &source) |
Assignment operator made private to ensure that it will never be called. |
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.
Describes the different cursor types:
Definition at line 176 of file OSDLMouseCursor.h.
MouseCursor::MouseCursor | ( | Length | width, | |
Length | height, | |||
const Ceylan::Uint8 & | data, | |||
const Ceylan::Uint8 & | mask, | |||
Coordinate | hotSpotAbscissa, | |||
Coordinate | hotSpotOrdinate | |||
) |
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 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.
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 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.
MouseCursor::CursorType MouseCursor::getType | ( | ) | const |
Returns the type of this mouse cursor.
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.
level | the requested verbosity level. |
Definition at line 191 of file OSDLMouseCursor.cc.
References _type, BlittedCursor, SystemCursor, and TexturedCursor.
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().