don't include any gdk headers. added structure definitions for
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org> * gtk/gtktypeutils.h: don't include any gdk headers. added structure definitions for GtkTypeObject and GtkTypeClass, which cover the very basic fields of GtkObject and GtkObjectClass, which are actually used by the type system. * gtk/gtktypeutils.c: don't include gtkobject.h or gtkcontainer.h, we only refer to our own structures. improved class inheritance sanity checking a bit. * gtk/gtkobject.h: placed appropriate comments at the beginnings of the GtkObject and GtkObjectClass structures, which explain their relationship to GtkTypeObject and GtkTypeClass. * gtk/gtktypeutils.h: * gtk/gtkobject.h: moved GTK_STRUCT_OFFSET(), GTK_CHECK_CAST(), GTK_CHECK_CLASS_CAST(), GTK_CHECK_TYPE() and GTK_CHECK_CLASS_TYPE() macro definitions from gtkobject.h to gtktypeutils.h. * gtk/gtkobject.h: * gtk/gtkobject.c: removed gtk_object_check_cast() and gtk_object_check_class_cast() functions. to keep source compatibility, we can provide macro aliases for the corresponding gtk_type_* functions. but then again, people shouldn't have been using these functions anyways since they were part of Gtk's internal API. * gtk/gtktypeutils.h: * gtk/gtktypeutils.c: implemented gtk_type_check_object_cast() and gtk_type_check_class_cast() functions to check GtkTypeObject and GtkTypeClass types.
This commit is contained in:
@ -917,85 +917,6 @@ gtk_object_query_args (GtkType class_type,
|
||||
return gtk_args_query (class_type, object_arg_info_ht, arg_flags, n_args);
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
* GtkObject and GtkObjectClass cast checking functions
|
||||
*
|
||||
********************************************************/
|
||||
|
||||
static gchar*
|
||||
gtk_object_descriptive_type_name (GtkType type)
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
name = gtk_type_name (type);
|
||||
if (!name)
|
||||
name = "(unknown)";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
GtkObject*
|
||||
gtk_object_check_cast (GtkObject *obj,
|
||||
GtkType cast_type)
|
||||
{
|
||||
if (!obj)
|
||||
{
|
||||
g_warning ("invalid cast from (NULL) pointer to `%s'",
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return obj;
|
||||
}
|
||||
if (!obj->klass)
|
||||
{
|
||||
g_warning ("invalid unclassed pointer in cast to `%s'",
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return obj;
|
||||
}
|
||||
if (obj->klass->type < GTK_TYPE_OBJECT)
|
||||
{
|
||||
g_warning ("invalid class type `%s' in cast to `%s'",
|
||||
gtk_object_descriptive_type_name (obj->klass->type),
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return obj;
|
||||
}
|
||||
if (!gtk_type_is_a (obj->klass->type, cast_type))
|
||||
{
|
||||
g_warning ("invalid cast from `%s' to `%s'",
|
||||
gtk_object_descriptive_type_name (obj->klass->type),
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return obj;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
GtkObjectClass*
|
||||
gtk_object_check_class_cast (GtkObjectClass *klass,
|
||||
GtkType cast_type)
|
||||
{
|
||||
if (!klass)
|
||||
{
|
||||
g_warning ("invalid class cast from (NULL) pointer to `%s'",
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return klass;
|
||||
}
|
||||
if (klass->type < GTK_TYPE_OBJECT)
|
||||
{
|
||||
g_warning ("invalid class type `%s' in class cast to `%s'",
|
||||
gtk_object_descriptive_type_name (klass->type),
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return klass;
|
||||
}
|
||||
if (!gtk_type_is_a (klass->type, cast_type))
|
||||
{
|
||||
g_warning ("invalid class cast from `%s' to `%s'",
|
||||
gtk_object_descriptive_type_name (klass->type),
|
||||
gtk_object_descriptive_type_name (cast_type));
|
||||
return klass;
|
||||
}
|
||||
|
||||
return klass;
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
* GtkObject object_data mechanism
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user