GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Data Fields
gp_widget Struct Reference

A widget base. More...

#include <gp_widget.h>

Collaboration diagram for gp_widget:
Collaboration graph
[legend]

Data Fields

unsigned int type
 A widget type enum gp_widget_type.
 
unsigned int widget_class
 A widget class enum gp_widget_class.
 
gp_widgetparent
 Parent widget in the widget tree.
 
int(* on_event )(gp_widget_event *)
 An application event handler.
 
void * priv
 A pointer to arbitrary application data.
 
unsigned int x
 A relative offset to the parent widget in pixels.
 
unsigned int w
 Current widget size in pixels.
 
unsigned int min_w
 Cached widget minimal size in pixel.
 
unsigned int align:16
 Widget alignment in parent container, enum gp_widget_alignment.
 
unsigned int no_shrink:1
 Widget no-shrink flag.
 
unsigned int redraw:1
 Internal widget repaint flag.
 
unsigned int focused:1
 Set if widget is focused.
 
unsigned int resized:1
 Internal widget resize flag.
 
unsigned int no_events:1
 Internal widget flag.
 
unsigned int disabled:1
 Internal disabled flag.
 
uint32_t event_mask
 A mask to enable and disable a widget events.
 

Detailed Description

A widget base.

Definition at line 28 of file gp_widget.h.

Field Documentation

◆ disabled

unsigned int gp_widget::disabled

Internal disabled flag.

If set widget is 'grayed out' and no events are processed.

Definition at line 142 of file gp_widget.h.

◆ event_mask

uint32_t gp_widget::event_mask

A mask to enable and disable a widget events.

This mask decides for which kind of enum gp_widget_event_type will be the gp_widget::on_event called.

Definition at line 150 of file gp_widget.h.

Referenced by gp_widget_send_event().

◆ no_events

unsigned int gp_widget::no_events

Internal widget flag.

If set the widget cannot get focused and will not process input events even if ops->event is implemented.

Definition at line 135 of file gp_widget.h.

◆ no_shrink

unsigned int gp_widget::no_shrink

Widget no-shrink flag.

If set widget will not shrink, i.e. will be resized only when the new minimal size is bigger than the previous one.

By default this is set to 0.

Definition at line 97 of file gp_widget.h.

◆ on_event

int(* gp_widget::on_event) (gp_widget_event *)

An application event handler.

This function is supplied by the application. Changes in widget state are propagated to the application by this function.

Definition at line 61 of file gp_widget.h.

Referenced by gp_widget_send_event(), and gp_widget_send_widget_event().

◆ parent

gp_widget* gp_widget::parent

Parent widget in the widget tree.

It's set to NULL unless widget has been inserted into a container widget, e.g. grid, tabs, etc.

Definition at line 54 of file gp_widget.h.

◆ priv

void* gp_widget::priv

A pointer to arbitrary application data.

Useful for event handlers and other user defined functions. The library will not access or modify the memory pointed to by this.

Definition at line 69 of file gp_widget.h.

◆ redraw

unsigned int gp_widget::redraw

Internal widget repaint flag.

This flag is used internally by the widget code to mark it to be repainted.

Definition at line 106 of file gp_widget.h.

Referenced by gp_widget_should_redraw().

◆ resized

unsigned int gp_widget::resized

Internal widget resize flag.

If set widget resize is schedulled before we attemp to repaint it.

Definition at line 127 of file gp_widget.h.

◆ type

unsigned int gp_widget::type

A widget type enum gp_widget_type.

Widget type e.g. button or text box. The type is used to locate the struct gp_widget_ops in a global widget ops table.

It's also used to assert that we are dealing with a correct widget in the API functions, e.g. button functions check that the widget type is set to button at the start of each function.

Definition at line 39 of file gp_widget.h.

Referenced by gp_widget_send_event(), and gp_widget_send_widget_event().

◆ widget_class

unsigned int gp_widget::widget_class

A widget class enum gp_widget_class.

Widget classes define widgets with exacly same API but different UI and implementation. E.g. GP_WIDGET_CLASS_CHOICE can be rendered as a radio button or a spin button.

Definition at line 47 of file gp_widget.h.


The documentation for this struct was generated from the following file: