Re: Menu with icons !!



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);
}


Good Luck!


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/




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