Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ApplicationCursor Class Reference

Singleton for overriding the application's cursor. More...

#include <mitkApplicationCursor.h>

Public Member Functions

void PushCursor (const char *XPM[], int hotspotX=-1, int hotspotY=-1)
 Push a new cursor onto the stack (XPM format). More...
 
void PushCursor (std::istream &cursorStream, int hotspotX=-1, int hotspotY=-1)
 Push a new cursor onto the stack (stream format). More...
 
void PopCursor ()
 Pop the most recent cursor from the stack, restoring the previous one. More...
 
const Point2I GetCursorPosition ()
 Get the absolute mouse position on screen. More...
 
void SetCursorPosition (const Point2I &position)
 Set the absolute mouse position on screen. More...
 

Static Public Member Functions

static ApplicationCursor * GetInstance ()
 Get the singleton instance. More...
 
static void RegisterImplementation (ApplicationCursorImplementation *implementation)
 Register a toolkit-specific cursor implementation. More...
 

Protected Member Functions

 ApplicationCursor ()
 Hidden constructor (singleton pattern). More...
 

Detailed Description

Singleton for overriding the application's cursor.

Provides a stack-based mechanism to override the application cursor with context-dependent cursors. Accepts cursors in XPM format. Push a cursor on top of the stack and later pop it to restore the previous state. This mimics Qt's QApplication::setOverrideCursor() behavior.

A toolkit-specific ApplicationCursorImplementation must be registered before any cursor operations are used.

See also
ApplicationCursorImplementation

Definition at line 82 of file mitkApplicationCursor.h.

Constructor & Destructor Documentation

◆ ApplicationCursor()

mitk::ApplicationCursor::ApplicationCursor ( )
protected

Hidden constructor (singleton pattern).

Member Function Documentation

◆ GetCursorPosition()

const Point2I mitk::ApplicationCursor::GetCursorPosition ( )

Get the absolute mouse position on screen.

Returns
The cursor position, or (-1, -1) if querying is not possible.

◆ GetInstance()

static ApplicationCursor* mitk::ApplicationCursor::GetInstance ( )
static

Get the singleton instance.

Returns
Pointer to the singleton ApplicationCursor.

◆ PopCursor()

void mitk::ApplicationCursor::PopCursor ( )

Pop the most recent cursor from the stack, restoring the previous one.

◆ PushCursor() [1/2]

void mitk::ApplicationCursor::PushCursor ( const char *  XPM[],
int  hotspotX = -1,
int  hotspotY = -1 
)

Push a new cursor onto the stack (XPM format).

Parameters
[in]XPMThe cursor image in XPM format.
[in]hotspotXThe x-coordinate of the cursor hotspot (-1 for default).
[in]hotspotYThe y-coordinate of the cursor hotspot (-1 for default).

◆ PushCursor() [2/2]

void mitk::ApplicationCursor::PushCursor ( std::istream &  cursorStream,
int  hotspotX = -1,
int  hotspotY = -1 
)

Push a new cursor onto the stack (stream format).

Parameters
[in,out]cursorStreamInput stream containing cursor data.
[in]hotspotXThe x-coordinate of the cursor hotspot (-1 for default).
[in]hotspotYThe y-coordinate of the cursor hotspot (-1 for default).

◆ RegisterImplementation()

static void mitk::ApplicationCursor::RegisterImplementation ( ApplicationCursorImplementation *  implementation)
static

Register a toolkit-specific cursor implementation.

Parameters
[in]implementationThe implementation to use for cursor operations.

◆ SetCursorPosition()

void mitk::ApplicationCursor::SetCursorPosition ( const Point2I &  position)

Set the absolute mouse position on screen.

Parameters
[in]positionThe desired cursor position in screen coordinates.

The documentation for this class was generated from the following file: