MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Go to the documentation of this file.
64 #ifndef _MGUI_MINIGUI_H
65 #define _MGUI_MINIGUI_H
68 #include <sys/types.h>
79 #define ZOF_STATUS_MASK 0x0000000F
80 #define ZOF_VISIBLE 0x00000001
81 #define ZOF_DISABLED 0x00000002
82 #define ZOF_MAXIMIZED 0x00000004 // Since 5.0.0
83 #define ZOF_MINIMIZED 0x00000008 // Since 5.0.0
86 #define ZOF_GESTURE_FLAGS_MASK 0X000000F0
87 #define ZOF_GF_SWIPE_HORZ 0x00000010
88 #define ZOF_GF_SWIPE_VERT 0x00000020
91 #define ZOF_INTERNAL_FLAGS_MASK 0X000F0000
92 #define ZOF_IF_REFERENCE 0x00010000
93 #define ZOF_IF_ALWAYSTOP 0x00020000
94 #define ZOF_IF_SPECIAL 0x00040000 // Since 5.0.6
96 #define ZOF_TW_FLAG_MASK 0x00F00000
97 #define ZOF_TW_TROUNDCNS 0x00100000
98 #define ZOF_TW_BROUNDCNS 0x00200000
99 #define ZOF_TW_TBROUNDCNS 0x00300000
101 #define ZOF_TYPE_FLAG_MASK 0xFF000000
103 #define ZOF_TYPE_MASK 0xF0000000
104 #define ZOF_TYPE_NULL 0x00000000
105 #define ZOF_TYPE_DESKTOP 0x10000000 // fixed and only one.
106 #define ZOF_TYPE_LAUNCHER 0x20000000 // Since 5.0.0
107 #define ZOF_TYPE_NORMAL 0x30000000
108 #define ZOF_TYPE_HIGHER 0x40000000
109 #define ZOF_TYPE_DOCKER 0x50000000 // Since 5.0.0
110 #define ZOF_TYPE_SCREENLOCK 0x60000000 // Since 5.0.0
111 #define ZOF_TYPE_GLOBAL 0x70000000
112 #define ZOF_TYPE_TOOLTIP 0x80000000 // Since 5.0.0
113 #define ZOF_TYPE_POPUPMENU 0x90000000
115 #define ZOF_TYPE_BOTTOMMOST ZOF_TYPE_LAUNCHER
116 #define ZOF_TYPE_TOPMOST ZOF_TYPE_TOOLTIP
118 #define ZOF_TF_FLAG_MASK 0x0F000000
119 #define ZOF_TF_MAINWIN 0x01000000
120 #define ZOF_TF_TOOLWIN 0x02000000
121 #define ZOF_TF_CONTROL 0x04000000
123 #define ZNIT_NULL (ZOF_TYPE_NULL)
124 #define ZNIT_POPUPMENU (ZOF_TYPE_POPUPMENU)
125 #define ZNIT_TOOLTIP (ZOF_TYPE_TOOLTIP | ZOF_TF_MAINWIN)
127 #define ZNIT_GLOBAL_MAINWIN (ZOF_TYPE_GLOBAL | ZOF_TF_MAINWIN)
128 #define ZNIT_GLOBAL_TOOLWIN (ZOF_TYPE_GLOBAL | ZOF_TF_TOOLWIN)
129 #define ZNIT_GLOBAL_CONTROL (ZOF_TYPE_GLOBAL | ZOF_TF_CONTROL)
131 #define ZNIT_SCREENLOCK_MAINWIN (ZOF_TYPE_SCREENLOCK | ZOF_TF_MAINWIN)
132 #define ZNIT_SCREENLOCK_TOOLWIN (ZOF_TYPE_SCREENLOCK | ZOF_TF_TOOLWIN)
133 #define ZNIT_SCREENLOCK_CONTROL (ZOF_TYPE_SCREENLOCK | ZOF_TF_CONTROL)
135 #define ZNIT_DOCKER_MAINWIN (ZOF_TYPE_DOCKER | ZOF_TF_MAINWIN)
136 #define ZNIT_DOCKER_TOOLWIN (ZOF_TYPE_DOCKER | ZOF_TF_TOOLWIN)
137 #define ZNIT_DOCKER_CONTROL (ZOF_TYPE_DOCKER | ZOF_TF_CONTROL)
139 #define ZNIT_HIGHER_MAINWIN (ZOF_TYPE_HIGHER | ZOF_TF_MAINWIN)
140 #define ZNIT_HIGHER_TOOLWIN (ZOF_TYPE_HIGHER | ZOF_TF_TOOLWIN)
141 #define ZNIT_HIGHER_CONTROL (ZOF_TYPE_HIGHER | ZOF_TF_CONTROL)
143 #define ZNIT_NORMAL_MAINWIN (ZOF_TYPE_NORMAL | ZOF_TF_MAINWIN)
144 #define ZNIT_NORMAL_TOOLWIN (ZOF_TYPE_NORMAL | ZOF_TF_TOOLWIN)
145 #define ZNIT_NORMAL_CONTROL (ZOF_TYPE_NORMAL | ZOF_TF_CONTROL)
147 #define ZNIT_LAUNCHER_MAINWIN (ZOF_TYPE_LAUNCHER | ZOF_TF_MAINWIN)
148 #define ZNIT_LAUNCHER_TOOLWIN (ZOF_TYPE_LAUNCHER | ZOF_TF_TOOLWIN)
149 #define ZNIT_LAUNCHER_CONTROL (ZOF_TYPE_LAUNCHER | ZOF_TF_CONTROL)
151 #define ZNIT_DESKTOP (ZOF_TYPE_DESKTOP)
153 #define ZNIF_VISIBLE (ZOF_VISIBLE)
154 #define ZNIF_DISABLED (ZOF_DISABLED)
155 #define ZNIF_MAXIMIZED (ZOF_MAXIMIZED)
156 #define ZNIF_MINIMIZED (ZOF_MINIMIZED)
159 #define ZNIT_TOPMOST_MAINWIN (ZNIT_HIGHER_MAINWIN)
160 #define ZNIT_TOPMOST_TOOLWIN (ZNIT_HIGHER_TOOLWIN)
161 #define ZNIT_TOPMOST_CONTROL (ZNIT_HIGHER_CONTROL)
163 typedef struct _CalcPosInfo {
188 #define g_rcScr (GetScreenRect())
198 #define g_rcDesktop g_rcScr
202 #ifdef _MGRM_PROCESSES
221 MG_EXPORT
BOOL GUIAPI IsServer(
void);
232 #define mgIsServer (IsServer())
243 extern MG_EXPORT
void* mgSharedRes;
253 extern MG_EXPORT
size_t mgSizeRes;
259 #define LEN_LAYER_NAME 15
265 #define LEN_CLIENT_NAME 15
271 #define INV_LAYER_HANDLE 0
276 typedef struct _MG_Client
279 char name [LEN_CLIENT_NAME + 1];
291 DWORD last_live_time;
296 struct _MG_Client* next;
298 struct _MG_Client* prev;
301 struct _MG_Layer* layer;
304 struct GlobalRes* global_res;
308 typedef struct _MG_Layer
311 char name [LEN_LAYER_NAME + 1];
319 MG_Client* cli_active;
322 struct _MG_Layer* next;
324 struct _MG_Layer* prev;
338 extern MG_EXPORT
int mgClientSize;
350 extern MG_EXPORT MG_Client* mgClients;
358 extern MG_EXPORT MG_Layer* mgTopmostLayer;
366 extern MG_EXPORT MG_Layer* mgDefaultLayer;
374 extern MG_EXPORT MG_Layer* mgLayers;
399 MG_EXPORT
int GUIAPI
InitGUI (
int argc,
const char *argv[]);
425 #define NAME_SELF_LAYER ""
431 #define NAME_TOPMOST_LAYER ""
437 #define NAME_DEF_LAYER "mginit"
439 #ifdef _MGRM_PROCESSES
494 const char* client_name,
495 int max_nr_highers,
int max_nr_normals);
521 MG_EXPORT
GHANDLE GUIAPI GetLayerInfo (
const char* layer_name,
522 int* nr_clients,
BOOL* is_topmost,
int* cli_active);
541 MG_EXPORT
BOOL GUIAPI SetTopmostLayer (
BOOL handle_name,
542 GHANDLE layer_handle,
const char* layer_name);
561 MG_EXPORT
BOOL GUIAPI DeleteLayer (
BOOL handle_name,
562 GHANDLE layer_handle,
const char* layer_name);
589 MG_EXPORT
BOOL GUIAPI MoveToLayer (
BOOL handle_name,
590 GHANDLE layer_handle,
const char* layer_name);
613 typedef int (* ON_LOCK_CLIENT_REQ) (void);
621 typedef int (* ON_TRYLOCK_CLIENT_REQ) (void);
629 typedef void (* ON_UNLOCK_CLIENT_REQ) (void);
639 extern MG_EXPORT ON_LOCK_CLIENT_REQ OnLockClientReq;
649 extern MG_EXPORT ON_TRYLOCK_CLIENT_REQ OnTrylockClientReq;
658 extern MG_EXPORT ON_UNLOCK_CLIENT_REQ OnUnlockClientReq;
660 #define LCO_NEW_CLIENT 1
661 #define LCO_DEL_CLIENT 2
669 typedef void (* ON_NEW_DEL_CLIENT) (
int op,
int cli);
671 #define LCO_NEW_LAYER 1
672 #define LCO_DEL_LAYER 2
673 #define LCO_JOIN_CLIENT 3
674 #define LCO_REMOVE_CLIENT 4
675 #define LCO_TOPMOST_CHANGED 5
676 #define LCO_ACTIVE_CHANGED 6
685 typedef void (* ON_CHANGE_LAYER) (
int op, MG_Layer* layer,
688 #define ZNOP_ALLOCATE 1
690 #define ZNOP_MOVE2TOP 3
693 #define ZNOP_MOVEWIN 6
694 #define ZNOP_SETACTIVE 7
696 #define ZNOP_ENABLEWINDOW 11
697 #define ZNOP_DISABLEWINDOW 12
698 #define ZNOP_STARTDRAG 13
699 #define ZNOP_CANCELDRAG 14
700 #define ZNOP_CHANGECAPTION 15
701 #define ZNOP_REGIONCHANGED 16
702 #define ZNOP_COMPOSITINGCHANGED 17
703 #define ZNOP_ICONCHANGED 18
711 typedef void (* ON_ZNODE_OPERATION) (
int op,
int cli,
int idx_znode);
736 extern MG_EXPORT ON_NEW_DEL_CLIENT OnNewDelClient;
767 extern MG_EXPORT ON_CHANGE_LAYER OnChangeLayer;
815 extern MG_EXPORT ON_ZNODE_OPERATION OnZNodeOperation;
843 MG_EXPORT
BOOL GUIAPI ServerStartup (
int nr_globals,
844 int def_nr_highers,
int def_nr_normals);
874 MG_EXPORT MG_Layer* GUIAPI ServerCreateLayer (
const char* layer_name,
875 int max_nr_highers,
int max_nr_normals);
891 MG_EXPORT
BOOL GUIAPI ServerSetTopmostLayer (MG_Layer* layer);
907 MG_EXPORT
BOOL GUIAPI ServerDeleteLayer (MG_Layer* layer);
939 MG_EXPORT
int GUIAPI ServerGetTopmostZNodeOfType (MG_Layer* layer,
DWORD type,
968 MG_EXPORT
int GUIAPI ServerGetNextZNode (MG_Layer* layer,
int idx_znode,
999 MG_EXPORT
int GUIAPI ServerGetPrevZNode (MG_Layer* layer,
int idx_znode,
1003 typedef struct _ZNODEINFO {
1069 const char* caption;
1085 #ifdef _MGSCHEMA_COMPOSITING
1124 MG_EXPORT
BOOL GUIAPI ServerGetZNodeInfo (MG_Layer* layer,
int idx_znode,
1125 ZNODEINFO* znode_info);
1128 typedef struct _ZNODEHEADER {
1144 const char* caption;
1164 #ifdef _MGSCHEMA_COMPOSITING
1166 unsigned int changes;
1182 unsigned int dirty_age;
1188 const RECT* dirty_rcs;
1227 MG_EXPORT
const ZNODEHEADER* GUIAPI ServerGetWinZNodeHeader (
1228 MG_Layer* layer,
int idx_znode,
void** priv_data,
BOOL lock);
1252 #ifdef _MGSCHEMA_COMPOSITING
1253 MG_EXPORT
BOOL GUIAPI ServerReleaseWinZNodeHeader (MG_Layer* layer,
1256 static inline BOOL GUIAPI ServerReleaseWinZNodeHeader (MG_Layer* layer,
1277 MG_EXPORT
int GUIAPI ServerGetPopupMenusCount (
void);
1304 MG_EXPORT
const ZNODEHEADER* GUIAPI ServerGetPopupMenuZNodeHeader (
1305 int idx_znode,
void** priv_data,
BOOL lock);
1329 #ifdef _MGSCHEMA_COMPOSITING
1330 MG_EXPORT
BOOL GUIAPI ServerReleasePopupMenuZNodeHeader (
int idx_znode);
1332 static inline BOOL GUIAPI ServerReleasePopupMenuZNodeHeader (
int idx_znode)
1340 #define RGN_OP_MASK 0x000F
1341 #define RGN_OP_SET 0x0000
1342 #define RGN_OP_INCLUDE 0x0001
1343 #define RGN_OP_EXCLUDE 0x0002
1344 #define RGN_OP_FLAG_ABS 0x0010
1377 MG_EXPORT
BOOL GUIAPI ServerGetWinZNodeRegion (MG_Layer* layer,
int idx_znode,
1413 MG_EXPORT
BOOL GUIAPI ServerGetPopupMenuZNodeRegion (
int idx_znode,
1438 MG_EXPORT
BOOL GUIAPI ServerSetWinZNodePrivateData (MG_Layer* layer,
1439 int idx_znode,
void* priv_data);
1460 MG_EXPORT
BOOL GUIAPI ServerSetPopupMenuZNodePrivateData (
int idx_znode,
1495 MG_EXPORT
BOOL GUIAPI ServerDoZNodeOperation (MG_Layer* layer,
int idx_znode,
1496 int op_code,
void* op_data,
BOOL notify);
1520 MG_EXPORT
BOOL GUIAPI ServerMoveClientToLayer (
int cli, MG_Layer* dst_layer);
1533 MG_EXPORT
int GUIAPI GetClientByPID (
int pid);
1551 MG_EXPORT
BOOL GUIAPI SetTopmostClient (
int cli);
1557 MG_EXPORT
void GUIAPI DisableClientsOutput (
void);
1565 MG_EXPORT
void GUIAPI UpdateTopmostLayer (
const RECT* dirty_rc);
1567 #ifdef _MGSCHEMA_COMPOSITING
1573 struct _CompositorCtxt;
1574 typedef struct _CompositorCtxt CompositorCtxt;
1582 typedef struct _CompositorOps {
1587 CompositorCtxt* (*initialize) (
const char* name);
1593 void (*terminate) (CompositorCtxt* ctxt);
1599 void (*refresh) (CompositorCtxt* ctxt);
1606 void (*purge_ppp_data) (CompositorCtxt* ctxt,
int zidx,
void* data);
1613 void (*purge_win_data) (CompositorCtxt* ctxt, MG_Layer* layer,
1614 int zidx,
void* data);
1620 void (*calc_mainwin_pos) (CompositorCtxt* ctxt, MG_Layer* layer,
1621 DWORD zt_type,
int first_for_type,
int cli, CALCPOSINFO* info);
1627 void (*on_layer_op) (CompositorCtxt* ctxt,
int layer_op,
1628 MG_Layer* layer, MG_Client* client);
1636 BOOL (*reset_dirty_region) (CompositorCtxt* ctxt, MG_Layer* layer);
1644 BOOL (*merge_dirty_ppp) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1652 BOOL (*merge_dirty_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1660 BOOL (*merge_dirty_wpp) (CompositorCtxt* ctxt, MG_Layer* layer);
1666 BOOL (*refresh_dirty_region) (CompositorCtxt* ctxt, MG_Layer* layer);
1679 void (*on_dirty_screen) (CompositorCtxt* ctxt, MG_Layer* layer,
1680 DWORD cause_type,
const RECT* rc_dirty);
1688 void (*on_showing_ppp) (CompositorCtxt* ctxt,
int zidx);
1695 void (*on_hiding_ppp) (CompositorCtxt* ctxt,
int zidx);
1703 void (*on_closed_menu) (CompositorCtxt* ctxt,
const RECT* rc_bound);
1711 void (*on_showing_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1718 void (*on_hiding_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1725 void (*on_raised_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1732 void (*on_changed_ct) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1739 void (*on_changed_rgn) (CompositorCtxt* ctxt, MG_Layer* layer,
1740 int zidx,
const RECT* rc_org_bound);
1747 void (*on_moved_win) (CompositorCtxt* ctxt, MG_Layer* layer,
1748 int zidx,
const RECT* rc_org);
1754 unsigned int (*composite_layers) (CompositorCtxt* ctxt, MG_Layer* layers[],
1755 int nr_layers,
void* combine_param);
1762 void (*transit_to_layer) (CompositorCtxt* ctxt, MG_Layer* to_layer);
1768 void (*on_maximizing_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1774 void (*on_minimizing_win) (CompositorCtxt* ctxt, MG_Layer* layer,
int zidx);
1778 #define FCM_HORIZONTAL 0x0000
1779 #define FCM_VERTICAL 0x0001
1780 #define FCM_METHOD_MASK 0x00FF
1781 #define FCM_SCALE 0x0100
1784 typedef struct _CombParamsFallback {
1792 unsigned int method;
1799 } COMBPARAMS_FALLBACK;
1820 MG_EXPORT
const CompositorOps* GUIAPI ServerGetCompositorOps (
const char* name);
1838 MG_EXPORT
BOOL GUIAPI ServerRegisterCompositor (
1839 const char* name,
const CompositorOps* ops);
1856 MG_EXPORT
BOOL GUIAPI ServerUnregisterCompositor (
const char* name);
1858 #define LEN_COMPOSITOR_NAME 15
1859 #define COMPSOR_NAME_DEFAULT "default"
1860 #define COMPSOR_NAME_FALLBACK "fallback"
1881 MG_EXPORT
const CompositorOps* GUIAPI ServerSelectCompositor (
1882 const char* name, CompositorCtxt** ctxt);
1899 MG_EXPORT
const char* GUIAPI ServerGetCurrentCompositor (
1900 const CompositorOps** ops, CompositorCtxt** ctxt);
1902 #define COMPSOR_OPS_VERSION 2
1920 const CompositorOps* __ex_compositor_get (
const char* name,
1921 const CompositorOps* fallback_ops,
int* version);
1961 #define MAX_SYS_REQID 0x0023
1969 #define MAX_REQID 0x0030
1972 typedef struct _REQUEST {
1981 typedef REQUEST* PREQUEST;
2015 MG_EXPORT
int GUIAPI ClientRequestEx2 (
const REQUEST* request,
2016 const void* ex_data,
size_t ex_data_len,
int fd_to_send,
2017 void* result,
size_t len_rslt,
int* fd_received);
2045 static inline int GUIAPI ClientRequestEx (
const REQUEST* request,
2046 const void* ex_data,
int ex_data_len,
2047 void* result,
int len_rslt)
2049 return ClientRequestEx2 (request, ex_data, ex_data_len, -1,
2050 result, len_rslt,
NULL);
2078 static inline int ClientRequest (
const REQUEST* request,
2079 void* result,
int len_rslt)
2081 return ClientRequestEx (request,
NULL, 0, result, len_rslt);
2095 MG_EXPORT
int GUIAPI GetSockFD2Server (
void);
2121 MG_EXPORT
int GUIAPI ServerSendReplyEx (
int clifd,
2122 const void* reply,
int len,
int fd_to_send);
2145 static inline int GUIAPI ServerSendReply (
int clifd,
const void* reply,
int len)
2147 return ServerSendReplyEx (clifd, reply, len, -1);
2156 typedef int (* REQ_HANDLER) (
int cli,
int clifd,
void* buff,
size_t len);
2167 typedef int (* REQ_HANDLER_V1) (
int cli,
int clifd,
2168 void* buff,
size_t len,
int fd_received);
2188 MG_EXPORT
BOOL GUIAPI RegisterRequestHandler (
int req_id,
2189 REQ_HANDLER your_handler);
2212 MG_EXPORT
BOOL GUIAPI RegisterRequestHandlerV1 (
int req_id,
2213 REQ_HANDLER_V1 your_handler_v1);
2236 MG_EXPORT REQ_HANDLER GUIAPI GetRequestHandler (
int req_id);
2259 MG_EXPORT REQ_HANDLER_V1 GUIAPI GetRequestHandlerV1 (
int req_id);
2280 MG_EXPORT
void* GUIAPI GetRequestHandlerEx (
int req_id,
int* version);
2316 MG_EXPORT
int serv_listen (
const char* name);
2339 MG_EXPORT
int serv_accept (
int listenfd, pid_t *pidptr, uid_t *uidptr);
2361 MG_EXPORT
int cli_conn (
const char* name,
char project);
2363 #define SOCKERR_IO -1
2364 #define SOCKERR_CLOSED -2
2365 #define SOCKERR_INVARG -3
2366 #define SOCKERR_TIMEOUT -4
2367 #define SOCKERR_OK 0
2397 MG_EXPORT ssize_t sock_write_t (
int fd,
const void* buff,
size_t count,
2427 MG_EXPORT ssize_t sock_read_t (
int fd,
void* buff,
size_t count,
2436 #define sock_write(fd, buff, count) sock_write_t(fd, buff, count, 0)
2444 #define sock_read(fd, buff, count) sock_read_t(fd, buff, count, 0)
2498 #define ReinitDesktop() ReinitDesktopEx (TRUE)
2516 #ifdef _USE_MINIGUIENTRY
2517 #define main_entry minigui_entry
2518 int minigui_entry (
int args,
const char* arg[]);
2520 #define main_entry main
2540 #define MiniGUIMain \
2541 MiniGUIAppMain (int args, const char* argv[]); \
2542 int main_entry (int args, const char* argv[]) \
2545 if (InitGUI (args, argv) != 0) { \
2548 iRet = MiniGUIAppMain (args, argv); \
2549 TerminateGUI (iRet); \
2559 #define IDM_DTI_FIRST (300)
2565 void* (*init) (
HDC dc_desktop);
2572 HDC dc_desktop,
const RECT* inv_rc);
2584 HMENU hmenu,
int start_pos);
2672 #ifndef _MGRM_PROCESSES
2674 #define DUMMY_LAYER_HANDLE (GHANDLE)(-1)
2690 const char* client_name,
int max_nr_highers,
int max_nr_normals)
2692 return DUMMY_LAYER_HANDLE;
2699 #ifdef _MGHAVE_MOUSECALIBRATE
2736 const POINT* dst_pts);
2763 #ifdef _MGMISC_ABOUTDLG
2770 #ifdef _MGRM_THREADS
2862 #define ETC_MAXLINE 1024
2868 #define ETC_FILENOTFOUND -1
2873 #define ETC_SECTIONNOTFOUND -2
2878 #define ETC_KEYNOTFOUND -3
2883 #define ETC_TMPFILEFAILED -4
2888 #define ETC_FILEIOFAILED -5
2893 #define ETC_INTCONV -6
2898 #define ETC_INVALIDOBJ -7
2903 #define ETC_READONLYOBJ -8
2938 #ifndef _MGINCORE_RES
2990 const char* pSection,
const char* pKey,
char* pValue,
int iLen);
3030 const char* pSection,
const char* pKey,
int* value);
3058 const char* pSection,
const char* pKey,
char* pValue);
3081 const char* pSection);
3182 const char* pKey,
char* pValue,
int iLen);
3192 const char* pKey,
int* pValue);
3204 #define SetValueToEtc(hEtc, pSection, pKey, pValue) \
3205 GetValueFromEtc(hEtc, pSection, pKey, pValue, -1)
3225 const char* pSection,
BOOL bCreateNew);
3253 const char* pKey,
char* pValue,
int iLen);
3279 const char* pKey,
int* pValue);
3292 const char* pKey,
char* pValue);
3317 extern MG_EXPORT
GHANDLE hMgEtc;
3329 const char *pKey,
char *pValue,
int iLen)
3331 #ifndef _MGINCORE_RES
3348 static inline int GetMgEtcIntValue (
const char *pSection,
3349 const char* pKey,
int *value)
3351 #ifndef _MGINCORE_RES
3361 #ifdef _MGHAVE_CLIPBOARD
3372 #define LEN_CLIPBOARD_NAME 15
3377 #define NR_CLIPBOARDS 4
3383 #define CBNAME_TEXT ("text")
3396 #define CBERR_BADNAME 1
3402 #define CBERR_NOMEM 2
3408 #define CBOP_NORMAL 0
3413 #define CBOP_APPEND 1
3432 MG_EXPORT
int GUIAPI
CreateClipBoard (
const char* cb_name,
size_t size);
3473 void* data,
size_t n,
int cbop);
3505 void* data,
size_t n);
3525 int index,
unsigned char*
byte);
3556 MG_EXPORT
void GUIAPI
Ping (
void);
3580 MG_EXPORT
void GUIAPI
Tone (
int frequency_hz,
int duration_ms);
3643 MG_EXPORT
char* GUIAPI
FixStrDup (
const char* str);
3657 MG_EXPORT
void GUIAPI
FreeFixStr (
char* str);
3666 #ifdef _MGHAVE_CURSOR
3704 #ifdef _MGSCHEMA_COMPOSITING
3727 MG_EXPORT
HCURSOR GUIAPI LoadCursorFromPNGFile (
const char* filename,
3728 int hotspot_x,
int hotspot_y);
3752 MG_EXPORT
HCURSOR GUIAPI LoadCursorFromPNGMem (
const void* area,
size_t size,
3753 int hotspot_x,
int hotspot_y);
3783 const BYTE* pANDBits,
const BYTE* pXORBits,
int colornum);
3891 #ifdef _MGSCHEMA_COMPOSITING
3893 HCURSOR LoadCursorFromPNGFile(
const char* filename,
3894 int hotspot_x,
int hotspot_y) {
3899 HCURSOR GUIAPI LoadCursorFromPNGMem(
const void* area,
size_t size,
3900 int hotspot_x,
int hotspot_y) {
3908 const BYTE* pANDBits,
const BYTE* pXORBits,
int colornum) {
3930 #define MAX_SYSCURSORINDEX 22
3938 #define IDC_PENCIL 2
3944 #define IDC_SIZENWSE 5
3946 #define IDC_SIZENESW 6
3948 #define IDC_SIZEWE 7
3950 #define IDC_SIZENS 8
3952 #define IDC_UPARROW 9
3962 #define IDC_RARROW 14
3964 #define IDC_COLOMN 15
3970 #define IDC_NODROP 18
3972 #define IDC_HAND_POINT 19
3974 #define IDC_HAND_SELECT 20
3976 #define IDC_SPLIT_HORZ 21
3978 #define IDC_SPLIT_VERT 22
4034 #ifdef _MGHAVE_CURSOR
4113 #define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
4130 #define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
4235 #define IDS_MGST_WINDOW 0
4241 #define IDS_MGST_START 1
4247 #define IDS_MGST_REFRESH 2
4253 #define IDS_MGST_CLOSEALLWIN 3
4259 #define IDS_MGST_ENDSESSION 4
4265 #define IDS_MGST_OPERATIONS 5
4271 #define IDS_MGST_MINIMIZE 6
4277 #define IDS_MGST_MAXIMIZE 7
4283 #define IDS_MGST_RESTORE 8
4289 #define IDS_MGST_CLOSE 9
4295 #define IDS_MGST_OK 10
4301 #define IDS_MGST_NEXT 11
4307 #define IDS_MGST_CANCEL 12
4313 #define IDS_MGST_PREV 13
4319 #define IDS_MGST_YES 14
4325 #define IDS_MGST_NO 15
4331 #define IDS_MGST_ABORT 16
4337 #define IDS_MGST_RETRY 17
4343 #define IDS_MGST_IGNORE 18
4349 #define IDS_MGST_ABOUTMG 19
4355 #define IDS_MGST_OPENFILE 20
4361 #define IDS_MGST_SAVEFILE 21
4367 #define IDS_MGST_COLORSEL 22
4373 #define IDS_MGST_SWITCHLAYER 23
4379 #define IDS_MGST_DELLAYER 24
4385 #define IDS_MGST_ERROR 25
4391 #define IDS_MGST_LOGO 26
4397 #define IDS_MGST_CURRPATH 27
4403 #define IDS_MGST_FILE 28
4409 #define IDS_MGST_LOCATION 29
4415 #define IDS_MGST_UP 30
4421 #define IDS_MGST_NAME 31
4427 #define IDS_MGST_SIZE 32
4433 #define IDS_MGST_ACCESSMODE 33
4439 #define IDS_MGST_LASTMODTIME 34
4445 #define IDS_MGST_OPEN 35
4451 #define IDS_MGST_FILENAME 36
4457 #define IDS_MGST_FILETYPE 37
4463 #define IDS_MGST_SHOWHIDEFILE 38
4469 #define IDS_MGST_NOTFOUND 39
4475 #define IDS_MGST_NR 40
4481 #define IDS_MGST_NW 41
4487 #define IDS_MGST_INFO 42
4493 #define IDS_MGST_R 43
4499 #define IDS_MGST_W 44
4505 #define IDS_MGST_WR 45
4511 #define IDS_MGST_SAVE 46
4517 #define IDS_MGST_FILEEXIST 47
4519 #define IDS_MGST_MAXNUM 47
4540 MG_EXPORT
const char* GUIAPI
GetSysText (
unsigned int id);
4608 extern MG_EXPORT
const char*
SysText [];
4623 #ifdef _MGCHARSET_UNICODE
4643 extern MG_EXPORT
const char** GUIAPI
GetSysTextInUTF8 (
const char* language);
4667 MG_EXPORT
char*
strnchr (
const char* s,
size_t n,
int c);
4685 MG_EXPORT
int substrlen (
const char* text,
int len,
int delimiter,
4847 MG_EXPORT
void *
mg_slice_copy(
size_t block_size,
const void *mem_block);
4867 MG_EXPORT
void mg_slice_free(
size_t block_size,
void *mem_block);
4892 void *mem_chain,
size_t next_offset);
4917 #define mg_slice_new(type) ((type*)mg_slice_alloc(sizeof (type)))
4944 #define mg_slice_new0(type) ((type*)mg_slice_alloc0(sizeof (type)))
4980 #define mg_slice_dup(type, mem) \
4981 (1 ? (type*) mg_slice_copy (sizeof (type), (mem)) \
4982 : ((void) ((type*) 0 == (mem)), (type*) 0))
5006 #define mg_slice_delete(type, mem) \
5008 if (1) mg_slice_free (sizeof (type), (mem)); \
5009 else (void) ((type*) 0 == (mem)); \
5036 #define mg_slice_delete_chain(type, mem_chain, next) \
5038 if (1) mg_slice_free_chain_with_offset (sizeof (type), \
5039 (mem_chain), G_STRUCT_OFFSET (type, next)); \
5040 else (void) ((type*) 0 == (mem_chain)); \
5043 #ifdef _MGDEVEL_MODE
5044 MG_EXPORT
void mg_slice_debug_tree_statistics(
void);
MG_EXPORT void GUIAPI GetClipCursor(RECT *prc)
Get the current cursor clipping rectangle.
MG_EXPORT void GUIAPI GetOriginalMousePosition(int *x, int *y)
Get the original mouse position.
void(* keyboard_handler)(void *context, int message, WPARAM wParam, LPARAM lParam)
MG_EXPORT void GUIAPI ExitGUISafely(int exitcode)
Exits your MiniGUI application safely.
#define NULL
A value indicates null pointer.
MG_EXPORT int GUIAPI GetClipBoardByte(const char *cb_name, int index, unsigned char *byte)
Get a byte from a clipboard.
MG_EXPORT HCURSOR GUIAPI GetCurrentCursor(void)
Get the handle to the current cursor.
DWORD_PTR DWORD
A unsigned long type definition for pointer precision.
MG_EXPORT GHANDLE GUIAPI FindSectionInEtc(GHANDLE hEtc, const char *pSection, BOOL bCreateNew)
Finds/Creates a section from an etc object.
MG_EXPORT BOOL GUIAPI SetMouseCalibrationParameters(const POINT *src_pts, const POINT *dst_pts)
Set the parameters for doing mouse calibration.
MG_EXPORT BOOL GUIAPI GetKeyStatus(UINT uKey)
Get a key or a mouse button status.
GHANDLE HWND
Handle to main window or control.
GHANDLE HDC
Handle to device context.
const MG_EXPORT char ** local_SysText
The pointer to the current localized system text array.
MG_EXPORT DWORD GUIAPI GetTickCount(void)
Retrieve the tick counts that have elapsed since MiniGUI was started.
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 HCURSOR GUIAPI GetSystemCursor(int csrid)
Get the handle to a system cursor by its identifier.
const MG_EXPORT char * SysText[]
Contains all text used by MiniGUI in English.
MG_EXPORT void GUIAPI GetKeyboardState(BYTE *kbd_state)
Get status of all keys on keyboard.
MG_EXPORT void GUIAPI OpenAboutDialog(void)
Opens or actives the 'About MiniGUI' dialog.
MG_EXPORT int GUIAPI RemoveSectionInEtcFile(const char *pEtcFile, const char *pSection)
Removes a section in an etc file.
MG_EXPORT int GUIAPI GetIntValueFromEtcSec(GHANDLE hSect, const char *pKey, int *pValue)
Get an integer value from an etc section object.
MG_EXPORT DWORD GUIAPI GetShiftKeyStatus(void)
Get status of the shift keys.
const MG_EXPORT char *GUIAPI GetSysText(unsigned int id)
Translates system text to localized text.
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.
PVOID GHANDLE
General handle.
unsigned int UINT
A type definition for unsigned integer.
unsigned char BYTE
A type definition for an 8-bit unsigned character (byte).
MG_EXPORT int GUIAPI CreateClipBoard(const char *cb_name, size_t size)
Creates a new clipboard.
MG_EXPORT char *GUIAPI FixStrDup(const char *str)
Duplicates a length-fixed string.
MG_EXPORT size_t GUIAPI GetClipBoardDataLen(const char *cb_name)
Get the length of the data of a 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 HCURSOR GUIAPI CopyCursor(HCURSOR hcsr)
Copies a cursor object.
GHANDLE HMENU
Handle to menu.
MG_EXPORT int GUIAPI SaveEtcToFile(GHANDLE hEtc, const char *file_name)
Saves an ETC object into a file.
MG_EXPORT BOOL GUIAPI DestroyCursor(HCURSOR hcsr)
Destroys a cursor object.
MG_EXPORT int GUIAPI UnloadEtcFile(GHANDLE hEtc)
Unloads an etc file.
MG_EXPORT void GUIAPI DesktopUpdateAllWindow(void)
Update all visible windows on the desktop.
const MG_EXPORT char **GUIAPI GetSysTextInUTF8(const char *language)
Get the localized system text array in UTF-8 for a specified language.
MG_EXPORT char *GUIAPI FixStrAlloc(int len)
Allocates a buffer for a length-fixed string.
MG_EXPORT void GUIAPI Tone(int frequency_hz, int duration_ms)
Makes a tone.
int BOOL
A type definition for boolean value.
MG_EXPORT int GUIAPI GetIntValueFromEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, int *value)
Get integer value from a configuration file.
MG_EXPORT int GUIAPI InitGUI(int argc, const char *argv[])
Initialize MiniGUI.
MG_EXPORT char ETCFILEPATH[]
The path name of MiniGUI configuration file.
MG_EXPORT int GUIAPI GetValueFromEtcSec(GHANDLE hSect, const char *pKey, char *pValue, int iLen)
Get value from an etc section object.
MG_EXPORT HCURSOR GUIAPI GetDefaultCursor(void)
Get the default cursor.
MG_EXPORT int GUIAPI GetValueFromEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, char *pValue, int iLen)
Get value from a configuration file.
MG_EXPORT RECT GUIAPI GetScreenRect(void)
Return the rectangle of the physical screen.
MG_EXPORT void mg_slice_free(size_t block_size, void *mem_block)
Free a block of memory.
void(* deinit)(void *context)
MG_EXPORT size_t GUIAPI GetClipBoardData(const char *cb_name, void *data, size_t n)
Get the data of a clipboard.
MG_EXPORT HCURSOR GUIAPI LoadCursorFromFile(const char *filename)
Loads a cursor from a M$ Windows cursor file.
MG_EXPORT int GUIAPI SetClipBoardData(const char *cb_name, void *data, size_t n, int cbop)
Set the data of a clipboard.
MG_EXPORT char * strtrimall(char *src)
Deletes all space characters.
MG_EXPORT DESKTOPOPS *GUIAPI SetCustomDesktopOperationSet(DESKTOPOPS *usr_dsk_ops)
Set customer desktop operation set.
MG_EXPORT int GUIAPI ShowCursor(BOOL fShow)
Shows or hides cursor.
MG_EXPORT int GUIAPI GetValueFromEtc(GHANDLE hEtc, const char *pSection, const char *pKey, char *pValue, int iLen)
Get value from a configuration etc object.
void(* desktop_menucmd_handler)(void *context, int id)
MG_EXPORT void *GUIAPI GetOriginalTermIO(void)
Get termios structure of the original terminal before initializing MiniGUI.
static int GetMgEtcValue(const char *pSection, const char *pKey, char *pValue, int iLen)
Get value from MiniGUI configuration etc object.
MG_EXPORT void GUIAPI MiniGUIPanic(int exitcode)
The panic of MiniGUI application.
void(* customize_desktop_menu)(void *context, HMENU hmenu, int start_pos)
MG_EXPORT void * mg_slice_alloc0(size_t block_size)
Allocate a slice memory and initialize the memory to zero.
MG_EXPORT void GUIAPI SetCursorPos(int x, int y)
Set position of the current cursor.
MG_EXPORT void GUIAPI TerminateGUI(int not_used)
Terminate MiniGUI.
MG_EXPORT void * mg_slice_alloc(size_t block_size)
Allocate a slice memory.
MG_EXPORT int GUIAPI GetIntValueFromEtc(GHANDLE hEtc, const char *pSection, const char *pKey, int *pValue)
Get the integer value from a configuration etc 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 LoadCursorFromMem(const void *area)
Loads a cursor from a memory area.
MG_EXPORT int GUIAPI DestroyClipBoard(const char *cb_name)
Destroys a new clipboard.
MG_EXPORT BOOL GUIAPI ReinitDesktopEx(BOOL init_sys_text)
Re-initializes the desktop.
MG_EXPORT void GUIAPI FreeFixStr(char *str)
Frees a length-fixed string.
MG_EXPORT int GUIAPI SetValueToEtcFile(const char *pEtcFile, const char *pSection, const char *pKey, char *pValue)
Set a value in a configuration file.
MG_EXPORT void GUIAPI GetCursorPos(POINT *ppt)
Get position of the current cursor.
MG_EXPORT void GUIAPI Ping(void)
Makes a beep sound.
void(* mouse_handler)(void *context, int message, WPARAM wParam, LPARAM lParam)
MG_EXPORT GHANDLE GUIAPI LoadEtcFile(const char *pEtcFile)
Loads an etc file into memory.
MG_EXPORT int GUIAPI SetValueToEtcSec(GHANDLE hSect, const char *pKey, char *pValue)
Set the value in the etc section object.
#define TRUE
TRUE value, defined as 1 by MiniGUI.
struct _DESKTOPOPS DESKTOPOPS
UINT_PTR LPARAM
A type definition for the second message paramter.
MG_EXPORT int GUIAPI RemoveSectionInEtc(GHANDLE hEtc, const char *pSection)
Removes a section in etc object.
MG_EXPORT void * mg_slice_copy(size_t block_size, const void *mem_block)
Allocate and copy a slice.
GHANDLE HCURSOR
Handle to cursor.
void(* paint_desktop)(void *context, HDC dc_desktop, const RECT *inv_rc)
MG_EXPORT HCURSOR GUIAPI SetCursorEx(HCURSOR hcsr, BOOL set_def)
Changes the current cursor.
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.
MG_EXPORT int GUIAPI SaveSectionToEtcFile(const char *pEtcFile, PETCSECTION psect)
Saves a section to an etc file.
MG_EXPORT void GUIAPI ClipCursor(const RECT *prc)
Clips the cursor range.
struct _ETCSECTION ETCSECTION