2 /* $Id: imagemenuitem.ccg,v 1.2 2003/10/28 17:12:27 murrayc Exp $ */
6 * Copyright 1998-2002 The gtkmm Development Team
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <gtk/gtkimagemenuitem.h>
25 #include <gtkmm/image.h>
26 #include <gtkmm/stock.h>
27 #include <gtkmm/accellabel.h>
32 ImageMenuItem::ImageMenuItem(Widget& image,
33 const Glib::ustring& label, bool mnemonic)
38 add_accel_label(label, mnemonic);
41 ImageMenuItem::ImageMenuItem(const Glib::ustring& label, bool mnemonic)
45 add_accel_label(label, mnemonic);
48 ImageMenuItem::ImageMenuItem(const Gtk::StockID& stock_id)
52 Gtk::Image* image = new Gtk::Image(stock_id, ICON_SIZE_MENU);
54 set_image( *(Gtk::manage(image)) );
57 if(Gtk::Stock::lookup(stock_id, item))
59 add_accel_label(item.get_label(), true); //true = use mnemonic.
60 set_accel_key( AccelKey(item.get_keyval(), item.get_modifier()) );
64 add_accel_label(stock_id.get_string(), false);