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

Macros

#define MGUI_NR_KEYS   255
 Number of MiniGUI keys. More...
 
#define NR_KEYS   250
 The number of keys defined by Linux operating system. More...
 
#define SCANCODE_USER   (NR_KEYS + 1)
 The first key scan code different from OS defined ones. More...
 
#define KS_LEFTMETA   0x00002000
 This status indicate that left-Meta key was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTMETA   0x00001000
 This status indicate that right-Meta key was pressed when the key or mouse message posted to the window. More...
 
#define KS_META   0x00003000
 This status indicate that either the left-Meta key or the right-Meta key was pressed when the key or mouse message posted to the window. More...
 
#define KS_REPEATED   0x00000800
 This status indicate that the key down message is an auto-repeated one. More...
 
#define KS_CAPTURED   0x00000400
 This status indicate that the mouse is captured by a window when the mouse message posted. More...
 
#define KS_IMEPOST   0x00000200
 This status indicate that the key message is posted by the IME window. More...
 
#define KS_CAPSLOCK   0x00000100
 This status indicate that the CapsLock key was locked when the key or mouse message posted to the window. More...
 
#define KS_NUMLOCK   0x00000080
 This status indicate that the NumLock key was locked when the key or mouse message posted to the window. More...
 
#define KS_SCROLLLOCK   0x00000040
 This status indicate that the ScrollLock key was locked when the key or mouse message posted to the window. More...
 
#define KS_LEFTCTRL   0x00000020
 This status indicate that the left-Ctrl key was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTCTRL   0x00000010
 This status indicate that the right-Ctrl key was pressed when the key or mouse message posted to the window. More...
 
#define KS_CTRL   0x00000030
 This status indicate that either the left-Ctrl key or the right-Ctrl key was pressed when the key or mouse message posted to the window. More...
 
#define KS_LEFTALT   0x00000008
 This status indicate that left-Alt key was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTALT   0x00000004
 This status indicate that right-Alt key was pressed when the key or mouse message posted to the window. More...
 
#define KS_ALT   0x0000000C
 This status indicate that either the left-Alt key or the right-Alt key was pressed when the key or mouse message posted to the window. More...
 
#define KS_LEFTSHIFT   0x00000002
 This status indicate that left-Shift key was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTSHIFT   0x00000001
 This status indicate that right-Shift key was pressed when the key or mouse message posted to the window. More...
 
#define KS_SHIFT   0x00000003
 This status indicate that either the left-Shift key or the right-Shift key was pressed when the key or mouse message posted to the window. More...
 
#define MASK_KS_SHIFTKEYS   0x0000FFFF
 The mask of key status. More...
 
#define KS_LEFTBUTTON   0x00010000
 This status indicate that left button was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTBUTTON   0x00020000
 This status indicate that right button was pressed when the key or mouse message posted to the window. More...
 
#define KS_MIDDLEBUTTON   0x00040000
 This status indicate that middle button was pressed when the key or mouse message posted to the window. More...
 
#define MASK_KS_BUTTONS   0x000F0000
 The mask of mouse button status. More...
 

Detailed Description

Macro Definition Documentation

◆ KS_ALT

#define KS_ALT   0x0000000C

This status indicate that either the left-Alt key or the right-Alt key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1724 of file common.h.

◆ KS_CAPSLOCK

#define KS_CAPSLOCK   0x00000100

This status indicate that the CapsLock key was locked when the key or mouse message posted to the window.

You can test the status by AND'ed with lParam of the message, like below

switch (message) {
if (lParam & KS_CAPSLOCK) {
// the CapsLock key is locked.
...
}
break;
...
See also
Key event messages

Definition at line 1651 of file common.h.

◆ KS_CAPTURED

#define KS_CAPTURED   0x00000400

This status indicate that the mouse is captured by a window when the mouse message posted.

You can test the status by AND'ed with wParam of the message, like below:

switch (message) {
if (wParam & KS_CAPTURED) {
// the mouse is captured by this window.
...
}
break;
...
See also
Mouse event messages

Definition at line 1621 of file common.h.

◆ KS_CTRL

#define KS_CTRL   0x00000030

This status indicate that either the left-Ctrl key or the right-Ctrl key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1697 of file common.h.

◆ KS_IMEPOST

#define KS_IMEPOST   0x00000200

This status indicate that the key message is posted by the IME window.

See also
Key event messages

Definition at line 1629 of file common.h.

◆ KS_LEFTALT

#define KS_LEFTALT   0x00000008

This status indicate that left-Alt key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1706 of file common.h.

◆ KS_LEFTBUTTON

#define KS_LEFTBUTTON   0x00010000

This status indicate that left button was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1767 of file common.h.

◆ KS_LEFTCTRL

#define KS_LEFTCTRL   0x00000020

This status indicate that the left-Ctrl key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1678 of file common.h.

◆ KS_LEFTMETA

#define KS_LEFTMETA   0x00002000

This status indicate that left-Meta key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Since 4.0.0

Definition at line 1555 of file common.h.

◆ KS_LEFTSHIFT

#define KS_LEFTSHIFT   0x00000002

This status indicate that left-Shift key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1733 of file common.h.

◆ KS_META

#define KS_META   0x00003000

This status indicate that either the left-Meta key or the right-Meta key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Since 4.0.0

Definition at line 1577 of file common.h.

◆ KS_MIDDLEBUTTON

#define KS_MIDDLEBUTTON   0x00040000

This status indicate that middle button was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1785 of file common.h.

◆ KS_NUMLOCK

#define KS_NUMLOCK   0x00000080

This status indicate that the NumLock key was locked when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1660 of file common.h.

◆ KS_REPEATED

#define KS_REPEATED   0x00000800

This status indicate that the key down message is an auto-repeated one.

You can test the status by AND'ed with lParam of the message, like below:

switch (message) {
if (lParam & KS_REPEATED) {
// the key down messsage is auto-repeated.
...
}
break;
...
See also
Key event messages

Definition at line 1599 of file common.h.

◆ KS_RIGHTALT

#define KS_RIGHTALT   0x00000004

This status indicate that right-Alt key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1715 of file common.h.

◆ KS_RIGHTBUTTON

#define KS_RIGHTBUTTON   0x00020000

This status indicate that right button was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1776 of file common.h.

◆ KS_RIGHTCTRL

#define KS_RIGHTCTRL   0x00000010

This status indicate that the right-Ctrl key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1687 of file common.h.

◆ KS_RIGHTMETA

#define KS_RIGHTMETA   0x00001000

This status indicate that right-Meta key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Since 4.0.0

Definition at line 1566 of file common.h.

◆ KS_RIGHTSHIFT

#define KS_RIGHTSHIFT   0x00000001

This status indicate that right-Shift key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1742 of file common.h.

◆ KS_SCROLLLOCK

#define KS_SCROLLLOCK   0x00000040

This status indicate that the ScrollLock key was locked when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1669 of file common.h.

◆ KS_SHIFT

#define KS_SHIFT   0x00000003

This status indicate that either the left-Shift key or the right-Shift key was pressed when the key or mouse message posted to the window.

See also
Key event messages

Definition at line 1752 of file common.h.

◆ MASK_KS_BUTTONS

#define MASK_KS_BUTTONS   0x000F0000

The mask of mouse button status.

Definition at line 1791 of file common.h.

◆ MASK_KS_SHIFTKEYS

#define MASK_KS_SHIFTKEYS   0x0000FFFF

The mask of key status.

Definition at line 1758 of file common.h.

◆ MGUI_NR_KEYS

#define MGUI_NR_KEYS   255

Number of MiniGUI keys.

The number of MiniGUI keys is defined to 255 by default. This means that MiniGUI can destinguish 255 different keys with each has an unique scan code. The scan codes below 251 are defined for Linux keyboard keys by default. If your system has a large amount of keys, you can define the scan code of keys ranged from 1 to 255 in your IAL engine. And your application will receive a MSG_KEYDOWN and MSG_KEYUP messages when a key pressed and released, and the wParam of the messages will be defined to be equal to the scan code of the key.

See also
NR_KEYS, SCANCODE_USER

Definition at line 1196 of file common.h.

◆ NR_KEYS

#define NR_KEYS   250

The number of keys defined by Linux operating system.

For a Linux box, NR_KEYS is defined to 250 by default. You can define some input events from an input device other than keyboard, e.g. your remote controller, as key events with different scan codes from those of PC's. MiniGUI can support 255 keys, and the constant is defined by MGUI_NR_KEYS.

See also
MGUI_NR_KEYS

Definition at line 1211 of file common.h.

◆ SCANCODE_USER

#define SCANCODE_USER   (NR_KEYS + 1)

The first key scan code different from OS defined ones.

You can define your special key scan codes like below

#define SCANCODE_PLAY (SCANCODE_USER)
#define SCANCODE_STOP (SCANCODE_USER + 1)
#define SCANCODE_PAUSE (SCANCODE_USER + 2)

to distinguish the keys on your remote controller.

See also
MGUI_NR_KEYS, NR_KEYS

Definition at line 1230 of file common.h.

KS_REPEATED
#define KS_REPEATED
This status indicate that the key down message is an auto-repeated one.
Definition: common.h:1599
KS_CAPTURED
#define KS_CAPTURED
This status indicate that the mouse is captured by a window when the mouse message posted.
Definition: common.h:1621
KS_CAPSLOCK
#define KS_CAPSLOCK
This status indicate that the CapsLock key was locked when the key or mouse message posted to the win...
Definition: common.h:1651
MSG_KEYDOWN
#define MSG_KEYDOWN
User presses a key down.
Definition: window.h:568
MSG_MOUSEMOVE
#define MSG_MOUSEMOVE
The mouse moved message.
Definition: window.h:187