MiniGUI API Reference (MiniGUI-Processes)
v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Data Structures | |
struct | _ZNODEINFO |
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 |
Functions | |
MG_EXPORT BOOL GUIAPI | ServerStartup (int nr_globals, int def_nr_topmosts, int def_nr_normals) |
Initializes the server of MiniGUI-Processes. More... | |
MG_EXPORT MG_Layer *GUIAPI | ServerCreateLayer (const char *layer_name, int max_nr_topmosts, int max_nr_normals) |
Create a new layer from the server. More... | |
MG_EXPORT BOOL GUIAPI | ServerSetTopmostLayer (MG_Layer *layer) |
Sets 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 | ServerGetNextZNode (MG_Layer *layer, int idx_znode, int *cli) |
Get the next 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... | |
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 int GUIAPI | GetClientByPID (int pid) |
Returns the client identifier from PID of a client. More... | |
MG_EXPORT BOOL GUIAPI | SetTopmostClient (int cli) |
Sets 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... | |
Variables | |
MG_EXPORT ON_LOCK_CLIENT_REQ | OnLockClientReq |
Sets to a function to lock a client request. More... | |
MG_EXPORT ON_TRYLOCK_CLIENT_REQ | OnTrylockClientReq |
Sets to a function to lock a client request. More... | |
MG_EXPORT ON_UNLOCK_CLIENT_REQ | OnUnlockClientReq |
Sets to a function to unlock a client request. More... | |
MG_EXPORT ON_NEW_DEL_CLIENT | OnNewDelClient |
Sets to a function to handle a comming in (going away) connection of client. More... | |
MG_EXPORT ON_CHANGE_LAYER | OnChangeLayer |
Sets to a function to handle events of layers. More... | |
MG_EXPORT ON_ZNODE_OPERATION | OnZNodeOperation |
Sets 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:
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 _ZNODEINFO ZNODEINFO |
Z-node information structure
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_topmosts, | ||
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 topmost frame objects (max_nr_topmosts) and the maximal number of normal frame objects (max_nr_normals) in the new layer. Passing zero to max_nr_topmosts 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 the layer. |
max_nr_topmosts | The maximal number of topmost z-order nodes in the new layer. |
max_nr_normals | The maximal number of normal z-order nodes in the new layer. |
Delete a layer from the server.
This functions 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 functions 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 znode. |
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 znode. Not used currently, reserved for future use. |
notify | Whether to notify the client about the change of the znode. |
int GUIAPI ServerGetNextZNode | ( | MG_Layer * | layer, |
int | idx_znode, | ||
int * | cli | ||
) |
Get the next z-node in the specified layer from the server.
This functions gets the next 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 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 z-node in the layer. |
cli | The client identifier of the next znode will be returned through this pointer. NULL is okay. |
Get the z-node information in the specified layer from the server.
This functions gets the z-node information 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 znode. |
znode_info | The information of the requested znode will be returned through this structure. |
Sets topmost layer from the server.
This functions sets the specified layer layer to be the topmost layer.
layer | The pointer to the layer. |
BOOL GUIAPI ServerStartup | ( | int | nr_globals, |
int | def_nr_topmosts, | ||
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 global z-order nodes. All z-order nodes created by mginit are global ones. |
def_nr_topmosts | The maximal number of the topmost z-order nodes in the default layer. It is also the default number of topmost z-order nodes of a new layer. |
def_nr_normals | The maximal number of normal global z-order nodes in the new layer. It is also the default number of normal z-order nodes of a new layer. |
BOOL GUIAPI SetTopmostClient | ( | int | cli | ) |
Sets 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 |
Sets 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 |
Sets to a function to lock a client request.
ON_NEW_DEL_CLIENT OnNewDelClient |
Sets 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 |
Sets to a function to lock a client request.
ON_UNLOCK_CLIENT_REQ OnUnlockClientReq |
Sets to a function to unlock a client request.
ON_ZNODE_OPERATION OnZNodeOperation |
Sets to a function to handle events of z-node.
After the server does an operation on a znode, 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.