Tracks pointer position, button state and cursor image selection.
The Pointer class represents the active pointing device used by the display system. It tracks global pointer coordinates, the surface and object under the hot spot, button state, drag state and the cursor image currently being shown to the user.
On hosted systems such as Windows and X11, pointer movement and cursor images are synchronised with the host windowing system. On native displays, the display module is responsible for drawing and managing the cursor directly.
A system-wide pointer object named SystemPointer is created automatically. Applications and module code should use this shared object, usually via AccessPointer(), when reading pointer state or changing cursor behaviour.
The Pointer class consists of the following fields:
Access | Name | Type | Comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Acceleration | DOUBLE | The rate of acceleration for relative pointer movement. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field affects relative pointer movement before the final coordinates are applied. It is normally treated as a user preference, because suitable acceleration values depend on the input device and user expectations. Hosted display drivers may apply their own pointer acceleration before events reach the display module, so this field is not always relevant in hosted environments. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Anchor | OBJECTID | Can refer to a surface that the pointer has been anchored to. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
If the pointer has been anchored to a surface through SetCursor(), this field refers to the surface that receives anchored movement events. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bitmap | *Bitmap | Refers to bitmap in which custom cursor images can be drawn. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
The pointer graphic can be changed to a custom image by drawing into this Bitmap and selecting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ButtonOrder | STRING | Defines the order in which mouse buttons are interpreted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field defines how physical pointer buttons are mapped to logical button positions when pressed. It can be used to remap a right-handed device for left-handed use, or to normalise unusual button layouts. The default button order is Buttons may be referenced more than once. For example, Changes to this field will have an immediate impact on the pointing device's behaviour. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ButtonState | INT | Indicates the current button-press state. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field returns the current pointer button state as bit flags after ButtonOrder mapping has been applied. A set bit indicates that the corresponding logical button is being held down. The first three bits represent left, right and middle button state respectively, with the left button at bit position zero. Additional buttons are supported, but their order depends on the device and the active ButtonOrder setting. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ClickSlop | INT | A leniency value that assists in determining if the user intended to click or drag. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
ClickSlop defines the allowed pointer movement, in pixels, before a press-and-release sequence is treated as a drag rather than a click. The same tolerance is used when deciding whether a second click is close enough to qualify as a double-click. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CursorID | PTC | Identifies the active cursor image. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field stores the cursor image currently selected for the pointer. Use SetCursor() or SetCustomCursor() to change the cursor after initialisation.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CursorOwner | OBJECTID | The object that currently owns the cursor state. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
If the cursor is currently locked by an owner, this field refers to that owner's object ID. Cursor ownership is managed by SetCursor() and released with RestoreCursor(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DoubleClick | DOUBLE | The maximum interval between two clicks for a double click to be recognised. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
A double-click is recognised when two presses of the same logical button occur within this interval. The value is measured in seconds and defaults to the user's pointer preference. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DragItem | INT | The currently dragged item, as defined by StartCursorDrag(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
When a drag-and-drop operation is active, this field contains the custom item number supplied to StartCursorDrag(). At all other times it is zero. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DragSource | OBJECTID | The object managing the current drag operation, as defined by StartCursorDrag(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
When a drag-and-drop operation is active, this field refers to the object managing the source data. At all other times it is zero. Item dragging is managed by StartCursorDrag(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Flags | PF | Optional flags. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Input | OBJECTID | Declares the I/O object to read movement from. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field records an alternate object intended to supply pointer movement. Input records delivered to the pointer must use the same | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MaxSpeed | INT | Restricts the maximum speed of a pointer's movement. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field limits the maximum relative movement applied to the pointer during a single update. Values assigned to the field are clamped to the supported range. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OverObject | OBJECTID | Readable field that gives the ID of the object under the pointer. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field returns the object directly under the pointer hot spot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OverX | DOUBLE | The horizontal position of the pointer with respect to the object underneath the hot spot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field gives the horizontal position of the pointer hot spot relative to OverObject. It can be read when handling input to determine the object-local coordinate affected by a click, wheel or movement event. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OverY | DOUBLE | The vertical position of the pointer with respect to the object underneath the hot spot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field gives the vertical position of the pointer hot spot relative to OverObject. It can be read together with OverX to determine the object-local coordinate affected by pointer input. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OverZ | DOUBLE | The position of the Pointer within an object. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field is reserved for interfaces that can report pointer depth. It reflects the pointer coordinate on the Z axis relative to the object under the hot spot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Restrict | OBJECTID | Refers to a surface when the pointer is restricted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
If the pointer has been restricted to a surface through SetCursor(), this field refers to that surface. If the pointer is not restricted, this field is zero. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Speed | DOUBLE | Speed multiplier for pointer movement. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field controls the relative movement multiplier, expressed as a percentage. Values below 100 reduce movement, while values above 100 increase movement. MaxSpeed is applied as a separate upper limit. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Surface | OBJECTID | The top-most surface that is under the pointer's hot spot. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field refers to the top-most Surface under the pointer hot spot. It is automatically updated when the pointer moves or when surface visibility, position or stacking changes affect the object under the pointer. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WheelSpeed | DOUBLE | Defines a multiplier to be applied to the mouse wheel. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
This field defines a multiplier applied to pointer wheel values. A setting of | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| X | DOUBLE | The horizontal position of the pointer within its display. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Y | DOUBLE | The vertical position of the pointer within its display. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
Setting X or Y on an initialised pointer forwards the change through MoveToPoint(). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following actions are currently supported:
| DataFeed | Sends device input events to the pointer. | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
ERR acDataFeed(*Object, OBJECTID Object, DATA Datatype, std::span<const int8_t> Buffer)
Use DataFeed with the Button presses are stateful. If a submitted record presses a button, the client must later submit the corresponding release record so click, drag and repeat handling can return to a consistent state. | ||||||||||||
| Hide | Hides the pointer cursor. | |||||||||||
| Move | Moves the pointer by a relative offset. | |||||||||||
ERR acMove(*Object, DOUBLE DeltaX, DOUBLE DeltaY, DOUBLE DeltaZ)
The Move action adjusts the current X and Y coordinates by the supplied delta values. It applies the movement immediately by forwarding the resulting position to MoveToPoint(). | ||||||||||||
| MoveToPoint | Moves the pointer to an absolute location. | |||||||||||
ERR acMoveToPoint(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, MTF Flags)
The MoveToPoint action changes the pointer's X and Y coordinates immediately. It updates the host cursor position where supported, refreshes the object under the hot spot and notifies subscribers to MoveToPoint with the final coordinates. This action is intended for programmatic repositioning. Hardware input is normally delivered through DataFeed and is translated into input events for the affected surface or object. | ||||||||||||
| Refresh | Refreshes the pointer's target and cursor image. | |||||||||||
ERR acRefresh(*Object) This action recalculates the object under the pointer hot spot and reapplies any cursor image selected by the underlying surface. | ||||||||||||
| Reset | Restores user-adjustable pointer settings to their defaults. | |||||||||||
ERR acReset(*Object) This action resets movement speed, acceleration, double-click interval, maximum speed and wheel speed. It does not move the pointer or clear the current cursor ownership state. | ||||||||||||
| SaveToObject | Saves pointer preferences to another object. | |||||||||||
ERR acSaveToObject(*Object, OBJECTID Dest, CLASSID ClassID)
This action writes the current speed, acceleration, double-click interval, maximum speed, wheel speed and button order to the destination object in configuration format. | ||||||||||||
| Show | Shows the pointer cursor. | |||||||||||
Flags for the Pointer class.
| Name | Description |
|---|---|
| PF::ANCHOR | Allow the pointer to be anchored. |
| PF::UNUSED | |
| PF::VISIBLE | Indicates that the pointer is currently visible. Read-only. |
Predefined cursor styles
| Name | Description |
|---|---|
| PTC::CROSSHAIR | The cross hair is used for targeting specific pixel points (common in paint programs). |
| PTC::CUSTOM | Works in conjunction with the SetCustomCursor() function to represent a program defined bitmap. |
| PTC::DEFAULT | The default cursor (usually an arrow pointing to the upper left). |
| PTC::DRAGGABLE | Used to indicate that a surface or object can be dragged by the user. |
| PTC::END | |
| PTC::HAND | The hand cursor is often used for indicating click-able content (hyper-links, icons etc). |
| PTC::HAND_LEFT | Similar to the standard hand cursor, but points to the left. |
| PTC::HAND_RIGHT | Similar to the standard hand cursor, but points to the right. |
| PTC::INVISIBLE | The cursor graphic is invisible (but will continue to operate as normal in all other respects). |
| PTC::MAGNIFIER | Represents a magnifying glass. |
| PTC::NO_CHANGE | |
| PTC::PAINTBRUSH | The paintbrush cursor is typically employed by paint programs. |
| PTC::SIZE_BOTTOM | Sizing cursor - for resizing the bottom edge of any rectangular area. |
| PTC::SIZE_BOTTOM_LEFT | Sizing cursor - for resizing the bottom left corner of any rectangular area. |
| PTC::SIZE_BOTTOM_RIGHT | Sizing cursor - for resizing the bottom right corner of any rectangular area. |
| PTC::SIZE_LEFT | Sizing cursor - for resizing the left edge of any rectangular area. |
| PTC::SIZE_RIGHT | Sizing cursor - for resizing the right edge of any rectangular area. |
| PTC::SIZE_TOP | Sizing cursor - for resizing the top edge of any rectangular area. |
| PTC::SIZE_TOP_LEFT | Sizing cursor - for resizing the top left corner of any rectangular area. |
| PTC::SIZE_TOP_RIGHT | Sizing cursor - for resizing the top right corner of any rectangular area. |
| PTC::SIZING | Multi-directional sizing cursor - for resizing in any direction. |
| PTC::SLEEP | The sleep cursor is used to inform the user that the computer is busy. |
| PTC::SPLIT_HORIZONTAL | The horizontal split cursor is typically used for splitting rectangles in half, or dragging a horizontal split within a large rectangular space. |
| PTC::SPLIT_VERTICAL | The vertical split cursor is typically used for splitting rectangles in half, or dragging a vertical split within a large rectangular space. |
| PTC::STOP | The stop cursor is used to inform the user that an operation is not possible (e.g. drag and drop to an unsupported object area). |
| PTC::TEXT | The text cursor is popular for the precise positioning of text cursors. |