Re: Menu with icons !!



On Pi, 2001-09-21 at 04:24, zongh liu wrote:
> The attachment is the code from gnome
> gtk_pixmapmenuitem.c 
> use the following code ,you could use it to get a menu
> with icons.
> 
> #include "../pixmaps/tb_save.xpm"
> static GtkWidget* xpm_to_widget(gchar **xpm)
> {
> 	GdkPixmap *pixmap;
> 	GdkBitmap *mask;
> 
> 	pixmap =
> gdk_pixmap_create_from_xpm_d(main_win->window, &mask,
> NULL, xpm);
> 	return gtk_pixmap_new(pixmap, mask);
> }
> 
> void 
> create_pix_menu_item(void)
> {
>   GtkPixmapMenuItem  *itemnew;	
>   itemnew =gtk_pixmap_menu_item_new();  
> gtk_widget_ref (itemnew);
>   gtk_object_set_data_full (GTK_OBJECT (main_wnd),
> "New", itemnew,
>                             (GtkDestroyNotify)
> gtk_widget_unref);
> 
>   gtk_pixmap_menu_item_set_pixmap   
> ((GtkPixmapMenuItem *)itemnew,
>                                                
> xpm_to_widget(tb_save_xpm));  
>   gtk_widget_show (itemnew);
> }
> 

I have tried this, but I don't see any icon. Why? Can you send full
example code?
Thanks.
Michal.






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