Server-only operations
[MiniGUI-Processes specific functions]

Data Structures

Typedefs

Functions

Variables


Detailed Description

MiniGUI provides some server-only functions for you to create a customized server for MiniGUI-Processes, i.e. mginit.

Example:

/*
 * This program which should be named "mginit" calls "ServerStartup" 
 * to start the server of MiniGUI-Processes.
 */
int MiniGUIMain (int args, const char* arg[])
{
    if (!ServerStartup (0, 0, 0)) {
        fprintf (stderr, "Can not the MiniGUI server: mginit.\n");
        return 1;
    }

    if (!InitMiniGUIExt ()) {
        fprintf (stderr, "Can not init mgext library.\n");
        return 1;
    }

    /* Enter message loop */
    while (GetMessage (&msg, HWND_DESKTOP)) {
        DispatchMessage (&msg);
    }

    MiniGUIExtCleanUp ();

    return 0;
}

Typedef Documentation

typedef void(* ON_CHANGE_LAYER)(int op, MG_Layer *layer, MG_Client *client)

Type of layer change event callback.

See also:
OnNewDelClient, OnChangeLayer

Definition at line 599 of file minigui.h.

typedef void(* ON_LOCK_CLIENT_REQ)(void)

Type of client request lock callback.

See also:
OnTrylockClientReq, OnLockClientReq, OnUnlockClientReq

Definition at line 526 of file minigui.h.

typedef void(* ON_NEW_DEL_CLIENT)(int op, int cli)

Type of client event callback.

See also:
OnNewDelClient, OnChangeLayer

Definition at line 583 of file minigui.h.

typedef void(* ON_TRYLOCK_CLIENT_REQ)(void)

Type of client request lock callback.

See also:
OnTrylockClientReq, OnLockClientReq, OnUnlockClientReq

Definition at line 535 of file minigui.h.

typedef void(* ON_UNLOCK_CLIENT_REQ)(void)

Type of client request unlock callback.

See also:
OnTrylockClientReq, OnLockClientReq, OnUnlockClientReq

Definition at line 543 of file minigui.h.

typedef void(* ON_ZNODE_OPERATION)(int op, int cli, int idx_znode)

Type of z-node operation callback.

See also:
OnNewDelClient, OnChangeLayer, OnZNodeOperation

Definition at line 622 of file minigui.h.

typedef struct _ZNODEINFO ZNODEINFO

Z-node information structure


Function Documentation

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.

Parameters:
pid The process ID of the client.
Returns:
The client identifier on success, less than 0 on error.
Note:
Server-only function.
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".

Parameters:
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.
Returns:
The handle to the layer on success, NULL on error.
Note:
Only call this function in the server of MiniGUI-Processes.
See also:
ServerDeleteLayer, ServerStartup
BOOL GUIAPI ServerDeleteLayer ( MG_Layer layer  ) 

Delete a layer from the server.

This functions deletes the specified layer layer.

Parameters:
layer The pointer to the layer.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
ServerCreateLayer, JoinLayer, DeleteLayer
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.

Parameters:
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:

  • ZNOP_MOVE2TOP
    Move the znode to be the topmost one.
  • ZNOP_SETACTIVE
    Set the znode to be the active one. Note that the operation can be applied only for a main window.
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.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function, and the operation can be applied only for a main window.
See also:
ServerGetZNodeInfo
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.

Parameters:
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.
Returns:
The index of the next z-node. Zero when the next z-node is the last one; < 0 when error;
Note:
Server-only function. Note that this function will not return the z-node of the desktop, and the desktop always has the index of z-node zero.
See also:
ServerGetZNodeInfo
BOOL GUIAPI ServerGetZNodeInfo ( MG_Layer layer,
int  idx_znode,
ZNODEINFO znode_info 
)

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.

Parameters:
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.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
ServerGetNextZNode, ZNODEINFO
BOOL GUIAPI ServerSetTopmostLayer ( MG_Layer layer  ) 

Sets topmost layer from the server.

This functions sets the specified layer layer to be the topmost layer.

Parameters:
layer The pointer to the layer.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
SetTopmostClient, SetTopmostLayer
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).

Parameters:
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.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function, i.e. only can be called by mginit.
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.

Parameters:
cli The identifier of the client.
Returns:
TRUE on success, otherwise FALSE.
Note:
Server-only function.
See also:
ServerSetTopmostLayer, SetTopmostLayer
void GUIAPI UpdateTopmostLayer ( const RECT dirty_rc  ) 

Update topmost layer.

Parameters:
dirty_rc The refresh region.

Variable Documentation

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:

  • LCO_NEW_LAYER
    A new layer is creating.
  • LCO_DEL_LAYER
    A new layer is deleting.
  • LCO_JOIN_CLIENT
    A client is joining to the layer.
  • LCO_REMOVE_CLIENT
    A client is removing from the layer.
  • LCO_TOPMOST_CHANGED
    The topmost layer changed, the layer will be the topmost one.
  • LCO_ACTIVE_CHANGED
    The active client changed, the client will be the active one.

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.

Note:
Only available for the server of MiniGUI-Processes.
See also:
ON_NEW_DEL_CLIENT, mgClients

Sets to a function to lock a client request.

Note:
Only available for the client of MiniGUI-Processes.
See also:
ON_LOCK_CLIENT_REQ

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:

  • LCO_NEW_CLIENT
    A new client is connecting to the server.
  • LCO_DEL_CLIENT
    A new client is disconnecting from the server.

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.

Note:
Only available for the server of MiniGUI-Processes.
See also:
ON_NEW_DEL_CLIENT, mgClients

Sets to a function to lock a client request.

Note:
Only available for the client of MiniGUI-Processes.
See also:
ON_TRYLOCK_CLIENT_REQ

Sets to a function to unlock a client request.

Note:
Only available for the client of MiniGUI-Processes.
See also:
ON_UNLOCK_CLIENT_REQ

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:

  • ZNOP_ALLOCATE
    The z-node has been created.
  • ZNOP_FREE
    The z-node has been destroyed.
  • ZNOP_MOVE2TOP
    The z-node has been moved to be the topmost one.
  • ZNOP_SHOW
    The z-node has been shown.
  • ZNOP_HIDE
    The z-node has been hidden.
  • ZNOP_MOVEWIN
    The z-node has been moved or its size has changed.
  • ZNOP_SETACTIVE
    The z-node has been set to be the active one.
  • ZNOP_ENABLEWINDOW
    The z-node is disabled or enabled.
  • ZNOP_STARTDRAG
    Start to drag the z-node.
  • ZNOP_CANCELDRAG
    Cancel to drag the z-node.
  • ZNOP_CHANGECAPTION
    The caption of the z-node has changed.

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.

Note:
Only available for the server of MiniGUI-Processes.
See also:
ON_ZNODE_OPERATION, ServerGetZNodeInfo, mgClients
Generated on Thu Apr 7 16:01:49 2011 for MiniGUI V3.0.12 API Reference by  doxygen 1.6.3