MiniGUI API Reference (MiniGUI-Threads)  v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Data Structures | Macros | Typedefs | Functions | Variables
minigui.h File Reference

This file includes global and miscellaneous interfaces of MiniGUI. More...

#include <stdio.h>
#include <sys/types.h>

Go to the source code of this file.

Data Structures

struct  _DESKTOPOPS
 
struct  _ETCSECTION
 
struct  _ETC_S
 

Macros

#define g_rcScr   (GetScreenRect())
 Contains the rectangle of the whole screen. More...
 
#define g_rcDesktop   g_rcScr
 Contains the rectangle of desktop of the application. More...
 
#define NAME_SELF_LAYER   ""
 The name of the self layer. More...
 
#define NAME_TOPMOST_LAYER   ""
 The name of the topmost layer. More...
 
#define NAME_DEF_LAYER   "mginit"
 The default name of the layer. More...
 
#define ReinitDesktop()   ReinitDesktopEx (TRUE)
 Re-initializes the desktop including the local system text. More...
 
#define MiniGUIMain
 The main entry of a MiniGUI application. More...
 
#define IDM_DTI_FIRST   (300)
 The minimum interger value of command ID when user customize desktop menu. More...
 
#define ETC_MAXLINE   1024
 The max line number of etc file. More...
 
#define ETC_FILENOTFOUND   -1
 No found etc file. More...
 
#define ETC_SECTIONNOTFOUND   -2
 No found section in etc file. More...
 
#define ETC_KEYNOTFOUND   -3
 No found key in etc file. More...
 
#define ETC_TMPFILEFAILED   -4
 Create tmpfile failed. More...
 
#define ETC_FILEIOFAILED   -5
 IO operation failed to etc file. More...
 
#define ETC_INTCONV   -6
 Convert the value string to an integer failed. More...
 
#define ETC_INVALIDOBJ   -7
 Invalid object to etc file. More...
 
#define ETC_READONLYOBJ   -8
 Read only to etc file. More...
 
#define ETC_OK   0
 Operate success to etc file. More...
 
#define SetValueToEtc(hEtc, pSection, pKey, pValue)   GetValueFromEtc(hEtc, pSection, pKey, pValue, -1)
 Set the value in the etc object. More...
 
#define LEN_CLIPBOARD_NAME   15
 The maximum length of the name of clipboard. More...
 
#define NR_CLIPBOARDS   4
 The maximum number of clipboard. More...
 
#define CBNAME_TEXT   ("text")
 The default clipboard name of text control. More...
 
#define CBERR_OK   0
 Operate clipboard success. More...
 
#define CBERR_BADNAME   1
 Bad name to clipboard. More...
 
#define CBERR_NOMEM   2
 No enough memory to clipboard. More...
 
#define CBOP_NORMAL   0
 Overwrite operation to clipboard. More...
 
#define CBOP_APPEND   1
 Append the new data to clipboarda after the old data. More...
 
#define Beep   Ping
 Alias of Ping. More...
 
#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...
 
#define IDS_MGST_WINDOW   0
 The identifier of the window system text. More...
 
#define IDS_MGST_START   1
 The identifier of the start system text. More...
 
#define IDS_MGST_REFRESH   2
 The identifier of the refresh background system text. More...
 
#define IDS_MGST_CLOSEALLWIN   3
 The identifier of the close all windows system text. More...
 
#define IDS_MGST_ENDSESSION   4
 The identifier of the end session system text. More...
 
#define IDS_MGST_OPERATIONS   5
 The identifier of the operations system text. More...
 
#define IDS_MGST_MINIMIZE   6
 The identifier of the minimize system text. More...
 
#define IDS_MGST_MAXIMIZE   7
 The identifier of the maximize system text. More...
 
#define IDS_MGST_RESTORE   8
 The identifier of the restore system text. More...
 
#define IDS_MGST_CLOSE   9
 The identifier of the close system text. More...
 
#define IDS_MGST_OK   10
 The identifier of the ok system text. More...
 
#define IDS_MGST_NEXT   11
 The identifier of the next system text. More...
 
#define IDS_MGST_CANCEL   12
 The identifier of the cancel system text. More...
 
#define IDS_MGST_PREV   13
 The identifier of the previous system text. More...
 
#define IDS_MGST_YES   14
 The identifier of the yes system text. More...
 
#define IDS_MGST_NO   15
 The identifier of the no system text. More...
 
#define IDS_MGST_ABORT   16
 The identifier of the abort system text. More...
 
#define IDS_MGST_RETRY   17
 The identifier of the retry system text. More...
 
#define IDS_MGST_IGNORE   18
 The identifier of the ignore system text. More...
 
#define IDS_MGST_ABOUTMG   19
 The identifier of the about minigui system text. More...
 
#define IDS_MGST_OPENFILE   20
 The identifier of the open file system text. More...
 
#define IDS_MGST_SAVEFILE   21
 The identifier of the save file system text. More...
 
#define IDS_MGST_COLORSEL   22
 The identifier of the color selection system text. More...
 
#define IDS_MGST_SWITCHLAYER   23
 The identifier of the switch layer system text. More...
 
#define IDS_MGST_DELLAYER   24
 The identifier of the delete layer system text. More...
 
#define IDS_MGST_ERROR   25
 The identifier of the error system text. More...
 
#define IDS_MGST_LOGO   26
 The identifier of the logo system text. More...
 
#define IDS_MGST_CURRPATH   27
 The identifier of the current path system text. More...
 
#define IDS_MGST_FILE   28
 The identifier of the file system text. More...
 
#define IDS_MGST_LOCATION   29
 The identifier of the location system text. More...
 
#define IDS_MGST_UP   30
 The identifier of the up system text. More...
 
#define IDS_MGST_NAME   31
 The identifier of the name system text. More...
 
#define IDS_MGST_SIZE   32
 The identifier of the size system text. More...
 
#define IDS_MGST_ACCESSMODE   33
 The identifier of the access mode system text. More...
 
#define IDS_MGST_LASTMODTIME   34
 The identifier of the last modify time system text. More...
 
#define IDS_MGST_OPEN   35
 The identifier of the open system text. More...
 
#define IDS_MGST_FILENAME   36
 The identifier of the file name system text. More...
 
#define IDS_MGST_FILETYPE   37
 The identifier of the file type system text. More...
 
#define IDS_MGST_SHOWHIDEFILE   38
 The identifier of the show hide file system text. More...
 
#define IDS_MGST_NOTFOUND   39
 The identifier of the not found file system text. More...
 
#define IDS_MGST_NR   40
 The identifier of the can't read system text. More...
 
#define IDS_MGST_NW   41
 The identifier of the can't write system text. More...
 
#define IDS_MGST_INFO   42
 The identifier of the information system text. More...
 
#define IDS_MGST_R   43
 The identifier of the read system text. More...
 
#define IDS_MGST_W   44
 The identifier of the write system text. More...
 
#define IDS_MGST_WR   45
 The identifier of the read and write system text. More...
 
#define IDS_MGST_SAVE   46
 The identifier of the save system text. More...
 
#define IDS_MGST_FILEEXIST   47
 The identifier of the file exist system text. More...
 
#define mg_slice_new(type)   ((type*)mg_slice_alloc(sizeof (type)))
 The macro to allocate a slice memory for a structure. More...
 
#define mg_slice_new0(type)   ((type*)mg_slice_alloc0(sizeof (type)))
 The macro to allocate a zero'd slice memory for a structure. More...
 
#define mg_slice_dup(type, mem)
 Duplicate a structure. More...
 
#define mg_slice_delete(type, mem)
 Free a block of memory. More...
 
#define mg_slice_delete_chain(type, mem_chain, next)
 Free a linked list of memory blocks. More...
 

Typedefs

typedef struct _DESKTOPOPS DESKTOPOPS
 
typedef struct _ETCSECTION ETCSECTION
 
typedef ETCSECTIONPETCSECTION
 
typedef struct _ETC_S ETC_S
 

Functions

MG_EXPORT RECT GUIAPI GetScreenRect (void)
 Return the rectangle of the physical screen. More...
 
MG_EXPORT int GUIAPI InitGUI (int argc, const char *argv[])
 Initialize MiniGUI. More...
 
MG_EXPORT void GUIAPI TerminateGUI (int not_used)
 Terminate MiniGUI. More...
 
MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode)
 The panic of MiniGUI application. More...
 
MG_EXPORT BOOL GUIAPI ReinitDesktopEx (BOOL init_sys_text)
 Re-initializes the desktop. More...
 
MG_EXPORT void GUIAPI ExitGUISafely (int exitcode)
 Exits your MiniGUI application safely. More...
 
MG_EXPORT DESKTOPOPS *GUIAPI SetCustomDesktopOperationSet (DESKTOPOPS *usr_dsk_ops)
 Set customer desktop operation set. More...
 
MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void)
 Update all visible windows on the desktop. More...
 
static GHANDLE GUIAPI JoinLayer (const char *layer_name, const char *client_name, int max_nr_highers, int max_nr_normals)
 The dummy replacement of the same function for MiniGUI-Processes. More...
 
MG_EXPORT BOOL GUIAPI SetMouseCalibrationParameters (const POINT *src_pts, const POINT *dst_pts)
 Set the parameters for doing mouse calibration. More...
 
MG_EXPORT void GUIAPI GetOriginalMousePosition (int *x, int *y)
 Get the original mouse position. More...
 
MG_EXPORT void GUIAPI OpenAboutDialog (void)
 Opens or actives the 'About MiniGUI' dialog. More...
 
MG_EXPORT int GUIAPI GetValueFromEtcFile (const char *pEtcFile, const char *pSection, const char *pKey, char *pValue, int iLen)
 Get value from a configuration file. More...
 
MG_EXPORT int GUIAPI GetIntValueFromEtcFile (const char *pEtcFile, const char *pSection, const char *pKey, int *value)
 Get integer value from a configuration file. More...
 
MG_EXPORT int GUIAPI SetValueToEtcFile (const char *pEtcFile, const char *pSection, const char *pKey, char *pValue)
 Set a value in a configuration file. More...
 
MG_EXPORT int GUIAPI RemoveSectionInEtcFile (const char *pEtcFile, const char *pSection)
 Removes a section in an etc file. More...
 
MG_EXPORT int GUIAPI SaveSectionToEtcFile (const char *pEtcFile, PETCSECTION psect)
 Saves a section to an etc file. More...
 
MG_EXPORT GHANDLE GUIAPI LoadEtcFile (const char *pEtcFile)
 Loads an etc file into memory. More...
 
MG_EXPORT int GUIAPI SaveEtcToFile (GHANDLE hEtc, const char *file_name)
 Saves an ETC object into a file. More...
 
MG_EXPORT int GUIAPI UnloadEtcFile (GHANDLE hEtc)
 Unloads an etc file. More...
 
MG_EXPORT int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char *pSection, const char *pKey, char *pValue, int iLen)
 Get value from a configuration etc object. More...
 
MG_EXPORT int GUIAPI GetIntValueFromEtc (GHANDLE hEtc, const char *pSection, const char *pKey, int *pValue)
 Get the integer value from a configuration etc object. More...
 
MG_EXPORT GHANDLE GUIAPI FindSectionInEtc (GHANDLE hEtc, const char *pSection, BOOL bCreateNew)
 Finds/Creates a section from an etc object. More...
 
MG_EXPORT int GUIAPI GetValueFromEtcSec (GHANDLE hSect, const char *pKey, char *pValue, int iLen)
 Get value from an etc section object. More...
 
MG_EXPORT int GUIAPI GetIntValueFromEtcSec (GHANDLE hSect, const char *pKey, int *pValue)
 Get an integer value from an etc section object. More...
 
MG_EXPORT int GUIAPI SetValueToEtcSec (GHANDLE hSect, const char *pKey, char *pValue)
 Set the value in the etc section object. More...
 
MG_EXPORT int GUIAPI RemoveSectionInEtc (GHANDLE hEtc, const char *pSection)
 Removes a section in etc object. More...
 
static int GetMgEtcValue (const char *pSection, const char *pKey, char *pValue, int iLen)
 Get value from MiniGUI configuration etc object. More...
 
MG_EXPORT int GUIAPI CreateClipBoard (const char *cb_name, size_t size)
 Creates a new clipboard. More...
 
MG_EXPORT int GUIAPI DestroyClipBoard (const char *cb_name)
 Destroys a new clipboard. More...
 
MG_EXPORT int GUIAPI SetClipBoardData (const char *cb_name, void *data, size_t n, int cbop)
 Set the data of a clipboard. More...
 
MG_EXPORT size_t GUIAPI GetClipBoardDataLen (const char *cb_name)
 Get the length of the data of a clipboard. More...
 
MG_EXPORT size_t GUIAPI GetClipBoardData (const char *cb_name, void *data, size_t n)
 Get the data of a clipboard. More...
 
MG_EXPORT int GUIAPI GetClipBoardByte (const char *cb_name, int index, unsigned char *byte)
 Get a byte from a clipboard. More...
 
MG_EXPORT DWORD GUIAPI GetTickCount (void)
 Retrieve the tick counts that have elapsed since MiniGUI was started. More...
 
MG_EXPORT void GUIAPI Ping (void)
 Makes a beep sound. More...
 
MG_EXPORT void GUIAPI Tone (int frequency_hz, int duration_ms)
 Makes a tone. More...
 
MG_EXPORT void *GUIAPI GetOriginalTermIO (void)
 Get termios structure of the original terminal before initializing MiniGUI. More...
 
MG_EXPORT char *GUIAPI FixStrAlloc (int len)
 Allocates a buffer for a length-fixed string. More...
 
MG_EXPORT char *GUIAPI FixStrDup (const char *str)
 Duplicates a length-fixed string. More...
 
MG_EXPORT void GUIAPI FreeFixStr (char *str)
 Frees a length-fixed string. More...
 
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...
 
MG_EXPORT BOOL GUIAPI GetKeyStatus (UINT uKey)
 Get a key or a mouse button status. More...
 
MG_EXPORT DWORD GUIAPI GetShiftKeyStatus (void)
 Get status of the shift keys. More...
 
MG_EXPORT void GUIAPI GetKeyboardState (BYTE *kbd_state)
 Get status of all keys on keyboard. More...
 
const MG_EXPORT char *GUIAPI GetSysText (unsigned int id)
 Translates system text to localized text. More...
 
const MG_EXPORT char **GUIAPI GetSysTextInUTF8 (const char *language)
 Get the localized system text array in UTF-8 for a specified language. More...
 
MG_EXPORT char * strnchr (const char *s, size_t n, int c)
 Locates character in the first n characters of string s. More...
 
MG_EXPORT int substrlen (const char *text, int len, int delimiter, int *nr_delim)
 Locates a substring delimited by one or more delimiters in the first len characters of string text. More...
 
MG_EXPORT char * strtrimall (char *src)
 Deletes all space characters. More...
 
MG_EXPORT void * mg_slice_alloc (size_t block_size)
 Allocate a slice memory. More...
 
MG_EXPORT void * mg_slice_alloc0 (size_t block_size)
 Allocate a slice memory and initialize the memory to zero. More...
 
MG_EXPORT void * mg_slice_copy (size_t block_size, const void *mem_block)
 Allocate and copy a slice. More...
 
MG_EXPORT void mg_slice_free (size_t block_size, void *mem_block)
 Free a block of memory. More...
 
MG_EXPORT void mg_slice_free_chain_with_offset (size_t block_size, void *mem_chain, size_t next_offset)
 Free a linked list of memory blocks. More...
 

Variables

MG_EXPORT char ETCFILEPATH []
 The path name of MiniGUI configuration file. More...
 
const MG_EXPORT char * SysText []
 Contains all text used by MiniGUI in English. More...
 
const MG_EXPORT char ** local_SysText
 The pointer to the current localized system text array. More...
 

Detailed Description

This file includes global and miscellaneous interfaces of 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~2020, 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/blog/minigui-licensing-policy/>.

Definition in file minigui.h.