1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/uimanager.h>
5 #include <gtkmm/private/uimanager_p.h>
10 /* Copyright 2003 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtk/gtkuimanager.h>
33 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.
35 #ifdef GLIBMM_EXCEPTIONS_ENABLED
36 UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer)
38 UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer, std::auto_ptr<Glib::Error>& error)
39 #endif //GLIBMM_EXCEPTIONS_ENABLED
42 guint retvalue = gtk_ui_manager_add_ui_from_string(gobj(), buffer.c_str(), buffer.size(), &(gerror));
46 #ifdef GLIBMM_EXCEPTIONS_ENABLED
47 ::Glib::Error::throw_exception(gerror);
49 error = ::Glib::Error::throw_exception(gerror);
50 #endif //GLIBMM_EXCEPTIONS_ENABLED
55 void UIManager::add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, UIManagerItemType type, bool top)
57 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), 0 /* See C docs */, ((GtkUIManagerItemType)(type)), static_cast<int>(top));
68 static void UIManager_signal_add_widget_callback(GtkUIManager* self, GtkWidget* p0,void* data)
71 typedef sigc::slot< void,Widget* > SlotType;
73 // Do not try to call a signal on a disassociated wrapper.
74 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
76 #ifdef GLIBMM_EXCEPTIONS_ENABLED
79 #endif //GLIBMM_EXCEPTIONS_ENABLED
80 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
81 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
83 #ifdef GLIBMM_EXCEPTIONS_ENABLED
87 Glib::exception_handlers_invoke();
89 #endif //GLIBMM_EXCEPTIONS_ENABLED
93 static const Glib::SignalProxyInfo UIManager_signal_add_widget_info =
96 (GCallback) &UIManager_signal_add_widget_callback,
97 (GCallback) &UIManager_signal_add_widget_callback
101 static const Glib::SignalProxyInfo UIManager_signal_actions_changed_info =
104 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
105 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
109 static void UIManager_signal_connect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
112 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
114 // Do not try to call a signal on a disassociated wrapper.
115 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
117 #ifdef GLIBMM_EXCEPTIONS_ENABLED
120 #endif //GLIBMM_EXCEPTIONS_ENABLED
121 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
122 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
125 #ifdef GLIBMM_EXCEPTIONS_ENABLED
129 Glib::exception_handlers_invoke();
131 #endif //GLIBMM_EXCEPTIONS_ENABLED
135 static const Glib::SignalProxyInfo UIManager_signal_connect_proxy_info =
138 (GCallback) &UIManager_signal_connect_proxy_callback,
139 (GCallback) &UIManager_signal_connect_proxy_callback
143 static void UIManager_signal_disconnect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
146 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
148 // Do not try to call a signal on a disassociated wrapper.
149 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
151 #ifdef GLIBMM_EXCEPTIONS_ENABLED
154 #endif //GLIBMM_EXCEPTIONS_ENABLED
155 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
156 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
159 #ifdef GLIBMM_EXCEPTIONS_ENABLED
163 Glib::exception_handlers_invoke();
165 #endif //GLIBMM_EXCEPTIONS_ENABLED
169 static const Glib::SignalProxyInfo UIManager_signal_disconnect_proxy_info =
172 (GCallback) &UIManager_signal_disconnect_proxy_callback,
173 (GCallback) &UIManager_signal_disconnect_proxy_callback
177 static void UIManager_signal_pre_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
180 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
182 // Do not try to call a signal on a disassociated wrapper.
183 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
185 #ifdef GLIBMM_EXCEPTIONS_ENABLED
188 #endif //GLIBMM_EXCEPTIONS_ENABLED
189 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
190 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
192 #ifdef GLIBMM_EXCEPTIONS_ENABLED
196 Glib::exception_handlers_invoke();
198 #endif //GLIBMM_EXCEPTIONS_ENABLED
202 static const Glib::SignalProxyInfo UIManager_signal_pre_activate_info =
205 (GCallback) &UIManager_signal_pre_activate_callback,
206 (GCallback) &UIManager_signal_pre_activate_callback
210 static void UIManager_signal_post_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
213 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
215 // Do not try to call a signal on a disassociated wrapper.
216 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
218 #ifdef GLIBMM_EXCEPTIONS_ENABLED
221 #endif //GLIBMM_EXCEPTIONS_ENABLED
222 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
223 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
225 #ifdef GLIBMM_EXCEPTIONS_ENABLED
229 Glib::exception_handlers_invoke();
231 #endif //GLIBMM_EXCEPTIONS_ENABLED
235 static const Glib::SignalProxyInfo UIManager_signal_post_activate_info =
238 (GCallback) &UIManager_signal_post_activate_callback,
239 (GCallback) &UIManager_signal_post_activate_callback
243 } // anonymous namespace
246 GType Glib::Value<Gtk::UIManagerItemType>::value_type()
248 return gtk_ui_manager_item_type_get_type();
255 Glib::RefPtr<Gtk::UIManager> wrap(GtkUIManager* object, bool take_copy)
257 return Glib::RefPtr<Gtk::UIManager>( dynamic_cast<Gtk::UIManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
258 //We use dynamic_cast<> in case of multiple inheritance.
261 } /* namespace Glib */
268 /* The *_Class implementation: */
270 const Glib::Class& UIManager_Class::init()
272 if(!gtype_) // create the GType if necessary
274 // Glib::Class has to know the class init function to clone custom types.
275 class_init_func_ = &UIManager_Class::class_init_function;
277 // This is actually just optimized away, apparently with no harm.
278 // Make sure that the parent type has been created.
279 //CppClassParent::CppObjectType::get_type();
281 // Create the wrapper type, with the same class/instance size as the base type.
282 register_derived_type(gtk_ui_manager_get_type());
284 // Add derived versions of interfaces, if the C type implements any interfaces:
290 void UIManager_Class::class_init_function(void* g_class, void* class_data)
292 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
293 CppClassParent::class_init_function(klass, class_data);
295 #ifdef GLIBMM_VFUNCS_ENABLED
296 #endif //GLIBMM_VFUNCS_ENABLED
298 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
299 klass->add_widget = &add_widget_callback;
300 klass->actions_changed = &actions_changed_callback;
301 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
304 #ifdef GLIBMM_VFUNCS_ENABLED
305 #endif //GLIBMM_VFUNCS_ENABLED
307 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
308 void UIManager_Class::add_widget_callback(GtkUIManager* self, GtkWidget* p0)
310 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
311 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
313 // Non-gtkmmproc-generated custom classes implicitly call the default
314 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
315 // generated classes can use this optimisation, which avoids the unnecessary
316 // parameter conversions if there is no possibility of the virtual function
318 if(obj_base && obj_base->is_derived_())
320 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
321 if(obj) // This can be NULL during destruction.
323 #ifdef GLIBMM_EXCEPTIONS_ENABLED
324 try // Trap C++ exceptions which would normally be lost because this is a C callback.
326 #endif //GLIBMM_EXCEPTIONS_ENABLED
327 // Call the virtual member method, which derived classes might override.
328 obj->on_add_widget(Glib::wrap(p0)
331 #ifdef GLIBMM_EXCEPTIONS_ENABLED
335 Glib::exception_handlers_invoke();
337 #endif //GLIBMM_EXCEPTIONS_ENABLED
341 BaseClassType *const base = static_cast<BaseClassType*>(
342 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
345 // Call the original underlying C function:
346 if(base && base->add_widget)
347 (*base->add_widget)(self, p0);
349 void UIManager_Class::actions_changed_callback(GtkUIManager* self)
351 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
352 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
354 // Non-gtkmmproc-generated custom classes implicitly call the default
355 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
356 // generated classes can use this optimisation, which avoids the unnecessary
357 // parameter conversions if there is no possibility of the virtual function
359 if(obj_base && obj_base->is_derived_())
361 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
362 if(obj) // This can be NULL during destruction.
364 #ifdef GLIBMM_EXCEPTIONS_ENABLED
365 try // Trap C++ exceptions which would normally be lost because this is a C callback.
367 #endif //GLIBMM_EXCEPTIONS_ENABLED
368 // Call the virtual member method, which derived classes might override.
369 obj->on_actions_changed();
371 #ifdef GLIBMM_EXCEPTIONS_ENABLED
375 Glib::exception_handlers_invoke();
377 #endif //GLIBMM_EXCEPTIONS_ENABLED
381 BaseClassType *const base = static_cast<BaseClassType*>(
382 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
385 // Call the original underlying C function:
386 if(base && base->actions_changed)
387 (*base->actions_changed)(self);
389 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
392 Glib::ObjectBase* UIManager_Class::wrap_new(GObject* object)
394 return new UIManager((GtkUIManager*)object);
398 /* The implementation: */
400 GtkUIManager* UIManager::gobj_copy()
406 UIManager::UIManager(const Glib::ConstructParams& construct_params)
408 Glib::Object(construct_params)
411 UIManager::UIManager(GtkUIManager* castitem)
413 Glib::Object((GObject*)(castitem))
416 UIManager::~UIManager()
420 UIManager::CppClassType UIManager::uimanager_class_; // initialize static member
422 GType UIManager::get_type()
424 return uimanager_class_.init().get_type();
427 GType UIManager::get_base_type()
429 return gtk_ui_manager_get_type();
433 UIManager::UIManager()
435 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
437 Glib::Object(Glib::ConstructParams(uimanager_class_.init()))
441 Glib::RefPtr<UIManager> UIManager::create()
443 return Glib::RefPtr<UIManager>( new UIManager() );
445 void UIManager::set_add_tearoffs(bool add_tearoffs)
447 gtk_ui_manager_set_add_tearoffs(gobj(), static_cast<int>(add_tearoffs));
450 bool UIManager::get_add_tearoffs() const
452 return gtk_ui_manager_get_add_tearoffs(const_cast<GtkUIManager*>(gobj()));
455 void UIManager::insert_action_group(const Glib::RefPtr<ActionGroup>& action_group, int pos)
457 gtk_ui_manager_insert_action_group(gobj(), Glib::unwrap(action_group), pos);
460 void UIManager::remove_action_group(const Glib::RefPtr<ActionGroup>& action_group)
462 gtk_ui_manager_remove_action_group(gobj(), Glib::unwrap(action_group));
465 Glib::ListHandle< Glib::RefPtr<ActionGroup> > UIManager::get_action_groups()
467 return Glib::ListHandle< Glib::RefPtr<ActionGroup> >(gtk_ui_manager_get_action_groups(gobj()), Glib::OWNERSHIP_NONE);
470 Glib::ListHandle< Glib::RefPtr<const ActionGroup> > UIManager::get_action_groups() const
472 return Glib::ListHandle< Glib::RefPtr<const ActionGroup> >(gtk_ui_manager_get_action_groups(const_cast<GtkUIManager*>(gobj())), Glib::OWNERSHIP_SHALLOW);
475 Glib::RefPtr<AccelGroup> UIManager::get_accel_group()
478 Glib::RefPtr<AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(gobj()));
480 retvalue->reference(); //The function does not do a ref for us.
485 Glib::RefPtr<const AccelGroup> UIManager::get_accel_group() const
487 return const_cast<UIManager*>(this)->get_accel_group();
490 Widget* UIManager::get_widget(const Glib::ustring& path)
492 return Glib::wrap(gtk_ui_manager_get_widget(gobj(), path.c_str()));
495 const Widget* UIManager::get_widget(const Glib::ustring& path) const
497 return const_cast<UIManager*>(this)->get_widget(path);
500 Glib::SListHandle<Widget*> UIManager::get_toplevels(UIManagerItemType types)
502 return Glib::SListHandle<Widget*>(gtk_ui_manager_get_toplevels(gobj(), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
505 Glib::SListHandle<const Widget*> UIManager::get_toplevels(UIManagerItemType types) const
507 return Glib::SListHandle<const Widget*>(gtk_ui_manager_get_toplevels(const_cast<GtkUIManager*>(gobj()), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
510 Glib::RefPtr<Action> UIManager::get_action(const Glib::ustring& path)
513 Glib::RefPtr<Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(gobj(), path.c_str()));
515 retvalue->reference(); //The function does not do a ref for us.
520 Glib::RefPtr<const Action> UIManager::get_action(const Glib::ustring& path) const
522 return const_cast<UIManager*>(this)->get_action(path);
525 #ifdef GLIBMM_EXCEPTIONS_ENABLED
526 ui_merge_id UIManager::add_ui_from_file(const Glib::ustring& filename)
528 ui_merge_id UIManager::add_ui_from_file(const Glib::ustring& filename, std::auto_ptr<Glib::Error>& error)
529 #endif //GLIBMM_EXCEPTIONS_ENABLED
532 ui_merge_id retvalue = gtk_ui_manager_add_ui_from_file(gobj(), filename.c_str(), &(gerror));
533 #ifdef GLIBMM_EXCEPTIONS_ENABLED
535 ::Glib::Error::throw_exception(gerror);
538 error = ::Glib::Error::throw_exception(gerror);
539 #endif //GLIBMM_EXCEPTIONS_ENABLED
545 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)
547 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), action.c_str(), ((GtkUIManagerItemType)(type)), static_cast<int>(top));
550 void UIManager::remove_ui(ui_merge_id merge_id)
552 gtk_ui_manager_remove_ui(gobj(), merge_id);
555 Glib::ustring UIManager::get_ui() const
557 return Glib::convert_return_gchar_ptr_to_ustring(gtk_ui_manager_get_ui(const_cast<GtkUIManager*>(gobj())));
560 void UIManager::ensure_update()
562 gtk_ui_manager_ensure_update(gobj());
565 ui_merge_id UIManager::new_merge_id()
567 return gtk_ui_manager_new_merge_id(gobj());
571 Glib::SignalProxy1< void,Widget* > UIManager::signal_add_widget()
573 return Glib::SignalProxy1< void,Widget* >(this, &UIManager_signal_add_widget_info);
577 Glib::SignalProxy0< void > UIManager::signal_actions_changed()
579 return Glib::SignalProxy0< void >(this, &UIManager_signal_actions_changed_info);
583 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_connect_proxy()
585 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_connect_proxy_info);
589 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_disconnect_proxy()
591 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_disconnect_proxy_info);
595 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_pre_activate()
597 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_pre_activate_info);
601 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_post_activate()
603 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_post_activate_info);
607 #ifdef GLIBMM_PROPERTIES_ENABLED
608 Glib::PropertyProxy<bool> UIManager::property_add_tearoffs()
610 return Glib::PropertyProxy<bool>(this, "add-tearoffs");
612 #endif //GLIBMM_PROPERTIES_ENABLED
614 #ifdef GLIBMM_PROPERTIES_ENABLED
615 Glib::PropertyProxy_ReadOnly<bool> UIManager::property_add_tearoffs() const
617 return Glib::PropertyProxy_ReadOnly<bool>(this, "add-tearoffs");
619 #endif //GLIBMM_PROPERTIES_ENABLED
621 #ifdef GLIBMM_PROPERTIES_ENABLED
622 Glib::PropertyProxy_ReadOnly<Glib::ustring> UIManager::property_ui() const
624 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "ui");
626 #endif //GLIBMM_PROPERTIES_ENABLED
629 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
630 void Gtk::UIManager::on_add_widget(Widget* widget)
632 BaseClassType *const base = static_cast<BaseClassType*>(
633 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
636 if(base && base->add_widget)
637 (*base->add_widget)(gobj(),(GtkWidget*)Glib::unwrap(widget));
639 void Gtk::UIManager::on_actions_changed()
641 BaseClassType *const base = static_cast<BaseClassType*>(
642 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
645 if(base && base->actions_changed)
646 (*base->actions_changed)(gobj());
648 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
650 #ifdef GLIBMM_VFUNCS_ENABLED
651 #endif //GLIBMM_VFUNCS_ENABLED