MiniGUI API Reference (MiniGUI-Processes)  v3.2.0
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   128
 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_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   0x00000FFF
 The mask of key status. More...
 
#define KS_LEFTBUTTON   0x00001000
 This status indicate that left button was pressed when the key or mouse message posted to the window. More...
 
#define KS_RIGHTBUTTON   0x00002000
 This status indicate that right button was pressed when the key or mouse message posted to the window. More...
 
#define KS_MIDDLBUTTON   0x00004000
 This status indicate that middle button was pressed when the key or mouse message posted to the window. More...
 
#define MASK_KS_BUTTONS   0x0000F000
 The mask of mouse button status. More...
 

Detailed Description

Macro Definition Documentation

#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 1429 of file common.h.

#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

1 switch (message) {
2 case MSG_KEYDOWN:
3  if (lParam & KS_CAPSLOCK) {
4  // the CapsLock key is locked.
5  ...
6  }
7  break;
8 ...
See also
Key event messages

Definition at line 1357 of file common.h.

#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:

1 switch (message) {
2 case MSG_MOUSEMOVE:
3  if (wParam & KS_CAPTURED) {
4  // the mouse is captured by this window.
5  ...
6  }
7  break;
8 ...
See also
Mouse event messages

Definition at line 1327 of file common.h.

#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 1402 of file common.h.

#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 1335 of file common.h.

#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 1411 of file common.h.

#define KS_LEFTBUTTON   0x00001000

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 1471 of file common.h.

#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 1384 of file common.h.

#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 1438 of file common.h.

#define KS_MIDDLBUTTON   0x00004000

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 1489 of file common.h.

#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 1366 of file common.h.

#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:

1 switch (message) {
2 case MSG_KEYDOWN:
3  if (lParam & KS_REPEATED) {
4  // the key down messsage is auto-repeated.
5  ...
6  }
7  break;
8 ...
See also
Key event messages

Definition at line 1305 of file common.h.

#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 1420 of file common.h.

#define KS_RIGHTBUTTON   0x00002000

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 1480 of file common.h.

#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 1393 of file common.h.

#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 1447 of file common.h.

#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 1375 of file common.h.

#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 1456 of file common.h.

#define MASK_KS_BUTTONS   0x0000F000

The mask of mouse button status.

Definition at line 1495 of file common.h.

#define MASK_KS_SHIFTKEYS   0x00000FFF

The mask of key status.

Definition at line 1462 of file common.h.

#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 129 are defined for PC keyboard 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 1104 of file common.h.

#define NR_KEYS   128

The number of keys defined by Linux operating system.

For a PC box, NR_KEYS is defined to 128 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 1119 of file common.h.

#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

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

to distinguish the keys on your remote controller.

See also
MGUI_NR_KEYS, NR_KEYS

Definition at line 1138 of file common.h.