diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-06-30 18:20:45 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-06-30 18:20:45 +0100 |
commit | f3fc28d63254fe90de5472352256e7df415ab886 (patch) | |
tree | 0f1ce71a25ee2862a59a0c530704a332982d0137 /src/play-button.c | |
parent | 8dc783c9943dbb1a80579d6f7e70492769b67717 (diff) | |
download | ayatana-indicator-sound-f3fc28d63254fe90de5472352256e7df415ab886.tar.gz ayatana-indicator-sound-f3fc28d63254fe90de5472352256e7df415ab886.tar.bz2 ayatana-indicator-sound-f3fc28d63254fe90de5472352256e7df415ab886.zip |
highlighting sorted and a start towards the cairo stuff
Diffstat (limited to 'src/play-button.c')
-rw-r--r-- | src/play-button.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/play-button.c b/src/play-button.c index e798668..d79161b 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -40,7 +40,7 @@ static void play_button_init (PlayButton *self); static void play_button_dispose (GObject *object); static void play_button_finalize (GObject *object); -static gboolean play_button_expose (GtkWidget *button, GdkEventExpose *event, gpointer userdata); +static gboolean play_button_expose (GtkWidget *button, GdkEventExpose *event); static void draw (GtkWidget* button, cairo_t *cr); G_DEFINE_TYPE (PlayButton, play_button, GTK_TYPE_DRAWING_AREA); @@ -51,11 +51,11 @@ play_button_class_init (PlayButtonClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - //GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); + GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); g_type_class_add_private (klass, sizeof (PlayButtonPrivate)); - //widget_class->expose_event = play_button_expose; + widget_class->expose_event = play_button_expose; gobject_class->dispose = play_button_dispose; gobject_class->finalize = play_button_finalize; @@ -65,7 +65,7 @@ static void play_button_init (PlayButton *self) { g_debug("PlayButton::play_button_init"); - g_signal_connect(GTK_WIDGET(self), "expose-event", G_CALLBACK (play_button_expose), NULL); + gtk_widget_set_size_request(GTK_WIDGET(self), 50, 50); } static void @@ -81,18 +81,8 @@ play_button_finalize (GObject *object) } static gboolean -play_button_expose (GtkWidget *button, GdkEventExpose *event, gpointer userdata) +play_button_expose (GtkWidget *button, GdkEventExpose *event) { - GtkAllocation alloc; - - alloc.width = 200; - alloc.height = 600; - alloc.x = 10; - alloc.y = 10; - - gtk_widget_set_allocation(GTK_WIDGET(button), - &alloc); - cairo_t *cr; cr = gdk_cairo_create (button->window); @@ -110,14 +100,23 @@ play_button_expose (GtkWidget *button, GdkEventExpose *event, gpointer userdata) return FALSE; } + static void draw (GtkWidget* button, cairo_t *cr) { - double x, y; + double x=50; + double y=30; double radius; - int i; - x = button->allocation.x + button->allocation.width / 2; + int rect_width = 100; + int rect_height = 50; + + cairo_move_to(cr, x+radius, y); + cairo_line_to(cr, x+rect_width-radius, y); + cairo_curve_to(cr, x+rect_width, y, x+rect_width, y, x+rect_width, y+radius); + cairo_line_to(x+w,y+h-r) + cairo_curve_to(cr, + x = button->allocation.x - button->allocation.width / 2; y = button->allocation.y + button->allocation.height / 2; radius = MIN (button->allocation.width / 2, button->allocation.height / 2) - 5; @@ -159,6 +158,8 @@ draw (GtkWidget* button, cairo_t *cr) cairo_surface_write_to_png(cairo_get_target (cr), "/tmp/foobar.png"); } + + /** * play_button_new: * @returns: a new #PlayButton. |