13
0
livetrax/libs/gtkmm2/gtk/gtkmm/container.cc
Paul Davis 449aab3c46 rollback to 3428, before the mysterious removal of libs/* at 3431/3432
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 21:41:35 +00:00

1054 lines
33 KiB
C++

// Generated by gtkmmproc -- DO NOT MODIFY!
#include <gtkmm/container.h>
#include <gtkmm/private/container_p.h>
// -*- c++ -*-
/* $Id$ */
/* Copyright 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtkmm/adjustment.h>
#include <gtk/gtkcontainer.h>
namespace
{
static void container_foreach_callback(GtkWidget* widget_gobj, void* data)
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
Gtk::Container::ForeachSlot& slot = *static_cast<Gtk::Container::ForeachSlot*>(data);
Gtk::Widget *const widget = Glib::wrap(widget_gobj);
g_return_if_fail(widget != 0);
slot(*widget);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
//Copy of generated callback:
static void Container_signal_remove_callback_normal(GtkContainer* self, GtkWidget* p0,void* data)
{
using namespace Gtk;
typedef sigc::slot< void,Widget* > SlotType;
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
static void Container_signal_remove_callback(GtkContainer* self, GtkWidget* p0, void* data)
{
//GTKMM_LIFECYCLE
#ifdef GLIBMM_DEBUG_REFCOUNTING
g_warning("Container_signal_remove_callback()");
#endif
//Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback.
const bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0);
if(!gtkmm_child_already_deleted)
{
//Call the regular, generated callback:
Container_signal_remove_callback_normal(self, p0, data);
}
else
{
//Do nothing.
}
}
} // anonymous namespace
namespace Gtk
{
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Copy of generated callback:
void Container_Class::remove_callback_normal(GtkContainer* self, GtkWidget* p0)
{
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj && obj->is_derived_())
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->on_remove(Glib::wrap(p0)
);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->remove)
(*base->remove)(self, p0);
}
}
//Custom hand-coded callback:
void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
{
//GTKMM_LIFECYCLE
#ifdef GLIBMM_DEBUG_REFCOUNTING
g_warning("Container_Class::remove_callback_custom() C self=%p: C child=%p\n", (void*)self, (void*)p0);
g_warning("gtypename self: %s\n, gtypename child: %s", G_OBJECT_TYPE_NAME(G_OBJECT(self)), G_OBJECT_TYPE_NAME(G_OBJECT(p0)));
#endif
//Don't call wrap() on a GTK+ instance whose gtkmm instance has been deleted - just call the original C callback.
const bool gtkmm_child_already_deleted = Glib::_gobject_cppinstance_already_deleted((GObject*)p0);
if(!gtkmm_child_already_deleted)
{
//Call the regular, generated callback:
Container_Class::remove_callback_normal(self, p0);
}
else
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
//Call the original underlying C function:
if(base && base->remove)
(*base->remove)(self, p0);
}
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Container::foreach(const Container::ForeachSlot& slot)
{
ForeachSlot slot_copy (slot);
gtk_container_foreach(gobj(), &container_foreach_callback, &slot_copy);
}
void Container::add(Widget& widget)
{
gtk_container_add(gobj(), widget.gobj());
}
bool Container::has_focus_chain() const
{
return gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), 0);
}
Glib::ListHandle<Widget*> Container::get_focus_chain()
{
GList* list = 0;
gtk_container_get_focus_chain(gobj(), &list);
return Glib::ListHandle<Widget*>(list, Glib::OWNERSHIP_SHALLOW);
}
Glib::ListHandle<const Widget*> Container::get_focus_chain() const
{
GList* list = 0;
gtk_container_get_focus_chain(const_cast<GtkContainer*>(gobj()), &list);
return Glib::ListHandle<const Widget*>(list, Glib::OWNERSHIP_SHALLOW);
}
void Container::show_all_children(bool recursive)
{
// Plain C version if this turns out to be performance-critical:
//GtkCallback callback = (GtkCallback) ((recursive) ? &gtk_widget_show_all : &gtk_widget_show);
//gtk_container_foreach(gobj(), callback, 0);
// This could also be done with get_children() and an explicit loop,
// if any problems should arise. In gtkmm-1.2, foreach() is known to
// cause segfaults eventually, but it seems to work now.
foreach(sigc::mem_fun((recursive) ? &Widget::show_all : &Widget::show));
}
void Container::remove(Widget& widget)
{
//If this is a managed widget,
//then do an extra ref so that it will
//not be destroyed when adding to another container
//This should leave it in much the same state as when it was instantiated,
//before being added to the first container.
if(widget.is_managed_())
widget.reference();
gtk_container_remove(gobj(), widget.gobj());
}
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
// static
void Container_Class::destroy_callback(GtkObject* self)
{
#ifdef GLIBMM_DEBUG_REFCOUNTING
g_warning("Container_Class::destroy_callback() gobject_=%10X\n", self);
if(self)
g_warning("gtypename: %s\n", G_OBJECT_TYPE_NAME(G_OBJECT(self)));
#endif
//Call the normal C destroy implementation, such as gtk_button_destroy:
//This will chain to gtk_container_destroy(), which will gtk_widget_destroy() any remaining child widgets.
GtkObjectClass *const base = static_cast<GtkObjectClass*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)));
if(base->destroy)
(*base->destroy)(self);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
} // namespace Gtk
namespace
{
static void Container_signal_add_callback(GtkContainer* self, GtkWidget* p0,void* data)
{
using namespace Gtk;
typedef sigc::slot< void,Widget* > SlotType;
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
static const Glib::SignalProxyInfo Container_signal_add_info =
{
"add",
(GCallback) &Container_signal_add_callback,
(GCallback) &Container_signal_add_callback
};
static const Glib::SignalProxyInfo Container_signal_remove_info =
{
"remove",
(GCallback) &Container_signal_remove_callback,
(GCallback) &Container_signal_remove_callback
};
static const Glib::SignalProxyInfo Container_signal_check_resize_info =
{
"check_resize",
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};
static void Container_signal_set_focus_child_callback(GtkContainer* self, GtkWidget* p0,void* data)
{
using namespace Gtk;
typedef sigc::slot< void,Widget* > SlotType;
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
(*static_cast<SlotType*>(slot))(Glib::wrap(p0)
);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
static const Glib::SignalProxyInfo Container_signal_set_focus_child_info =
{
"set_focus_child",
(GCallback) &Container_signal_set_focus_child_callback,
(GCallback) &Container_signal_set_focus_child_callback
};
} // anonymous namespace
namespace Glib
{
Gtk::Container* wrap(GtkContainer* object, bool take_copy)
{
return dynamic_cast<Gtk::Container *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}
} /* namespace Glib */
namespace Gtk
{
/* The *_Class implementation: */
const Glib::Class& Container_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Class has to know the class init function to clone custom types.
class_init_func_ = &Container_Class::class_init_function;
// This is actually just optimized away, apparently with no harm.
// Make sure that the parent type has been created.
//CppClassParent::CppObjectType::get_type();
// Create the wrapper type, with the same class/instance size as the base type.
register_derived_type(gtk_container_get_type());
// Add derived versions of interfaces, if the C type implements any interfaces:
}
return *this;
}
void Container_Class::class_init_function(void* g_class, void* class_data)
{
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
CppClassParent::class_init_function(klass, class_data);
#ifdef GLIBMM_VFUNCS_ENABLED
klass->child_type = &child_type_vfunc_callback;
klass->forall = &forall_vfunc_callback;
klass->composite_name = &composite_name_vfunc_callback;
klass->set_child_property = &set_child_property_vfunc_callback;
klass->get_child_property = &get_child_property_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
klass->add = &add_callback;
klass->remove = &remove_callback;
klass->check_resize = &check_resize_callback;
klass->set_focus_child = &set_focus_child_callback;
reinterpret_cast<GtkObjectClass*>(klass)->destroy = &destroy_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}
#ifdef GLIBMM_VFUNCS_ENABLED
GtkType Container_Class::child_type_vfunc_callback(GtkContainer* self)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
return obj->child_type_vfunc();
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->child_type)
return (*base->child_type)(self);
typedef GtkType RType;
return RType();
}
void Container_Class::forall_vfunc_callback(GtkContainer* self, gboolean include_internals, GtkCallback callback, gpointer callback_data)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->forall_vfunc(include_internals, callback, callback_data);
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->forall)
(*base->forall)(self, include_internals, callback, callback_data);
}
gchar* Container_Class::composite_name_vfunc_callback(GtkContainer* self, GtkWidget* child)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
return obj->composite_name_vfunc(child);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->composite_name)
return (*base->composite_name)(self, child);
typedef gchar* RType;
return RType();
}
void Container_Class::set_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->set_child_property_vfunc(child, property_id, value, pspec);
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->set_child_property)
(*base->set_child_property)(self, child, property_id, value, pspec);
}
void Container_Class::get_child_property_vfunc_callback(GtkContainer* self, GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->get_child_property_vfunc(child, property_id, value, pspec);
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->get_child_property)
(*base->get_child_property)(self, child, property_id, value, pspec);
}
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Container_Class::add_callback(GtkContainer* self, GtkWidget* p0)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->on_add(Glib::wrap(p0)
);
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->add)
(*base->add)(self, p0);
}
void Container_Class::check_resize_callback(GtkContainer* self)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->on_check_resize();
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->check_resize)
(*base->check_resize)(self);
}
void Container_Class::set_focus_child_callback(GtkContainer* self, GtkWidget* p0)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
obj->on_set_focus_child(Glib::wrap(p0)
);
return;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
// Call the original underlying C function:
if(base && base->set_focus_child)
(*base->set_focus_child)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
Glib::ObjectBase* Container_Class::wrap_new(GObject* o)
{
return manage(new Container((GtkContainer*)(o)));
}
/* The implementation: */
Container::Container(const Glib::ConstructParams& construct_params)
:
Gtk::Widget(construct_params)
{
}
Container::Container(GtkContainer* castitem)
:
Gtk::Widget((GtkWidget*)(castitem))
{
}
Container::~Container()
{
destroy_();
}
Container::CppClassType Container::container_class_; // initialize static member
GType Container::get_type()
{
return container_class_.init().get_type();
}
GType Container::get_base_type()
{
return gtk_container_get_type();
}
void Container::set_border_width(guint border_width)
{
gtk_container_set_border_width(gobj(), border_width);
}
guint Container::get_border_width() const
{
return gtk_container_get_border_width(const_cast<GtkContainer*>(gobj()));
}
void Container::set_resize_mode(ResizeMode resize_mode)
{
gtk_container_set_resize_mode(gobj(), ((GtkResizeMode)(resize_mode)));
}
ResizeMode Container::get_resize_mode() const
{
return ((ResizeMode)(gtk_container_get_resize_mode(const_cast<GtkContainer*>(gobj()))));
}
void Container::check_resize()
{
gtk_container_check_resize(gobj());
}
Glib::ListHandle<Widget*> Container::get_children()
{
return Glib::ListHandle<Widget*>(gtk_container_get_children(gobj()), Glib::OWNERSHIP_SHALLOW);
}
Glib::ListHandle<const Widget*> Container::get_children() const
{
return Glib::ListHandle<const Widget*>(gtk_container_get_children(const_cast<GtkContainer*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}
void Container::propagate_expose(Widget& child, GdkEventExpose* event)
{
gtk_container_propagate_expose(gobj(), (child).gobj(), event);
}
void Container::set_focus_chain(const Glib::ListHandle<Widget*>& focusable_widgets)
{
gtk_container_set_focus_chain(gobj(), focusable_widgets.data());
}
void Container::unset_focus_chain()
{
gtk_container_unset_focus_chain(gobj());
}
void Container::set_reallocate_redraws(bool needs_redraws)
{
gtk_container_set_reallocate_redraws(gobj(), static_cast<int>(needs_redraws));
}
void Container::set_focus_child(Widget& widget)
{
gtk_container_set_focus_child(gobj(), (widget).gobj());
}
void Container::set_focus_vadjustment(Adjustment& adjustment)
{
gtk_container_set_focus_vadjustment(gobj(), (adjustment).gobj());
}
Adjustment* Container::get_focus_vadjustment()
{
return Glib::wrap(gtk_container_get_focus_vadjustment(gobj()));
}
const Adjustment* Container::get_focus_vadjustment() const
{
return const_cast<Container*>(this)->get_focus_vadjustment();
}
void Container::set_focus_hadjustment(Adjustment& adjustment)
{
gtk_container_set_focus_hadjustment(gobj(), (adjustment).gobj());
}
Adjustment* Container::get_focus_hadjustment()
{
return Glib::wrap(gtk_container_get_focus_hadjustment(gobj()));
}
const Adjustment* Container::get_focus_hadjustment() const
{
return const_cast<Container*>(this)->get_focus_hadjustment();
}
void Container::resize_children()
{
gtk_container_resize_children(gobj());
}
GType Container::child_type() const
{
return gtk_container_child_type(const_cast<GtkContainer*>(gobj()));
}
Container::Container()
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
Gtk::Widget(Glib::ConstructParams(container_class_.init()))
{
}
Glib::SignalProxy1< void,Widget* > Container::signal_add()
{
return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_add_info);
}
Glib::SignalProxy1< void,Widget* > Container::signal_remove()
{
return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_remove_info);
}
Glib::SignalProxy0< void > Container::signal_check_resize()
{
return Glib::SignalProxy0< void >(this, &Container_signal_check_resize_info);
}
Glib::SignalProxy1< void,Widget* > Container::signal_set_focus_child()
{
return Glib::SignalProxy1< void,Widget* >(this, &Container_signal_set_focus_child_info);
}
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<guint> Container::property_border_width()
{
return Glib::PropertyProxy<guint>(this, "border-width");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<guint> Container::property_border_width() const
{
return Glib::PropertyProxy_ReadOnly<guint>(this, "border-width");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<ResizeMode> Container::property_resize_mode()
{
return Glib::PropertyProxy<ResizeMode>(this, "resize-mode");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<ResizeMode> Container::property_resize_mode() const
{
return Glib::PropertyProxy_ReadOnly<ResizeMode>(this, "resize-mode");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_WriteOnly<Widget*> Container::property_child()
{
return Glib::PropertyProxy_WriteOnly<Widget*>(this, "child");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gtk::Container::on_add(Widget* widget)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->add)
(*base->add)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}
void Gtk::Container::on_remove(Widget* widget)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->remove)
(*base->remove)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}
void Gtk::Container::on_check_resize()
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->check_resize)
(*base->check_resize)(gobj());
}
void Gtk::Container::on_set_focus_child(Widget* widget)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->set_focus_child)
(*base->set_focus_child)(gobj(),(GtkWidget*)Glib::unwrap(widget));
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#ifdef GLIBMM_VFUNCS_ENABLED
GtkType Gtk::Container::child_type_vfunc() const
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->child_type)
return (*base->child_type)(const_cast<GtkContainer*>(gobj()));
typedef GtkType RType;
return RType();
}
void Gtk::Container::forall_vfunc(gboolean include_internals, GtkCallback callback, gpointer callback_data)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->forall)
(*base->forall)(gobj(),include_internals,callback,callback_data);
}
char* Gtk::Container::composite_name_vfunc(GtkWidget* child)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->composite_name)
return (*base->composite_name)(gobj(),child);
typedef char* RType;
return RType();
}
void Gtk::Container::set_child_property_vfunc(GtkWidget* child, guint property_id, const GValue* value, GParamSpec* pspec)
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->set_child_property)
(*base->set_child_property)(gobj(),child,property_id,value,pspec);
}
void Gtk::Container::get_child_property_vfunc(GtkWidget* child, guint property_id, GValue* value, GParamSpec* pspec) const
{
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if(base && base->get_child_property)
(*base->get_child_property)(const_cast<GtkContainer*>(gobj()),child,property_id,value,pspec);
}
#endif //GLIBMM_VFUNCS_ENABLED
} // namespace Gtk