changeset 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 c7119bdbcc76
children e36afef679e8
files audacious/equalizer.c audacious/pbutton.c audacious/pbutton.h
diffstat 3 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/equalizer.c	Fri Jan 13 19:18:38 2006 -0800
+++ b/audacious/equalizer.c	Fri Jan 13 20:03:07 2006 -0800
@@ -687,7 +687,7 @@
     equalizerwin_shade =
         create_pbutton_ex(&equalizerwin_wlist, equalizerwin_bg,
                           equalizerwin_gc, 254, 3, 9, 9, 254, 137, 1, 38,
-                          equalizerwin_shade_toggle, SKIN_EQMAIN, SKIN_EQ_EX);
+                          equalizerwin_shade_toggle, NULL, SKIN_EQMAIN, SKIN_EQ_EX);
     equalizerwin_shade->pb_allow_draw = FALSE;
 
     equalizerwin_graph =
--- 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
--- a/audacious/pbutton.h	Fri Jan 13 19:18:38 2006 -0800
+++ b/audacious/pbutton.h	Fri Jan 13 20:03:07 2006 -0800
@@ -36,6 +36,7 @@
     gboolean pb_inside;
     gboolean pb_allow_draw;
     void (*pb_push_cb) (void);
+    void (*pb_release_cb) (void);
     SkinPixmapId pb_skin_index1, pb_skin_index2;
 };
 
@@ -43,11 +44,12 @@
 
 PButton *create_pbutton(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), SkinPixmapId si);
+                        gint px, gint py, void (*push_cb) (void), SkinPixmapId si);
 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),
-                           SkinPixmapId si1, SkinPixmapId si2);
+                           gint ny, gint px, gint py, void (*push_cb) (void),
+			   void (*release_cb) (void), SkinPixmapId si1,
+			   SkinPixmapId si2);
 void free_pbutton(PButton * b);
 void pbutton_set_skin_index(PButton * b, SkinPixmapId si);
 void pbutton_set_skin_index1(PButton * b, SkinPixmapId si);