Mercurial > audlegacy
diff audacious/pbutton.c @ 424:d7d70779c074 trunk
[svn] Buttons are now tri-state, meaning they have both callbacks for push and
release. This can be used for creating timers between the two points of
push and release (for instance, to allow the rewind/forward buttons to
seek through songs if they are not exited immediately)
author | nenolod |
---|---|
date | Fri, 13 Jan 2006 20:03:07 -0800 |
parents | cb178e5ad177 |
children | 4d1aa30a8776 |
line wrap: on
line diff
--- a/audacious/pbutton.c Fri Jan 13 19:18:38 2006 -0800 +++ b/audacious/pbutton.c Fri Jan 13 20:03:07 2006 -0800 @@ -69,6 +69,8 @@ button->pb_pressed = 1; button->pb_inside = 1; widget_draw(WIDGET(button)); + if (button->pb_push_cb) + button->pb_push_cb(); } } @@ -82,8 +84,8 @@ if (button->pb_inside && button->pb_pressed) { button->pb_inside = 0; widget_draw(WIDGET(button)); - if (button->pb_push_cb) - button->pb_push_cb(); + if (button->pb_release_cb) + button->pb_release_cb(); } if (button->pb_pressed) button->pb_pressed = 0; @@ -141,7 +143,8 @@ PButton * create_pbutton_ex(GList ** wlist, GdkPixmap * parent, GdkGC * gc, gint x, gint y, gint w, gint h, gint nx, - gint ny, gint px, gint py, void (*cb) (void), + gint ny, gint px, gint py, void (*push_cb) (void), + void (*release_cb) (void), SkinPixmapId si1, SkinPixmapId si2) { PButton *b; @@ -163,7 +166,8 @@ b->pb_ny = ny; b->pb_px = px; b->pb_py = py; - b->pb_push_cb = cb; + b->pb_push_cb = push_cb; + b->pb_release_cb = release_cb; b->pb_skin_index1 = si1; b->pb_skin_index2 = si2; b->pb_allow_draw = TRUE; @@ -179,7 +183,7 @@ gint px, gint py, void (*cb) (void), SkinPixmapId si) { return create_pbutton_ex(wlist, parent, gc, x, y, w, h, nx, ny, px, py, - cb, si, si); + cb, NULL, si, si); } void