The GWIN module takes usage of all the other modules and combines them into a complete GUI toolkit. It provides everything from buttons and checkboxes over lists and even graph widgets and much more. Most commonly, the user will interact with the provided widgets through a touchscreen. However, the GINPUT module also allows to use other input methods as well.
There are three basic types of GWIN elements:
The API reference of the GWIN module can be found here.
GHandle data type is the main GWIN data type. All three GWIN types use this data type. The
GHandle is the object reference and it is used to pass the different windows, widgets and containers around the different GWIN functions. In more technical terms: A
GHandle is a reference to a GWIN element (widget, container, window, ...).
|gdispFillXxx(...)||gwinFillXxx(GHandle gh, ...)|
All coordinates supplied to the GWIN drawing calls are relative to the specified window. The GWIN drawing support is usually used for two cases:
- Drawing/rendering routines for widgets
- To do custom drawing within the basic window element.
Note: Unlike the GDISP drawing routines, the GWIN ones don't take a color parameter. Instead, the currently set foreground color is used.
It's possible to configure the redrawing behavior of GWIN. The redrawing mode defines how GWIN will handle redraw events.
Note: Usually there is no need to change the default redrawing mode of GWIN. Only touch this if you know what you're doing.
Unless the default settings are overwritten by using any of the corresponding configuration settings (see below) in the configuration file, GWIN will use the default redrawing mode.
When a widget issues a redraw it will not be redrawn immediately to reduce stack usage. Instead, the GWIN logic will remember that it has to redraw the widget and will redraw it later on. GWIN uses a GTIMER timer to periodically redraw the pending widgets. However, as drawing operations are quite time intensive GWIN will automatically split up the redrawing jobs into individual redrawing operations. The GWIN redrawing routine will return in between these different redrawing jobs to allow other threads to become active. Therefore other threads can continue to work without extensive delay periods.
In immediate redrawing mode GWIN will redraw a widget immediately when the widget wants to be redrawn. As this happens within the widget rendering routine this is a very stack intensive operation.
The immediate redrawing mode can be enabled through the configuration file:
#define GWIN_REDRAW_IMMEDIATE TRUE
In single operation mode GWIN will no longer split up all pending redraws into individual jobs but perform all the pending drawing operations and return only after all of them are completed. It is discouraged to use this mode as it will keep other threads from executing any code for a long time. This is especially bad when it comes to threads which need to stream data, eg. when playing an audio file.
The single operation redrawing mode can be enabled through the configuration file:
#define GWIN_REDRAW_SINGLEOP TRUE