17#include <widgets/gp_common.h>
18#include <widgets/gp_widget_types.h>
39 unsigned int widget_class;
75 unsigned int min_w, min_h;
77 unsigned int align:16;
84 unsigned int no_shrink:1;
85 unsigned int no_resize:1;
89 unsigned int redraw:1;
94 unsigned int redraw_child:1;
98 unsigned int redraw_children:1;
99 unsigned int focused:1;
102 unsigned int resized:1;
108 unsigned int no_events:1;
113 unsigned int disabled:1;
118 struct gp_widget_grid *grid;
119 struct gp_widget_tabs *tabs;
121 struct gp_widget_bool *b;
122 struct gp_widget_bool *button;
123 struct gp_widget_bool *checkbox;
125 struct gp_widget_label *label;
127 struct gp_widget_int *i;
128 struct gp_widget_pbar *pbar;
129 struct gp_widget_int *spin;
130 struct gp_widget_int *slider;
132 struct gp_widget_tbox *tbox;
134 struct gp_widget_choice *choice;
136 struct gp_widget_table *tbl;
138 struct gp_widget_pixmap *pixmap;
140 struct gp_widget_stock *stock;
142 struct gp_widget_scroll_area *scroll;
144 struct gp_widget_frame *frame;
146 struct gp_widget_markup *markup;
148 struct gp_widget_switch *switch_;
150 struct gp_widget_overlay *overlay;
152 struct gp_widget_log *log;
154 struct gp_widget_graph *graph;
167 GP_WIDGET_PROGRESSBAR,
171 GP_WIDGET_RADIOBUTTON,
172 GP_WIDGET_SPINBUTTON,
176 GP_WIDGET_SCROLL_AREA,
186enum gp_widget_class {
187 GP_WIDGET_CLASS_NONE = 0,
188 GP_WIDGET_CLASS_BOOL,
190 GP_WIDGET_CLASS_CHOICE,
197const char *gp_widget_class_name(
enum gp_widget_class widget_class);
199enum gp_widget_alignment {
201 GP_HCENTER_WEAK = 0x00,
207 GP_VCENTER_WEAK = 0x00,
214#define GP_FILL (GP_VFILL | GP_HFILL)
216#define GP_HALIGN_MASK 0x0f
217#define GP_VALIGN_MASK 0xf0
228gp_widget *gp_widget_new(
enum gp_widget_type type,
229 enum gp_widget_class widget_class,
230 size_t payload_size);
232#define GP_WIDGET_CLASS_ASSERT(self, wclass, ret) do { \
234 GP_BUG("NULL widget!"); \
237 if (self->widget_class != wclass) { \
238 GP_BUG("Invalid widget (%p) class %u != %u", \
239 self, self->widget_class, wclass); \
244#define GP_WIDGET_ASSERT(self, wtype, ret) do { \
246 GP_BUG("NULL widget!"); \
248 } else if (self->type != wtype) {\
249 GP_BUG("Invalid widget type %s != %s", \
250 gp_widget_type_id(self), gp_widget_type_name(wtype)); \
267void gp_widget_free(gp_widget *self);
275void gp_widget_set_parent(gp_widget *self, gp_widget *parent);
285int gp_widget_focus_set(gp_widget *self);
294void gp_widget_disable(gp_widget *self);
303void gp_widget_enable(gp_widget *self);
313void gp_widget_disable_set(gp_widget *self,
bool disable);
325static inline bool gp_widget_disabled(gp_widget *self)
327 return self->disabled;
340void gp_widget_on_event_set(gp_widget *self,