Function Macro
GObjectDEFINE_TYPE_EXTENDED
since: 2.4
Declaration [src]
#define G_DEFINE_TYPE_EXTENDED (
TN,
t_n,
T_P,
_f_,
_C_
)
Description [src]
The most general convenience macro for type implementations, on which G_DEFINE_TYPE(), etc are based.
G_DEFINE_TYPE_EXTENDED (GtkGadget,
gtk_gadget,
GTK_TYPE_WIDGET,
0,
G_ADD_PRIVATE (GtkGadget)
G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
gtk_gadget_gizmo_init));
expands to
static void gtk_gadget_init (GtkGadget *self);
static void gtk_gadget_class_init (GtkGadgetClass *klass);
static gpointer gtk_gadget_parent_class = NULL;
static gint GtkGadget_private_offset;
static void gtk_gadget_class_intern_init (gpointer klass)
{
gtk_gadget_parent_class = g_type_class_peek_parent (klass);
if (GtkGadget_private_offset != 0)
g_type_class_adjust_private_offset (klass, &GtkGadget_private_offset);
gtk_gadget_class_init ((GtkGadgetClass*) klass);
}
static inline gpointer gtk_gadget_get_instance_private (GtkGadget *self)
{
return (G_STRUCT_MEMBER_P (self, GtkGadget_private_offset));
}
GType
gtk_gadget_get_type (void)
{
static GType static_g_define_type_id = 0;
if (g_once_init_enter_pointer (&static_g_define_type_id))
{
GType g_define_type_id =
g_type_register_static_simple (GTK_TYPE_WIDGET,
g_intern_static_string ("GtkGadget"),
sizeof (GtkGadgetClass),
(GClassInitFunc) gtk_gadget_class_intern_init,
sizeof (GtkGadget),
(GInstanceInitFunc) gtk_gadget_init,
0);
{
GtkGadget_private_offset =
g_type_add_instance_private (g_define_type_id, sizeof (GtkGadgetPrivate));
}
{
const GInterfaceInfo g_implement_interface_info = {
(GInterfaceInitFunc) gtk_gadget_gizmo_init
};
g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
}
g_once_init_leave_pointer (&static_g_define_type_id, g_define_type_id);
}
return static_g_define_type_id;
}
The only pieces which have to be manually provided are the definitions of the instance and class structure and the definitions of the instance and class init functions.
Available since: 2.4
This function is not directly available to language bindings.
Parameters
TN
-
Type:
-
The name of the new type, in Camel case.
t_n
-
Type:
-
The name of the new type, in lowercase, with words separated by
_
. T_P
-
Type:
-
The
GType
of the parent type. _f_
-
Type:
-
GTypeFlags
to pass to g_type_register_static(). _C_
-
Type:
-
Custom code that gets inserted in the
*_get_type()
function.