1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/accelgroup.h>
4 #include <gtkmm/private/accelgroup_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtk/gtkaccelgroup.h>
32 bool AccelGroup::valid(guint keyval, Gdk::ModifierType modifiers)
34 return gtk_accelerator_valid(keyval, (GdkModifierType) modifiers);
37 void AccelGroup::parse(const Glib::ustring& accelerator,
38 guint& accelerator_key,
39 Gdk::ModifierType& accelerator_mods)
41 GdkModifierType mods = GdkModifierType(0);
42 gtk_accelerator_parse(accelerator.c_str(), &accelerator_key, &mods);
44 accelerator_mods = (Gdk::ModifierType) mods;
47 Glib::ustring AccelGroup::name(guint accelerator_key, Gdk::ModifierType accelerator_mods)
49 return gtk_accelerator_name(accelerator_key, (GdkModifierType) accelerator_mods);
52 void AccelGroup::set_default_mod_mask(Gdk::ModifierType default_mod_mask)
54 gtk_accelerator_set_default_mod_mask((GdkModifierType) default_mod_mask);
57 Gdk::ModifierType AccelGroup::get_default_mod_mask()
59 return (Gdk::ModifierType) gtk_accelerator_get_default_mod_mask();
68 gboolean AccelGroup_signal_accel_activate_callback(GtkAccelGroup* self, GObject* p0,guint p1,GdkModifierType p2,void* data)
71 typedef sigc::slot< bool,const Glib::RefPtr<Glib::Object>&,guint,Gdk::ModifierType > SlotType;
73 // Do not try to call a signal on a disassociated wrapper.
74 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
78 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
79 return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
80 , p1, ((Gdk::ModifierType)(p2))
85 Glib::exception_handlers_invoke();
89 typedef gboolean RType;
93 gboolean AccelGroup_signal_accel_activate_notify_callback(GtkAccelGroup* self, GObject* p0,guint p1,GdkModifierType p2, void* data)
96 typedef sigc::slot< void,const Glib::RefPtr<Glib::Object>&,guint,Gdk::ModifierType > SlotType;
98 // Do not try to call a signal on a disassociated wrapper.
99 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
103 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
104 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
105 , p1, ((Gdk::ModifierType)(p2))
110 Glib::exception_handlers_invoke();
114 typedef gboolean RType;
118 const Glib::SignalProxyInfo AccelGroup_signal_accel_activate_info =
121 (GCallback) &AccelGroup_signal_accel_activate_callback,
122 (GCallback) &AccelGroup_signal_accel_activate_notify_callback
126 void AccelGroup_signal_accel_changed_callback(GtkAccelGroup* self, guint p0,GdkModifierType p1,GClosure* p2,void* data)
129 typedef sigc::slot< void,guint,Gdk::ModifierType,GClosure* > SlotType;
131 // Do not try to call a signal on a disassociated wrapper.
132 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
136 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
137 (*static_cast<SlotType*>(slot))(p0, ((Gdk::ModifierType)(p1))
142 Glib::exception_handlers_invoke();
147 const Glib::SignalProxyInfo AccelGroup_signal_accel_changed_info =
150 (GCallback) &AccelGroup_signal_accel_changed_callback,
151 (GCallback) &AccelGroup_signal_accel_changed_callback
154 } // anonymous namespace
160 Glib::RefPtr<Gtk::AccelGroup> wrap(GtkAccelGroup* object, bool take_copy)
162 return Glib::RefPtr<Gtk::AccelGroup>( dynamic_cast<Gtk::AccelGroup*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
163 //We use dynamic_cast<> in case of multiple inheritance.
166 } /* namespace Glib */
173 /* The *_Class implementation: */
175 const Glib::Class& AccelGroup_Class::init()
177 if(!gtype_) // create the GType if necessary
179 // Glib::Class has to know the class init function to clone custom types.
180 class_init_func_ = &AccelGroup_Class::class_init_function;
182 // This is actually just optimized away, apparently with no harm.
183 // Make sure that the parent type has been created.
184 //CppClassParent::CppObjectType::get_type();
186 // Create the wrapper type, with the same class/instance size as the base type.
187 register_derived_type(gtk_accel_group_get_type());
189 // Add derived versions of interfaces, if the C type implements any interfaces:
195 void AccelGroup_Class::class_init_function(void* g_class, void* class_data)
197 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
198 CppClassParent::class_init_function(klass, class_data);
200 klass->accel_changed = &accel_changed_callback;
204 void AccelGroup_Class::accel_changed_callback(GtkAccelGroup* self, guint p0, GdkModifierType p1, GClosure* p2)
206 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
207 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
209 // Non-gtkmmproc-generated custom classes implicitly call the default
210 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
211 // generated classes can use this optimisation, which avoids the unnecessary
212 // parameter conversions if there is no possibility of the virtual function
214 if(obj && obj->is_derived_())
216 try // Trap C++ exceptions which would normally be lost because this is a C callback.
218 // Call the virtual member method, which derived classes might override.
219 obj->on_accel_changed(p0, ((Gdk::ModifierType)(p1))
224 Glib::exception_handlers_invoke();
229 BaseClassType *const base = static_cast<BaseClassType*>(
230 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
233 // Call the original underlying C function:
234 if(base && base->accel_changed)
235 (*base->accel_changed)(self, p0, p1, p2);
240 Glib::ObjectBase* AccelGroup_Class::wrap_new(GObject* object)
242 return new AccelGroup((GtkAccelGroup*)object);
246 /* The implementation: */
248 GtkAccelGroup* AccelGroup::gobj_copy()
254 AccelGroup::AccelGroup(const Glib::ConstructParams& construct_params)
256 Glib::Object(construct_params)
259 AccelGroup::AccelGroup(GtkAccelGroup* castitem)
261 Glib::Object((GObject*)(castitem))
264 AccelGroup::~AccelGroup()
268 AccelGroup::CppClassType AccelGroup::accelgroup_class_; // initialize static member
270 GType AccelGroup::get_type()
272 return accelgroup_class_.init().get_type();
275 GType AccelGroup::get_base_type()
277 return gtk_accel_group_get_type();
281 AccelGroup::AccelGroup()
283 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
284 Glib::Object(Glib::ConstructParams(accelgroup_class_.init()))
288 Glib::RefPtr<AccelGroup> AccelGroup::create()
290 return Glib::RefPtr<AccelGroup>( new AccelGroup() );
292 void AccelGroup::lock()
294 gtk_accel_group_lock(gobj());
297 void AccelGroup::unlock()
299 gtk_accel_group_unlock(gobj());
302 bool AccelGroup::disconnect_key(guint accel_key, Gdk::ModifierType accel_mods)
304 return gtk_accel_group_disconnect_key(gobj(), accel_key, ((GdkModifierType)(accel_mods)));
307 Glib::ustring AccelGroup::get_label(guint accelerator_key, Gdk::ModifierType accelerator_mods)
309 return Glib::convert_return_gchar_ptr_to_ustring(gtk_accelerator_get_label(accelerator_key, ((GdkModifierType)(accelerator_mods))));
312 bool AccelGroup::activate(GQuark accel_quark, const Glib::RefPtr<Glib::Object>& acceleratable, guint accel_key, Gdk::ModifierType accel_mods)
314 return gtk_accel_group_activate(gobj(), accel_quark, Glib::unwrap(acceleratable), accel_key, ((GdkModifierType)(accel_mods)));
317 bool AccelGroup::activate(Gtk::Object& object, guint accel_key, Gdk::ModifierType accel_mods)
319 return gtk_accel_groups_activate((object).Glib::Object::gobj(), accel_key, ((GdkModifierType)(accel_mods)));
323 Glib::SignalProxy3< bool,const Glib::RefPtr<Glib::Object>&,guint,Gdk::ModifierType > AccelGroup::signal_accel_activate()
325 return Glib::SignalProxy3< bool,const Glib::RefPtr<Glib::Object>&,guint,Gdk::ModifierType >(this, &AccelGroup_signal_accel_activate_info);
328 Glib::SignalProxy3< void,guint,Gdk::ModifierType,GClosure* > AccelGroup::signal_accel_changed()
330 return Glib::SignalProxy3< void,guint,Gdk::ModifierType,GClosure* >(this, &AccelGroup_signal_accel_changed_info);
334 void Gtk::AccelGroup::on_accel_changed(guint keyval, Gdk::ModifierType modifier, GClosure* accel_closure)
336 BaseClassType *const base = static_cast<BaseClassType*>(
337 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
340 if(base && base->accel_changed)
341 (*base->accel_changed)(gobj(),keyval,((GdkModifierType)(modifier)),accel_closure);