MiniGUI API Reference (MiniGUI-Threads)  v3.2.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 
45 /*
46  * $Id: minigui.h 13674 2010-12-06 06:45:01Z wanzheng $
47  *
48  * MiniGUI for Linux/uClinux, eCos, uC/OS-II, VxWorks,
49  * pSOS, ThreadX, NuCleus, OSE, and Win32.
50  */
51 
52 #ifndef _MGUI_MINIGUI_H
53  #define _MGUI_MINIGUI_H
54 
55 #include <stdio.h>
56 
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif /* __cplusplus */
61 
76 extern MG_EXPORT RECT g_rcScr;
77 
86 #define g_rcDesktop g_rcScr
87 
95 #ifdef _MGRM_PROCESSES
96 
97 #include <sys/types.h>
98 
106 extern MG_EXPORT BOOL mgIsServer;
107 
117 extern MG_EXPORT void* mgSharedRes;
118 
127 extern MG_EXPORT size_t mgSizeRes;
128 
133 #define LEN_LAYER_NAME 14
134 
139 #define LEN_CLIENT_NAME 14
140 
145 #define INV_LAYER_HANDLE 0
146 
147 struct _MG_Layer;
148 
150 typedef struct _MG_Client
151 {
153  char name [LEN_CLIENT_NAME + 1];
154 
156  pid_t pid;
158  uid_t uid;
160  int fd;
161 
163  BOOL has_dirty;
165  DWORD last_live_time;
167  DWORD dwAddData;
168 
170  struct _MG_Client* next;
172  struct _MG_Client* prev;
173 
175  struct _MG_Layer* layer;
176 
178  struct GlobalRes* global_res;
179 } MG_Client;
180 
182 typedef struct _MG_Layer
183 {
185  char name [LEN_LAYER_NAME + 1];
186 
188  DWORD dwAddData;
189 
191  MG_Client* cli_head;
193  MG_Client* cli_active;
194 
196  struct _MG_Layer* next;
198  struct _MG_Layer* prev;
199 
201  void* zorder_info;
203  int zorder_shmid;
204 } MG_Layer;
205 
206 /*screen attr type*/
207 #define SCREEN_ATTR_ALPHA_CHANNEL 0x01 //alpha channel
208 #define SCREEN_ATTR_COLORKEY 0x02 //colorkey
209 #define SCREEN_ATTR_COLORSPACE 0x03 //colorspace
210 #define SCREEN_ATTR_ALPHA 0x04
211 #define SCREEN_NO_EXIST -99 //screen don't exist
212 
219 extern MG_EXPORT int mgClientSize;
220 
231 extern MG_EXPORT MG_Client* mgClients;
232 
239 extern MG_EXPORT MG_Layer* mgTopmostLayer;
240 
247 extern MG_EXPORT MG_Layer* mgLayers;
248 
249 #endif /* _MGRM_PROCESSES */
250 
263 MG_EXPORT int GUIAPI InitGUI (int, const char **);
264 
272 MG_EXPORT void GUIAPI TerminateGUI (int not_used);
273 
283 MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
284 
300 #ifndef _MGRM_THREADS
301 
324 #define MAX_NR_LISTEN_FD 5
325 
326 #ifdef WIN32
327 #ifndef POLLIN
328 #define POLLIN 0x001
329 #endif
330 
331 #ifndef POLLOUT
332 #define POLLOUT 0x004
333 #endif
334 
335 #ifndef POLLERR
336 #define POLLERR 0x008
337 #endif
338 
339 #endif
340 
367 MG_EXPORT BOOL GUIAPI RegisterListenFD (int fd, int type,
368  HWND hwnd, void* context);
369 
384 MG_EXPORT BOOL GUIAPI UnregisterListenFD (int fd);
385 
388 #ifdef _MGRM_PROCESSES
389 
407 #define NAME_SELF_LAYER ""
408 
413 #define NAME_TOPMOST_LAYER ""
414 
419 #define NAME_DEF_LAYER "mginit"
420 
455 MG_EXPORT GHANDLE GUIAPI JoinLayer (const char* layer_name,
456  const char* client_name,
457  int max_nr_topmosts, int max_nr_normals);
458 
483 MG_EXPORT GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
484  int* nr_clients, BOOL* is_topmost, int* cli_active);
485 
503 MG_EXPORT BOOL GUIAPI SetTopmostLayer (BOOL handle_name,
504  GHANDLE handle, const char* name);
505 
523 MG_EXPORT BOOL GUIAPI DeleteLayer (BOOL handle_name,
524  GHANDLE handle, const char* layer_name);
525 
547 typedef int (* ON_LOCK_CLIENT_REQ) (void);
548 
549 
556 typedef int (* ON_TRYLOCK_CLIENT_REQ) (void);
557 
564 typedef void (* ON_UNLOCK_CLIENT_REQ) (void);
565 
574 extern MG_EXPORT ON_LOCK_CLIENT_REQ OnLockClientReq;
575 
584 extern MG_EXPORT ON_TRYLOCK_CLIENT_REQ OnTrylockClientReq;
593 extern MG_EXPORT ON_UNLOCK_CLIENT_REQ OnUnlockClientReq;
594 
595 #define LCO_NEW_CLIENT 1
596 #define LCO_DEL_CLIENT 2
597 
604 typedef void (* ON_NEW_DEL_CLIENT) (int op, int cli);
605 
606 #define LCO_NEW_LAYER 1
607 #define LCO_DEL_LAYER 2
608 #define LCO_JOIN_CLIENT 3
609 #define LCO_REMOVE_CLIENT 4
610 #define LCO_TOPMOST_CHANGED 5
611 #define LCO_ACTIVE_CHANGED 6
612 
620 typedef void (* ON_CHANGE_LAYER) (int op, MG_Layer* layer,
621  MG_Client* client);
622 
623 #define ZNOP_ALLOCATE 1
624 #define ZNOP_FREE 2
625 #define ZNOP_MOVE2TOP 3
626 #define ZNOP_SHOW 4
627 #define ZNOP_HIDE 5
628 #define ZNOP_MOVEWIN 6
629 #define ZNOP_SETACTIVE 7
630 
631 #define ZNOP_ENABLEWINDOW 11
632 #define ZNOP_DISABLEWINDOW 12
633 #define ZNOP_STARTDRAG 13
634 #define ZNOP_CANCELDRAG 14
635 #define ZNOP_CHANGECAPTION 15
636 
643 typedef void (* ON_ZNODE_OPERATION) (int op, int cli, int idx_znode);
644 
668 extern MG_EXPORT ON_NEW_DEL_CLIENT OnNewDelClient;
669 
699 extern MG_EXPORT ON_CHANGE_LAYER OnChangeLayer;
700 
743 extern MG_EXPORT ON_ZNODE_OPERATION OnZNodeOperation;
744 
771 MG_EXPORT BOOL GUIAPI ServerStartup (int nr_globals,
772  int def_nr_topmosts, int def_nr_normals);
773 
801 MG_EXPORT MG_Layer* GUIAPI ServerCreateLayer (const char* layer_name,
802  int max_nr_topmosts, int max_nr_normals);
803 
818 MG_EXPORT BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer);
819 
834 MG_EXPORT BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer);
835 
860 MG_EXPORT int GUIAPI ServerGetNextZNode (MG_Layer* layer, int idx_znode,
861  int* cli);
862 
863 #define ZNIT_DESKTOP 0x50000000
864 
865 #define ZNIT_GLOBAL_MAINWIN 0x31000000
866 #define ZNIT_GLOBAL_TOOLWIN 0x32000000
867 #define ZNIT_GLOBAL_CONTROL 0x30000000
868 
869 #define ZNIT_TOPMOST_MAINWIN 0x21000000
870 #define ZNIT_TOPMOST_TOOLWIN 0x22000000
871 #define ZNIT_TOPMOST_CONTROL 0x20000000
872 
873 #define ZNIT_NORMAL_MAINWIN 0x11000000
874 #define ZNIT_NORMAL_TOOLWIN 0x12000000
875 #define ZNIT_NORMAL_CONTROL 0x10000000
876 
877 #define ZNIT_NULL 0x00000000
878 
879 #define ZNIF_VISIBLE 0x00000002
880 #define ZNIF_DISABLED 0x00000004
881 
883 typedef struct _ZNODEINFO
884 {
910  DWORD type;
911 
920  DWORD flags;
921 
923  const char* caption;
925  RECT rc;
926 
928  int cli;
930  HWND hwnd;
935  HWND main_win;
936 } ZNODEINFO;
937 
957 MG_EXPORT BOOL GUIAPI ServerGetZNodeInfo (MG_Layer* layer, int idx_znode,
958  ZNODEINFO* znode_info);
959 
992 MG_EXPORT BOOL GUIAPI ServerDoZNodeOperation (MG_Layer* layer, int idx_znode,
993  int op_code, void* op_data, BOOL notify);
994 
1006 MG_EXPORT int GUIAPI GetClientByPID (int pid);
1007 
1024 MG_EXPORT BOOL GUIAPI SetTopmostClient (int cli);
1025 
1030 MG_EXPORT void GUIAPI DisableClientsOutput (void);
1031 
1038 MG_EXPORT void GUIAPI UpdateTopmostLayer (const RECT* dirty_rc);
1039 
1076 #define MAX_SYS_REQID 0x0020
1077 
1084 #define MAX_REQID 0x0030
1085 
1087 typedef struct _REQUEST {
1089  int id;
1091  const void* data;
1093  size_t len_data;
1094 } REQUEST;
1096 typedef REQUEST* PREQUEST;
1097 
1120 MG_EXPORT int GUIAPI ClientRequestEx (const REQUEST* request, const void* ex_data,
1121  int ex_data_len, void* result, int len_rslt);
1122 
1145 static inline int ClientRequest (const REQUEST* request,
1146  void* result, int len_rslt)
1147 {
1148  return ClientRequestEx (request, NULL, 0, result, len_rslt);
1149 }
1150 
1162 MG_EXPORT int GUIAPI GetSockFD2Server (void);
1163 
1181 MG_EXPORT int GUIAPI ServerSendReply (int clifd, const void* reply, int len);
1182 
1189 typedef int (* REQ_HANDLER) (int cli, int clifd, void* buff, size_t len);
1190 
1209 MG_EXPORT BOOL GUIAPI RegisterRequestHandler (int req_id, REQ_HANDLER your_handler);
1210 
1226 MG_EXPORT REQ_HANDLER GUIAPI GetRequestHandler (int req_id);
1227 
1262 MG_EXPORT int serv_listen (const char* name);
1263 
1285 MG_EXPORT int serv_accept (int listenfd, pid_t *pidptr, uid_t *uidptr);
1286 
1307 MG_EXPORT int cli_conn (const char* name, char project);
1308 
1309 #define SOCKERR_IO -1
1310 #define SOCKERR_CLOSED -2
1311 #define SOCKERR_INVARG -3
1312 #define SOCKERR_TIMEOUT -4
1313 #define SOCKERR_OK 0
1314 
1343 MG_EXPORT int sock_write_t (int fd, const void* buff,
1344  int count, unsigned int timeout);
1345 
1373 MG_EXPORT int sock_read_t (int fd, void* buff, int count, unsigned int timeout);
1374 
1381 #define sock_write(fd, buff, count) sock_write_t(fd, buff, count, 0)
1382 
1389 #define sock_read(fd, buff, count) sock_read_t(fd, buff, count, 0)
1390 
1395 #endif /* _MGRM_PROCESSES */
1396 
1397 #endif /* LITE_VERSION */
1398 
1432 MG_EXPORT BOOL GUIAPI ReinitDesktopEx (BOOL init_sys_text);
1433 
1445 #define ReinitDesktop() ReinitDesktopEx (TRUE)
1446 
1461 MG_EXPORT void GUIAPI ExitGUISafely (int exitcode);
1462 
1463 #ifdef _USE_MINIGUIENTRY
1464  #define main_entry minigui_entry
1465  int minigui_entry (int args, const char* arg[]);
1466 #else
1467  #define main_entry main
1468 #endif
1469 
1487 #define MiniGUIMain \
1488 MiniGUIAppMain (int args, const char* argv[]); \
1489 int main_entry (int args, const char* argv[]) \
1490 { \
1491  int iRet = 0; \
1492  if (InitGUI (args, argv) != 0) { \
1493  return 1; \
1494  } \
1495  iRet = MiniGUIAppMain (args, argv); \
1496  TerminateGUI (iRet); \
1497  return iRet; \
1498 } \
1499 int MiniGUIAppMain
1500 
1506 #define IDM_DTI_FIRST (300)
1507 
1509 typedef struct _DESKTOPOPS {
1510 
1512  void* (*init) (void);
1513 
1515  void (*deinit) (void* context);
1516 
1518  void (*paint_desktop) (void* context,
1519  HDC dc_desktop, const RECT* inv_rc);
1520 
1522  void (*keyboard_handler) (void* context,
1523  int message, WPARAM wParam, LPARAM lParam);
1524 
1526  void (*mouse_handler) (void* context,
1527  int message, WPARAM wParam, LPARAM lParam);
1528 
1530  void (*customize_desktop_menu) (void* context,
1531  HMENU hmenu, int start_pos);
1532 
1534  void (*desktop_menucmd_handler) (void* context, int id);
1535 } DESKTOPOPS;
1536 
1604 MG_EXPORT DESKTOPOPS* GUIAPI SetCustomDesktopOperationSet
1605  (DESKTOPOPS* usr_dsk_ops);
1606 
1617 MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
1618 
1626 #ifdef _MGHAVE_MOUSECALIBRATE
1627 
1657 MG_EXPORT BOOL GUIAPI SetMouseCalibrationParameters (const POINT* src_pts,
1658  const POINT* dst_pts);
1659 
1679 MG_EXPORT void GUIAPI GetOriginalMousePosition (int* x, int* y);
1680 
1681 #endif /* _MGHAVE_MOUSECALIBRATE */
1682 
1689 #ifdef _MGMISC_ABOUTDLG
1690 #ifdef _MGRM_THREADS
1691 
1706 MG_EXPORT void GUIAPI OpenAboutDialog (void);
1707 #else
1708 
1726 MG_EXPORT HWND GUIAPI OpenAboutDialog (HWND hHosting);
1727 #endif /* _MGRM_THREADS */
1728 #endif /* _MGMISC_ABOUTDLG */
1729 
1779 #define ETC_MAXLINE 1024
1780 
1785 #define ETC_FILENOTFOUND -1
1786 
1790 #define ETC_SECTIONNOTFOUND -2
1791 
1795 #define ETC_KEYNOTFOUND -3
1796 
1800 #define ETC_TMPFILEFAILED -4
1801 
1805 #define ETC_FILEIOFAILED -5
1806 
1810 #define ETC_INTCONV -6
1811 
1815 #define ETC_INVALIDOBJ -7
1816 
1820 #define ETC_READONLYOBJ -8
1821 
1825 #define ETC_OK 0
1826 
1828 typedef struct _ETCSECTION
1829 {
1833  int key_nr;
1835  char *name;
1837  char** keys;
1839  char** values;
1840 } ETCSECTION;
1843 
1845 typedef struct _ETC_S
1846 {
1852  PETCSECTION sections;
1853 } ETC_S;
1854 
1855 #ifndef _MGINCORE_RES
1856 
1872 extern MG_EXPORT char ETCFILEPATH [];
1873 
1874 #endif /* _MGINCORE_RES */
1875 
1906 MG_EXPORT int GUIAPI GetValueFromEtcFile (const char* pEtcFile,
1907  const char* pSection, const char* pKey, char* pValue, int iLen);
1908 
1946 MG_EXPORT int GUIAPI GetIntValueFromEtcFile (const char* pEtcFile,
1947  const char* pSection, const char* pKey, int* value);
1948 
1974 MG_EXPORT int GUIAPI SetValueToEtcFile (const char* pEtcFile,
1975  const char* pSection, const char* pKey, char* pValue);
1976 
1997 MG_EXPORT int GUIAPI RemoveSectionInEtcFile (const char* pEtcFile,
1998  const char* pSection);
1999 
2018 MG_EXPORT int GUIAPI SaveSectionToEtcFile (const char* pEtcFile,
2019  PETCSECTION psect);
2034 MG_EXPORT GHANDLE GUIAPI LoadEtcFile (const char * pEtcFile);
2035 
2053 MG_EXPORT int GUIAPI SaveEtcToFile (GHANDLE hEtc, const char* file_name);
2054 
2068 MG_EXPORT int GUIAPI UnloadEtcFile (GHANDLE hEtc);
2069 
2098 MG_EXPORT int GUIAPI GetValueFromEtc (GHANDLE hEtc, const char* pSection,
2099  const char* pKey, char* pValue, int iLen);
2100 
2108 MG_EXPORT int GUIAPI GetIntValueFromEtc (GHANDLE hEtc, const char* pSection,
2109  const char* pKey, int* pValue);
2110 
2121 #define SetValueToEtc(hEtc, pSection, pKey, pValue) \
2122  GetValueFromEtc(hEtc, pSection, pKey, pValue, -1)
2123 
2141 MG_EXPORT GHANDLE GUIAPI FindSectionInEtc (GHANDLE hEtc,
2142  const char* pSection, BOOL bCreateNew);
2143 
2169 MG_EXPORT int GUIAPI GetValueFromEtcSec (GHANDLE hSect,
2170  const char* pKey, char* pValue, int iLen);
2171 
2195 MG_EXPORT int GUIAPI GetIntValueFromEtcSec (GHANDLE hSect,
2196  const char* pKey, int* pValue);
2197 
2208 MG_EXPORT int GUIAPI SetValueToEtcSec (GHANDLE hSect,
2209  const char* pKey, char* pValue);
2210 
2231 MG_EXPORT int GUIAPI RemoveSectionInEtc (GHANDLE hEtc, const char* pSection);
2232 
2233 /* global MiniGUI etc file object */
2234 extern MG_EXPORT GHANDLE hMgEtc;
2235 
2245 static inline int GetMgEtcValue(const char* pSection,
2246  const char *pKey, char *pValue, int iLen)
2247 {
2248 #ifndef _MGINCORE_RES
2249  if (!hMgEtc)
2250  return GetValueFromEtcFile (ETCFILEPATH, pSection, pKey, pValue, iLen);
2251 #endif
2252 
2253  return GetValueFromEtc (hMgEtc, pSection, pKey, pValue, iLen);
2254 }
2255 
2265 static inline int GetMgEtcIntValue (const char *pSection,
2266  const char* pKey, int *value)
2267 {
2268 #ifndef _MGINCORE_RES
2269  if (!hMgEtc)
2270  return GetIntValueFromEtcFile (ETCFILEPATH, pSection, pKey, value);
2271 #endif
2272 
2273  return GetIntValueFromEtc (hMgEtc, pSection, pKey, value);
2274 }
2275 
2278 #ifdef _MGHAVE_CLIPBOARD
2279 
2289 #define LEN_CLIPBOARD_NAME 15
2290 
2294 #define NR_CLIPBOARDS 4
2295 
2300 #define CBNAME_TEXT ("text")
2301 
2307 #define CBERR_OK 0
2308 
2313 #define CBERR_BADNAME 1
2314 
2319 #define CBERR_NOMEM 2
2320 
2325 #define CBOP_NORMAL 0
2326 
2330 #define CBOP_APPEND 1
2331 
2349 MG_EXPORT int GUIAPI CreateClipBoard (const char* cb_name, size_t size);
2350 
2364 MG_EXPORT int GUIAPI DestroyClipBoard (const char* cb_name);
2365 
2389 MG_EXPORT int GUIAPI SetClipBoardData (const char* cb_name,
2390  void* data, size_t n, int cbop);
2391 
2404 MG_EXPORT size_t GUIAPI GetClipBoardDataLen (const char* cb_name);
2405 
2421 MG_EXPORT size_t GUIAPI GetClipBoardData (const char* cb_name,
2422  void* data, size_t n);
2423 
2441 MG_EXPORT int GUIAPI GetClipBoardByte (const char* cb_name,
2442  int index, unsigned char* byte);
2443 
2446 #endif /* _MGHAVE_CLIPBOARD */
2447 
2458 MG_EXPORT void GUIAPI Ping (void);
2459 
2465 #define Beep Ping
2466 
2482 MG_EXPORT void GUIAPI Tone (int frequency_hz, int duration_ms);
2483 
2491 MG_EXPORT void* GUIAPI GetOriginalTermIO (void);
2492 
2526 MG_EXPORT char* GUIAPI FixStrAlloc (int len);
2527 
2545 MG_EXPORT char* GUIAPI FixStrDup (const char* str);
2546 
2559 MG_EXPORT void GUIAPI FreeFixStr (char* str);
2560 
2568 #ifndef _MGHAVE_CURSOR
2569 static inline void do_nothing (void) { return; }
2570 #endif
2571 
2572 #ifdef _MGHAVE_CURSOR
2573 
2590 MG_EXPORT HCURSOR GUIAPI LoadCursorFromFile (const char* filename);
2591 
2608 MG_EXPORT HCURSOR GUIAPI LoadCursorFromMem (const void* area);
2609 
2635 MG_EXPORT HCURSOR GUIAPI CreateCursor (int xhotspot, int yhotspot, int w, int h,
2636  const BYTE* pANDBits, const BYTE* pXORBits, int colornum);
2637 
2650 MG_EXPORT HCURSOR GUIAPI CopyCursor (HCURSOR hcsr);
2651 
2662 MG_EXPORT BOOL GUIAPI DestroyCursor (HCURSOR hcsr);
2663 
2722 MG_EXPORT HCURSOR GUIAPI GetSystemCursor (int csrid);
2723 
2732 MG_EXPORT HCURSOR GUIAPI GetCurrentCursor (void);
2733 #else
2734  #define LoadCursorFromFile(filename) (do_nothing(), 0)
2735  #define CreateCursor(x, y, w, h, ANDbs, XORbs, cr) (do_nothing(), 0)
2736  #define DestroyCursor(hcsr) (do_nothing(), 0)
2737  #define GetSystemCursor(csrid) (do_nothing(), 0)
2738  #define GetCurrentCursor() (do_nothing(), 0)
2739 #endif /* _MGHAVE_CURSOR */
2740 
2741 #define MAX_SYSCURSORINDEX 22
2742 
2743 /* System cursor index. */
2745 #define IDC_ARROW 0
2746 
2747 #define IDC_IBEAM 1
2748 
2749 #define IDC_PENCIL 2
2750 
2751 #define IDC_CROSS 3
2752 
2753 #define IDC_MOVE 4
2754 
2755 #define IDC_SIZENWSE 5
2756 
2757 #define IDC_SIZENESW 6
2758 
2759 #define IDC_SIZEWE 7
2760 
2761 #define IDC_SIZENS 8
2762 
2763 #define IDC_UPARROW 9
2764 
2765 #define IDC_NONE 10
2766 
2767 #define IDC_HELP 11
2768 
2769 #define IDC_BUSY 12
2770 
2771 #define IDC_WAIT 13
2772 
2773 #define IDC_RARROW 14
2774 
2775 #define IDC_COLOMN 15
2776 
2777 #define IDC_ROW 16
2778 
2779 #define IDC_DRAG 17
2780 
2781 #define IDC_NODROP 18
2782 
2783 #define IDC_HAND_POINT 19
2784 
2785 #define IDC_HAND_SELECT 20
2786 
2787 #define IDC_SPLIT_HORZ 21
2788 
2789 #define IDC_SPLIT_VERT 22
2790 
2802 MG_EXPORT void GUIAPI ClipCursor (const RECT* prc);
2803 
2814 MG_EXPORT void GUIAPI GetClipCursor (RECT* prc);
2815 
2828 MG_EXPORT void GUIAPI GetCursorPos (POINT* ppt);
2829 
2843 MG_EXPORT void GUIAPI SetCursorPos (int x, int y);
2844 
2845 #ifdef _MGHAVE_CURSOR
2846 
2864  MG_EXPORT HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL set_def);
2865 
2880  #define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
2881 
2897  #define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
2898 
2909 MG_EXPORT HCURSOR GUIAPI GetDefaultCursor (void);
2910 
2911 #else
2912  #define SetCursorEx(hcsr, set_def) (do_nothing(), 0)
2913  #define SetCursor(hcsr) (do_nothing(), 0)
2914  #define SetDefaultCursor(hcsr) (do_nothing(), 0)
2915  #define GetDefaultCursor() (do_nothing(), 0)
2916 #endif /* _MGHAVE_CURSOR */
2917 
2918 #ifdef _MGHAVE_CURSOR
2919 
2934 MG_EXPORT int GUIAPI ShowCursor (BOOL fShow);
2935 #else
2936  #define ShowCursor(fShow) (do_nothing(), 0)
2937 #endif /* _MGHAVE_CURSOR */
2938 
2971 MG_EXPORT BOOL GUIAPI GetKeyStatus (UINT uKey);
2972 
3013 MG_EXPORT DWORD GUIAPI GetShiftKeyStatus (void);
3014 
3029 MG_EXPORT void GUIAPI GetKeyboardState (BYTE* kbd_state);
3030 
3042 #define IDS_MGST_WINDOW 0
3043 
3048 #define IDS_MGST_START 1
3049 
3054 #define IDS_MGST_REFRESH 2
3055 
3060 #define IDS_MGST_CLOSEALLWIN 3
3061 
3066 #define IDS_MGST_ENDSESSION 4
3067 
3072 #define IDS_MGST_OPERATIONS 5
3073 
3078 #define IDS_MGST_MINIMIZE 6
3079 
3084 #define IDS_MGST_MAXIMIZE 7
3085 
3090 #define IDS_MGST_RESTORE 8
3091 
3096 #define IDS_MGST_CLOSE 9
3097 
3102 #define IDS_MGST_OK 10
3103 
3108 #define IDS_MGST_NEXT 11
3109 
3114 #define IDS_MGST_CANCEL 12
3115 
3120 #define IDS_MGST_PREV 13
3121 
3126 #define IDS_MGST_YES 14
3127 
3132 #define IDS_MGST_NO 15
3133 
3138 #define IDS_MGST_ABORT 16
3139 
3144 #define IDS_MGST_RETRY 17
3145 
3150 #define IDS_MGST_IGNORE 18
3151 
3156 #define IDS_MGST_ABOUTMG 19
3157 
3162 #define IDS_MGST_OPENFILE 20
3163 
3168 #define IDS_MGST_SAVEFILE 21
3169 
3174 #define IDS_MGST_COLORSEL 22
3175 
3180 #define IDS_MGST_SWITCHLAYER 23
3181 
3186 #define IDS_MGST_DELLAYER 24
3187 
3192 #define IDS_MGST_ERROR 25
3193 
3198 #define IDS_MGST_LOGO 26
3199 
3204 #define IDS_MGST_CURRPATH 27
3205 
3210 #define IDS_MGST_FILE 28
3211 
3216 #define IDS_MGST_LOCATION 29
3217 
3222 #define IDS_MGST_UP 30
3223 
3228 #define IDS_MGST_NAME 31
3229 
3234 #define IDS_MGST_SIZE 32
3235 
3240 #define IDS_MGST_ACCESSMODE 33
3241 
3246 #define IDS_MGST_LASTMODTIME 34
3247 
3252 #define IDS_MGST_OPEN 35
3253 
3258 #define IDS_MGST_FILENAME 36
3259 
3264 #define IDS_MGST_FILETYPE 37
3265 
3270 #define IDS_MGST_SHOWHIDEFILE 38
3271 
3276 #define IDS_MGST_NOTFOUND 39
3277 
3282 #define IDS_MGST_NR 40
3283 
3288 #define IDS_MGST_NW 41
3289 
3294 #define IDS_MGST_INFO 42
3295 
3300 #define IDS_MGST_R 43
3301 
3306 #define IDS_MGST_W 44
3307 
3312 #define IDS_MGST_WR 45
3313 
3318 #define IDS_MGST_SAVE 46
3319 
3324 #define IDS_MGST_FILEEXIST 47
3325 
3326 #define IDS_MGST_MAXNUM 47
3327 
3347 MG_EXPORT const char* GUIAPI GetSysText (unsigned int id);
3348 
3415 extern MG_EXPORT const char* SysText [];
3416 
3428 extern MG_EXPORT const char** local_SysText;
3429 
3430 #ifdef _MGCHARSET_UNICODE
3431 
3450 extern MG_EXPORT const char** GUIAPI GetSysTextInUTF8 (const char* language);
3451 
3452 #endif /* _MGCHARSET_UNICODE */
3453 
3474 MG_EXPORT char* strnchr (const char* s, size_t n, int c);
3475 
3492 MG_EXPORT int substrlen (const char* text, int len, int delimiter,
3493  int* nr_delim);
3494 
3507 MG_EXPORT char * strtrimall (char* src);
3508 
3515 #ifdef __cplusplus
3516 }
3517 #endif /* __cplusplus */
3518 
3519 #endif /* _MGUI_MINIGUI_H */
3520 
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.
Definition: common.h:874
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:294
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:411
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 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.
char * name
Definition: minigui.h:1835
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 int GUIAPI InitGUI(int, const char **)
Initialize MiniGUI.
MG_EXPORT DESKTOPOPS *GUIAPI SetCustomDesktopOperationSet(DESKTOPOPS *usr_dsk_ops)
Set customer desktop operation set.
Definition: common.h:843
MG_EXPORT size_t GUIAPI GetClipBoardDataLen(const char *cb_name)
Gets the length of the data of a clipboard.
struct _DESKTOPOPS DESKTOPOPS
PETCSECTION sections
Definition: minigui.h:1852
static int GetMgEtcIntValue(const char *pSection, const char *pKey, int *value)
Gets integer value from MiniGUI configuration etc object.
Definition: minigui.h:2265
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:363
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 HCURSOR GUIAPI LoadCursorFromMem(const void *area)
Loads a cursor from a memory area.
ETCSECTION * PETCSECTION
Definition: minigui.h:1842
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:358
MG_EXPORT void GUIAPI Ping(void)
Makes a beep sound.
MG_EXPORT void GUIAPI OpenAboutDialog(void)
Opens or actives the &#39;About MiniGUI&#39; dialog.
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.
char ** keys
Definition: minigui.h:1837
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.
static int GetMgEtcValue(const char *pSection, const char *pKey, char *pValue, int iLen)
Gets value from MiniGUI configuration etc object.
Definition: minigui.h:2245
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:373
#define NULL
A value indicates null pointer.
Definition: common.h:320
PVOID GHANDLE
General handle.
Definition: common.h:353
struct _ETCSECTION ETCSECTION
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:642
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 GUIAPI MiniGUIPanic(int exitcode)
The panic of MiniGUI application.
char ** values
Definition: minigui.h:1839
MG_EXPORT void *GUIAPI GetOriginalTermIO(void)
Gets termios structure of the original terminal before initializing MiniGUI.
int section_nr
Definition: minigui.h:1850
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 void GUIAPI TerminateGUI(int not_used)
Terminate MiniGUI.
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.
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:636
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
Definition: common.h:555
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.
int sect_nr_alloc
Definition: minigui.h:1848
unsigned int UINT
A type definition for unsigned integer.
Definition: common.h:594
MG_EXPORT DWORD GUIAPI GetShiftKeyStatus(void)
Gets status of the shift keys.
GHANDLE HMENU
Handle to menu.
Definition: common.h:383
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.
int key_nr_alloc
Definition: minigui.h:1831
MG_EXPORT int GUIAPI RemoveSectionInEtc(GHANDLE hEtc, const char *pSection)
Removes a section in etc object.
int key_nr
Definition: minigui.h:1833