Muthiah Thanks for your help. But have you tested it before? According to my opinion, this function can only shape a window not a button. Forget to tell you that I put a table in a window then put a button on the table. When I want to shape the button I got a error "assertion `!GTK_WIDGET_NO_WINDOW (widget)' failed". Thanks! Chris.Wu
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Muthiah Annamalai Sent: 2005å5æ20æ 12:18 To: [EMAIL PROTECTED]; gtk-app-devel-list@gnome.org Subject: Re: How to shape a button Hi! Im sending you code from the project gtk-book, http://gtkbook.sourceforge.net/ The function make_shapedwidget() should help. To choose the shape of the widget change the mask in the file "circle.xpm". <CODE> #include<gtk/gtk.h> #include<gtk/gtkitemfactory.h> #include<glib/gprintf.h> gboolean configure_event(GtkWidget *w,gpointer data) { //make a shaped mask GdkPixmap *pix; GdkBitmap *bit; GdkColor c={0}; pix=gdk_pixmap_create_from_xpm(w->window,&bit,&c,"circle.xpm"); gdk_window_shape_combine_mask(GDK_WINDOW(w->window),bit,100,100); gtk_window_set_decorated(GTK_WINDOW(w),FALSE); return TRUE; } GtkWidget * make_shapedwidget(void) { GtkWidget *w; w=gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(w),"configure_event",G_CALLBACK(configure_event),NULL); g_signal_connect(G_OBJECT(w),"destroy",G_CALLBACK(gtk_main_quit),NULL); gtk_container_add(GTK_CONTAINER(w),gtk_color_selection_new()); return w; } </CODE> Cheers -Muthu. --- Chris Wu <[EMAIL PROTECTED]> wrote: > Hi all, > I would like to make a shaped button, but > when I use the > gtk_widget_shape_combine_mask(button, mask, 0, 0). > I got "assertion `!GTK_WIDGET_NO_WINDOW > (widget)' failed". > Would you mind to send me some demo code to > told me how to shape a > button! > > Chris.Wu > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > __________________________________ Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. http://mobile.yahoo.com/learn/mail _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list _____________________________________________________________________________ Scanned by Sanmina-SCI eShield _____________________________________________________________________________ _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list