gwenhywfar
5.11.1beta
|
Implementation hints.
Implementation hints.
The dialog framework is part of the GWEN_GUI framework (Graphical User Interface). To make your implementation available to the application you will have to set the following callbacks in GWEN_GUI:
The function GWEN_Gui_ExecDialog can be implemented by just calling the other functions (first GWEN_Gui_OpenDialog followed by GWEN_Gui_RunDialog and GWEN_Gui_CloseDialog).
Your implementation of GWEN_Gui_OpenDialog must set the follwing callbacks in the object pointed to by the first argument (GWEN_DIALOG):
The GKT2 implementation does it like this:
It must also create the actual widgets used by your GUI toolkit (e.g. QLabel for label widgets with QT). To do that you should call GWEN_Dialog_GetWidgets to get the tree of widget descriptions. The most important information about a widget is its type (GWEN_Widget_GetType). The implementation of GWEN_Gui_OpenDialog can use that information to decide what GUI widget should be created to represent that widget description.
For example the QT implementation creates a QLabel object for the widget type GWEN_Widget_TypeLabel.
You can call the function GWEN_Widget_SetImplData to store a pointer to the GUI widget created (e.g. the QT implementation stores a pointer to the created QLabel object for widgets of type GWEN_Widget_TypeLabel). To retrieve that pointer later call GWEN_Widget_GetImplData. Currently up to 4 pointers can be stored per GWEN_WIDGET object (in the case that there are multiple GUI objects required to represent a given GWEN_WIDGET).
Another important hint comes from the widget flags (get them with GWEN_Widget_GetFlags). Those flag tell the implementation about some layout options and other things.
For widgets using media like icons or images the implementation can call GWEN_Dialog_GetMediaPaths to get a list of paths where those icons can be found. This information is provided by the dialog itself. You can use functions like GWEN_Directory_FindFileInPaths to actually find the icon or image file using the media paths.
This example shows how the GTK2 implementation creates a GUI representation of type GWEN_Widget_TypeLabel: