Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / imagemenuitem.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/imagemenuitem.h>
4 #include <gtkmm/private/imagemenuitem_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 #include <gtk/gtkimagemenuitem.h>
29
30 #include <gtkmm/image.h>
31 #include <gtkmm/stock.h>
32 #include <gtkmm/accellabel.h>
33
34 namespace Gtk
35 {
36
37 ImageMenuItem::ImageMenuItem(Widget& image, 
38                              const Glib::ustring& label, bool mnemonic)
39 :
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))
42 {
43   set_image(image);
44   add_accel_label(label, mnemonic);
45 }
46
47 ImageMenuItem::ImageMenuItem(const Glib::ustring& label, bool mnemonic)
48 :
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))
51 {
52   add_accel_label(label, mnemonic);
53 }
54
55 ImageMenuItem::ImageMenuItem(const Gtk::StockID& stock_id)
56 :
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))
59 {
60   Gtk::Image* image = new Gtk::Image(stock_id, ICON_SIZE_MENU);
61   image->show();
62   set_image( *(Gtk::manage(image)) );
63
64   Gtk::StockItem item;
65   if(Gtk::Stock::lookup(stock_id, item))
66   {
67     add_accel_label(item.get_label(), true); //true = use mnemonic.
68     set_accel_key( AccelKey(item.get_keyval(), item.get_modifier()) );
69   }
70   else
71   {
72     add_accel_label(stock_id.get_string(), false);
73   }
74 }
75
76 } // namespace Gtk
77
78
79 namespace
80 {
81 } // anonymous namespace
82
83
84 namespace Glib
85 {
86
87 Gtk::ImageMenuItem* wrap(GtkImageMenuItem* object, bool take_copy)
88 {
89   return dynamic_cast<Gtk::ImageMenuItem *> (Glib::wrap_auto ((GObject*)(object), take_copy));
90 }
91
92 } /* namespace Glib */
93
94 namespace Gtk
95 {
96
97
98 /* The *_Class implementation: */
99
100 const Glib::Class& ImageMenuItem_Class::init()
101 {
102   if(!gtype_) // create the GType if necessary
103   {
104     // Glib::Class has to know the class init function to clone custom types.
105     class_init_func_ = &ImageMenuItem_Class::class_init_function;
106
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();
110
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());
113
114     // Add derived versions of interfaces, if the C type implements any interfaces:
115   }
116
117   return *this;
118 }
119
120 void ImageMenuItem_Class::class_init_function(void* g_class, void* class_data)
121 {
122   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
123   CppClassParent::class_init_function(klass, class_data);
124
125 }
126
127
128 Glib::ObjectBase* ImageMenuItem_Class::wrap_new(GObject* o)
129 {
130   return manage(new ImageMenuItem((GtkImageMenuItem*)(o)));
131
132 }
133
134
135 /* The implementation: */
136
137 ImageMenuItem::ImageMenuItem(const Glib::ConstructParams& construct_params)
138 :
139   Gtk::MenuItem(construct_params)
140 {
141   }
142
143 ImageMenuItem::ImageMenuItem(GtkImageMenuItem* castitem)
144 :
145   Gtk::MenuItem((GtkMenuItem*)(castitem))
146 {
147   }
148
149 ImageMenuItem::~ImageMenuItem()
150 {
151   destroy_();
152 }
153
154 ImageMenuItem::CppClassType ImageMenuItem::imagemenuitem_class_; // initialize static member
155
156 GType ImageMenuItem::get_type()
157 {
158   return imagemenuitem_class_.init().get_type();
159 }
160
161 GType ImageMenuItem::get_base_type()
162 {
163   return gtk_image_menu_item_get_type();
164 }
165
166
167 ImageMenuItem::ImageMenuItem()
168 :
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()))
171 {
172   }
173
174 void ImageMenuItem::set_image(Widget& image)
175 {
176   gtk_image_menu_item_set_image(gobj(), (image).gobj());
177 }
178
179 Widget* ImageMenuItem::get_image()
180 {
181   return Glib::wrap(gtk_image_menu_item_get_image(gobj()));
182 }
183
184 const Widget* ImageMenuItem::get_image() const
185 {
186   return Glib::wrap(gtk_image_menu_item_get_image(const_cast<GtkImageMenuItem*>(gobj())));
187 }
188
189
190 } // namespace Gtk
191
192