1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/uimanager.h>
4 #include <gtkmm/private/uimanager_p.h>
9 /* Copyright 2003 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/gtkuimanager.h>
32 typedef UIManager::ui_merge_id ui_merge_id; //Help gmmproc so that it does not need to add the full type name for the return type.
34 UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer)
37 guint retvalue = gtk_ui_manager_add_ui_from_string(gobj(), buffer.c_str(), buffer.size(), &(error));
38 if(error) ::Glib::Error::throw_exception(error);
42 void UIManager::add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, UIManagerItemType type, bool top)
44 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), 0 /* See C docs */, ((GtkUIManagerItemType)(type)), static_cast<int>(top));
54 void UIManager_signal_add_widget_callback(GtkUIManager* self, GtkWidget* p0,void* data)
57 typedef sigc::slot< void,Widget* > SlotType;
59 // Do not try to call a signal on a disassociated wrapper.
60 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
64 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
65 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
70 Glib::exception_handlers_invoke();
75 const Glib::SignalProxyInfo UIManager_signal_add_widget_info =
78 (GCallback) &UIManager_signal_add_widget_callback,
79 (GCallback) &UIManager_signal_add_widget_callback
83 const Glib::SignalProxyInfo UIManager_signal_actions_changed_info =
86 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
87 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
91 void UIManager_signal_connect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
94 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
96 // Do not try to call a signal on a disassociated wrapper.
97 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
101 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
102 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
108 Glib::exception_handlers_invoke();
113 const Glib::SignalProxyInfo UIManager_signal_connect_proxy_info =
116 (GCallback) &UIManager_signal_connect_proxy_callback,
117 (GCallback) &UIManager_signal_connect_proxy_callback
121 void UIManager_signal_disconnect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
124 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
126 // Do not try to call a signal on a disassociated wrapper.
127 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
131 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
132 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
138 Glib::exception_handlers_invoke();
143 const Glib::SignalProxyInfo UIManager_signal_disconnect_proxy_info =
146 (GCallback) &UIManager_signal_disconnect_proxy_callback,
147 (GCallback) &UIManager_signal_disconnect_proxy_callback
151 void UIManager_signal_pre_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
154 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
156 // Do not try to call a signal on a disassociated wrapper.
157 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
161 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
162 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
167 Glib::exception_handlers_invoke();
172 const Glib::SignalProxyInfo UIManager_signal_pre_activate_info =
175 (GCallback) &UIManager_signal_pre_activate_callback,
176 (GCallback) &UIManager_signal_pre_activate_callback
180 void UIManager_signal_post_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
183 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
185 // Do not try to call a signal on a disassociated wrapper.
186 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
190 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
191 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
196 Glib::exception_handlers_invoke();
201 const Glib::SignalProxyInfo UIManager_signal_post_activate_info =
204 (GCallback) &UIManager_signal_post_activate_callback,
205 (GCallback) &UIManager_signal_post_activate_callback
208 } // anonymous namespace
211 GType Glib::Value<Gtk::UIManagerItemType>::value_type()
213 return gtk_ui_manager_item_type_get_type();
220 Glib::RefPtr<Gtk::UIManager> wrap(GtkUIManager* object, bool take_copy)
222 return Glib::RefPtr<Gtk::UIManager>( dynamic_cast<Gtk::UIManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
223 //We use dynamic_cast<> in case of multiple inheritance.
226 } /* namespace Glib */
233 /* The *_Class implementation: */
235 const Glib::Class& UIManager_Class::init()
237 if(!gtype_) // create the GType if necessary
239 // Glib::Class has to know the class init function to clone custom types.
240 class_init_func_ = &UIManager_Class::class_init_function;
242 // This is actually just optimized away, apparently with no harm.
243 // Make sure that the parent type has been created.
244 //CppClassParent::CppObjectType::get_type();
246 // Create the wrapper type, with the same class/instance size as the base type.
247 register_derived_type(gtk_ui_manager_get_type());
249 // Add derived versions of interfaces, if the C type implements any interfaces:
255 void UIManager_Class::class_init_function(void* g_class, void* class_data)
257 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
258 CppClassParent::class_init_function(klass, class_data);
260 klass->add_widget = &add_widget_callback;
261 klass->actions_changed = &actions_changed_callback;
265 void UIManager_Class::add_widget_callback(GtkUIManager* self, GtkWidget* p0)
267 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
268 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
270 // Non-gtkmmproc-generated custom classes implicitly call the default
271 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
272 // generated classes can use this optimisation, which avoids the unnecessary
273 // parameter conversions if there is no possibility of the virtual function
275 if(obj && obj->is_derived_())
277 try // Trap C++ exceptions which would normally be lost because this is a C callback.
279 // Call the virtual member method, which derived classes might override.
280 obj->on_add_widget(Glib::wrap(p0)
285 Glib::exception_handlers_invoke();
290 BaseClassType *const base = static_cast<BaseClassType*>(
291 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
294 // Call the original underlying C function:
295 if(base && base->add_widget)
296 (*base->add_widget)(self, p0);
300 void UIManager_Class::actions_changed_callback(GtkUIManager* self)
302 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
303 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
305 // Non-gtkmmproc-generated custom classes implicitly call the default
306 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
307 // generated classes can use this optimisation, which avoids the unnecessary
308 // parameter conversions if there is no possibility of the virtual function
310 if(obj && obj->is_derived_())
312 try // Trap C++ exceptions which would normally be lost because this is a C callback.
314 // Call the virtual member method, which derived classes might override.
315 obj->on_actions_changed();
319 Glib::exception_handlers_invoke();
324 BaseClassType *const base = static_cast<BaseClassType*>(
325 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
328 // Call the original underlying C function:
329 if(base && base->actions_changed)
330 (*base->actions_changed)(self);
335 Glib::ObjectBase* UIManager_Class::wrap_new(GObject* object)
337 return new UIManager((GtkUIManager*)object);
341 /* The implementation: */
343 GtkUIManager* UIManager::gobj_copy()
349 UIManager::UIManager(const Glib::ConstructParams& construct_params)
351 Glib::Object(construct_params)
354 UIManager::UIManager(GtkUIManager* castitem)
356 Glib::Object((GObject*)(castitem))
359 UIManager::~UIManager()
363 UIManager::CppClassType UIManager::uimanager_class_; // initialize static member
365 GType UIManager::get_type()
367 return uimanager_class_.init().get_type();
370 GType UIManager::get_base_type()
372 return gtk_ui_manager_get_type();
376 UIManager::UIManager()
378 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
379 Glib::Object(Glib::ConstructParams(uimanager_class_.init()))
383 Glib::RefPtr<UIManager> UIManager::create()
385 return Glib::RefPtr<UIManager>( new UIManager() );
387 void UIManager::set_add_tearoffs(bool add_tearoffs)
389 gtk_ui_manager_set_add_tearoffs(gobj(), static_cast<int>(add_tearoffs));
392 bool UIManager::get_add_tearoffs() const
394 return gtk_ui_manager_get_add_tearoffs(const_cast<GtkUIManager*>(gobj()));
397 void UIManager::insert_action_group(const Glib::RefPtr<ActionGroup>& action_group, int pos)
399 gtk_ui_manager_insert_action_group(gobj(), Glib::unwrap(action_group), pos);
402 void UIManager::remove_action_group(const Glib::RefPtr<ActionGroup>& action_group)
404 gtk_ui_manager_remove_action_group(gobj(), Glib::unwrap(action_group));
407 Glib::ListHandle< Glib::RefPtr<ActionGroup> > UIManager::get_action_groups()
409 return Glib::ListHandle< Glib::RefPtr<ActionGroup> >(gtk_ui_manager_get_action_groups(gobj()), Glib::OWNERSHIP_SHALLOW);
412 Glib::ListHandle< Glib::RefPtr<const ActionGroup> > UIManager::get_action_groups() const
414 return Glib::ListHandle< Glib::RefPtr<const ActionGroup> >(gtk_ui_manager_get_action_groups(const_cast<GtkUIManager*>(gobj())), Glib::OWNERSHIP_SHALLOW);
417 Glib::RefPtr<AccelGroup> UIManager::get_accel_group()
420 Glib::RefPtr<AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(gobj()));
423 retvalue->reference(); //The function does not do a ref for us.
427 Glib::RefPtr<const AccelGroup> UIManager::get_accel_group() const
430 Glib::RefPtr<const AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(const_cast<GtkUIManager*>(gobj())));
433 retvalue->reference(); //The function does not do a ref for us.
437 Widget* UIManager::get_widget(const Glib::ustring& path)
439 return Glib::wrap(gtk_ui_manager_get_widget(gobj(), path.c_str()));
442 const Widget* UIManager::get_widget(const Glib::ustring& path) const
444 return Glib::wrap(gtk_ui_manager_get_widget(const_cast<GtkUIManager*>(gobj()), path.c_str()));
447 Glib::SListHandle<Widget*> UIManager::get_toplevels(UIManagerItemType types)
449 return Glib::SListHandle<Widget*>(gtk_ui_manager_get_toplevels(gobj(), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
452 Glib::SListHandle<const Widget*> UIManager::get_toplevels(UIManagerItemType types) const
454 return Glib::SListHandle<const Widget*>(gtk_ui_manager_get_toplevels(const_cast<GtkUIManager*>(gobj()), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
457 Glib::RefPtr<Action> UIManager::get_action(const Glib::ustring& path)
460 Glib::RefPtr<Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(gobj(), path.c_str()));
463 retvalue->reference(); //The function does not do a ref for us.
467 Glib::RefPtr<const Action> UIManager::get_action(const Glib::ustring& path) const
470 Glib::RefPtr<const Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(const_cast<GtkUIManager*>(gobj()), path.c_str()));
473 retvalue->reference(); //The function does not do a ref for us.
477 ui_merge_id UIManager::add_ui_from_file(const Glib::ustring& filename)
480 ui_merge_id retvalue = gtk_ui_manager_add_ui_from_file(gobj(), filename.c_str(), &(error));
481 if(error) ::Glib::Error::throw_exception(error);
485 void UIManager::add_ui(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, const Glib::ustring& action, UIManagerItemType type, bool top)
487 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), action.c_str(), ((GtkUIManagerItemType)(type)), static_cast<int>(top));
490 void UIManager::remove_ui(ui_merge_id merge_id)
492 gtk_ui_manager_remove_ui(gobj(), merge_id);
495 Glib::ustring UIManager::get_ui() const
497 return Glib::convert_return_gchar_ptr_to_ustring(gtk_ui_manager_get_ui(const_cast<GtkUIManager*>(gobj())));
500 void UIManager::ensure_update()
502 gtk_ui_manager_ensure_update(gobj());
505 ui_merge_id UIManager::new_merge_id()
507 return gtk_ui_manager_new_merge_id(gobj());
511 Glib::SignalProxy1< void,Widget* > UIManager::signal_add_widget()
513 return Glib::SignalProxy1< void,Widget* >(this, &UIManager_signal_add_widget_info);
516 Glib::SignalProxy0< void > UIManager::signal_actions_changed()
518 return Glib::SignalProxy0< void >(this, &UIManager_signal_actions_changed_info);
521 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_connect_proxy()
523 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_connect_proxy_info);
526 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_disconnect_proxy()
528 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_disconnect_proxy_info);
531 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_pre_activate()
533 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_pre_activate_info);
536 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_post_activate()
538 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_post_activate_info);
542 Glib::PropertyProxy<bool> UIManager::property_add_tearoffs()
544 return Glib::PropertyProxy<bool>(this, "add-tearoffs");
547 Glib::PropertyProxy_ReadOnly<bool> UIManager::property_add_tearoffs() const
549 return Glib::PropertyProxy_ReadOnly<bool>(this, "add-tearoffs");
552 Glib::PropertyProxy_ReadOnly<Glib::ustring> UIManager::property_ui() const
554 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "ui");
558 void Gtk::UIManager::on_add_widget(Widget* widget)
560 BaseClassType *const base = static_cast<BaseClassType*>(
561 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
564 if(base && base->add_widget)
565 (*base->add_widget)(gobj(),(GtkWidget*)Glib::unwrap(widget));
568 void Gtk::UIManager::on_actions_changed()
570 BaseClassType *const base = static_cast<BaseClassType*>(
571 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
574 if(base && base->actions_changed)
575 (*base->actions_changed)(gobj());