GTK_WINDOW
ist ein Makro, das den Cast durchführt.
Wie hier zu sehen
#define GTK_WINDOW(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_WINDOW, GtkWindow))
Wieder
#define GTK_CHECK_CAST G_TYPE_CHECK_INSTANCE_CAST
und
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
was ist...
#define _G_TYPE_CIC(ip,gt,ct) \
((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
Der Code für g_type_check_instance_cast
ist hier zu finden
GTypeInstance*
g_type_check_instance_cast (GTypeInstance *type_instance,
GType iface_type)
{
if (type_instance)
{
if (type_instance->g_class)
{
TypeNode *node, *iface;
gboolean is_instantiatable, check;
node = lookup_type_node_I (type_instance->g_class->g_type);
is_instantiatable = node && node->is_instantiatable;
iface = lookup_type_node_I (iface_type);
check = is_instantiatable && iface && type_node_conforms_to_U (node, iface, TRUE, FALSE);
if (check)
return type_instance;
if (is_instantiatable)
g_warning ("ungültiger Cast von `%s' nach `%s'",
type_descriptive_name_I (type_instance->g_class->g_type),
type_descriptive_name_I (iface_type));
else
g_warning ("ungültiger nicht instantiierbarer Typ `%s' im Cast nach `%s'",
type_descriptive_name_I (type_instance->g_class->g_type),
type_descriptive_name_I (iface_type));
}
else
g_warning ("ungültiger unklassifizierter Zeiger im Cast nach `%s'",
type_descriptive_name_I (iface_type));
}
return type_instance;
}