1 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gtkmm/uimanager.h>
7 #include <gtkmm/private/uimanager_p.h>
8
9
10 // -*- c++ -*-
11 /* $Id: uimanager.ccg,v 1.9 2006/11/24 19:09:39 jhs Exp $ */
12
13 /* Copyright 2003 The gtkmm Development Team
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free
27 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30 #include <gtk/gtk.h>
31
32
33 namespace Gtk
34 {
35
36 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.
37
add_ui_from_string(const Glib::ustring & buffer)38 UIManager::ui_merge_id UIManager::add_ui_from_string(const Glib::ustring& buffer)
39 {
40 GError* gerror = 0;
41 guint retvalue = gtk_ui_manager_add_ui_from_string(gobj(), buffer.c_str(), buffer.size(), &(gerror));
42
43 if (gerror)
44 {
45 ::Glib::Error::throw_exception(gerror);
46 }
47 return retvalue;
48 }
49
add_ui_separator(ui_merge_id merge_id,const Glib::ustring & path,const Glib::ustring & name,UIManagerItemType type,bool top)50 void UIManager::add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, UIManagerItemType type, bool top)
51 {
52 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), 0 /* See C docs */, ((GtkUIManagerItemType)(type)), static_cast<int>(top));
53 }
54
55
56 } // namespace Gtk
57
58
59 namespace
60 {
61
62
UIManager_signal_add_widget_callback(GtkUIManager * self,GtkWidget * p0,void * data)63 static void UIManager_signal_add_widget_callback(GtkUIManager* self, GtkWidget* p0,void* data)
64 {
65 using namespace Gtk;
66 typedef sigc::slot< void,Widget* > SlotType;
67
68 UIManager* obj = dynamic_cast<UIManager*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
69 // Do not try to call a signal on a disassociated wrapper.
70 if(obj)
71 {
72 try
73 {
74 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
75 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
76 );
77 }
78 catch(...)
79 {
80 Glib::exception_handlers_invoke();
81 }
82 }
83 }
84
85 static const Glib::SignalProxyInfo UIManager_signal_add_widget_info =
86 {
87 "add_widget",
88 (GCallback) &UIManager_signal_add_widget_callback,
89 (GCallback) &UIManager_signal_add_widget_callback
90 };
91
92
93 static const Glib::SignalProxyInfo UIManager_signal_actions_changed_info =
94 {
95 "actions_changed",
96 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
97 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
98 };
99
100
UIManager_signal_connect_proxy_callback(GtkUIManager * self,GtkAction * p0,GtkWidget * p1,void * data)101 static void UIManager_signal_connect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
102 {
103 using namespace Gtk;
104 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
105
106 UIManager* obj = dynamic_cast<UIManager*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
107 // Do not try to call a signal on a disassociated wrapper.
108 if(obj)
109 {
110 try
111 {
112 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
113 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
114 , Glib::wrap(p1)
115 );
116 }
117 catch(...)
118 {
119 Glib::exception_handlers_invoke();
120 }
121 }
122 }
123
124 static const Glib::SignalProxyInfo UIManager_signal_connect_proxy_info =
125 {
126 "connect_proxy",
127 (GCallback) &UIManager_signal_connect_proxy_callback,
128 (GCallback) &UIManager_signal_connect_proxy_callback
129 };
130
131
UIManager_signal_disconnect_proxy_callback(GtkUIManager * self,GtkAction * p0,GtkWidget * p1,void * data)132 static void UIManager_signal_disconnect_proxy_callback(GtkUIManager* self, GtkAction* p0,GtkWidget* p1,void* data)
133 {
134 using namespace Gtk;
135 typedef sigc::slot< void,const Glib::RefPtr<Action>&,Widget* > SlotType;
136
137 UIManager* obj = dynamic_cast<UIManager*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
138 // Do not try to call a signal on a disassociated wrapper.
139 if(obj)
140 {
141 try
142 {
143 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
144 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
145 , Glib::wrap(p1)
146 );
147 }
148 catch(...)
149 {
150 Glib::exception_handlers_invoke();
151 }
152 }
153 }
154
155 static const Glib::SignalProxyInfo UIManager_signal_disconnect_proxy_info =
156 {
157 "disconnect_proxy",
158 (GCallback) &UIManager_signal_disconnect_proxy_callback,
159 (GCallback) &UIManager_signal_disconnect_proxy_callback
160 };
161
162
UIManager_signal_pre_activate_callback(GtkUIManager * self,GtkAction * p0,void * data)163 static void UIManager_signal_pre_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
164 {
165 using namespace Gtk;
166 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
167
168 UIManager* obj = dynamic_cast<UIManager*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
169 // Do not try to call a signal on a disassociated wrapper.
170 if(obj)
171 {
172 try
173 {
174 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
175 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
176 );
177 }
178 catch(...)
179 {
180 Glib::exception_handlers_invoke();
181 }
182 }
183 }
184
185 static const Glib::SignalProxyInfo UIManager_signal_pre_activate_info =
186 {
187 "pre_activate",
188 (GCallback) &UIManager_signal_pre_activate_callback,
189 (GCallback) &UIManager_signal_pre_activate_callback
190 };
191
192
UIManager_signal_post_activate_callback(GtkUIManager * self,GtkAction * p0,void * data)193 static void UIManager_signal_post_activate_callback(GtkUIManager* self, GtkAction* p0,void* data)
194 {
195 using namespace Gtk;
196 typedef sigc::slot< void,const Glib::RefPtr<Action>& > SlotType;
197
198 UIManager* obj = dynamic_cast<UIManager*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
199 // Do not try to call a signal on a disassociated wrapper.
200 if(obj)
201 {
202 try
203 {
204 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
205 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
206 );
207 }
208 catch(...)
209 {
210 Glib::exception_handlers_invoke();
211 }
212 }
213 }
214
215 static const Glib::SignalProxyInfo UIManager_signal_post_activate_info =
216 {
217 "post_activate",
218 (GCallback) &UIManager_signal_post_activate_callback,
219 (GCallback) &UIManager_signal_post_activate_callback
220 };
221
222
223 } // anonymous namespace
224
225 // static
value_type()226 GType Glib::Value<Gtk::UIManagerItemType>::value_type()
227 {
228 return gtk_ui_manager_item_type_get_type();
229 }
230
231
232 namespace Glib
233 {
234
wrap(GtkUIManager * object,bool take_copy)235 Glib::RefPtr<Gtk::UIManager> wrap(GtkUIManager* object, bool take_copy)
236 {
237 return Glib::RefPtr<Gtk::UIManager>( dynamic_cast<Gtk::UIManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
238 //We use dynamic_cast<> in case of multiple inheritance.
239 }
240
241 } /* namespace Glib */
242
243
244 namespace Gtk
245 {
246
247
248 /* The *_Class implementation: */
249
init()250 const Glib::Class& UIManager_Class::init()
251 {
252 if(!gtype_) // create the GType if necessary
253 {
254 // Glib::Class has to know the class init function to clone custom types.
255 class_init_func_ = &UIManager_Class::class_init_function;
256
257 // This is actually just optimized away, apparently with no harm.
258 // Make sure that the parent type has been created.
259 //CppClassParent::CppObjectType::get_type();
260
261 // Create the wrapper type, with the same class/instance size as the base type.
262 register_derived_type(gtk_ui_manager_get_type());
263
264 // Add derived versions of interfaces, if the C type implements any interfaces:
265
266 }
267
268 return *this;
269 }
270
271
class_init_function(void * g_class,void * class_data)272 void UIManager_Class::class_init_function(void* g_class, void* class_data)
273 {
274 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
275 CppClassParent::class_init_function(klass, class_data);
276
277
278 klass->add_widget = &add_widget_callback;
279 klass->actions_changed = &actions_changed_callback;
280 }
281
282
add_widget_callback(GtkUIManager * self,GtkWidget * p0)283 void UIManager_Class::add_widget_callback(GtkUIManager* self, GtkWidget* p0)
284 {
285 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
286 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
287
288 // Non-gtkmmproc-generated custom classes implicitly call the default
289 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
290 // generated classes can use this optimisation, which avoids the unnecessary
291 // parameter conversions if there is no possibility of the virtual function
292 // being overridden:
293 if(obj_base && obj_base->is_derived_())
294 {
295 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
296 if(obj) // This can be NULL during destruction.
297 {
298 try // Trap C++ exceptions which would normally be lost because this is a C callback.
299 {
300 // Call the virtual member method, which derived classes might override.
301 obj->on_add_widget(Glib::wrap(p0)
302 );
303 return;
304 }
305 catch(...)
306 {
307 Glib::exception_handlers_invoke();
308 }
309 }
310 }
311
312 BaseClassType *const base = static_cast<BaseClassType*>(
313 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
314 );
315
316 // Call the original underlying C function:
317 if(base && base->add_widget)
318 (*base->add_widget)(self, p0);
319 }
actions_changed_callback(GtkUIManager * self)320 void UIManager_Class::actions_changed_callback(GtkUIManager* self)
321 {
322 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
323 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
324
325 // Non-gtkmmproc-generated custom classes implicitly call the default
326 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
327 // generated classes can use this optimisation, which avoids the unnecessary
328 // parameter conversions if there is no possibility of the virtual function
329 // being overridden:
330 if(obj_base && obj_base->is_derived_())
331 {
332 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
333 if(obj) // This can be NULL during destruction.
334 {
335 try // Trap C++ exceptions which would normally be lost because this is a C callback.
336 {
337 // Call the virtual member method, which derived classes might override.
338 obj->on_actions_changed();
339 return;
340 }
341 catch(...)
342 {
343 Glib::exception_handlers_invoke();
344 }
345 }
346 }
347
348 BaseClassType *const base = static_cast<BaseClassType*>(
349 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
350 );
351
352 // Call the original underlying C function:
353 if(base && base->actions_changed)
354 (*base->actions_changed)(self);
355 }
356
357
wrap_new(GObject * object)358 Glib::ObjectBase* UIManager_Class::wrap_new(GObject* object)
359 {
360 return new UIManager((GtkUIManager*)object);
361 }
362
363
364 /* The implementation: */
365
gobj_copy()366 GtkUIManager* UIManager::gobj_copy()
367 {
368 reference();
369 return gobj();
370 }
371
UIManager(const Glib::ConstructParams & construct_params)372 UIManager::UIManager(const Glib::ConstructParams& construct_params)
373 :
374 Glib::Object(construct_params)
375 {
376
377 }
378
UIManager(GtkUIManager * castitem)379 UIManager::UIManager(GtkUIManager* castitem)
380 :
381 Glib::Object((GObject*)(castitem))
382 {}
383
384
~UIManager()385 UIManager::~UIManager()
386 {}
387
388
389 UIManager::CppClassType UIManager::uimanager_class_; // initialize static member
390
get_type()391 GType UIManager::get_type()
392 {
393 return uimanager_class_.init().get_type();
394 }
395
396
get_base_type()397 GType UIManager::get_base_type()
398 {
399 return gtk_ui_manager_get_type();
400 }
401
402
UIManager()403 UIManager::UIManager()
404 :
405 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
406 Glib::ObjectBase(0),
407 Glib::Object(Glib::ConstructParams(uimanager_class_.init()))
408 {
409
410
411 }
412
create()413 Glib::RefPtr<UIManager> UIManager::create()
414 {
415 return Glib::RefPtr<UIManager>( new UIManager() );
416 }
417
set_add_tearoffs(bool add_tearoffs)418 void UIManager::set_add_tearoffs(bool add_tearoffs)
419 {
420 gtk_ui_manager_set_add_tearoffs(gobj(), static_cast<int>(add_tearoffs));
421 }
422
get_add_tearoffs() const423 bool UIManager::get_add_tearoffs() const
424 {
425 return gtk_ui_manager_get_add_tearoffs(const_cast<GtkUIManager*>(gobj()));
426 }
427
insert_action_group(const Glib::RefPtr<ActionGroup> & action_group,int pos)428 void UIManager::insert_action_group(const Glib::RefPtr<ActionGroup>& action_group, int pos)
429 {
430 gtk_ui_manager_insert_action_group(gobj(), Glib::unwrap(action_group), pos);
431 }
432
remove_action_group(const Glib::RefPtr<ActionGroup> & action_group)433 void UIManager::remove_action_group(const Glib::RefPtr<ActionGroup>& action_group)
434 {
435 gtk_ui_manager_remove_action_group(gobj(), Glib::unwrap(action_group));
436 }
437
get_action_groups()438 Glib::ListHandle< Glib::RefPtr<ActionGroup> > UIManager::get_action_groups()
439 {
440 return Glib::ListHandle< Glib::RefPtr<ActionGroup> >(gtk_ui_manager_get_action_groups(gobj()), Glib::OWNERSHIP_NONE);
441 }
442
get_action_groups() const443 Glib::ListHandle< Glib::RefPtr<const ActionGroup> > UIManager::get_action_groups() const
444 {
445 return Glib::ListHandle< Glib::RefPtr<const ActionGroup> >(gtk_ui_manager_get_action_groups(const_cast<GtkUIManager*>(gobj())), Glib::OWNERSHIP_SHALLOW);
446 }
447
get_accel_group()448 Glib::RefPtr<AccelGroup> UIManager::get_accel_group()
449 {
450 Glib::RefPtr<AccelGroup> retvalue = Glib::wrap(gtk_ui_manager_get_accel_group(gobj()));
451 if(retvalue)
452 retvalue->reference(); //The function does not do a ref for us.
453 return retvalue;
454 }
455
get_accel_group() const456 Glib::RefPtr<const AccelGroup> UIManager::get_accel_group() const
457 {
458 return const_cast<UIManager*>(this)->get_accel_group();
459 }
460
get_widget(const Glib::ustring & path)461 Widget* UIManager::get_widget(const Glib::ustring& path)
462 {
463 return Glib::wrap(gtk_ui_manager_get_widget(gobj(), path.c_str()));
464 }
465
get_widget(const Glib::ustring & path) const466 const Widget* UIManager::get_widget(const Glib::ustring& path) const
467 {
468 return const_cast<UIManager*>(this)->get_widget(path);
469 }
470
get_toplevels(UIManagerItemType types)471 Glib::SListHandle<Widget*> UIManager::get_toplevels(UIManagerItemType types)
472 {
473 return Glib::SListHandle<Widget*>(gtk_ui_manager_get_toplevels(gobj(), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
474 }
475
get_toplevels(UIManagerItemType types) const476 Glib::SListHandle<const Widget*> UIManager::get_toplevels(UIManagerItemType types) const
477 {
478 return Glib::SListHandle<const Widget*>(gtk_ui_manager_get_toplevels(const_cast<GtkUIManager*>(gobj()), ((GtkUIManagerItemType)(types))), Glib::OWNERSHIP_SHALLOW);
479 }
480
get_action(const Glib::ustring & path)481 Glib::RefPtr<Action> UIManager::get_action(const Glib::ustring& path)
482 {
483 Glib::RefPtr<Action> retvalue = Glib::wrap(gtk_ui_manager_get_action(gobj(), path.c_str()));
484 if(retvalue)
485 retvalue->reference(); //The function does not do a ref for us.
486 return retvalue;
487 }
488
get_action(const Glib::ustring & path) const489 Glib::RefPtr<const Action> UIManager::get_action(const Glib::ustring& path) const
490 {
491 return const_cast<UIManager*>(this)->get_action(path);
492 }
493
add_ui_from_file(const Glib::ustring & filename)494 ui_merge_id UIManager::add_ui_from_file(const Glib::ustring& filename)
495 {
496 GError* gerror = 0;
497 ui_merge_id retvalue = gtk_ui_manager_add_ui_from_file(gobj(), filename.c_str(), &(gerror));
498 if(gerror)
499 ::Glib::Error::throw_exception(gerror);
500 return retvalue;
501 }
502
add_ui(ui_merge_id merge_id,const Glib::ustring & path,const Glib::ustring & name,const Glib::ustring & action,UIManagerItemType type,bool top)503 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)
504 {
505 gtk_ui_manager_add_ui(gobj(), merge_id, path.c_str(), name.c_str(), action.c_str(), ((GtkUIManagerItemType)(type)), static_cast<int>(top));
506 }
507
remove_ui(ui_merge_id merge_id)508 void UIManager::remove_ui(ui_merge_id merge_id)
509 {
510 gtk_ui_manager_remove_ui(gobj(), merge_id);
511 }
512
get_ui() const513 Glib::ustring UIManager::get_ui() const
514 {
515 return Glib::convert_return_gchar_ptr_to_ustring(gtk_ui_manager_get_ui(const_cast<GtkUIManager*>(gobj())));
516 }
517
ensure_update()518 void UIManager::ensure_update()
519 {
520 gtk_ui_manager_ensure_update(gobj());
521 }
522
new_merge_id()523 ui_merge_id UIManager::new_merge_id()
524 {
525 return gtk_ui_manager_new_merge_id(gobj());
526 }
527
528
signal_add_widget()529 Glib::SignalProxy1< void,Widget* > UIManager::signal_add_widget()
530 {
531 return Glib::SignalProxy1< void,Widget* >(this, &UIManager_signal_add_widget_info);
532 }
533
534
signal_actions_changed()535 Glib::SignalProxy0< void > UIManager::signal_actions_changed()
536 {
537 return Glib::SignalProxy0< void >(this, &UIManager_signal_actions_changed_info);
538 }
539
540
signal_connect_proxy()541 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_connect_proxy()
542 {
543 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_connect_proxy_info);
544 }
545
546
signal_disconnect_proxy()547 Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > UIManager::signal_disconnect_proxy()
548 {
549 return Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* >(this, &UIManager_signal_disconnect_proxy_info);
550 }
551
552
signal_pre_activate()553 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_pre_activate()
554 {
555 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_pre_activate_info);
556 }
557
558
signal_post_activate()559 Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > UIManager::signal_post_activate()
560 {
561 return Glib::SignalProxy1< void,const Glib::RefPtr<Action>& >(this, &UIManager_signal_post_activate_info);
562 }
563
564
property_add_tearoffs()565 Glib::PropertyProxy< bool > UIManager::property_add_tearoffs()
566 {
567 return Glib::PropertyProxy< bool >(this, "add-tearoffs");
568 }
569
property_add_tearoffs() const570 Glib::PropertyProxy_ReadOnly< bool > UIManager::property_add_tearoffs() const
571 {
572 return Glib::PropertyProxy_ReadOnly< bool >(this, "add-tearoffs");
573 }
574
property_ui() const575 Glib::PropertyProxy_ReadOnly< Glib::ustring > UIManager::property_ui() const
576 {
577 return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "ui");
578 }
579
580
on_add_widget(Widget * widget)581 void Gtk::UIManager::on_add_widget(Widget* widget)
582 {
583 BaseClassType *const base = static_cast<BaseClassType*>(
584 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
585 );
586
587 if(base && base->add_widget)
588 (*base->add_widget)(gobj(),(GtkWidget*)Glib::unwrap(widget));
589 }
on_actions_changed()590 void Gtk::UIManager::on_actions_changed()
591 {
592 BaseClassType *const base = static_cast<BaseClassType*>(
593 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
594 );
595
596 if(base && base->actions_changed)
597 (*base->actions_changed)(gobj());
598 }
599
600
601 } // namespace Gtk
602
603
604