Browse Source

pass draw rect to draw callbacks

master
Alexandros Theodotou 3 years ago
parent
commit
a3dee28d05
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 3
      inc/ztoolkit/ztk_widget.h
  2. 2
      src/ztk_app.c
  3. 7
      src/ztk_button.c
  4. 1
      src/ztk_combo_box.c
  5. 1
      src/ztk_knob.c
  6. 7
      src/ztk_knob_with_label.c
  7. 1
      src/ztk_label.c

3
inc/ztoolkit/ztk_widget.h

@ -100,12 +100,15 @@ typedef void (*ZtkWidgetGenericCallback) ( @@ -100,12 +100,15 @@ typedef void (*ZtkWidgetGenericCallback) (
*
* @param widget The ZtkWidget instance.
* @param cr The cairo context to draw to.
* @param rect The rectangle this widget must
* draw in.
* @param data User data passed during
* instantiation.
*/
typedef void (*ZtkWidgetDrawCallback) (
ZtkWidget * widget,
cairo_t * cr,
ZtkRect * rect,
void * data);
/**

2
src/ztk_app.c

@ -531,7 +531,7 @@ ztk_app_draw ( @@ -531,7 +531,7 @@ ztk_app_draw (
continue;
widget->draw_cb (
widget, cr, widget->user_data);
widget, cr, rect, widget->user_data);
}
}

7
src/ztk_button.c

@ -26,6 +26,7 @@ static void @@ -26,6 +26,7 @@ static void
button_draw_cb (
ZtkWidget * widget,
cairo_t * cr,
ZtkRect * draw_rect,
void * data)
{
ZtkButton * self = (ZtkButton *) widget;
@ -58,7 +59,8 @@ button_draw_cb ( @@ -58,7 +59,8 @@ button_draw_cb (
}
else if (self->bg_draw_cb)
{
self->bg_draw_cb (widget, cr, data);
self->bg_draw_cb (
widget, cr, draw_rect, data);
}
#define DRAW_SVG(svg) \
@ -95,7 +97,8 @@ button_draw_cb ( @@ -95,7 +97,8 @@ button_draw_cb (
break;
#endif
case ZTK_BTN_CUSTOM:
self->custom_draw_cb (widget, cr, data);
self->custom_draw_cb (
widget, cr, draw_rect, data);
break;
default:
break;

1
src/ztk_combo_box.c

@ -144,6 +144,7 @@ static void @@ -144,6 +144,7 @@ static void
draw_cb (
ZtkWidget * w,
cairo_t * cr,
ZtkRect * draw_rect,
void * data)
{
ZtkComboBox * self = (ZtkComboBox *) w;

1
src/ztk_knob.c

@ -73,6 +73,7 @@ static void @@ -73,6 +73,7 @@ static void
draw_cb (
ZtkWidget * widget,
cairo_t * cr,
ZtkRect * draw_rect,
void * data)
{
ZtkKnob * self = (ZtkKnob *) widget;

7
src/ztk_knob_with_label.c

@ -28,14 +28,17 @@ static void @@ -28,14 +28,17 @@ static void
ztk_knob_with_label_draw_cb (
ZtkWidget * widget,
cairo_t * cr,
ZtkRect * draw_rect,
void * data)
{
ZtkKnobWithLabel * self =
(ZtkKnobWithLabel *) widget;
ZtkWidget * knob_w = (ZtkWidget *) self->knob;
knob_w->draw_cb (knob_w, cr, knob_w->user_data);
knob_w->draw_cb (
knob_w, cr, draw_rect, knob_w->user_data);
ZtkWidget * label_w = (ZtkWidget *) self->label;
label_w->draw_cb (label_w, cr, knob_w->user_data);
label_w->draw_cb (
label_w, cr, draw_rect, knob_w->user_data);
}
static void

1
src/ztk_label.c

@ -26,6 +26,7 @@ static void @@ -26,6 +26,7 @@ static void
ztk_label_draw_cb (
ZtkWidget * widget,
cairo_t * cr,
ZtkRect * draw_rect,
void * data)
{
ZtkLabel * self = (ZtkLabel *) widget;

Loading…
Cancel
Save