Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

Application control

This group includes functions for the application's start/end controlling and event handling. More...

Functions

void MGUIMain (int argc, char **argv)
 The program's starting point.

void MGUITerm (void)
 Prepares the program for temination, freeing allocated resources.

void MMainLoop (void)
 Transfers control to the main MGUI event loop handler.

void MLoopWhileFlag (int *pflag, int value)
 Transfers control temporarily to a MGUI event loop handler.

void MLoopWhileEvents (int discard)
 Processes all pending events and then returns.

void MNextEvent (MEvent *pe, int wait)
 Retrieves next available MGUI event waiting for it if desired.

void MProcessEvent (MEvent *pe)
 Processes a MGUI event retrieved by MNextEvent().


Detailed Description

This group includes functions for the application's start/end controlling and event handling.


Function Documentation

void MGUIMain int    argc,
char **    argv
 

The program's starting point.

Due to compatibility problems with the Windows platform, an MGUI program cannot start with the standard main() function. This function must be provided by the application and it's called internally by the library at startup. The parameters received by the function are exactly the same as the ones used in the standard C main().

void MGUITerm void   
 

Prepares the program for temination, freeing allocated resources.

This is the recommended method to close your MGUI application. It frees all resources allocated by the MGUI library and it must be followed by a call to the standard exit function.

void MLoopWhileEvents int    discard
 

Processes all pending events and then returns.

The argument 'discard' is a bolean value specifying whether the function has to discard all pending events or process them normally. It's highly recommended not to discard events. The main purpose of this function is to provide a way to poll for MGUI events, allowing event processing. This function is useful if your application has its own event loop and wants to process MGUI events without blocking into the MGUI loop.

See also:
MNextEvent, MProcessEvent, MLoopWhileFlag, MMainLoop

void MLoopWhileFlag int *    pflag,
int    value
 

Transfers control temporarily to a MGUI event loop handler.

This function acts exactly as MMainLoop while the value of the integer pointed to by 'pflag' equals 'value'. When such values differ, the function returns control to the calling program. The main purpose of this function is to provide a way to stop the program flow, allowing event processing, and then to resume it after a particular condition occurs (*pflag becomes different from 'value'). Many utility dialogs provided by MGUI use this function to stop execution and return to the calling program when the desired user input is available (See MMessageDialog , MFileSelection , MInputPrompt , MTextPrompt

See also:
MNextEvent, MProcessEvent, MLoopWhileEvents, MMmainLoop

void MMainLoop void   
 

Transfers control to the main MGUI event loop handler.

This function never returns. It puts the program in an infinite loop allowing the program to get and then process any external MGUI event. External events are:

  • keyboard and mouse input
  • window expose, resize and move
  • timeouts

See also:
MNextEvent, MProcessEvent, MLoopWhileEvents, MLoopWhileFlag

void MNextEvent MEvent   pe,
int    wait
 

Retrieves next available MGUI event waiting for it if desired.

The event is returned in the buffer pointed to by 'pe'. Memory fir such structure must be allocated by the calling function. The second argument, a boolean value, specifies whether the caller wants to wait for an event or not. If no pending event is found and 'wait' equals 0, the function returns immediately and sets the 'type' field of the MEvent structure to E_NO_EVENT.

See also:
MProcessEvent, MLoopWhileEvents, MLoopWhileFlag, MMainLoop

void MProcessEvent MEvent   pe
 

Processes a MGUI event retrieved by MNextEvent().

The MMainLoop() function uses MNextEvent() and this function to realize the blocking MGUI loop.

See also:
MNextEvent, MLoopWhileEvents, MLoopWhileFlag, MMainLoop


Generated on Sun Jun 29 13:03:08 2003 for MGui API by doxygen1.3-rc2