1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/imagemenuitem.h>
4 #include <gtkmm/private/imagemenuitem_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <gtk/gtkimagemenuitem.h>
30 #include <gtkmm/image.h>
31 #include <gtkmm/stock.h>
32 #include <gtkmm/accellabel.h>
37 ImageMenuItem::ImageMenuItem(Widget& image,
38 const Glib::ustring& label, bool mnemonic)
40 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
41 Gtk::MenuItem(Glib::ConstructParams(imagemenuitem_class_.init(), (char*) 0))
44 add_accel_label(label, mnemonic);
47 ImageMenuItem::ImageMenuItem(const Glib::ustring& label, bool mnemonic)
49 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
50 Gtk::MenuItem(Glib::ConstructParams(imagemenuitem_class_.init(), (char*) 0))
52 add_accel_label(label, mnemonic);
55 ImageMenuItem::ImageMenuItem(const Gtk::StockID& stock_id)
57 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
58 Gtk::MenuItem(Glib::ConstructParams(imagemenuitem_class_.init(), (char*) 0))
60 Gtk::Image* image = new Gtk::Image(stock_id, ICON_SIZE_MENU);
62 set_image( *(Gtk::manage(image)) );
65 if(Gtk::Stock::lookup(stock_id, item))
67 add_accel_label(item.get_label(), true); //true = use mnemonic.
68 set_accel_key( AccelKey(item.get_keyval(), item.get_modifier()) );
72 add_accel_label(stock_id.get_string(), false);
81 } // anonymous namespace
87 Gtk::ImageMenuItem* wrap(GtkImageMenuItem* object, bool take_copy)
89 return dynamic_cast<Gtk::ImageMenuItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
92 } /* namespace Glib */
98 /* The *_Class implementation: */
100 const Glib::Class& ImageMenuItem_Class::init()
102 if(!gtype_) // create the GType if necessary
104 // Glib::Class has to know the class init function to clone custom types.
105 class_init_func_ = &ImageMenuItem_Class::class_init_function;
107 // This is actually just optimized away, apparently with no harm.
108 // Make sure that the parent type has been created.
109 //CppClassParent::CppObjectType::get_type();
111 // Create the wrapper type, with the same class/instance size as the base type.
112 register_derived_type(gtk_image_menu_item_get_type());
114 // Add derived versions of interfaces, if the C type implements any interfaces:
120 void ImageMenuItem_Class::class_init_function(void* g_class, void* class_data)
122 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
123 CppClassParent::class_init_function(klass, class_data);
128 Glib::ObjectBase* ImageMenuItem_Class::wrap_new(GObject* o)
130 return manage(new ImageMenuItem((GtkImageMenuItem*)(o)));
135 /* The implementation: */
137 ImageMenuItem::ImageMenuItem(const Glib::ConstructParams& construct_params)
139 Gtk::MenuItem(construct_params)
143 ImageMenuItem::ImageMenuItem(GtkImageMenuItem* castitem)
145 Gtk::MenuItem((GtkMenuItem*)(castitem))
149 ImageMenuItem::~ImageMenuItem()
154 ImageMenuItem::CppClassType ImageMenuItem::imagemenuitem_class_; // initialize static member
156 GType ImageMenuItem::get_type()
158 return imagemenuitem_class_.init().get_type();
161 GType ImageMenuItem::get_base_type()
163 return gtk_image_menu_item_get_type();
167 ImageMenuItem::ImageMenuItem()
169 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
170 Gtk::MenuItem(Glib::ConstructParams(imagemenuitem_class_.init()))
174 void ImageMenuItem::set_image(Widget& image)
176 gtk_image_menu_item_set_image(gobj(), (image).gobj());
179 Widget* ImageMenuItem::get_image()
181 return Glib::wrap(gtk_image_menu_item_get_image(gobj()));
184 const Widget* ImageMenuItem::get_image() const
186 return Glib::wrap(gtk_image_menu_item_get_image(const_cast<GtkImageMenuItem*>(gobj())));