xtd.forms - Reference Guide  0.1.0
Modern c++17 library containing classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and Linux like Ubuntu operating system.
xtd::forms::cursor Class Reference

Represents the image used to paint the mouse pointer. More...

#include <cursor.hpp>

Public Member Functions

 cursor ()
 Initializes a new instance of the Cursor class. More...
 
 cursor (intptr_t handle)
 Initializes a new instance of the Cursor class from the specified Windows handle. More...
 
intptr_t copy_handle () const
 
intptr_t handle () const
 Gets the handle of the cursor. More...
 
drawing::point hot_spot () const
 Gets the cursor hot spot. More...
 
drawing::size size () const
 Gets the size of the cursor object. More...
 
std::any tag () const
 Gets the object that contains data about the control. More...
 
void tag (std::any tag)
 Sets the object that contains data about the control. More...
 
ustring to_string () const
 

Static Public Member Functions

static void hide ()
 Hides the cursor. More...
 
static drawing::point position ()
 Gets the cursor's position. More...
 
static void position (const drawing::point &position)
 Sets the cursor's position. More...
 
static void show ()
 Displays the cursor. More...
 

Friends

class cursors
 

Detailed Description

Represents the image used to paint the mouse pointer.

Remarks
A cursor is a small picture whose location on the screen is controlled by a pointing device, such as a mouse, pen, or trackball. When the user moves the pointing device, the operating system moves the cursor accordingly.
Different cursor shapes are used to inform the user what operation the mouse will have. For example, when editing or selecting text, a cursors::ibeam cursor is typically displayed. A wait cursor is commonly used to inform the user that a process is currently running. Examples of processes you might have the user wait for are opening a file, saving a file, or filling a control such as a data_grid, list_box or tree_view with a large amount of data.
All controls that derive from the Control class have a Cursor property. To change the cursor displayed by the mouse pointer when it is within the bounds of the control, assign a Cursor to the Cursor property of the control. Alternatively, you can display cursors at the application level by assigning a Cursor to the Current property. For example, if the purpose of your application is to edit a text file, you might set the Current property to Cursors.WaitCursor to display a wait cursor over the application while the file loads or saves to prevent any mouse events from being processed. When the process is complete, set the Current property to Cursors.Default for the application to display the appropriate cursor over each control type.

Constructor & Destructor Documentation

§ cursor() [1/2]

xtd::forms::cursor::cursor ( )

Initializes a new instance of the Cursor class.

§ cursor() [2/2]

xtd::forms::cursor::cursor ( intptr_t  handle)
inlineexplicit

Initializes a new instance of the Cursor class from the specified Windows handle.

Parameters
handleAn IntPtr that represents the Windows handle of the cursor to create.
Remarks
You must free the cursor handle when you are done with it.

Member Function Documentation

§ copy_handle()

intptr_t xtd::forms::cursor::copy_handle ( ) const
Remarks
Copies the handle of this cursor.
Returns
An intptr_t that represents the cursor's handle.
Remarks
The handle created as a result of calling this method must be deleted of when you are done with it.

§ handle()

intptr_t xtd::forms::cursor::handle ( ) const
inline

Gets the handle of the cursor.

Returns
An intptr_t that represents the cursor's handle.
Remarks
This is not a copy of the handle; do not detroy it.

§ hide()

static void xtd::forms::cursor::hide ( )
static

Hides the cursor.

The show and hide method calls must be balanced. For every call to the hide method there must be a corresponding call to the show method.

§ hot_spot()

drawing::point xtd::forms::cursor::hot_spot ( ) const
inline

Gets the cursor hot spot.

Returns
A point representing the cursor hot spot.
Remarks
The hot_spot is the point in the cursor that interacts with other elements on the screen.

§ position() [1/2]

static drawing::point xtd::forms::cursor::position ( )
static

Gets the cursor's position.

Returns
A point that represents the cursor's position in screen coordinates.
Remarks
The position property is identical to the control::mouse_position property.

§ position() [2/2]

static void xtd::forms::cursor::position ( const drawing::point position)
static

Sets the cursor's position.

Parameters
positionA point that represents the cursor's position in screen coordinates.
Remarks
The position property is identical to the control::mouse_position property.

§ show()

static void xtd::forms::cursor::show ( )
static

Displays the cursor.

The show and hide method calls must be balanced. For every call to the hide method there must be a corresponding call to the show method.

§ size()

drawing::size xtd::forms::cursor::size ( ) const
inline

Gets the size of the cursor object.

Returns
A size that represents the width and height of the cursor.

§ tag() [1/2]

std::any xtd::forms::cursor::tag ( ) const
inline

Gets the object that contains data about the control.

Returns
A std::any that contains data about the control. The default is empty.
Remarks
Any type of class can be assigned to this property.

§ tag() [2/2]

void xtd::forms::cursor::tag ( std::any  tag)
inline

Sets the object that contains data about the control.

Parameters
tagA std::any that contains data about the control. The default is empty.
Remarks
Any type of class can be assigned to this property.

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