MiniGUI API Reference (MiniGUI-Processes)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
MiniGUI provides some server-only functions for you to create a customized server for MiniGUI-Processes, i.e. mginit. More...
Data Structures | |
struct | _ZNODEINFO |
struct | _ZNODEHEADER |
struct | _CompositorOps |
struct | _CombParamsFallback |
Typedefs | |
typedef int(* | ON_LOCK_CLIENT_REQ) (void) |
Type of client request lock callback. More... | |
typedef int(* | ON_TRYLOCK_CLIENT_REQ) (void) |
Type of client request lock callback. More... | |
typedef void(* | ON_UNLOCK_CLIENT_REQ) (void) |
Type of client request unlock callback. More... | |
typedef void(* | ON_NEW_DEL_CLIENT) (int op, int cli) |
Type of client event callback. More... | |
typedef void(* | ON_CHANGE_LAYER) (int op, MG_Layer *layer, MG_Client *client) |
Type of layer change event callback. More... | |
typedef void(* | ON_ZNODE_OPERATION) (int op, int cli, int idx_znode) |
Type of z-node operation callback. More... | |
typedef struct _ZNODEINFO | ZNODEINFO |
typedef struct _ZNODEHEADER | ZNODEHEADER |
typedef struct _CompositorOps | CompositorOps |
typedef struct _CombParamsFallback | COMBPARAMS_FALLBACK |
Functions | |
MG_EXPORT BOOL GUIAPI | ServerStartup (int nr_globals, int def_nr_highers, int def_nr_normals) |
Initializes the server of MiniGUI-Processes. More... | |
MG_EXPORT MG_Layer *GUIAPI | ServerCreateLayer (const char *layer_name, int max_nr_highers, int max_nr_normals) |
Create a new layer from the server. More... | |
MG_EXPORT BOOL GUIAPI | ServerSetTopmostLayer (MG_Layer *layer) |
Set topmost layer from the server. More... | |
MG_EXPORT BOOL GUIAPI | ServerDeleteLayer (MG_Layer *layer) |
Delete a layer from the server. More... | |
MG_EXPORT int GUIAPI | ServerGetTopmostZNodeOfType (MG_Layer *layer, DWORD type, int *cli) |
Get the topmost z-node in the specified layer for the specific window type from the server. More... | |
MG_EXPORT int GUIAPI | ServerGetNextZNode (MG_Layer *layer, int idx_znode, int *cli) |
Get the next z-node in the specified layer from the server. More... | |
MG_EXPORT int GUIAPI | ServerGetPrevZNode (MG_Layer *layer, int idx_znode, int *cli) |
Get the previous z-node in the specified layer from the server. More... | |
MG_EXPORT BOOL GUIAPI | ServerGetZNodeInfo (MG_Layer *layer, int idx_znode, ZNODEINFO *znode_info) |
Get the z-node information in the specified layer from the server. More... | |
const MG_EXPORT ZNODEHEADER *GUIAPI | ServerGetWinZNodeHeader (MG_Layer *layer, int idx_znode, void **priv_data, BOOL lock) |
Get the pointer to the z-node header of a specific window in the specified layer. More... | |
MG_EXPORT BOOL GUIAPI | ServerReleaseWinZNodeHeader (MG_Layer *layer, int idx_znode) |
Release z-node header of a specific window in the specified layer. More... | |
MG_EXPORT int GUIAPI | ServerGetPopupMenusCount (void) |
Get the number of popup menus shown on the screen. More... | |
MG_EXPORT BOOL GUIAPI | ServerReleasePopupMenuZNodeHeader (int idx_znode) |
Release the lock of the z-node header of the specific popup menu. More... | |
MG_EXPORT BOOL GUIAPI | ServerGetWinZNodeRegion (MG_Layer *layer, int idx_znode, DWORD rgn_ops, CLIPRGN *dst_rgn) |
Get the z-node region of a specific window in the specified layer. More... | |
MG_EXPORT BOOL GUIAPI | ServerGetPopupMenuZNodeRegion (int idx_znode, DWORD rgn_ops, CLIPRGN *dst_rgn) |
Get the z-node region of a specific popup menu in the current layer. More... | |
MG_EXPORT BOOL GUIAPI | ServerSetWinZNodePrivateData (MG_Layer *layer, int idx_znode, void *priv_data) |
Set the private data of the z-node of a specific window in the specified layer. More... | |
MG_EXPORT BOOL GUIAPI | ServerSetPopupMenuZNodePrivateData (int idx_znode, void *priv_data) |
Set the private data of the z-node of the specific popup menu. More... | |
MG_EXPORT BOOL GUIAPI | ServerDoZNodeOperation (MG_Layer *layer, int idx_znode, int op_code, void *op_data, BOOL notify) |
Does an operation on the z-node in the specified layer from the server. More... | |
MG_EXPORT BOOL GUIAPI | ServerMoveClientToLayer (int cli, MG_Layer *dst_layer) |
Move a client to the specified layer. More... | |
MG_EXPORT int GUIAPI | GetClientByPID (int pid) |
Returns the client identifier from PID of a client. More... | |
MG_EXPORT BOOL GUIAPI | SetTopmostClient (int cli) |
Set topmost layer by a client identifier. More... | |
MG_EXPORT void GUIAPI | DisableClientsOutput (void) |
Disable all clients output. More... | |
MG_EXPORT void GUIAPI | UpdateTopmostLayer (const RECT *dirty_rc) |
Update topmost layer. More... | |
const MG_EXPORT CompositorOps *GUIAPI | ServerGetCompositorOps (const char *name) |
Get the operations of a specific compositor. More... | |
MG_EXPORT BOOL GUIAPI | ServerRegisterCompositor (const char *name, const CompositorOps *ops) |
Register a new compositor. More... | |
MG_EXPORT BOOL GUIAPI | ServerUnregisterCompositor (const char *name) |
Un-register a new compositor. More... | |
const MG_EXPORT CompositorOps *GUIAPI | ServerSelectCompositor (const char *name, CompositorCtxt **ctxt) |
Select a compositor as the current compositor. More... | |
const MG_EXPORT char *GUIAPI | ServerGetCurrentCompositor (const CompositorOps **ops, CompositorCtxt **ctxt) |
Get the name and the context of the current compositor. More... | |
const CompositorOps * | __ex_compositor_get (const char *name, const CompositorOps *fallback_ops, int *version) |
Variables | |
MG_EXPORT ON_LOCK_CLIENT_REQ | OnLockClientReq |
Set to a function to lock a client request. More... | |
MG_EXPORT ON_TRYLOCK_CLIENT_REQ | OnTrylockClientReq |
Set to a function to lock a client request. More... | |
MG_EXPORT ON_UNLOCK_CLIENT_REQ | OnUnlockClientReq |
Set to a function to unlock a client request. More... | |
MG_EXPORT ON_NEW_DEL_CLIENT | OnNewDelClient |
Set to a function to handle a comming in (going away) connection of client. More... | |
MG_EXPORT ON_CHANGE_LAYER | OnChangeLayer |
Set to a function to handle events of layers. More... | |
MG_EXPORT ON_ZNODE_OPERATION | OnZNodeOperation |
Set to a function to handle events of z-node. More... | |
MiniGUI provides some server-only functions for you to create a customized server for MiniGUI-Processes, i.e. mginit.
Example:
typedef struct _CombParamsFallback COMBPARAMS_FALLBACK |
The combining parameters for the callback compositor.
typedef struct _CompositorOps CompositorOps |
The struct type defines the operations for a compositor.
Type of layer change event callback.
typedef void(* ON_LOCK_CLIENT_REQ)(void) |
Type of client request lock callback.
typedef void(* ON_NEW_DEL_CLIENT)(int op, int cli) |
Type of client event callback.
typedef void(* ON_TRYLOCK_CLIENT_REQ)(void) |
Type of client request lock callback.
typedef void(* ON_UNLOCK_CLIENT_REQ)(void) |
Type of client request unlock callback.
typedef void(* ON_ZNODE_OPERATION)(int op, int cli, int idx_znode) |
Type of z-node operation callback.
typedef struct _ZNODEHEADER ZNODEHEADER |
Z-node header structure
typedef struct _ZNODEINFO ZNODEINFO |
Z-node information structure
const CompositorOps* __ex_compositor_get | ( | const char * | name, |
const CompositorOps * | fallback_ops, | ||
int * | version | ||
) |
Implement this stub to return the compositor operations for a specific compositor name if you implement the compositor in a shared library.
name | The name of the compositor desired. |
fallback_ops | The fallback operations. |
version | The version code for the operations of the compositor. |
void GUIAPI DisableClientsOutput | ( | void | ) |
Disable all clients output.
int GUIAPI GetClientByPID | ( | int | pid | ) |
Returns the client identifier from PID of a client.
This function gets the identifier of the sepcified client from the PID of it.
pid | The process ID of the client. |
MG_Layer *GUIAPI ServerCreateLayer | ( | const char * | layer_name, |
int | max_nr_highers, | ||
int | max_nr_normals | ||
) |
Create a new layer from the server.
This function creates a new layer named by layer_name. You should specify the maximal number of z-nodes in the higher level (max_nr_highers) and the maximal number of z-nodes in the normal level (max_nr_normals) of the new layer. Passing zero to max_nr_highers and max_nr_normals will use the default values, and the default values are specified by ServerStartup.
Note that the server will create a default layer named "mginit".
layer_name | The name of the layer. If there is already a layer named layer_name, the function will return the pointer to that layer. |
max_nr_highers | The maximal number of z-nodes in the higher level of the new layer. |
max_nr_normals | The maximal number of z-nodes in the normal level of the new layer. |
Delete a layer from the server.
This function deletes the specified layer layer.
layer | The pointer to the layer. |
BOOL GUIAPI ServerDoZNodeOperation | ( | MG_Layer * | layer, |
int | idx_znode, | ||
int | op_code, | ||
void * | op_data, | ||
BOOL | notify | ||
) |
Does an operation on the z-node in the specified layer from the server.
This function does an operation upon the z-node in the specified layer layer from the server.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
op_code | The code of the operation, can be one of the following values:
|
op_data | The data of the operation, used to pass the data need by the operation. For example, if the operation is moving the z-node, op_data will be a pointer to a RECT structure, which contains the new position and size of the z-node. Not used currently, reserved for future use. |
notify | Whether to notify the client about the change of the z-node. |
const MG_EXPORT CompositorOps* GUIAPI ServerGetCompositorOps | ( | const char * | name | ) |
Get the operations of a specific compositor.
This function gets the operations of a specific compositor.
name | The name of the compositor. MiniGUI reserved fallback as the default compositor which is implemented in MiniGUI Core. You can use some operations of the default compositor as the corresponding operations for your own compositor. |
Since 5.0.0.
const MG_EXPORT char* GUIAPI ServerGetCurrentCompositor | ( | const CompositorOps ** | ops, |
CompositorCtxt ** | ctxt | ||
) |
Get the name and the context of the current compositor.
This function gets the name and the context of the current compositor.
ops | The buffer used to return the compositor operations. |
ctxt | The buffer used to return the compositor context. |
Since 5.0.6.
int GUIAPI ServerGetNextZNode | ( | MG_Layer * | layer, |
int | idx_znode, | ||
int * | cli | ||
) |
Get the next z-node in the specified layer from the server.
This function gets the next z-node of the z-node specified by idx_znode, i.e., the z-node below it, in the specified layer layer from the server.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The initial z-node. If the initial z-node index is less than or equal to zero, the function will return the index of the first (the topmost) z-node in the layer. |
cli | The client identifier of the next z-node will be returned through this pointer. NULL is okay. |
int GUIAPI ServerGetPopupMenusCount | ( | void | ) |
Get the number of popup menus shown on the screen.
This function gets the number of popup menus shown currently on the screen.
Since 5.0.0
Get the z-node region of a specific popup menu in the current layer.
This function gets the region of the popup menu which uses the specific z-node index idx_znode in the specified layer layer.
idx_znode | The z-node index of the popup menu. |
rgn_ops | The operation for the region of the popup menu z-node and the destination region given by the last argument. It can be one of the following values and OR'ed with RGN_OP_FLAG_ABS :
|
dst_rgn | The pointer to the destination region. |
Since 5.0.0
int GUIAPI ServerGetPrevZNode | ( | MG_Layer * | layer, |
int | idx_znode, | ||
int * | cli | ||
) |
Get the previous z-node in the specified layer from the server.
This function gets the previous z-node of the z-node specified by idx_znode, i.e., the z-node above it, in the specified layer layer from the server.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The initial z-node. If the initial z-node index is less than or equal to zero, the function will return the index of the last (the bottommost) z-node in the layer. |
cli | The client identifier of the next z-node will be returned through this pointer. NULL is okay. |
Since 5.0.0
Get the topmost z-node in the specified layer for the specific window type from the server.
This function gets the topmost z-node of the type specified by type in the specified layer layer from the server.
layer | The pointer to the layer, NULL for the current topmost layer. |
type | The window type, can be one of the following values:
|
cli | The client identifier of the topmost z-node will be returned through this pointer. NULL is okay. |
const ZNODEHEADER *GUIAPI ServerGetWinZNodeHeader | ( | MG_Layer * | layer, |
int | idx_znode, | ||
void ** | priv_data, | ||
BOOL | lock | ||
) |
Get the pointer to the z-node header of a specific window in the specified layer.
This function gets the pointer to the z-node header of the window which uses the specific z-node index idx_znode in the specified layer layer.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
priv_data | The buffer to return the private data of the z-node; can be NULL. |
lock | Whether to lock the shared surface. |
Since 5.0.0
BOOL GUIAPI ServerGetWinZNodeRegion | ( | MG_Layer * | layer, |
int | idx_znode, | ||
DWORD | rgn_ops, | ||
CLIPRGN * | dst_rgn | ||
) |
Get the z-node region of a specific window in the specified layer.
This function gets the region of the window which uses the specific z-node index idx_znode in the specified layer layer.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
rgn_ops | The operation for the region of the window z-node and the destination region given by the last argument. It can be one of the following values and OR'ed with RGN_OP_FLAG_ABS :
|
dst_rgn | The pointer to the destination region. |
Since 5.0.0
Get the z-node information in the specified layer from the server.
This function copies the z-node information of a window which uses the specific z-node index idx_znode in the specified layer layer from the server.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
znode_info | The information of the requested z-node will be returned through this structure. |
Move a client to the specified layer.
This function moves a client specified by cli to other layer specified dst_layer.
cli | The identifier of the client. |
dst_layer | The pointer to the destination layer. |
Since 5.0.0.
MG_EXPORT BOOL GUIAPI ServerRegisterCompositor | ( | const char * | name, |
const CompositorOps * | ops | ||
) |
Register a new compositor.
This function registers a new compositor.
name | The name of the compositor. |
ops | The new compositor object. |
Since 5.0.0.
BOOL GUIAPI ServerReleasePopupMenuZNodeHeader | ( | int | idx_znode | ) |
Release the lock of the z-node header of the specific popup menu.
This function releases the lock of the z-node header of the specific popup menu which is currently shown on the current layer.
idx_znode | The index of the popup menu. 0 means the first popup menu. |
Since 5.0.0
void GUIAPI ServerReleaseWinZNodeHeader | ( | MG_Layer * | layer, |
int | idx_znode | ||
) |
Release z-node header of a specific window in the specified layer.
This function releases the z-node header of the window which uses the specific z-node index idx_znode in the specified layer layer.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
Since 5.0.0
const MG_EXPORT CompositorOps* GUIAPI ServerSelectCompositor | ( | const char * | name, |
CompositorCtxt ** | ctxt | ||
) |
Select a compositor as the current compositor.
This function selects a compositor as the current compositor and returns the compositor operations. It also destroies the old compositor object if there is old one.
name | The name of the compositor. If the argument is NULL, this function will return the current compositor. Use COMPSOR_NAME_DEFAULT when you want to refer to the default compositor. |
ctxt | The buffer used to return the compositor context. |
Since 5.0.0.
BOOL GUIAPI ServerSetPopupMenuZNodePrivateData | ( | int | idx_znode, |
void * | priv_data | ||
) |
Set the private data of the z-node of the specific popup menu.
This function sets the private data of the z-node header of the specific popup menu which is currently shown on the current layer.
idx_znode | The index of the popup menu. 0 means the first popup menu. |
priv_data | The private data. |
Since 5.0.0
Set topmost layer from the server.
This function sets the specified layer layer to be the topmost layer.
layer | The pointer to the layer. |
Set the private data of the z-node of a specific window in the specified layer.
This function sets the private data of the z-node header of the window which uses the specific z-node index idx_znode in the specified layer layer.
layer | The pointer to the layer, NULL for the current topmost layer. |
idx_znode | The index of the z-node. |
priv_data | The private data. |
Since 5.0.0
BOOL GUIAPI ServerStartup | ( | int | nr_globals, |
int | def_nr_highers, | ||
int | def_nr_normals | ||
) |
Initializes the server of MiniGUI-Processes.
This function initializes the server, i.e. mginit. It creates the shared resource, the listening socket, the default layer, and other internal objects. Your costomized mginit program should call this function before calling any other function.
Note that the default layer created by the server called "mginit" (NAME_DEF_LAYER).
nr_globals | The number of the z-nodes in the global level. All z-nodes created by mginit are global ones. |
def_nr_highers | The maximal number of the z-nodes in the higher level of the default layer. It is also the default number of the z-nodes in the higher level of a new layer. |
def_nr_normals | The maximal number of the z-nodes in the normal level of the default layer. It is also the default number of the z-nodes in the normal level of a new layer. |
MG_EXPORT BOOL GUIAPI ServerUnregisterCompositor | ( | const char * | name | ) |
Un-register a new compositor.
This function un-registers a compositor.
name | The name of the compositor. |
Since 5.0.0.
BOOL GUIAPI SetTopmostClient | ( | int | cli | ) |
Set topmost layer by a client identifier.
This function sets the topmost layer by the specified client identifier cli. It will bring the layer contains the client to be the topmost one.
cli | The identifier of the client. |
void GUIAPI UpdateTopmostLayer | ( | const RECT * | dirty_rc | ) |
Update topmost layer.
dirty_rc | The refresh region. |
ON_CHANGE_LAYER OnChangeLayer |
Set to a function to handle events of layers.
When a layer is changing, MiniGUI will call this function to tell you the event and the layer or the client which leads to the event. The event could be one of the following:
The event will be passed through the argument of op, and the pointers to the relevant layer and client will be passed through the argument of layer and client respectively.
ON_LOCK_CLIENT_REQ OnLockClientReq |
Set to a function to lock a client request.
ON_NEW_DEL_CLIENT OnNewDelClient |
Set to a function to handle a comming in (going away) connection of client.
When a client is connecting to or disconnecting from the server, MiniGUI will call this function to tell you the event and the client identifier. The event could be one of the following:
The event will be passed through the argument of op, and the client identifier will be passed through the argument of cli. You can get the information of the client by accessing mgClients with cli.
ON_TRYLOCK_CLIENT_REQ OnTrylockClientReq |
Set to a function to lock a client request.
ON_UNLOCK_CLIENT_REQ OnUnlockClientReq |
Set to a function to unlock a client request.
ON_ZNODE_OPERATION OnZNodeOperation |
Set to a function to handle events of z-node.
After the server does an operation on a z-node, MiniGUI will call this function to tell you the event and the layer, the client, and the z-node which leads to the event.
The event could be one of the following:
The event will be passed through the argument of op; the pointers to the layer, the identifier of the client, and the index of the z-node will be passed through the argument of layer, cli, and idx_znode respectively.