MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Macros | Functions

Macros

#define IDC_ARROW   0
 
#define IDC_IBEAM   1
 
#define IDC_PENCIL   2
 
#define IDC_CROSS   3
 
#define IDC_MOVE   4
 
#define IDC_SIZENWSE   5
 
#define IDC_SIZENESW   6
 
#define IDC_SIZEWE   7
 
#define IDC_SIZENS   8
 
#define IDC_UPARROW   9
 
#define IDC_NONE   10
 
#define IDC_HELP   11
 
#define IDC_BUSY   12
 
#define IDC_WAIT   13
 
#define IDC_RARROW   14
 
#define IDC_COLOMN   15
 
#define IDC_ROW   16
 
#define IDC_DRAG   17
 
#define IDC_NODROP   18
 
#define IDC_HAND_POINT   19
 
#define IDC_HAND_SELECT   20
 
#define IDC_SPLIT_HORZ   21
 
#define IDC_SPLIT_VERT   22
 
#define SetCursor(hcsr)   SetCursorEx (hcsr, FALSE)
 Changes the current cursor. More...
 
#define SetDefaultCursor(hcsr)   SetCursorEx (hcsr, TRUE)
 Changes the current cursor, and set it as the default cursor. More...
 

Functions

MG_EXPORT HCURSOR GUIAPI LoadCursorFromFile (const char *filename)
 Loads a cursor from a M$ Windows cursor file. More...
 
MG_EXPORT HCURSOR GUIAPI LoadCursorFromMem (const void *area)
 Loads a cursor from a memory area. More...
 
MG_EXPORT HCURSOR GUIAPI CreateCursor (int xhotspot, int yhotspot, int w, int h, const BYTE *pANDBits, const BYTE *pXORBits, int colornum)
 Creates a cursor from memory data. More...
 
MG_EXPORT HCURSOR GUIAPI CopyCursor (HCURSOR hcsr)
 Copies a cursor object. More...
 
MG_EXPORT BOOL GUIAPI DestroyCursor (HCURSOR hcsr)
 Destroys a cursor object. More...
 
MG_EXPORT HCURSOR GUIAPI GetSystemCursor (int csrid)
 Get the handle to a system cursor by its identifier. More...
 
MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void)
 Get the handle to the current cursor. More...
 
MG_EXPORT void GUIAPI ClipCursor (const RECT *prc)
 Clips the cursor range. More...
 
MG_EXPORT void GUIAPI GetClipCursor (RECT *prc)
 Get the current cursor clipping rectangle. More...
 
MG_EXPORT void GUIAPI GetCursorPos (POINT *ppt)
 Get position of the current cursor. More...
 
MG_EXPORT void GUIAPI SetCursorPos (int x, int y)
 Set position of the current cursor. More...
 
MG_EXPORT HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def)
 Changes the current cursor. More...
 
MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void)
 Get the default cursor. More...
 
MG_EXPORT int GUIAPI ShowCursor (BOOL fShow)
 Shows or hides cursor. More...
 

Detailed Description

Macro Definition Documentation

◆ IDC_ARROW

#define IDC_ARROW   0

System arrow cursor index.

Definition at line 3934 of file minigui.h.

◆ IDC_BUSY

#define IDC_BUSY   12

System busy cursor index.

Definition at line 3958 of file minigui.h.

◆ IDC_COLOMN

#define IDC_COLOMN   15

System colomn cursor index.

Definition at line 3964 of file minigui.h.

◆ IDC_CROSS

#define IDC_CROSS   3

System cross cursor index.

Definition at line 3940 of file minigui.h.

◆ IDC_DRAG

#define IDC_DRAG   17

System drag cursor index.

Definition at line 3968 of file minigui.h.

◆ IDC_HAND_POINT

#define IDC_HAND_POINT   19

System hand point cursor index.

Definition at line 3972 of file minigui.h.

◆ IDC_HAND_SELECT

#define IDC_HAND_SELECT   20

System hand select cursor index.

Definition at line 3974 of file minigui.h.

◆ IDC_HELP

#define IDC_HELP   11

System help cursor index.

Definition at line 3956 of file minigui.h.

◆ IDC_IBEAM

#define IDC_IBEAM   1

System beam cursor index.

Definition at line 3936 of file minigui.h.

◆ IDC_MOVE

#define IDC_MOVE   4

System move cursor index.

Definition at line 3942 of file minigui.h.

◆ IDC_NODROP

#define IDC_NODROP   18

System nodrop cursor index.

Definition at line 3970 of file minigui.h.

◆ IDC_NONE

#define IDC_NONE   10

System none cursor index.

Definition at line 3954 of file minigui.h.

◆ IDC_PENCIL

#define IDC_PENCIL   2

System pencil cursor index.

Definition at line 3938 of file minigui.h.

◆ IDC_RARROW

#define IDC_RARROW   14

System right arrow cursor index.

Definition at line 3962 of file minigui.h.

◆ IDC_ROW

#define IDC_ROW   16

System row cursor index.

Definition at line 3966 of file minigui.h.

◆ IDC_SIZENESW

#define IDC_SIZENESW   6

System size northeast to southwest cursor index.

Definition at line 3946 of file minigui.h.

◆ IDC_SIZENS

#define IDC_SIZENS   8

System north to south cursor index.

Definition at line 3950 of file minigui.h.

◆ IDC_SIZENWSE

#define IDC_SIZENWSE   5

System size northwest to southeast cursor index.

Definition at line 3944 of file minigui.h.

◆ IDC_SIZEWE

#define IDC_SIZEWE   7

System west to east cursor index.

Definition at line 3948 of file minigui.h.

◆ IDC_SPLIT_HORZ

#define IDC_SPLIT_HORZ   21

System horizontal split cursor index.

Definition at line 3976 of file minigui.h.

◆ IDC_SPLIT_VERT

#define IDC_SPLIT_VERT   22

System vertical cursor index.

Definition at line 3978 of file minigui.h.

◆ IDC_UPARROW

#define IDC_UPARROW   9

System up arrow cursor index.

Definition at line 3952 of file minigui.h.

◆ IDC_WAIT

#define IDC_WAIT   13

System wait cursor index.

Definition at line 3960 of file minigui.h.

◆ SetCursor

#define SetCursor (   hcsr)    SetCursorEx (hcsr, FALSE)

Changes the current cursor.

This function changes the current cursor to be hcsr.

Parameters
hcsrThe expected cursor handle.
Returns
The old cursor handle.
Note
This function defined as a macro calling SetCursorEx with passing set_def as FALSE.
See also
SetCursorEx, SetDefaultCursor

Definition at line 4113 of file minigui.h.

◆ SetDefaultCursor

#define SetDefaultCursor (   hcsr)    SetCursorEx (hcsr, TRUE)

Changes the current cursor, and set it as the default cursor.

This function changes the current cursor to be hcsr, and set it as the default cursor.

Parameters
hcsrThe expected cursor handle.
Returns
The old cursor handle.
Note
This function defined as a macro calling SetCursorEx with passing set_def as TRUE.
See also
SetCursorEx, SetCursor

Definition at line 4130 of file minigui.h.

Function Documentation

◆ ClipCursor()

void GUIAPI ClipCursor ( const RECT prc)

Clips the cursor range.

This function sets cursor's clipping rectangle. prc is the new clipping rectangle in screen coordinates. If prc is NULL, ClipCursor will disable cursor clipping.

Parameters
prcThe clipping rectangle.
Returns
None.

◆ CopyCursor()

HCURSOR GUIAPI CopyCursor ( HCURSOR  hcsr)

Copies a cursor object.

This function copies the specified cursor.

Parameters
hcsrHandle to the cursor to be copied.
Returns
If the function succeeds, the return value is the handle to the duplicate cursor. If the function fails, the return value is 0.

◆ CreateCursor()

HCURSOR GUIAPI CreateCursor ( int  xhotspot,
int  yhotspot,
int  w,
int  h,
const BYTE pANDBits,
const BYTE pXORBits,
int  colornum 
)

Creates a cursor from memory data.

This function creates a cursor from memory data rather than cursor file. xhotspot and yhotspot specify the hotpot of the cursor, w and h are the width and the height of the cursor respectively. pANDBits and pXORBits are AND bitmask and XOR bitmask of the cursor. MiniGUI currently support mono-color cursor and 16-color cursor, colornum specifies the cursor's color depth. For mono-color, it should be 1, and for 16-color cursor, it should be 4.

Parameters
xhotspotThe x-coordinate of the hotspot.
yhotspotThe y-coordinate of the hotspot.
wThe width of the cursor.
hThe height of the cursor.
pANDBitsThe pointer to AND bits of the cursor.
pXORBitsThe pointer to XOR bits of the cursor.
colornumThe bit-per-pixel of XOR bits.
Returns
Handle to the cursor, zero on error.
Note
This function only supports 2-color or 16-color cursor.

◆ DestroyCursor()

BOOL GUIAPI DestroyCursor ( HCURSOR  hcsr)

Destroys a cursor object.

This function destroys a cursor object specified by hcsr.

Parameters
hcsrHandle to the cursor.
Returns
TRUE on success, otherwise FALSE.

◆ GetClipCursor()

void GUIAPI GetClipCursor ( RECT prc)

Get the current cursor clipping rectangle.

This function copies the current clipping rectangle to a RECT pointed to by prc.

Parameters
prcThe clipping rectangle will be saved to this rectangle.
Returns
None.

◆ GetCurrentCursor()

HCURSOR GUIAPI GetCurrentCursor ( void  )

Get the handle to the current cursor.

This function retrives the current cursor and returns its handle.

Returns
Handle to the current system cursor, zero means no current cursor.

◆ GetCursorPos()

void GUIAPI GetCursorPos ( POINT ppt)

Get position of the current cursor.

This function copies the current mouse cursor position to a POINT structure pointed to by ppt.

Parameters
pptThe position will be saved in this buffer.
Returns
None.
See also
SetCursorPos, POINT

◆ GetDefaultCursor()

HCURSOR GUIAPI GetDefaultCursor ( void  )

Get the default cursor.

This function gets the current default cursor.

Returns
The current default cursor handle.
See also
SetCursorEx, SetDefaultCursor

◆ GetSystemCursor()

HCURSOR GUIAPI GetSystemCursor ( int  csrid)

Get the handle to a system cursor by its identifier.

MiniGUI creates (MAX_SYSCURSORINDEX + 1) system cursors for application. You can use GetSystemCursor to get the handle to these system cursors. The identifier can be one of the following:

  • IDC_ARROW
    Normal arrow cursor.
  • IDC_IBEAM
    'I' shaped beam cursor, indicate an input field.
  • IDC_PENCIL
    Pencil-shape cursor.
  • IDC_CROSS
    Cross cursor.
  • IDC_MOVE
    Moving cursor.
  • IDC_SIZENWSE
    Sizing cursor, along north-west and south-east.
  • IDC_SIZENESW
    Sizing cursor, along north-east and south-west.
  • IDC_SIZEWE
    Sizing cursor, along west and east.
  • IDC_SIZENS
    Sizing cursor, along north and south.
  • IDC_UPARROW
    Up arrow cursor.
  • IDC_NONE
    None cursor.
  • IDC_HELP
    Arrow with question.
  • IDC_BUSY
    Busy cursor.
  • IDC_WAIT
    Wait cursor.
  • IDC_RARROW
    Right arrow cursor.
  • IDC_COLOMN
    Cursor indicates column.
  • IDC_ROW
    Cursor indicates row.
  • IDC_DRAG
    Draging cursor.
  • IDC_NODROP
    No droping cursor.
  • IDC_HAND_POINT
    Hand point cursor.
  • IDC_HAND_SELECT
    Hand selection cursor.
  • IDC_SPLIT_HORZ
    Horizontal splitting cursor.
  • IDC_SPLIT_VERT
    Vertical splitting cursor.
Parameters
csridThe identifier of the system cursor.
Returns
Handle to the system cursor, otherwise zero.

◆ LoadCursorFromFile()

HCURSOR GUIAPI LoadCursorFromFile ( const char *  filename)

Loads a cursor from a M$ Windows cursor file.

This function loads a cursor from M$ Windows *.cur file named filename and returns the handle to loaded cursor. The returned handle can be used by SetCursor to set new mouse cursor.

Parameters
filenameThe path name of the cursor file.
Returns
Handle to the cursor, zero on error.
Note
This function does not support 256-color or animation cursor.
See also
SetCursor

◆ LoadCursorFromMem()

HCURSOR GUIAPI LoadCursorFromMem ( const void *  area)

Loads a cursor from a memory area.

This function loads a cursor from a memory area pointed to by area. The memory has the same layout as a M$ Windows CURSOR file. The returned handle can be used by SetCursor to set new mouse cursor.

Parameters
areaThe pointer to the cursor data.
Returns
Handle to the cursor, zero on error.
Note
This function does not support 256-color or animation cursor.
See also
SetCursor

◆ SetCursorEx()

HCURSOR GUIAPI SetCursorEx ( HCURSOR  hcsr,
BOOL  set_def 
)

Changes the current cursor.

This function changes the current cursor to be hcsr, and/or sets it to be the default cursor.

If you pass set_def as TRUE, the expected cursor will be the default cursor. The default cursor will be used when you move the cursor to the desktop.

Parameters
hcsrThe expected cursor handle.
set_defIndicates whether setting the cursor as the default cursor.
Returns
The old cursor handle.
See also
SetCursor, SetDefaultCursor, GetDefaultCursor

◆ SetCursorPos()

void GUIAPI SetCursorPos ( int  x,
int  y 
)

Set position of the current cursor.

This function sets mouse cursor position with the given arguments: (x,y).

Parameters
xThe x-corrdinate of the expected poistion.
yThe y-corrdinate of the expected poistion.
Returns
None.
See also
GetCursorPos

◆ ShowCursor()

int GUIAPI ShowCursor ( BOOL  fShow)

Shows or hides cursor.

This function shows or hides cursor according to the argument fShow. Show cursor when fShow is TRUE, and hide cursor when fShow is FALSE. MiniGUI maintains a showing count value. Calling ShowCursor once, the count will increase when fShow is TRUE, or decrease one when FALSE. When the count is less than 0, the cursor will disapear actually.

Parameters
fShowIndicates show or hide the cursor.
Returns
Cursor showing count value.