you can do something like this: GtkStyle *style; GdkPixmap *pixmap_normal = NULL; GdkPixmap *pixmap_prelight = NULL; GdkPixmap *pixmap_active = NULL; GdkPixmap *pixmap_selected = NULL; GdkPixmap *pixmap_insensitive = NULL; gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap_normal, &mask, 255); gdk_pixbuf_render_pixmap_and_mask(spotbuf, &pixmap_prelight, NULL, 255); gdk_pixbuf_render_pixmap_and_mask(spotbuf, &pixmap_active, NULL, 255); gdk_pixbuf_render_pixmap_and_mask(spotbuf, &pixmap_selected, NULL, 255); gdk_pixbuf_render_pixmap_and_mask(spotbuf, &pixmap_insensitive, NULL, 255); style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(self))); style->bg_pixmap[GTK_STATE_NORMAL] = pixmap_normal; style->bg_pixmap[GTK_STATE_PRELIGHT] = pixmap_prelight; style->bg_pixmap[GTK_STATE_ACTIVE] = pixmap_active; style->bg_pixmap[GTK_STATE_SELECTED] = pixmap_selected; style->bg_pixmap[GTK_STATE_INSENSITIVE] = pixmap_insensitive; gtk_widget_shape_combine_mask(GTK_WIDGET(self), mask, 0, 0); /* now connect to the signals in order to change the widget state */ g_signal_connect(G_OBJECT(self), "enter-notify-event", G_CALLBACK(on_enter), NULL); g_signal_connect(G_OBJECT(self), "leave-notify-event", G_CALLBACK(on_leave), NULL); static int on_enter(GtkWidget *widget, GdkEvent *gdk_event) { gtk_widget_set_state(widget, GTK_STATE_PRELIGHT); return 0; } static int on_leave(GtkWidget *widget, GdkEvent *gdk_event) { gtk_widget_set_state(widget, GTK_STATE_NORMAL); return 0; } Steffen Toksvig wrote: Just make a regular button and turn off the relief decoration and the border: gtk_button_set_relief( GTK_BUTTON( but ), GTK_RELIEF_NONE ); gtk_container_set_border_width( GTK_CONTAINER( but ), 0 ); No doubt you could do this with a style file too. Put a GtkImage inside the button and change the graphic to whatever you want, whenever you want.I have made a screenshot of what I am trying to do: http://picasaweb.google.com/lh/photo/gnQjiPc5wq1J-4yFVHLExA?feat=directlink Notice that when I use the GtkButton there is still a border around the image and the button decorations are still drawn. Any idea of how to completely swap the button graphics with an image? -Steffen _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list |
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list