MiniGUI API Reference (MiniGUI-Standalone)  v4.0.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
minigui.h
Go to the documentation of this file.
1 //
3 // IMPORTANT NOTICE
4 //
5 // The following open source license statement does not apply to any
6 // entity in the Exception List published by FMSoft.
7 //
8 // For more information, please visit:
9 //
10 // https://www.fmsoft.cn/exception-list
11 //
13 
57 /*
58  * $Id: minigui.h 13674 2010-12-06 06:45:01Z wanzheng $
59  *
60  * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks,
61  * pSOS, ThreadX, NuCleus, OSE, and Win32.
62  */
63 
64 #ifndef _MGUI_MINIGUI_H
65  #define _MGUI_MINIGUI_H
66 
67 #include <stdio.h>
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif /* __cplusplus */
72 
87 extern MG_EXPORT RECT g_rcScr;
88 
97 #define g_rcDesktop g_rcScr
98 
101 #ifdef _MGRM_PROCESSES
102 
108 #include <sys/types.h>
109 
117 extern MG_EXPORT BOOL mgIsServer;
118 
128 extern MG_EXPORT void* mgSharedRes;
129 
138 extern MG_EXPORT size_t mgSizeRes;
139 
144 #define LEN_LAYER_NAME 14
145 
150 #define LEN_CLIENT_NAME 14
151 
156 #define INV_LAYER_HANDLE 0
157 
158 struct _MG_Layer;
159 
161 typedef struct _MG_Client
162 {
164  char name [LEN_CLIENT_NAME + 1];
165 
167  pid_t pid;
169  uid_t uid;
171  int fd;
172 
174  BOOL has_dirty;
176  DWORD last_live_time;
178  DWORD dwAddData;
179 
181  struct _MG_Client* next;
183  struct _MG_Client* prev;
184 
186  struct _MG_Layer* layer;
187 
189  struct GlobalRes* global_res;
190 } MG_Client;
191 
193 typedef struct _MG_Layer
194 {
196  char name [LEN_LAYER_NAME + 1];
197 
199  DWORD dwAddData;
200 
202  MG_Client* cli_head;
204  MG_Client* cli_active;
205 
207  struct _MG_Layer* next;
209  struct _MG_Layer* prev;
210 
212  void* zorder_info;
214  int zorder_shmid;
215 } MG_Layer;
216 
217 /*screen attr type*/
218 #define SCREEN_ATTR_ALPHA_CHANNEL 0x01 //alpha channel
219 #define SCREEN_ATTR_COLORKEY 0x02 //colorkey
220 #define SCREEN_ATTR_COLORSPACE 0x03 //colorspace
221 #define SCREEN_ATTR_ALPHA 0x04
222 #define SCREEN_NO_EXIST -99 //screen don't exist
223 
230 extern MG_EXPORT int mgClientSize;
231 
242 extern MG_EXPORT MG_Client* mgClients;
243 
250 extern MG_EXPORT MG_Layer* mgTopmostLayer;
251 
258 extern MG_EXPORT MG_Layer* mgLayers;
259 
262 #endif /* _MGRM_PROCESSES */
263 
283 MG_EXPORT int GUIAPI InitGUI (int, const char **);
284 
292 MG_EXPORT void GUIAPI TerminateGUI (int not_used);
293 
303 MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
304 
305 #ifndef _MGRM_THREADS
306 
334 #define MAX_NR_LISTEN_FD 5
335 
336 #ifdef WIN32
337 #ifndef POLLIN
338 #define POLLIN 0x001
339 #endif
340 
341 #ifndef POLLOUT
342 #define POLLOUT 0x004
343 #endif
344 
345 #ifndef POLLERR
346 #define POLLERR 0x008
347 #endif
348 
349 #endif /* WIN32 */
350 
377 MG_EXPORT BOOL GUIAPI RegisterListenFD (int fd, int type,
378  HWND hwnd, void* context);
379 
394 MG_EXPORT BOOL GUIAPI UnregisterListenFD (int fd);
395 
398 #ifdef _MGRM_PROCESSES
399 
417 #define NAME_SELF_LAYER ""
418 
423 #define NAME_TOPMOST_LAYER ""
424 
429 #define NAME_DEF_LAYER "mginit"
430 
465 MG_EXPORT GHANDLE GUIAPI JoinLayer (const char* layer_name,
466  const char* client_name,
467  int max_nr_topmosts, int max_nr_normals);
468 
493 MG_EXPORT GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
494  int* nr_clients, BOOL* is_topmost, int* cli_active);
495 
513 MG_EXPORT BOOL GUIAPI SetTopmostLayer (BOOL handle_name,
514  GHANDLE handle, const char* name);
515 
533 MG_EXPORT BOOL GUIAPI DeleteLayer (BOOL handle_name,
534  GHANDLE handle, const char* layer_name);
535 
557 typedef int (* ON_LOCK_CLIENT_REQ) (void);
558 
559 
566 typedef int (* ON_TRYLOCK_CLIENT_REQ) (void);
567 
574 typedef void (* ON_UNLOCK_CLIENT_REQ) (void);
575 
584 extern MG_EXPORT ON_LOCK_CLIENT_REQ OnLockClientReq;
585 
594 extern MG_EXPORT ON_TRYLOCK_CLIENT_REQ OnTrylockClientReq;
603 extern MG_EXPORT ON_UNLOCK_CLIENT_REQ OnUnlockClientReq;
604 
605 #define LCO_NEW_CLIENT 1
606 #define LCO_DEL_CLIENT 2
607 
614 typedef void (* ON_NEW_DEL_CLIENT) (int op, int cli);
615 
616 #define LCO_NEW_LAYER 1
617 #define LCO_DEL_LAYER 2
618 #define LCO_JOIN_CLIENT 3
619 #define LCO_REMOVE_CLIENT 4
620 #define LCO_TOPMOST_CHANGED 5
621 #define LCO_ACTIVE_CHANGED 6
622 
630 typedef void (* ON_CHANGE_LAYER) (int op, MG_Layer* layer,
631  MG_Client* client);
632 
633 #define ZNOP_ALLOCATE 1
634 #define ZNOP_FREE 2
635 #define ZNOP_MOVE2TOP 3
636 #define ZNOP_SHOW 4
637 #define ZNOP_HIDE 5
638 #define ZNOP_MOVEWIN 6
639 #define ZNOP_SETACTIVE 7
640 
641 #define ZNOP_ENABLEWINDOW 11
642 #define ZNOP_DISABLEWINDOW 12
643 #define ZNOP_STARTDRAG 13
644 #define ZNOP_CANCELDRAG 14
645 #define ZNOP_CHANGECAPTION 15
646 
653 typedef void (* ON_ZNODE_OPERATION) (int op, int cli, int idx_znode);
654 
678 extern MG_EXPORT ON_NEW_DEL_CLIENT OnNewDelClient;
679 
709 extern MG_EXPORT ON_CHANGE_LAYER OnChangeLayer;
710 
753 extern MG_EXPORT ON_ZNODE_OPERATION OnZNodeOperation;
754 
781 MG_EXPORT BOOL GUIAPI ServerStartup (int nr_globals,
782  int def_nr_topmosts, int def_nr_normals);
783 
811 MG_EXPORT MG_Layer* GUIAPI ServerCreateLayer (const char* layer_name,
812  int max_nr_topmosts, int max_nr_normals);
813 
828 MG_EXPORT BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer);
829 
844 MG_EXPORT BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer);
845 
870 MG_EXPORT int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode,
871  int* cli);
872 
873 #define ZNIT_DESKTOP 0x50000000
874 
875 #define ZNIT_GLOBAL_MAINWIN 0x31000000
876 #define ZNIT_GLOBAL_TOOLWIN 0x32000000
877 #define ZNIT_GLOBAL_CONTROL 0x30000000
878 
879 #define ZNIT_TOPMOST_MAINWIN 0x21000000
880 #define ZNIT_TOPMOST_TOOLWIN 0x22000000
881 #define ZNIT_TOPMOST_CONTROL 0x20000000
882 
883 #define ZNIT_NORMAL_MAINWIN 0x11000000
884 #define ZNIT_NORMAL_TOOLWIN 0x12000000
885 #define ZNIT_NORMAL_CONTROL 0x10000000
886 
887 #define ZNIT_NULL 0x00000000
888 
889 #define ZNIF_VISIBLE 0x00000002
890 #define ZNIF_DISABLED 0x00000004
891 
893 typedef struct _ZNODEINFO
894 {
920  DWORD type;
921 
930  DWORD flags;
931 
933  const char* caption;
935  RECT rc;
936 
938  int cli;
940  HWND hwnd;
945  HWND main_win;
946 } ZNODEINFO;
947 
967 MG_EXPORT BOOL GUIAPI ServerGetZNodeInfo (MG_Layer* layer, int idx_znode,
968  ZNODEINFO* znode_info);
969 
1002 MG_EXPORT BOOL GUIAPI ServerDoZNodeOperation (MG_Layer* layer, int idx_znode,
1003  int op_code, void* op_data, BOOL notify);
1004 
1016 MG_EXPORT int GUIAPI GetClientByPID (int pid);
1017 
1034 MG_EXPORT BOOL GUIAPI SetTopmostClient (int cli);
1035 
1040 MG_EXPORT void GUIAPI DisableClientsOutput (void);
1041 
1048 MG_EXPORT void GUIAPI UpdateTopmostLayer (const RECT* dirty_rc);
1049 
1086 #define MAX_SYS_REQID 0x0020
1087 
1094 #define MAX_REQID 0x0030
1095 
1097 typedef struct _REQUEST {
1099  int id;
1101  const void* data;
1103  size_t len_data;
1104 } REQUEST;
1106 typedef REQUEST* PREQUEST;
1107 
1130 MG_EXPORT int GUIAPI ClientRequestEx (const REQUEST* request, const void* ex_data,
1131  int ex_data_len, void* result, int len_rslt);
1132 
1155 static inline int ClientRequest (const REQUEST* request,
1156  void* result, int len_rslt)
1157 {
1158  return ClientRequestEx (request, NULL, 0, result, len_rslt);
1159 }
1160 
1172 MG_EXPORT int GUIAPI GetSockFD2Server (void);
1173 
1191 MG_EXPORT int GUIAPI ServerSendReply (int clifd, const void* reply, int len);
1192 
1199 typedef int (* REQ_HANDLER) (int cli, int clifd, void* buff, size_t len);
1200 
1219 MG_EXPORT BOOL GUIAPI RegisterRequestHandler (int req_id, REQ_HANDLER your_handler);
1220 
1236 MG_EXPORT REQ_HANDLER GUIAPI GetRequestHandler (int req_id);
1237 
1272 MG_EXPORT int serv_listen (const char* name);
1273 
1295 MG_EXPORT int serv_accept (int listenfd, pid_t *pidptr, uid_t *uidptr);
1296 
1317 MG_EXPORT int cli_conn (const char* name, char project);
1318 
1319 #define SOCKERR_IO -1
1320 #define SOCKERR_CLOSED -2
1321 #define SOCKERR_INVARG -3
1322 #define SOCKERR_TIMEOUT -4
1323 #define SOCKERR_OK 0
1324 
1353 MG_EXPORT int sock_write_t (int fd, const void* buff,
1354  int count, unsigned int timeout);
1355 
1383 MG_EXPORT int sock_read_t (int fd, void* buff, int count, unsigned int timeout);
1384 
1391 #define sock_write(fd, buff, count) sock_write_t(fd, buff, count, 0)
1392 
1399 #define sock_read(fd, buff, count) sock_read_t(fd, buff, count, 0)
1400 
1403 #endif /* _MGRM_PROCESSES */
1404 
1407 #endif /* _MGRM_THREADS */
1408 
1442 MG_EXPORT BOOL GUIAPI ReinitDesktopEx (BOOL init_sys_text);
1443 
1455 #define ReinitDesktop() ReinitDesktopEx (TRUE)
1456 
1471 MG_EXPORT void GUIAPI ExitGUISafely (int exitcode);
1472 
1473 #ifdef _USE_MINIGUIENTRY
1474  #define main_entry minigui_entry
1475  int minigui_entry (int args, const char* arg[]);
1476 #else
1477  #define main_entry main
1478 #endif /* _USE_MINIGUIENTRY */
1479 
1497 #define MiniGUIMain \
1498 MiniGUIAppMain (int args, const char* argv[]); \
1499 int main_entry (int args, const char* argv[]) \
1500 { \
1501  int iRet = 0; \
1502  if (InitGUI (args, argv) != 0) { \
1503  return 1; \
1504  } \
1505  iRet = MiniGUIAppMain (args, argv); \
1506  TerminateGUI (iRet); \
1507  return iRet; \
1508 } \
1509 int MiniGUIAppMain
1510 
1516 #define IDM_DTI_FIRST (300)
1517 
1519 typedef struct _DESKTOPOPS {
1520 
1522  void* (*init) (void);
1523 
1525  void (*deinit) (void* context);
1526 
1528  void (*paint_desktop) (void* context,
1529  HDC dc_desktop, const RECT* inv_rc);
1530 
1532  void (*keyboard_handler) (void* context,
1533  int message, WPARAM wParam, LPARAM lParam);
1534 
1536  void (*mouse_handler) (void* context,
1537  int message, WPARAM wParam, LPARAM lParam);
1538 
1540  void (*customize_desktop_menu) (void* context,
1541  HMENU hmenu, int start_pos);
1542 
1544  void (*desktop_menucmd_handler) (void* context, int id);
1545 } DESKTOPOPS;
1546 
1614 MG_EXPORT DESKTOPOPS* GUIAPI SetCustomDesktopOperationSet
1615  (DESKTOPOPS* usr_dsk_ops);
1616 
1627 MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
1628 
1631 #ifdef _MGHAVE_MOUSECALIBRATE
1632 
1667 MG_EXPORT BOOL GUIAPI SetMouseCalibrationParameters (const POINT* src_pts,
1668  const POINT* dst_pts);
1669 
1689 MG_EXPORT void GUIAPI GetOriginalMousePosition (int* x, int* y);
1690 
1693 #endif /* _MGHAVE_MOUSECALIBRATE */
1694 
1695 #ifdef _MGMISC_ABOUTDLG
1696 
1702 #ifdef _MGRM_THREADS
1703 
1718 MG_EXPORT void GUIAPI OpenAboutDialog (void);
1719 
1720 #else /* _MGRM_THREADS */
1721 
1739 MG_EXPORT HWND GUIAPI OpenAboutDialog (HWND hHosting);
1740 
1741 #endif /* _MGRM_THREADS */
1742 
1745 #endif /* _MGMISC_ABOUTDLG */
1746 
1794 #define ETC_MAXLINE 1024
1795 
1800 #define ETC_FILENOTFOUND -1
1801 
1805 #define ETC_SECTIONNOTFOUND -2
1806 
1810 #define ETC_KEYNOTFOUND -3
1811 
1815 #define ETC_TMPFILEFAILED -4
1816 
1820 #define ETC_FILEIOFAILED -5
1821 
1825 #define ETC_INTCONV -6
1826 
1830 #define ETC_INVALIDOBJ -7
1831 
1835 #define ETC_READONLYOBJ -8
1836 
1840 #define ETC_OK 0
1841 
1843 typedef struct _ETCSECTION
1844 {
1848  int key_nr;
1850  char *name;
1852  char** keys;
1854  char** values;
1855 } ETCSECTION;
1858 
1860 typedef struct _ETC_S
1861 {
1867  PETCSECTION sections;
1868 } ETC_S;
1869 
1870 #ifndef _MGINCORE_RES
1871 
1887 extern MG_EXPORT char ETCFILEPATH [];
1888 
1889 #endif /* !_MGINCORE_RES */
1890 
1921 MG_EXPORT int GUIAPI GetValueFromEtcFile (const char* pEtcFile,
1922  const char* pSection, const char* pKey, char* pValue, int iLen);
1923 
1961 MG_EXPORT int GUIAPI GetIntValueFromEtcFile (const char* pEtcFile,
1962  const char* pSection, const char* pKey, int* value);
1963 
1989 MG_EXPORT int GUIAPI SetValueToEtcFile (const char* pEtcFile,
1990  const char* pSection, const char* pKey, char* pValue);
1991 
2012 MG_EXPORT int GUIAPI RemoveSectionInEtcFile (const char* pEtcFile,
2013  const char* pSection);
2014 
2033 MG_EXPORT int GUIAPI SaveSectionToEtcFile (const char* pEtcFile,
2034  PETCSECTION psect);
2049 MG_EXPORT GHANDLE GUIAPI LoadEtcFile (const char * pEtcFile);
2050 
2068 MG_EXPORT int GUIAPI SaveEtcToFile (GHANDLE hEtc, const char* file_name);
2069 
2083 MG_EXPORT int GUIAPI UnloadEtcFile (GHANDLE hEtc);
2084 
2113 MG_EXPORT int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection,
2114  const char* pKey, char* pValue, int iLen);
2115 
2123 MG_EXPORT int GUIAPI GetIntValueFromEtc (GHANDLE hEtc, const char* pSection,
2124  const char* pKey, int* pValue);
2125 
2136 #define SetValueToEtc(hEtc, pSection, pKey, pValue) \
2137  GetValueFromEtc(hEtc, pSection, pKey, pValue, -1)
2138 
2156 MG_EXPORT GHANDLE GUIAPI FindSectionInEtc (GHANDLE hEtc,
2157  const char* pSection, BOOL bCreateNew);
2158 
2184 MG_EXPORT int GUIAPI GetValueFromEtcSec (GHANDLE hSect,
2185  const char* pKey, char* pValue, int iLen);
2186 
2210 MG_EXPORT int GUIAPI GetIntValueFromEtcSec (GHANDLE hSect,
2211  const char* pKey, int* pValue);
2212 
2223 MG_EXPORT int GUIAPI SetValueToEtcSec (GHANDLE hSect,
2224  const char* pKey, char* pValue);
2225 
2246 MG_EXPORT int GUIAPI RemoveSectionInEtc (GHANDLE hEtc, const char* pSection);
2247 
2248 /* global MiniGUI etc file object */
2249 extern MG_EXPORT GHANDLE hMgEtc;
2250 
2260 static inline int GetMgEtcValue(const char* pSection,
2261  const char *pKey, char *pValue, int iLen)
2262 {
2263 #ifndef _MGINCORE_RES
2264  if (!hMgEtc)
2265  return GetValueFromEtcFile (ETCFILEPATH, pSection, pKey, pValue, iLen);
2266 #endif /* !_MGINCORE_RES */
2267 
2268  return GetValueFromEtc (hMgEtc, pSection, pKey, pValue, iLen);
2269 }
2270 
2280 static inline int GetMgEtcIntValue (const char *pSection,
2281  const char* pKey, int *value)
2282 {
2283 #ifndef _MGINCORE_RES
2284  if (!hMgEtc)
2285  return GetIntValueFromEtcFile (ETCFILEPATH, pSection, pKey, value);
2286 #endif /* !_MGINCORE_RES */
2287 
2288  return GetIntValueFromEtc (hMgEtc, pSection, pKey, value);
2289 }
2290 
2293 #ifdef _MGHAVE_CLIPBOARD
2294 
2304 #define LEN_CLIPBOARD_NAME 15
2305 
2309 #define NR_CLIPBOARDS 4
2310 
2315 #define CBNAME_TEXT ("text")
2316 
2322 #define CBERR_OK 0
2323 
2328 #define CBERR_BADNAME 1
2329 
2334 #define CBERR_NOMEM 2
2335 
2340 #define CBOP_NORMAL 0
2341 
2345 #define CBOP_APPEND 1
2346 
2364 MG_EXPORT int GUIAPI CreateClipBoard (const char* cb_name, size_t size);
2365 
2379 MG_EXPORT int GUIAPI DestroyClipBoard (const char* cb_name);
2380 
2404 MG_EXPORT int GUIAPI SetClipBoardData (const char* cb_name,
2405  void* data, size_t n, int cbop);
2406 
2419 MG_EXPORT size_t GUIAPI GetClipBoardDataLen (const char* cb_name);
2420 
2436 MG_EXPORT size_t GUIAPI GetClipBoardData (const char* cb_name,
2437  void* data, size_t n);
2438 
2456 MG_EXPORT int GUIAPI GetClipBoardByte (const char* cb_name,
2457  int index, unsigned char* byte);
2458 
2461 #endif /* _MGHAVE_CLIPBOARD */
2462 
2481 MG_EXPORT DWORD GUIAPI GetTickCount (void);
2482 
2488 MG_EXPORT void GUIAPI Ping (void);
2489 
2495 #define Beep Ping
2496 
2512 MG_EXPORT void GUIAPI Tone (int frequency_hz, int duration_ms);
2513 
2521 MG_EXPORT void* GUIAPI GetOriginalTermIO (void);
2522 
2556 MG_EXPORT char* GUIAPI FixStrAlloc (int len);
2557 
2575 MG_EXPORT char* GUIAPI FixStrDup (const char* str);
2576 
2589 MG_EXPORT void GUIAPI FreeFixStr (char* str);
2590 
2598 #ifdef _MGHAVE_CURSOR
2599 
2616 MG_EXPORT HCURSOR GUIAPI LoadCursorFromFile (const char* filename);
2617 
2634 MG_EXPORT HCURSOR GUIAPI LoadCursorFromMem (const void* area);
2635 
2661 MG_EXPORT HCURSOR GUIAPI CreateCursor (int xhotspot, int yhotspot, int w, int h,
2662  const BYTE* pANDBits, const BYTE* pXORBits, int colornum);
2663 
2676 MG_EXPORT HCURSOR GUIAPI CopyCursor (HCURSOR hcsr);
2677 
2688 MG_EXPORT BOOL GUIAPI DestroyCursor (HCURSOR hcsr);
2689 
2748 MG_EXPORT HCURSOR GUIAPI GetSystemCursor (int csrid);
2749 
2758 MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void);
2759 
2760 #else /* _MGHAVE_CURSOR */
2761 
2762 static inline HCURSOR LoadCursorFromFile(const char* filename) {
2763  return (HCURSOR)0;
2764 }
2765 
2766 static inline HCURSOR CreateCursor(int xhotspot, int yhotspot, int w, int h,
2767  const BYTE* pANDBits, const BYTE* pXORBits, int colornum) {
2768  return (HCURSOR)0;
2769 }
2770 
2771 static inline HCURSOR GUIAPI CopyCursor (HCURSOR hcsr) {
2772  return (HCURSOR)0;
2773 }
2774 
2775 static inline BOOL DestroyCursor (HCURSOR hcsr) {
2776  return TRUE;
2777 }
2778 
2779 static inline HCURSOR GetSystemCursor (int csrid) {
2780  return (HCURSOR)0;
2781 }
2782 
2783 static inline HCURSOR GUIAPI GetCurrentCursor (void) {
2784  return (HCURSOR)0;
2785 }
2786 
2787 #endif /* !_MGHAVE_CURSOR */
2788 
2789 #define MAX_SYSCURSORINDEX 22
2790 
2791 /* System cursor index. */
2793 #define IDC_ARROW 0
2794 
2795 #define IDC_IBEAM 1
2796 
2797 #define IDC_PENCIL 2
2798 
2799 #define IDC_CROSS 3
2800 
2801 #define IDC_MOVE 4
2802 
2803 #define IDC_SIZENWSE 5
2804 
2805 #define IDC_SIZENESW 6
2806 
2807 #define IDC_SIZEWE 7
2808 
2809 #define IDC_SIZENS 8
2810 
2811 #define IDC_UPARROW 9
2812 
2813 #define IDC_NONE 10
2814 
2815 #define IDC_HELP 11
2816 
2817 #define IDC_BUSY 12
2818 
2819 #define IDC_WAIT 13
2820 
2821 #define IDC_RARROW 14
2822 
2823 #define IDC_COLOMN 15
2824 
2825 #define IDC_ROW 16
2826 
2827 #define IDC_DRAG 17
2828 
2829 #define IDC_NODROP 18
2830 
2831 #define IDC_HAND_POINT 19
2832 
2833 #define IDC_HAND_SELECT 20
2834 
2835 #define IDC_SPLIT_HORZ 21
2836 
2837 #define IDC_SPLIT_VERT 22
2838 
2850 MG_EXPORT void GUIAPI ClipCursor (const RECT* prc);
2851 
2862 MG_EXPORT void GUIAPI GetClipCursor (RECT* prc);
2863 
2876 MG_EXPORT void GUIAPI GetCursorPos (POINT* ppt);
2877 
2891 MG_EXPORT void GUIAPI SetCursorPos (int x, int y);
2892 
2893 #ifdef _MGHAVE_CURSOR
2894 
2912 MG_EXPORT HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def);
2913 
2924 MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void);
2925 
2940 MG_EXPORT int GUIAPI ShowCursor (BOOL fShow);
2941 
2942 #else /* _MGHAVE_CURSOR */
2943 
2944 static inline HCURSOR SetCursorEx(HCURSOR hcsr, BOOL set_def) {
2945  return (HCURSOR)0;
2946 }
2947 
2948 static inline HCURSOR GetDefaultCursor(void) {
2949  return (HCURSOR)0;
2950 }
2951 
2952 static inline int GUIAPI ShowCursor (BOOL fShow) {
2953  return 0;
2954 }
2955 
2956 #endif /* !_MGHAVE_CURSOR */
2957 
2972 #define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
2973 
2989 #define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
2990 
3023 MG_EXPORT BOOL GUIAPI GetKeyStatus (UINT uKey);
3024 
3065 MG_EXPORT DWORD GUIAPI GetShiftKeyStatus (void);
3066 
3081 MG_EXPORT void GUIAPI GetKeyboardState (BYTE* kbd_state);
3082 
3094 #define IDS_MGST_WINDOW 0
3095 
3100 #define IDS_MGST_START 1
3101 
3106 #define IDS_MGST_REFRESH 2
3107 
3112 #define IDS_MGST_CLOSEALLWIN 3
3113 
3118 #define IDS_MGST_ENDSESSION 4
3119 
3124 #define IDS_MGST_OPERATIONS 5
3125 
3130 #define IDS_MGST_MINIMIZE 6
3131 
3136 #define IDS_MGST_MAXIMIZE 7
3137 
3142 #define IDS_MGST_RESTORE 8
3143 
3148 #define IDS_MGST_CLOSE 9
3149 
3154 #define IDS_MGST_OK 10
3155 
3160 #define IDS_MGST_NEXT 11
3161 
3166 #define IDS_MGST_CANCEL 12
3167 
3172 #define IDS_MGST_PREV 13
3173 
3178 #define IDS_MGST_YES 14
3179 
3184 #define IDS_MGST_NO 15
3185 
3190 #define IDS_MGST_ABORT 16
3191 
3196 #define IDS_MGST_RETRY 17
3197 
3202 #define IDS_MGST_IGNORE 18
3203 
3208 #define IDS_MGST_ABOUTMG 19
3209 
3214 #define IDS_MGST_OPENFILE 20
3215 
3220 #define IDS_MGST_SAVEFILE 21
3221 
3226 #define IDS_MGST_COLORSEL 22
3227 
3232 #define IDS_MGST_SWITCHLAYER 23
3233 
3238 #define IDS_MGST_DELLAYER 24
3239 
3244 #define IDS_MGST_ERROR 25
3245 
3250 #define IDS_MGST_LOGO 26
3251 
3256 #define IDS_MGST_CURRPATH 27
3257 
3262 #define IDS_MGST_FILE 28
3263 
3268 #define IDS_MGST_LOCATION 29
3269 
3274 #define IDS_MGST_UP 30
3275 
3280 #define IDS_MGST_NAME 31
3281 
3286 #define IDS_MGST_SIZE 32
3287 
3292 #define IDS_MGST_ACCESSMODE 33
3293 
3298 #define IDS_MGST_LASTMODTIME 34
3299 
3304 #define IDS_MGST_OPEN 35
3305 
3310 #define IDS_MGST_FILENAME 36
3311 
3316 #define IDS_MGST_FILETYPE 37
3317 
3322 #define IDS_MGST_SHOWHIDEFILE 38
3323 
3328 #define IDS_MGST_NOTFOUND 39
3329 
3334 #define IDS_MGST_NR 40
3335 
3340 #define IDS_MGST_NW 41
3341 
3346 #define IDS_MGST_INFO 42
3347 
3352 #define IDS_MGST_R 43
3353 
3358 #define IDS_MGST_W 44
3359 
3364 #define IDS_MGST_WR 45
3365 
3370 #define IDS_MGST_SAVE 46
3371 
3376 #define IDS_MGST_FILEEXIST 47
3377 
3378 #define IDS_MGST_MAXNUM 47
3379 
3399 MG_EXPORT const char* GUIAPI GetSysText (unsigned int id);
3400 
3467 extern MG_EXPORT const char* SysText [];
3468 
3480 extern MG_EXPORT const char** local_SysText;
3481 
3482 #ifdef _MGCHARSET_UNICODE
3483 
3502 extern MG_EXPORT const char** GUIAPI GetSysTextInUTF8 (const char* language);
3503 
3504 #endif /* _MGCHARSET_UNICODE */
3505 
3526 MG_EXPORT char* strnchr (const char* s, size_t n, int c);
3527 
3544 MG_EXPORT int substrlen (const char* text, int len, int delimiter,
3545  int* nr_delim);
3546 
3559 MG_EXPORT char * strtrimall (char* src);
3560 
3669 MG_EXPORT void *mg_slice_alloc(size_t block_size);
3670 
3687 MG_EXPORT void *mg_slice_alloc0(size_t block_size);
3688 
3706 MG_EXPORT void *mg_slice_copy(size_t block_size, const void *mem_block);
3707 
3726 MG_EXPORT void mg_slice_free(size_t block_size, void *mem_block);
3727 
3750 MG_EXPORT void mg_slice_free_chain_with_offset(size_t block_size,
3751  void *mem_chain, size_t next_offset);
3752 
3776 #define mg_slice_new(type) ((type*)mg_slice_alloc(sizeof (type)))
3777 
3803 #define mg_slice_new0(type) ((type*)mg_slice_alloc0(sizeof (type)))
3804 
3805 /* MemoryBlockType *
3806  * mg_slice_dup (MemoryBlockType,
3807  * MemoryBlockType *mem_block);
3808  * mg_slice_delete (MemoryBlockType,
3809  * MemoryBlockType *mem_block);
3810  * mg_slice_delete_chain (MemoryBlockType,
3811  * MemoryBlockType *first_chain_block,
3812  * memory_block_next_field);
3813  * pseudo prototypes for the macro definitions following below.
3814  */
3815 
3839 #define mg_slice_dup(type, mem) \
3840  (1 ? (type*) mg_slice_copy (sizeof (type), (mem)) \
3841  : ((void) ((type*) 0 == (mem)), (type*) 0))
3842 
3865 #define mg_slice_delete(type, mem) \
3866  do { \
3867  if (1) mg_slice_free (sizeof (type), (mem)); \
3868  else (void) ((type*) 0 == (mem)); \
3869  } while(0)
3870 
3895 #define mg_slice_delete_chain(type, mem_chain, next) \
3896  do { \
3897  if (1) mg_slice_free_chain_with_offset (sizeof (type), \
3898  (mem_chain), G_STRUCT_OFFSET (type, next)); \
3899  else (void) ((type*) 0 == (mem_chain)); \
3900  } while(0)
3901 
3902 #ifdef _MGDEVEL_MODE
3903 MG_EXPORT void mg_slice_debug_tree_statistics(void);
3904 #endif
3905 
3912 #ifdef __cplusplus
3913 }
3914 #endif /* __cplusplus */
3915 
3916 #endif /* _MGUI_MINIGUI_H */
3917 
MG_EXPORT int GUIAPI GetClipBoardByte(const char *cb_name, int index, unsigned char *byte)
Gets a byte from a clipboard.
MG_EXPORT GHANDLE GUIAPI FindSectionInEtc(GHANDLE hEtc, const char *pSection, BOOL bCreateNew)
Finds/Creates a section from an etc object.
MG_EXPORT void GUIAPI Tone(int frequency_hz, int duration_ms)
Makes a tone.
MG_EXPORT void GUIAPI GetCursorPos(POINT *ppt)
Gets position of the current cursor.
int key_nr
Definition: minigui.h:1848
Definition: common.h:955
MG_EXPORT char *GUIAPI FixStrAlloc(int len)
Allocates a buffer for a length-fixed string.
int BOOL
A type definition for boolean value.
Definition: common.h:338
MG_EXPORT void GUIAPI SetCursorPos(int x, int y)
Sets position of the current cursor.
unsigned char BYTE
A type definition for an 8-bit unsigned character (byte).
Definition: common.h:455
MG_EXPORT int GUIAPI RemoveSectionInEtcFile(const char *pEtcFile, const char *pSection)
Removes a section in an etc file.
MG_EXPORT void GUIAPI DesktopUpdateAllWindow(void)
Update all visible windows on the desktop.
MG_EXPORT int GUIAPI GetIntValueFromEtcSec(GHANDLE hSect, const char *pKey, int *pValue)
Gets an integer value from an etc section object.
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.
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.
MG_EXPORT const char ** local_SysText
The pointer to the current localized system text array.
MG_EXPORT void GUIAPI GetOriginalMousePosition(int *x, int *y)
Gets the original mouse position.
MG_EXPORT HCURSOR GUIAPI CopyCursor(HCURSOR hcsr)
Copies a cursor object.
MG_EXPORT int GUIAPI CreateClipBoard(const char *cb_name, size_t size)
Creates a new clipboard.
MG_EXPORT DESKTOPOPS *GUIAPI SetCustomDesktopOperationSet(DESKTOPOPS *usr_dsk_ops)
Set customer desktop operation set.
Definition: common.h:925
char ** values
Definition: minigui.h:1854
MG_EXPORT void mg_slice_free(size_t block_size, void *mem_block)
Free a block of memory.
MG_EXPORT size_t GUIAPI GetClipBoardDataLen(const char *cb_name)
Gets the length of the data of a clipboard.
struct _DESKTOPOPS DESKTOPOPS
static int GetMgEtcIntValue(const char *pSection, const char *pKey, int *value)
Gets integer value from MiniGUI configuration etc object.
Definition: minigui.h:2280
MG_EXPORT int GUIAPI SaveEtcToFile(GHANDLE hEtc, const char *file_name)
Saves an ETC object into a file.
GHANDLE HDC
Handle to device context.
Definition: common.h:407
MG_EXPORT void * mg_slice_alloc(size_t block_size)
Allocate a slice memory.
MG_EXPORT BOOL GUIAPI UnregisterListenFD(int fd)
Unregisters a being listened file descriptor.
MG_EXPORT char ETCFILEPATH[]
The path name of MiniGUI configuration file.
MG_EXPORT BOOL GUIAPI GetKeyStatus(UINT uKey)
Gets a key or a mouse button status.
MG_EXPORT const char *GUIAPI GetSysText(unsigned int id)
Translates system text to localized text.
MG_EXPORT int GUIAPI GetValueFromEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, char *pValue, int iLen)
Gets value from a configuration file.
MG_EXPORT int GUIAPI UnloadEtcFile(GHANDLE hEtc)
Unloads an etc file.
MG_EXPORT char * strtrimall(char *src)
Deletes all space characters.
MG_EXPORT BOOL GUIAPI RegisterListenFD(int fd, int type, HWND hwnd, void *context)
Registers a listening file descriptor to MiniGUI-Lite.
#define TRUE
TRUE value, defined as 1 by MiniGUI.
Definition: common.h:353
MG_EXPORT HCURSOR GUIAPI LoadCursorFromMem(const void *area)
Loads a cursor from a memory area.
ETCSECTION * PETCSECTION
Definition: minigui.h:1857
MG_EXPORT void GUIAPI FreeFixStr(char *str)
Frees a length-fixed string.
struct _ETC_S ETC_S
MG_EXPORT BOOL GUIAPI ReinitDesktopEx(BOOL init_sys_text)
Re-initializes the desktop.
MG_EXPORT int GUIAPI GetIntValueFromEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, int *value)
Gets integer value from a configuration file.
MG_EXPORT void GUIAPI GetClipCursor(RECT *prc)
Gets the current cursor clipping rectangle.
GHANDLE HWND
Handle to main window or control.
Definition: common.h:402
MG_EXPORT void GUIAPI Ping(void)
Makes a beep sound.
MG_EXPORT void GUIAPI MiniGUIPanic(int exitcode)
The panic of MiniGUI application.
MG_EXPORT int GUIAPI GetValueFromEtcSec(GHANDLE hSect, const char *pKey, char *pValue, int iLen)
Gets value from an etc section object.
MG_EXPORT int GUIAPI SetClipBoardData(const char *cb_name, void *data, size_t n, int cbop)
Sets the data of a clipboard.
int sect_nr_alloc
Definition: minigui.h:1863
MG_EXPORT int GUIAPI GetValueFromEtc(GHANDLE hEtc, const char *pSection, const char *pKey, char *pValue, int iLen)
Gets value from a configuration etc object.
MG_EXPORT char *GUIAPI FixStrDup(const char *str)
Duplicates a length-fixed string.
MG_EXPORT void * mg_slice_copy(size_t block_size, const void *mem_block)
Allocate and copy a slice.
int key_nr_alloc
Definition: minigui.h:1846
static int GetMgEtcValue(const char *pSection, const char *pKey, char *pValue, int iLen)
Gets value from MiniGUI configuration etc object.
Definition: minigui.h:2260
MG_EXPORT size_t GUIAPI GetClipBoardData(const char *cb_name, void *data, size_t n)
Gets the data of a clipboard.
MG_EXPORT HCURSOR GUIAPI SetCursorEx(HCURSOR hcsr, BOOL set_def)
Changes the current cursor.
MG_EXPORT BOOL GUIAPI DestroyCursor(HCURSOR hcsr)
Destroys a cursor object.
GHANDLE HCURSOR
Handle to cursor.
Definition: common.h:417
int section_nr
Definition: minigui.h:1865
#define NULL
A value indicates null pointer.
Definition: common.h:364
PVOID GHANDLE
General handle.
Definition: common.h:397
struct _ETCSECTION ETCSECTION
MG_EXPORT HWND GUIAPI OpenAboutDialog(HWND hHosting)
Opens or actives the &#39;About MiniGUI&#39; dialog.
MG_EXPORT const char **GUIAPI GetSysTextInUTF8(const char *language)
Gets the localized system text array in UTF-8 for a specified language.
UINT_PTR LPARAM
A type definition for the second message paramter.
Definition: common.h:707
MG_EXPORT int GUIAPI GetIntValueFromEtc(GHANDLE hEtc, const char *pSection, const char *pKey, int *pValue)
Gets the integer value from a configuration etc object.
MG_EXPORT void * mg_slice_alloc0(size_t block_size)
Allocate a slice memory and initialize the memory to zero.
MG_EXPORT void *GUIAPI GetOriginalTermIO(void)
Gets termios structure of the original terminal before initializing MiniGUI.
MG_EXPORT HCURSOR GUIAPI GetDefaultCursor(void)
Gets the default cursor.
MG_EXPORT RECT g_rcScr
Contains the rectangle of the whole screen.
MG_EXPORT HCURSOR GUIAPI LoadCursorFromFile(const char *filename)
Loads a cursor from a M$ Windows cursor file.
MG_EXPORT int GUIAPI InitGUI(int, const char **)
Initialize MiniGUI.
PETCSECTION sections
Definition: minigui.h:1867
MG_EXPORT DWORD GUIAPI GetTickCount(void)
Retrieves the tick counts that have elapsed since MiniGUI was started.
MG_EXPORT HCURSOR GUIAPI GetSystemCursor(int csrid)
Gets the handle to a system cursor by its identifier.
MG_EXPORT HCURSOR GUIAPI GetCurrentCursor(void)
Gets the handle to the current cursor.
MG_EXPORT int GUIAPI ShowCursor(BOOL fShow)
Shows or hides cursor.
char ** keys
Definition: minigui.h:1852
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...
UINT_PTR WPARAM
A type definition for the first message paramter.
Definition: common.h:701
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:599
MG_EXPORT void GUIAPI ClipCursor(const RECT *prc)
Clips the cursor range.
MG_EXPORT void GUIAPI ExitGUISafely(int exitcode)
Exits your MiniGUI application safely.
MG_EXPORT int GUIAPI SetValueToEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, char *pValue)
Sets a value in a configuration file.
MG_EXPORT BOOL GUIAPI SetMouseCalibrationParameters(const POINT *src_pts, const POINT *dst_pts)
Sets the parameters for doing mouse calibration.
MG_EXPORT int GUIAPI SetValueToEtcSec(GHANDLE hSect, const char *pKey, char *pValue)
Sets the value in the etc section object.
MG_EXPORT int GUIAPI DestroyClipBoard(const char *cb_name)
Destroys a new clipboard.
MG_EXPORT char * strnchr(const char *s, size_t n, int c)
Locates character in the first n characters of string s.
MG_EXPORT const char * SysText[]
Contains all text used by MiniGUI in English.
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:659
MG_EXPORT DWORD GUIAPI GetShiftKeyStatus(void)
Gets status of the shift keys.
char * name
Definition: minigui.h:1850
MG_EXPORT void GUIAPI TerminateGUI(int not_used)
Terminate MiniGUI.
GHANDLE HMENU
Handle to menu.
Definition: common.h:427
MG_EXPORT GHANDLE GUIAPI LoadEtcFile(const char *pEtcFile)
Loads an etc file into memory.
MG_EXPORT int GUIAPI SaveSectionToEtcFile(const char *pEtcFile, PETCSECTION psect)
Saves a section to an etc file.
MG_EXPORT void GUIAPI GetKeyboardState(BYTE *kbd_state)
Gets status of all keys on keyboard.
MG_EXPORT int GUIAPI RemoveSectionInEtc(GHANDLE hEtc, const char *pSection)
Removes a section in etc object.