MiniGUI API Reference (MiniGUI-Standalone)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Data Structures | Macros | Typedefs
common.h File Reference

This file includes macro definitions and typedefs that commonly used by MiniGUI. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
#include <errno.h>
#include <assert.h>
#include <limits.h>

Go to the source code of this file.

Data Structures

struct  _RECT
 
struct  _POINT
 
struct  _SIZE
 
struct  _RGB
 
struct  _GAL_Color
 
struct  _GAL_Palette
 
struct  _GAL_Rect
 

Macros

#define _VERSION_CODE(major, minor, micro)   (((major)<<16) | ((minor)<<8) | (micro))
 A macro that returns the version code from major, minor and micro version number. More...
 
#define _MINIGUI_VERSION_CODE   ((MINIGUI_MAJOR_VERSION << 16) | (MINIGUI_MINOR_VERSION << 8) | MINIGUI_MICRO_VERSION)
 Version code of MiniGUI. More...
 
#define MGUI_LIL_ENDIAN   1234
 Little endianness. More...
 
#define MGUI_BIG_ENDIAN   4321
 Big endianness. More...
 
#define MGUI_BYTEORDER   MGUI_LIL_ENDIAN
 The byte order (endianness) of the target system. More...
 
#define FALSE   0
 FALSE value, defined as 0 by MiniGUI. More...
 
#define TRUE   1
 TRUE value, defined as 1 by MiniGUI. More...
 
#define NULL   ((void *)0)
 A value indicates null pointer. More...
 
#define INV_PTR   ((void *)-1)
 A value indicates an invalid non-null pointer. More...
 
#define SIZEOF_PTR   4
 The size of a pointer. 4 for 32-bit and 8 for 64-bit. More...
 
#define SIZEOF_HPTR   2
 The size of a half or pointer. 2 for 32-bit and 4 for 64-bit. More...
 
#define LOBYTE(w)   ((BYTE)(w))
 Returns the low byte of the word w. More...
 
#define HIBYTE(w)   ((BYTE)(((WORD)(w) >> NR_BITS_BYTE) & BITMASK_BYTE))
 Returns the high byte of the word w. More...
 
#define MAKEWORD(low, high)   ((WORD)(((BYTE)(low)) | (((WORD)((BYTE)(high))) << NR_BITS_BYTE)))
 Makes a word from low byte and high byte. More...
 
#define MAKEWORD16(low, high)   ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
 Makes a 16-bit word from low byte and high byte. More...
 
#define MAKEWPARAM(first, second, third, fourth)
 Makes a WPARAM value with four bytes. More...
 
#define FIRSTBYTE(w)   ((BYTE)(w))
 Returns the first byte of the WPARAM w. More...
 
#define SECONDBYTE(w)   ((BYTE)(((DWORD32)(w)) >> 8))
 Returns the second byte of the WPARAM w. More...
 
#define THIRDBYTE(w)   ((BYTE)(((DWORD32)(w)) >> 16))
 Returns the third byte of the WPARAM w. More...
 
#define FOURTHBYTE(w)   ((BYTE)(((DWORD32)(w)) >> 24))
 Returns the fourth byte of the WPARAM w. More...
 
#define LOWORD(l)   ((WORD)(DWORD)(l))
 Returns the low word of the double word l. More...
 
#define HIWORD(l)   ((WORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
 Returns the high word of the double word l. More...
 
#define LOSWORD(l)   ((SWORD)(DWORD)(l))
 Returns the low signed word of the double word l. More...
 
#define HISWORD(l)   ((SWORD)((((DWORD)(l)) >> NR_BITS_WORD) & BITMASK_WORD))
 Returns the high signed word of the double word l. More...
 
#define MAKELONG32(low, high)   ((DWORD32)(((WORD16)(low)) | (((DWORD32)((WORD16)(high))) << 16)))
 Makes a 32-bit double word from low word and high word which are both in 16-bit. More...
 
#define MAKELONG(low, high)   ((DWORD)(((WORD)(low)) | (((DWORD)((WORD)(high))) << NR_BITS_WORD)))
 Makes a double word with pointer precision from low word and high word. More...
 
#define GetRValue(rgba)   ((BYTE)(rgba))
 Gets the red component from a RGBA triple value rgba. More...
 
#define GetGValue(rgba)   ((BYTE)(((DWORD32)(rgba)) >> 8))
 Gets the green component from a RGBA triple value rgba. More...
 
#define GetBValue(rgba)   ((BYTE)((DWORD32)(rgba) >> 16))
 Gets the blue component from a RGBA triple value rgba. More...
 
#define GetAValue(rgba)   ((BYTE)((DWORD32)(rgba) >> 24))
 Gets the alpha component from a RGBA triple value rgba. More...
 
#define MakeRGBA(r, g, b, a)
 Makes a RGBA triple value from red r, green g, blue b and alpha components. More...
 
#define MakeRGB(r, g, b)
 Makes a RGB triple value from red r, green g, and blue b components. More...
 
#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...
 
#define ERR_OK   0
 Return value error ok. More...
 
#define ERR_INV_HWND   -1
 Return value invalid window handle error. More...
 
#define ERR_QUEUE_FULL   -2
 Return value queue is full error. More...
 
#define ERR_INVALID_HANDLE   -3
 Return value invalid handle error. More...
 
#define ERR_INVALID_HMENU   -4
 Return value invalid menu handle error. More...
 
#define ERR_INVALID_POS   -5
 Return value invalid postion error. More...
 
#define ERR_INVALID_ID   -6
 Return value invalid id error. More...
 
#define ERR_RES_ALLOCATION   -7
 Return value allocation resource error . More...
 
#define ERR_CTRLCLASS_INVNAME   -8
 Return value invalid name of control class error. More...
 
#define ERR_CTRLCLASS_INVLEN   -9
 Return value control class invalid length. More...
 
#define ERR_CTRLCLASS_MEM   -10
 Return value control class memory error. More...
 
#define ERR_CTRLCLASS_INUSE   -11
 Return value inuse control class error. More...
 
#define ERR_ALREADY_EXIST   -12
 Return value already exit error. More...
 
#define ERR_NO_MATCH   -13
 Return no match error. More...
 
#define ERR_BAD_OWNER   -14
 Return bad owner error. More...
 
#define ERR_IME_TOOMUCHIMEWND   -15
 Return value too much IME window error. More...
 
#define ERR_IME_NOSUCHIMEWND   -16
 Return value no such IME wondow error. More...
 
#define ERR_IME_NOIMEWND   -17
 Return value no IME wondow error. More...
 
#define ERR_CONFIG_FILE   -18
 Return value configure file error. More...
 
#define ERR_FILE_IO   -19
 Return value file I/O error. More...
 
#define ERR_GFX_ENGINE   -20
 Return value GFX engine error. More...
 
#define ERR_INPUT_ENGINE   -21
 Return value input engine error. More...
 
#define ERR_NO_ENGINE   -22
 Return value no engine error. More...
 
#define ERR_INVALID_ARGS   -23
 Return value invalid arguments. More...
 
#define TABLESIZE(table)   (sizeof(table)/sizeof(table[0]))
 A macro returns the number of elements in a table. More...
 
#define MAX(x, y)   (((x) > (y))?(x):(y))
 A macro returns the maximum of x and y. More...
 
#define MIN(x, y)   (((x) < (y))?(x):(y))
 A macro returns the minimum of x and y. More...
 
#define ABS(x)   (((x)<0) ? -(x) : (x))
 A macro returns the absolute value of x. More...
 
#define MAX_PATH   PATH_MAX
 The possible maximal length of a path name. More...
 
#define MAX_NAME   NAME_MAX
 The possible maximal length of a file name. More...
 

Typedefs

typedef unsigned char Uint8
 A type definition for an 8-bit unsigned character. More...
 
typedef signed char Sint8
 A type definition for an 8-bit signed character. More...
 
typedef unsigned short Uint16
 A type definition for a 16-bit unsigned integer. More...
 
typedef signed short Sint16
 A type definition for a 16-bit signed integer. More...
 
typedef unsigned int Uint32
 A type definition for a 32-bit unsigned integer. More...
 
typedef signed int Sint32
 A type definition for a 32-bit signed integer. More...
 
typedef unsigned long long Uint64
 A type definition for a 64-bit unsigned integer. More...
 
typedef signed long long Sint64
 A type definition for a 64-bit signed integer. More...
 
typedef void * PVOID
 A type definition for a pointer to any type. More...
 
typedef int BOOL
 A type definition for boolean value. More...
 
typedef PVOID GHANDLE
 General handle. More...
 
typedef GHANDLE HWND
 Handle to main window or control. More...
 
typedef GHANDLE HDC
 Handle to device context. More...
 
typedef GHANDLE HPALETTE
 Handle to a logical palette. More...
 
typedef GHANDLE HCURSOR
 Handle to cursor. More...
 
typedef GHANDLE HICON
 Handle to icon. More...
 
typedef GHANDLE HMENU
 Handle to menu. More...
 
typedef GHANDLE HACCEL
 Handle to accelarator. More...
 
typedef GHANDLE HDLG
 Handle to dialog box, same as HWND. More...
 
typedef GHANDLE HHOOK
 Handle to keyboard or mouse event hook. More...
 
typedef unsigned char BYTE
 A type definition for an 8-bit unsigned character (byte). More...
 
typedef signed char SBYTE
 A type definition for an 8-bit signed character. More...
 
typedef unsigned short WORD_HPTR
 An unsigned int (word) type in half pointer precision. More...
 
typedef signed short SWORD_HPTR
 An signed int type in half pointer precision. More...
 
typedef WORD_HPTR WORD
 A type definition for an unsigned integer (word). More...
 
typedef SWORD_HPTR SWORD
 A type definition for a signed integer. More...
 
typedef unsigned short WORD16
 A type definition for a 16-bit unsigned integer (word). More...
 
typedef signed short SWORD16
 A type definition for a 16-bit signed integer. More...
 
typedef long LONG_PTR
 A signed long type for pointer precision. More...
 
typedef LONG_PTR LINT
 Signed integer which has pointer precision. More...
 
typedef LONG_PTR LRESULT
 Signed result of message processing. More...
 
typedef unsigned long DWORD_PTR
 An unsigned long type for pointer precision. More...
 
typedef DWORD_PTR DWORD
 A unsigned long type definition for pointer precision. More...
 
typedef unsigned int DWORD32
 A type definition for a 32-bit unsigned integer. More...
 
typedef signed long SDWORD_PTR
 A signed long type for pointer precision. More...
 
typedef SDWORD_PTR SDWORD
 A signed long type definition for pointer precision. More...
 
typedef signed int SDWORD32
 A type definition for a 32-bit signed integer. More...
 
typedef unsigned int UINT
 A type definition for unsigned integer. More...
 
typedef int INT_PTR
 A signed integer type for pointer precision. More...
 
typedef unsigned long UINT_PTR
 A unsigned integer type for pointer precision. More...
 
typedef long LONG
 A type definition for long integer. More...
 
typedef unsigned long ULONG
 A type definition for unsigned long integer. More...
 
typedef UINT_PTR WPARAM
 A type definition for the first message paramter. More...
 
typedef UINT_PTR LPARAM
 A type definition for the second message paramter. More...
 
typedef DWORD32 RGBCOLOR
 A type definition for a RGB color. More...
 
typedef struct _RECT RECT
 
typedef RECTPRECT
 Data type of the pointer to a RECT. More...
 
typedef struct _POINT POINT
 
typedef POINTPPOINT
 Data type of the pointer to a POINT. More...
 
typedef struct _SIZE SIZE
 
typedef SIZEPSIZE
 Data type of the pointer to a SIZE. More...
 
typedef struct _RGB RGB
 
typedef RGBPRGB
 Data type of the pointer to a RGB. More...
 
typedef Sint8 gal_sint8
 Data type of 8-bit signed integer. More...
 
typedef Uint8 gal_uint8
 Data type of 8-bit unsigned integer. More...
 
typedef Sint16 gal_sint16
 Data type of 16-bit signed integer. More...
 
typedef Uint16 gal_uint16
 Data type of 16-bit unsigned integer. More...
 
typedef Sint32 gal_sint32
 Data type of 32-bit signed integer. More...
 
typedef Uint32 gal_uint32
 Data type of 32-bit unsigned integer. More...
 
typedef signed int gal_sint
 Data type of signed integer. More...
 
typedef unsigned int gal_uint
 Data type of unsigned integer. More...
 
typedef Uint32 gal_pixel
 Data type of pixel value. More...
 
typedef Uint32 gal_attr
 Data type of attribute value. More...
 
typedef long fixed
 Data type of fixed point. More...
 
typedef struct _GAL_Color GAL_Color
 
typedef struct _GAL_Palette GAL_Palette
 
typedef struct _GAL_Rect GAL_Rect
 

Detailed Description

This file includes macro definitions and typedefs that commonly used by MiniGUI.

Author
Wei Yongming vince.nosp@m.nt@m.nosp@m.inigu.nosp@m.i.or.nosp@m.g
Date
2002/01/06
   This file is part of MiniGUI, a mature cross-platform windowing 
   and Graphics User Interface (GUI) support system for embedded systems
   and smart IoT devices.

   Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
   Copyright (C) 1998~2002, WEI Yongming

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

   Or,

   As this program is a library, any link to this program must follow
   GNU General Public License version 3 (GPLv3). If you cannot accept
   GPLv3, you need to be licensed from FMSoft.

   If you have got a commercial license of this program, please use it
   under the terms and conditions of the commercial license.

   For more information about the commercial license, please refer to
   <http://www.minigui.com/en/about/licensing-policy/>.

Definition in file common.h.