Go to the source code of this file.
Functions | |
win_widget_t * | win_wcore_alloc (void(*install)(win_widget_t *), void(*deinstall)(win_widget_t *), void(*destroy)(win_widget_t *), void(*pref_size)(win_widget_t *, int *, int *), int focusable, void *widget_data) |
Allocates a new widget. | |
void * | win_wcore_get_data (win_widget_t *widget) |
Retrieves the type-specific data for a widget. | |
void | win_wcore_pref_size (win_widget_t *widget, int *width, int *height) |
Retrieves the preferred size of a widget. | |
void | win_wcore_paint_base (win_widget_t *widget) |
Prepares to paint a widget. | |
void | win_wcore_notify_focus (win_widget_t *widget, void(*focus_lost)(win_widget_t *widget), void(*focus_gained)(win_widget_t *widget)) |
Register functions to be called when focus changes. |
Writing custom components for the window system involves several repetitive tasks, and requires a little more knowledge about the window system internals than is required to use them. This header file contains the API needed to create widgets that work with the window system.
Definition in file wincore.h.
win_widget_t* win_wcore_alloc | ( | void(*)(win_widget_t *) | install, | |
void(*)(win_widget_t *) | deinstall, | |||
void(*)(win_widget_t *) | destroy, | |||
void(*)(win_widget_t *, int *, int *) | pref_size, | |||
int | focusable, | |||
void * | widget_data | |||
) |
Allocates a new widget.
This function allocates and returns a new widget. It is used as the base for all widgets created in the HPGCC window system. The function returns a pointer to the newly allocated widget. The parameters contain a large amount of information about the widget to create.
The caller should generally create the widget-specific data before calling this function. This function may interact with the widget as if it has been fully initialized.
install | The installation callback function. | |
deinstall | The de-installation callback function. | |
destroy | The deallocation callback function. | |
pref_size | The preferred size callback function. | |
focusable | Non-zero if the widget should be able to receive focus. | |
widget_data | An opaque pointer to widget-specific data. |
void* win_wcore_get_data | ( | win_widget_t * | widget | ) |
Retrieves the type-specific data for a widget.
widget | The widget for which data is needed. |
void win_wcore_notify_focus | ( | win_widget_t * | widget, | |
void(*)(win_widget_t *widget) | focus_lost, | |||
void(*)(win_widget_t *widget) | focus_gained | |||
) |
Register functions to be called when focus changes.
The two function pointers passed here point to functions which will be called when the widget gains or loses focus. NULL pointers will result in no action being taken when focus changes.
widget | The widget for which to watch focus. | |
focus_lost | Function to call when focus is lost. | |
focus_gained | Function to call when focus is gained. |
void win_wcore_paint_base | ( | win_widget_t * | widget | ) |
Prepares to paint a widget.
Preparation for painting includes clearing the background if the component is not transparent, and setting an appropriate clipping rectangle, font, color, and pattern.
widget | The widget being painted. |
void win_wcore_pref_size | ( | win_widget_t * | widget, | |
int * | width, | |||
int * | height | |||
) |
Retrieves the preferred size of a widget.
The preferred height of a widget is the size that it should be in order to function properly.
widget | The widget for which data is needed. | |
width | A pointer to where the preferred width will be stored. | |
height | A pointer to where the preferred height will be stored. |