diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-07-08 17:52:51 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-07-08 17:52:51 +0100 |
commit | 50b2e070852b5eab299b8c3612a86adf6d21e901 (patch) | |
tree | 18c40c1b61ce93552767ef3f02055a3d9e92dfcb /src/play-button.c | |
parent | 41747b032d2032c97fd7f1766157e2d846626880 (diff) | |
parent | 0f2a6b2736713951fb4b88848e79849a8f1dc72a (diff) | |
download | ayatana-indicator-sound-50b2e070852b5eab299b8c3612a86adf6d21e901.tar.gz ayatana-indicator-sound-50b2e070852b5eab299b8c3612a86adf6d21e901.tar.bz2 ayatana-indicator-sound-50b2e070852b5eab299b8c3612a86adf6d21e901.zip |
merged the event handling plus code tidy ups and proper icon loading from the theme
Diffstat (limited to 'src/play-button.c')
-rw-r--r-- | src/play-button.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/play-button.c b/src/play-button.c index 136f25d..2fddbcf 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -53,6 +53,13 @@ Uses code from ctk #define PAUSE_X 62.0f #define PAUSE_Y 15.0f +// Transport events +enum { + PREVIOUS, + PLAY_PAUSE, + NEXT +}; + typedef struct _PlayButtonPrivate PlayButtonPrivate; struct _PlayButtonPrivate @@ -349,6 +356,29 @@ play_button_expose (GtkWidget *button, GdkEventExpose *event) } +gint +determine_button_event(GtkWidget* button, GdkEventButton* event) +{ + g_debug("event x coordinate = %f", event->x); + g_debug("event y coordinate = %f", event->y); + gint result = 0; + // For now very simple rectangular collision detection + if(event->x > 40 && event->x < 80 + && event->y > 22 && event->y < 46){ + result = PREVIOUS; + } + else if(event->x > 86 && event->x < 118 + && event->y > 20 && event->y < 47){ + result = PLAY_PAUSE; + } + else if(event->x > 122 && event->x < 164 + && event->y > 22 && event->y < 46){ + result = NEXT; + } + + return result; +} + void play_button_set_style(GtkWidget* button, GtkStyle* style) { |