RE: How to shape a button



Hi
     Mr. Muthiah, I'm sorry to tell you the bad news.
     It can be passed build all step and no exception to run , but still can't shaped the button as the shape.
     According your suggestion, I write  a test code and send to you.
     I used the follow envionment for development.  
     OS : RedHat Linux 9.0
     IDE: Anjuta 1.2.2
     GTK+: GTK 2.0
     Can you give me any suggestion, thanks !
                                                                                                              
                                                              Chris.Wu

-----Original Message-----
From: gtk-app-devel-list-bounces gnome org [mailto:gtk-app-devel-list-bounces gnome org]On Behalf Of Muthiah 
Annamalai
Sent: 2005å5æ20æ 17:34
To: Chris Wu sanmina-sci com; gtk-app-devel-list gnome org
Subject: RE: How to shape a button


Hi!
It seems to work for me...

I just forgot to mention, just create & connect a
button to its configure_event.


<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,*btn;

  w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
  btn=gtk_button_new_with_label("Hello WOrld");
 

g_signal_connect(G_OBJECT(btn),"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),btn);
  return w;
}
</CODE>
 
 Cheers
 -Muthu.
 



                
__________________________________ 
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 _____________________________________________________________________________


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]