forked from AuroraMiddleware/gtk
display the current cursor name.
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org> * gtk/testgtk.c (create_cursors): display the current cursor name. * gtk/gtktypeutils.h: * gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to the fundamental type definition. the GtkArg union now only covers the required storage types for argument values. adapted the GTK_VALUE_* macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros. * gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the code, fixed int/float collection. fixed a bug in the sanity checking code for GtkObjects. * gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the argument collection code. * gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds macros when distinguishing the return type.
This commit is contained in:
parent
f38374c160
commit
da355feec6
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -1,3 +1,23 @@
|
||||
Tue Jul 14 06:25:46 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/testgtk.c (create_cursors): display the current cursor name.
|
||||
|
||||
* gtk/gtktypeutils.h:
|
||||
* gtk/gtktypeutils.c (gtk_type_init_builtin_types): cleanups to
|
||||
the fundamental type definition. the GtkArg union now only covers
|
||||
the required storage types for argument values. adapted the GTK_VALUE_*
|
||||
macro set. handle GTK_TYPE_UCHAR. definiton of type set bounds macros.
|
||||
|
||||
* gtk/gtkargcollector.c (gtk_arg_collect_value): clean ups of the
|
||||
code, fixed int/float collection. fixed a bug in the sanity checking
|
||||
code for GtkObjects.
|
||||
|
||||
* gtk/gtkbindings.c (gtk_binding_entry_add_signal): fixups of the
|
||||
argument collection code.
|
||||
|
||||
* gtk/gtksignal.c (gtk_signal_collect_params): use the type set bounds
|
||||
macros when distinguishing the return type.
|
||||
|
||||
Mon Jul 13 12:42:51 1998 George Lebl <jirka@5z.com>
|
||||
|
||||
* gdk/gdkwindow.h: (gdk_window_reparent) check if old_parent_private
|
||||
|
@ -315,6 +315,7 @@
|
||||
(invalid GTK_TYPE_INVALID)
|
||||
(none GTK_TYPE_NONE)
|
||||
(char GTK_TYPE_CHAR)
|
||||
(uchar GTK_TYPE_UCHAR)
|
||||
(bool GTK_TYPE_BOOL)
|
||||
(int GTK_TYPE_INT)
|
||||
(uint GTK_TYPE_UINT)
|
||||
@ -326,12 +327,12 @@
|
||||
(enum GTK_TYPE_ENUM)
|
||||
(flags GTK_TYPE_FLAGS)
|
||||
(boxed GTK_TYPE_BOXED)
|
||||
(foreign GTK_TYPE_FOREIGN)
|
||||
(callback GTK_TYPE_CALLBACK)
|
||||
(args GTK_TYPE_ARGS)
|
||||
(pointer GTK_TYPE_POINTER)
|
||||
(signal GTK_TYPE_SIGNAL)
|
||||
(args GTK_TYPE_ARGS)
|
||||
(callback GTK_TYPE_CALLBACK)
|
||||
(c-callback GTK_TYPE_C_CALLBACK)
|
||||
(foreign GTK_TYPE_FOREIGN)
|
||||
(object GTK_TYPE_OBJECT))
|
||||
|
||||
; enumerations from "./gtkwidget.h"
|
||||
|
@ -406,7 +406,7 @@ gtk_arg_copy (GtkArg *src_arg,
|
||||
dest_arg->d = src_arg->d;
|
||||
|
||||
if (src_arg->type == GTK_TYPE_STRING)
|
||||
dest_arg->d.string_data = g_strdup (src_arg->d.string_data);
|
||||
GTK_VALUE_STRING (*dest_arg) = g_strdup (GTK_VALUE_STRING (*src_arg));
|
||||
|
||||
return dest_arg;
|
||||
}
|
||||
|
@ -32,14 +32,27 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
case GTK_TYPE_INVALID:
|
||||
error_msg = g_strdup ("invalid untyped argument");
|
||||
break;
|
||||
|
||||
case GTK_TYPE_NONE:
|
||||
/* error_msg = g_strdup ("invalid argument type `void'"); */
|
||||
/* we just ignore this type, since it arithmetically just requires
|
||||
* us to not move the var_args pointer any further. callers need to
|
||||
* check for the validity of GTK_TYPE_NONE themselves.
|
||||
*
|
||||
* error_msg = g_strdup ("invalid argument type `void'");
|
||||
*/
|
||||
break;
|
||||
|
||||
/* everything smaller than an int is guarranteed to be
|
||||
* passed as an int
|
||||
*/
|
||||
case GTK_TYPE_CHAR:
|
||||
GTK_VALUE_CHAR (*arg) = va_arg (*var_args, gchar);
|
||||
GTK_VALUE_CHAR (*arg) = va_arg (*var_args, gint);
|
||||
break;
|
||||
case GTK_TYPE_UCHAR:
|
||||
GTK_VALUE_UCHAR (*arg) = va_arg (*var_args, guint);
|
||||
break;
|
||||
case GTK_TYPE_BOOL:
|
||||
GTK_VALUE_BOOL (*arg) = va_arg (*var_args, gboolean);
|
||||
GTK_VALUE_BOOL (*arg) = va_arg (*var_args, gint);
|
||||
break;
|
||||
case GTK_TYPE_INT:
|
||||
GTK_VALUE_INT (*arg) = va_arg (*var_args, gint);
|
||||
@ -51,14 +64,21 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
GTK_VALUE_ENUM (*arg) = va_arg (*var_args, gint);
|
||||
break;
|
||||
case GTK_TYPE_FLAGS:
|
||||
GTK_VALUE_FLAGS (*arg) = va_arg (*var_args, gint);
|
||||
GTK_VALUE_FLAGS (*arg) = va_arg (*var_args, guint);
|
||||
break;
|
||||
|
||||
/* we collect longs as glongs since they differ in size with
|
||||
* integers on some platforms
|
||||
*/
|
||||
case GTK_TYPE_LONG:
|
||||
GTK_VALUE_LONG (*arg) = va_arg (*var_args, glong);
|
||||
break;
|
||||
case GTK_TYPE_ULONG:
|
||||
GTK_VALUE_ULONG (*arg) = va_arg (*var_args, gulong);
|
||||
break;
|
||||
|
||||
/* floats are always passed as doubles
|
||||
*/
|
||||
case GTK_TYPE_FLOAT:
|
||||
/* GTK_VALUE_FLOAT (*arg) = va_arg (*var_args, gfloat); */
|
||||
GTK_VALUE_FLOAT (*arg) = va_arg (*var_args, gdouble);
|
||||
@ -66,6 +86,9 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
case GTK_TYPE_DOUBLE:
|
||||
GTK_VALUE_DOUBLE (*arg) = va_arg (*var_args, gdouble);
|
||||
break;
|
||||
|
||||
/* collect pointer values
|
||||
*/
|
||||
case GTK_TYPE_STRING:
|
||||
GTK_VALUE_STRING (*arg) = va_arg (*var_args, gchar*);
|
||||
break;
|
||||
@ -75,10 +98,17 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
case GTK_TYPE_BOXED:
|
||||
GTK_VALUE_BOXED (*arg) = va_arg (*var_args, gpointer);
|
||||
break;
|
||||
|
||||
/* structured types
|
||||
*/
|
||||
case GTK_TYPE_SIGNAL:
|
||||
GTK_VALUE_SIGNAL (*arg).f = va_arg (*var_args, GtkFunction);
|
||||
GTK_VALUE_SIGNAL (*arg).f = va_arg (*var_args, GtkSignalFunc);
|
||||
GTK_VALUE_SIGNAL (*arg).d = va_arg (*var_args, gpointer);
|
||||
break;
|
||||
case GTK_TYPE_ARGS:
|
||||
GTK_VALUE_ARGS (*arg).n_args = va_arg (*var_args, gint);
|
||||
GTK_VALUE_ARGS (*arg).args = va_arg (*var_args, GtkArg*);
|
||||
break;
|
||||
case GTK_TYPE_FOREIGN:
|
||||
GTK_VALUE_FOREIGN (*arg).data = va_arg (*var_args, gpointer);
|
||||
GTK_VALUE_FOREIGN (*arg).notify = va_arg (*var_args, GtkDestroyNotify);
|
||||
@ -92,18 +122,23 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
GTK_VALUE_C_CALLBACK (*arg).func = va_arg (*var_args, GtkFunction);
|
||||
GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (*var_args, gpointer);
|
||||
break;
|
||||
case GTK_TYPE_ARGS:
|
||||
GTK_VALUE_ARGS (*arg).n_args = va_arg (*var_args, gint);
|
||||
GTK_VALUE_ARGS (*arg).args = va_arg (*var_args, GtkArg*);
|
||||
break;
|
||||
|
||||
/* we do some extra sanity checking when collecting objects,
|
||||
* i.e. if the object pointer is not NULL, we check whether we
|
||||
* actually got an object pointer within the desired class branch.
|
||||
*/
|
||||
case GTK_TYPE_OBJECT:
|
||||
GTK_VALUE_OBJECT (*arg) = va_arg (*var_args, GtkObject*);
|
||||
if (GTK_VALUE_OBJECT (*arg) != NULL)
|
||||
{
|
||||
register GtkObject *object = GTK_VALUE_OBJECT (*arg);
|
||||
|
||||
if (object->klass == NULL ||
|
||||
!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type))
|
||||
|
||||
if (object->klass == NULL)
|
||||
error_msg = g_strconcat ("invalid unclassed object pointer for argument type `",
|
||||
gtk_type_name (arg->type),
|
||||
"'",
|
||||
NULL);
|
||||
else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type))
|
||||
error_msg = g_strconcat ("invalid object `",
|
||||
gtk_type_name (GTK_OBJECT_TYPE (object)),
|
||||
"' for argument type `",
|
||||
@ -112,6 +147,7 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error_msg = g_strconcat ("unsupported argument type `",
|
||||
gtk_type_name (arg->type),
|
||||
@ -119,6 +155,6 @@ gtk_arg_collect_value (GtkType fundamental_type,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return error_msg;
|
||||
}
|
||||
|
@ -643,16 +643,16 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
|
||||
arg->arg_type = va_arg (args, GtkType);
|
||||
switch (GTK_FUNDAMENTAL_TYPE (arg->arg_type))
|
||||
{
|
||||
/* for elaborated commenting about var args collection, take a look
|
||||
* at gtk_arg_collect_value() in gtkargcollector.c
|
||||
*/
|
||||
case GTK_TYPE_CHAR:
|
||||
arg->arg_type = GTK_TYPE_LONG;
|
||||
arg->d.long_data = va_arg (args, gchar);
|
||||
break;
|
||||
case GTK_TYPE_BOOL:
|
||||
arg->arg_type = GTK_TYPE_LONG;
|
||||
arg->d.long_data = va_arg (args, gboolean) != 0;
|
||||
break;
|
||||
case GTK_TYPE_UCHAR:
|
||||
case GTK_TYPE_INT:
|
||||
case GTK_TYPE_UINT:
|
||||
case GTK_TYPE_BOOL:
|
||||
case GTK_TYPE_ENUM:
|
||||
case GTK_TYPE_FLAGS:
|
||||
arg->arg_type = GTK_TYPE_LONG;
|
||||
arg->d.long_data = va_arg (args, gint);
|
||||
break;
|
||||
@ -662,9 +662,6 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
|
||||
arg->d.long_data = va_arg (args, glong);
|
||||
break;
|
||||
case GTK_TYPE_FLOAT:
|
||||
arg->arg_type = GTK_TYPE_DOUBLE;
|
||||
arg->d.double_data = va_arg (args, gfloat);
|
||||
break;
|
||||
case GTK_TYPE_DOUBLE:
|
||||
arg->arg_type = GTK_TYPE_DOUBLE;
|
||||
arg->d.double_data = va_arg (args, gdouble);
|
||||
@ -681,11 +678,6 @@ gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
|
||||
i += n_args + 1;
|
||||
}
|
||||
break;
|
||||
case GTK_TYPE_ENUM:
|
||||
case GTK_TYPE_FLAGS:
|
||||
arg->arg_type = GTK_TYPE_LONG;
|
||||
arg->d.long_data = va_arg (args, gint);
|
||||
break;
|
||||
default:
|
||||
g_warning ("gtk_binding_entry_add_signal(): unsupported type `%s' for arg[%u]",
|
||||
gtk_type_name (arg->arg_type), i);
|
||||
|
@ -310,7 +310,7 @@ gtk_object_set_arg (GtkObject *object,
|
||||
{
|
||||
gtk_signal_connect_full (object,
|
||||
arg_name + n + 2,
|
||||
(GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f, NULL,
|
||||
GTK_VALUE_SIGNAL (*arg).f, NULL,
|
||||
GTK_VALUE_SIGNAL (*arg).d,
|
||||
NULL,
|
||||
(arg_id == ARG_OBJECT_SIGNAL ||
|
||||
|
@ -221,18 +221,6 @@ struct _GtkObjectClass
|
||||
};
|
||||
|
||||
|
||||
/* For the purpose of user signals we need the signal function
|
||||
* and signal marshaller signatures already in this place.
|
||||
*/
|
||||
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
|
||||
|
||||
typedef void (*GtkSignalFunc) (void);
|
||||
typedef void (*GtkSignalMarshaller) (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args);
|
||||
|
||||
|
||||
|
||||
/* Application-level methods */
|
||||
|
||||
|
@ -1832,9 +1832,8 @@ gtk_signal_collect_params (GtkArg *params,
|
||||
return_type = GTK_FUNDAMENTAL_TYPE (return_type);
|
||||
if (return_type != GTK_TYPE_NONE)
|
||||
{
|
||||
if ((return_type >= GTK_TYPE_CHAR &&
|
||||
return_type <= GTK_TYPE_BOXED) ||
|
||||
(return_type == GTK_TYPE_POINTER) ||
|
||||
if ((return_type >= GTK_TYPE_FLAT_FIRST &&
|
||||
return_type <= GTK_TYPE_FLAT_LAST) ||
|
||||
(return_type == GTK_TYPE_OBJECT))
|
||||
{
|
||||
GTK_VALUE_POINTER (*params) = va_arg (var_args, gpointer);
|
||||
|
@ -337,6 +337,7 @@ static GtkEnumValue _gtk_fundamental_type_values[] = {
|
||||
{ GTK_TYPE_INVALID, "GTK_TYPE_INVALID", "invalid" },
|
||||
{ GTK_TYPE_NONE, "GTK_TYPE_NONE", "none" },
|
||||
{ GTK_TYPE_CHAR, "GTK_TYPE_CHAR", "char" },
|
||||
{ GTK_TYPE_UCHAR, "GTK_TYPE_UCHAR", "uchar" },
|
||||
{ GTK_TYPE_BOOL, "GTK_TYPE_BOOL", "bool" },
|
||||
{ GTK_TYPE_INT, "GTK_TYPE_INT", "int" },
|
||||
{ GTK_TYPE_UINT, "GTK_TYPE_UINT", "uint" },
|
||||
@ -348,12 +349,12 @@ static GtkEnumValue _gtk_fundamental_type_values[] = {
|
||||
{ GTK_TYPE_ENUM, "GTK_TYPE_ENUM", "enum" },
|
||||
{ GTK_TYPE_FLAGS, "GTK_TYPE_FLAGS", "flags" },
|
||||
{ GTK_TYPE_BOXED, "GTK_TYPE_BOXED", "boxed" },
|
||||
{ GTK_TYPE_FOREIGN, "GTK_TYPE_FOREIGN", "foreign" },
|
||||
{ GTK_TYPE_CALLBACK, "GTK_TYPE_CALLBACK", "callback" },
|
||||
{ GTK_TYPE_ARGS, "GTK_TYPE_ARGS", "args" },
|
||||
{ GTK_TYPE_POINTER, "GTK_TYPE_POINTER", "pointer" },
|
||||
{ GTK_TYPE_SIGNAL, "GTK_TYPE_SIGNAL", "signal" },
|
||||
{ GTK_TYPE_ARGS, "GTK_TYPE_ARGS", "args" },
|
||||
{ GTK_TYPE_CALLBACK, "GTK_TYPE_CALLBACK", "callback" },
|
||||
{ GTK_TYPE_C_CALLBACK, "GTK_TYPE_C_CALLBACK", "c-callback" },
|
||||
{ GTK_TYPE_FOREIGN, "GTK_TYPE_FOREIGN", "foreign" },
|
||||
{ GTK_TYPE_OBJECT, "GTK_TYPE_OBJECT", "object" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
@ -60,20 +60,20 @@ static gint gtk_type_name_compare (const char *a,
|
||||
static void gtk_type_init_builtin_types (void);
|
||||
|
||||
static GtkTypeNode *type_nodes = NULL;
|
||||
static guint n_type_nodes = 0;
|
||||
static guint n_type_nodes = 0;
|
||||
static GHashTable *type_name_2_type_ht = NULL;
|
||||
|
||||
|
||||
static GtkTypeNode*
|
||||
gtk_type_node_next_and_invalidate (void)
|
||||
{
|
||||
static guint n_free_type_nodes = 0;
|
||||
register GtkTypeNode *node;
|
||||
static guint n_free_type_nodes = 0;
|
||||
register GtkTypeNode *node;
|
||||
register GtkType new_type;
|
||||
|
||||
|
||||
/* don't keep *any* GtkTypeNode pointers across invokation of this function!!!
|
||||
*/
|
||||
|
||||
|
||||
if (n_free_type_nodes == 0)
|
||||
{
|
||||
register guint i;
|
||||
@ -89,19 +89,19 @@ gtk_type_node_next_and_invalidate (void)
|
||||
size = i;
|
||||
|
||||
type_nodes = g_realloc (type_nodes, size);
|
||||
|
||||
|
||||
n_free_type_nodes = size / sizeof (GtkTypeNode) - n_type_nodes;
|
||||
|
||||
memset (type_nodes + n_type_nodes, 0, n_free_type_nodes * sizeof (GtkTypeNode));
|
||||
}
|
||||
|
||||
|
||||
new_type = n_type_nodes++;
|
||||
n_free_type_nodes--;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, new_type);
|
||||
if (node)
|
||||
node->type = new_type;
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -111,35 +111,35 @@ gtk_type_init (void)
|
||||
if (n_type_nodes == 0)
|
||||
{
|
||||
GtkTypeNode *zero;
|
||||
|
||||
|
||||
g_assert (sizeof (GtkType) >= 4);
|
||||
|
||||
|
||||
zero = gtk_type_node_next_and_invalidate ();
|
||||
g_assert (zero == NULL);
|
||||
|
||||
|
||||
type_name_2_type_ht = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
|
||||
(GCompareFunc) gtk_type_name_compare);
|
||||
|
||||
|
||||
gtk_type_init_builtin_types ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_type_set_chunk_alloc (GtkType type,
|
||||
guint n_chunks)
|
||||
guint n_chunks)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
g_return_if_fail (node != NULL);
|
||||
g_return_if_fail (node->chunk_alloc_locked == FALSE);
|
||||
|
||||
|
||||
if (node->mem_chunk)
|
||||
{
|
||||
g_mem_chunk_destroy (node->mem_chunk);
|
||||
node->mem_chunk = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (n_chunks)
|
||||
node->mem_chunk = g_mem_chunk_new (node->type_info.type_name,
|
||||
node->type_info.object_size,
|
||||
@ -155,7 +155,7 @@ gtk_type_create (GtkType parent_type,
|
||||
GtkTypeNode *new_node;
|
||||
GtkTypeNode *parent;
|
||||
guint i;
|
||||
|
||||
|
||||
if (g_hash_table_lookup (type_name_2_type_ht, type_name))
|
||||
{
|
||||
g_warning ("gtk_type_create(): type `%s' already exists.", type_name);
|
||||
@ -173,11 +173,11 @@ gtk_type_create (GtkType parent_type,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
new_node = gtk_type_node_next_and_invalidate ();
|
||||
|
||||
|
||||
if (parent_type)
|
||||
{
|
||||
new_node->type = GTK_TYPE_MAKE (parent_type, new_node->type);
|
||||
@ -188,7 +188,7 @@ gtk_type_create (GtkType parent_type,
|
||||
g_assert (new_node->type <= 0xff);
|
||||
parent = NULL;
|
||||
}
|
||||
|
||||
|
||||
new_node->type_info = *type_info;
|
||||
new_node->type_info.type_name = type_name;
|
||||
/* new_node->type_info.reserved_1 = NULL; */
|
||||
@ -200,19 +200,19 @@ gtk_type_create (GtkType parent_type,
|
||||
new_node->klass = NULL;
|
||||
new_node->children_types = NULL;
|
||||
new_node->mem_chunk = NULL;
|
||||
|
||||
|
||||
if (parent)
|
||||
parent->children_types = g_list_append (parent->children_types, GUINT_TO_POINTER (new_node->type));
|
||||
|
||||
|
||||
parent = new_node;
|
||||
for (i = 0; i < new_node->n_supers + 1; i++)
|
||||
{
|
||||
new_node->supers[i] = parent->type;
|
||||
LOOKUP_TYPE_NODE (parent, parent->parent_type);
|
||||
}
|
||||
|
||||
|
||||
g_hash_table_insert (type_name_2_type_ht, new_node->type_info.type_name, GUINT_TO_POINTER (new_node->type));
|
||||
|
||||
|
||||
return new_node->type;
|
||||
}
|
||||
|
||||
@ -222,22 +222,22 @@ gtk_type_unique (GtkType parent_type,
|
||||
{
|
||||
GtkType new_type;
|
||||
gchar *type_name;
|
||||
|
||||
|
||||
g_return_val_if_fail (type_info != NULL, 0);
|
||||
g_return_val_if_fail (type_info->type_name != NULL, 0);
|
||||
|
||||
if (n_type_nodes == 0)
|
||||
gtk_type_init ();
|
||||
|
||||
|
||||
type_name = g_strdup (type_info->type_name);
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
new_type = gtk_type_create (parent_type, type_name, type_info);
|
||||
|
||||
|
||||
if (!new_type)
|
||||
g_free (type_name);
|
||||
|
||||
|
||||
return new_type;
|
||||
}
|
||||
|
||||
@ -245,12 +245,12 @@ gchar*
|
||||
gtk_type_name (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
|
||||
|
||||
if (node)
|
||||
return node->type_info.type_name;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -262,10 +262,10 @@ gtk_type_from_name (const gchar *name)
|
||||
GtkType type;
|
||||
|
||||
type = GPOINTER_TO_UINT (g_hash_table_lookup (type_name_2_type_ht, (gpointer) name));
|
||||
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -273,11 +273,11 @@ GtkType
|
||||
gtk_type_parent (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
if (node)
|
||||
return node->parent_type;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -285,23 +285,23 @@ gpointer
|
||||
gtk_type_parent_class (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
g_return_val_if_fail (node != NULL, NULL);
|
||||
|
||||
|
||||
if (node)
|
||||
{
|
||||
LOOKUP_TYPE_NODE (node, node->parent_type);
|
||||
|
||||
|
||||
if (node)
|
||||
{
|
||||
if (!node->klass)
|
||||
gtk_type_class_init (node);
|
||||
|
||||
|
||||
return node->klass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -309,13 +309,13 @@ gpointer
|
||||
gtk_type_class (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
g_return_val_if_fail (node != NULL, NULL);
|
||||
|
||||
|
||||
if (!node->klass)
|
||||
gtk_type_class_init (node);
|
||||
|
||||
|
||||
return node->klass;
|
||||
}
|
||||
|
||||
@ -326,10 +326,10 @@ gtk_type_new (GtkType type)
|
||||
GtkObject *object;
|
||||
gpointer klass;
|
||||
guint i;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
g_return_val_if_fail (node != NULL, NULL);
|
||||
|
||||
|
||||
klass = gtk_type_class (type);
|
||||
node->chunk_alloc_locked = TRUE;
|
||||
if (node->mem_chunk)
|
||||
@ -339,7 +339,7 @@ gtk_type_new (GtkType type)
|
||||
}
|
||||
else
|
||||
object = g_malloc0 (node->type_info.object_size);
|
||||
|
||||
|
||||
/* we need to call the base classes' object_init_func for derived
|
||||
* objects with the object's ->klass field still pointing to the
|
||||
* corresponding base class, otherwise overridden class functions
|
||||
@ -348,7 +348,7 @@ gtk_type_new (GtkType type)
|
||||
for (i = node->n_supers; i > 0; i--)
|
||||
{
|
||||
GtkTypeNode *pnode;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (pnode, node->supers[i]);
|
||||
if (pnode->type_info.object_init_func)
|
||||
{
|
||||
@ -359,20 +359,20 @@ gtk_type_new (GtkType type)
|
||||
object->klass = klass;
|
||||
if (node->type_info.object_init_func)
|
||||
node->type_info.object_init_func (object);
|
||||
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_type_free (GtkType type,
|
||||
gpointer mem)
|
||||
gtk_type_free (GtkType type,
|
||||
gpointer mem)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
g_return_if_fail (mem != NULL);
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
|
||||
if (node->mem_chunk)
|
||||
g_mem_chunk_free (node->mem_chunk, mem);
|
||||
else
|
||||
@ -383,11 +383,11 @@ GList*
|
||||
gtk_type_children_types (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
if (node)
|
||||
return node->children_types;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -396,10 +396,10 @@ gtk_type_describe_heritage (GtkType type)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
gboolean first;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
first = TRUE;
|
||||
|
||||
|
||||
while (node)
|
||||
{
|
||||
if (first)
|
||||
@ -407,18 +407,18 @@ gtk_type_describe_heritage (GtkType type)
|
||||
first = FALSE;
|
||||
g_print ("is a ");
|
||||
}
|
||||
|
||||
|
||||
if (node->type_info.type_name)
|
||||
g_print ("%s\n", node->type_info.type_name);
|
||||
else
|
||||
g_print ("<unnamed type>\n");
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, node->parent_type);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_type_describe_tree (GtkType type,
|
||||
gtk_type_describe_tree (GtkType type,
|
||||
gboolean show_size)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
@ -464,7 +464,7 @@ gtk_type_is_a (GtkType type,
|
||||
else
|
||||
{
|
||||
register GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, type);
|
||||
if (node)
|
||||
{
|
||||
@ -490,9 +490,9 @@ gtk_type_class_init (GtkTypeNode *node)
|
||||
GtkObjectClass *object_class;
|
||||
GtkTypeNode *base_node;
|
||||
GSList *slist;
|
||||
|
||||
|
||||
g_assert (node->type_info.class_size >= sizeof (GtkObjectClass));
|
||||
|
||||
|
||||
node->klass = g_malloc0 (node->type_info.class_size);
|
||||
|
||||
if (node->parent_type)
|
||||
@ -506,10 +506,10 @@ gtk_type_class_init (GtkTypeNode *node)
|
||||
if (parent->klass)
|
||||
memcpy (node->klass, parent->klass, parent->type_info.class_size);
|
||||
}
|
||||
|
||||
|
||||
object_class = node->klass;
|
||||
object_class->type = node->type;
|
||||
|
||||
|
||||
/* stack all base class initialization functions, so we
|
||||
* call them in ascending order.
|
||||
*/
|
||||
@ -524,22 +524,17 @@ gtk_type_class_init (GtkTypeNode *node)
|
||||
if (slist)
|
||||
{
|
||||
GSList *walk;
|
||||
|
||||
|
||||
for (walk = slist; walk; walk = walk->next)
|
||||
{
|
||||
register GtkClassInitFunc base_class_init;
|
||||
|
||||
|
||||
base_class_init = walk->data;
|
||||
base_class_init (node->klass);
|
||||
}
|
||||
g_slist_free (slist);
|
||||
}
|
||||
|
||||
/* FIXME: this initialization needs to be done through
|
||||
* a function pointer someday.
|
||||
*/
|
||||
g_assert (node->type_info.class_size >= sizeof (GtkObjectClass));
|
||||
|
||||
if (node->type_info.class_init_func)
|
||||
node->type_info.class_init_func (node->klass);
|
||||
}
|
||||
@ -552,32 +547,32 @@ gtk_type_enum_get_values (GtkType enum_type)
|
||||
GTK_FUNDAMENTAL_TYPE (enum_type) == GTK_TYPE_FLAGS)
|
||||
{
|
||||
GtkTypeNode *node;
|
||||
|
||||
|
||||
LOOKUP_TYPE_NODE (node, enum_type);
|
||||
if (node)
|
||||
return (GtkEnumValue*) node->type_info.reserved_1;
|
||||
}
|
||||
|
||||
|
||||
g_warning ("gtk_type_enum_get_values(): type `%s' is not derived from `enum' or `flags'",
|
||||
gtk_type_name (enum_type));
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkFlagValue*
|
||||
gtk_type_flags_get_values (GtkType flags_type)
|
||||
gtk_type_flags_get_values (GtkType flags_type)
|
||||
{
|
||||
return gtk_type_enum_get_values (flags_type);
|
||||
}
|
||||
|
||||
static inline GtkType
|
||||
gtk_type_register_intern (gchar *name,
|
||||
GtkType parent,
|
||||
gtk_type_register_intern (gchar *name,
|
||||
GtkType parent,
|
||||
GtkEnumValue *values)
|
||||
{
|
||||
GtkType type_id;
|
||||
GtkTypeInfo info;
|
||||
|
||||
|
||||
info.type_name = name;
|
||||
info.object_size = 0;
|
||||
info.class_size = 0;
|
||||
@ -585,28 +580,28 @@ gtk_type_register_intern (gchar *name,
|
||||
info.object_init_func = NULL;
|
||||
info.reserved_1 = values;
|
||||
info.reserved_2 = NULL;
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
type_id = gtk_type_create (parent, name, &info);
|
||||
|
||||
|
||||
if (type_id && values)
|
||||
{
|
||||
guint i;
|
||||
|
||||
|
||||
/* check for proper type consistency and NULL termination
|
||||
* of value array
|
||||
*/
|
||||
g_assert (GTK_FUNDAMENTAL_TYPE (type_id) == GTK_TYPE_ENUM ||
|
||||
GTK_FUNDAMENTAL_TYPE (type_id) == GTK_TYPE_FLAGS);
|
||||
|
||||
|
||||
i = 0;
|
||||
while (values[i].value_name)
|
||||
i++;
|
||||
|
||||
|
||||
g_assert (values[i].value_name == NULL && values[i].value_nick == NULL);
|
||||
}
|
||||
|
||||
|
||||
return type_id;
|
||||
}
|
||||
|
||||
@ -616,39 +611,39 @@ gtk_type_register_enum (const gchar *type_name,
|
||||
{
|
||||
GtkType type_id;
|
||||
gchar *name;
|
||||
|
||||
|
||||
g_return_val_if_fail (type_name != NULL, 0);
|
||||
|
||||
|
||||
name = g_strdup (type_name);
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
type_id = gtk_type_register_intern (name, GTK_TYPE_ENUM, values);
|
||||
|
||||
|
||||
if (!type_id)
|
||||
g_free (name);
|
||||
|
||||
|
||||
return type_id;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gtk_type_register_flags (const gchar *type_name,
|
||||
GtkFlagValue *values)
|
||||
gtk_type_register_flags (const gchar *type_name,
|
||||
GtkFlagValue *values)
|
||||
{
|
||||
GtkType type_id;
|
||||
gchar *name;
|
||||
|
||||
|
||||
g_return_val_if_fail (type_name != NULL, 0);
|
||||
|
||||
|
||||
name = g_strdup (type_name);
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
type_id = gtk_type_register_intern (name, GTK_TYPE_FLAGS, values);
|
||||
|
||||
|
||||
if (!type_id)
|
||||
g_free (name);
|
||||
|
||||
|
||||
return type_id;
|
||||
}
|
||||
|
||||
@ -656,11 +651,11 @@ static guint
|
||||
gtk_type_name_hash (const char *key)
|
||||
{
|
||||
guint result;
|
||||
|
||||
|
||||
result = 0;
|
||||
while (*key)
|
||||
result += (result << 3) + *key++;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -687,13 +682,14 @@ gtk_type_init_builtin_types (void)
|
||||
/* GTK_TYPE_INVALID has typeid 0. The first type id returned by
|
||||
* gtk_type_unique is 1, which is GTK_TYPE_NONE. And so on.
|
||||
*/
|
||||
|
||||
|
||||
struct {
|
||||
GtkType type_id;
|
||||
gchar *name;
|
||||
} fundamental_info[] = {
|
||||
{ GTK_TYPE_NONE, "void" },
|
||||
{ GTK_TYPE_CHAR, "gchar" },
|
||||
{ GTK_TYPE_UCHAR, "guchar" },
|
||||
{ GTK_TYPE_BOOL, "gboolean" },
|
||||
{ GTK_TYPE_INT, "gint" },
|
||||
{ GTK_TYPE_UINT, "guint" },
|
||||
@ -705,13 +701,13 @@ gtk_type_init_builtin_types (void)
|
||||
{ GTK_TYPE_ENUM, "GtkEnum" },
|
||||
{ GTK_TYPE_FLAGS, "GtkFlags" },
|
||||
{ GTK_TYPE_BOXED, "GtkBoxed" },
|
||||
{ GTK_TYPE_FOREIGN, "GtkForeign" },
|
||||
{ GTK_TYPE_CALLBACK, "GtkCallback" },
|
||||
{ GTK_TYPE_ARGS, "GtkArgs" },
|
||||
|
||||
{ GTK_TYPE_POINTER, "gpointer" },
|
||||
|
||||
{ GTK_TYPE_SIGNAL, "GtkSignal" },
|
||||
{ GTK_TYPE_C_CALLBACK, "GtkCCallback" }
|
||||
{ GTK_TYPE_ARGS, "GtkArgs" },
|
||||
{ GTK_TYPE_CALLBACK, "GtkCallback" },
|
||||
{ GTK_TYPE_C_CALLBACK, "GtkCCallback" },
|
||||
{ GTK_TYPE_FOREIGN, "GtkForeign" },
|
||||
};
|
||||
struct {
|
||||
gchar *type_name;
|
||||
@ -727,11 +723,11 @@ gtk_type_init_builtin_types (void)
|
||||
for (i = 0; i < sizeof (fundamental_info) / sizeof (fundamental_info[0]); i++)
|
||||
{
|
||||
GtkType type_id;
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
type_id = gtk_type_register_intern (fundamental_info[i].name, GTK_TYPE_INVALID, NULL);
|
||||
|
||||
|
||||
g_assert (type_id == fundamental_info[i].type_id);
|
||||
}
|
||||
|
||||
@ -740,17 +736,17 @@ gtk_type_init_builtin_types (void)
|
||||
for (i = 0; i < GTK_TYPE_NUM_BUILTINS; i++)
|
||||
{
|
||||
GtkType type_id;
|
||||
|
||||
|
||||
g_assert (builtin_info[i].type_name != NULL);
|
||||
|
||||
|
||||
/* relookup pointers afterwards.
|
||||
*/
|
||||
type_id = gtk_type_register_intern (builtin_info[i].type_name,
|
||||
builtin_info[i].parent,
|
||||
builtin_info[i].values);
|
||||
|
||||
|
||||
g_assert (type_id != GTK_TYPE_INVALID);
|
||||
|
||||
|
||||
(*builtin_info[i].type_id) = type_id;
|
||||
}
|
||||
}
|
||||
@ -759,9 +755,9 @@ GtkType
|
||||
gtk_identifier_get_type (void)
|
||||
{
|
||||
static GtkType identifier_type = 0;
|
||||
|
||||
|
||||
if (!identifier_type)
|
||||
identifier_type = gtk_type_register_intern ("GtkIdentifier", GTK_TYPE_STRING, NULL);
|
||||
|
||||
|
||||
return identifier_type;
|
||||
}
|
||||
|
@ -35,7 +35,10 @@ typedef enum
|
||||
{
|
||||
GTK_TYPE_INVALID,
|
||||
GTK_TYPE_NONE,
|
||||
|
||||
/* flat types */
|
||||
GTK_TYPE_CHAR,
|
||||
GTK_TYPE_UCHAR,
|
||||
GTK_TYPE_BOOL,
|
||||
GTK_TYPE_INT,
|
||||
GTK_TYPE_UINT,
|
||||
@ -47,23 +50,30 @@ typedef enum
|
||||
GTK_TYPE_ENUM,
|
||||
GTK_TYPE_FLAGS,
|
||||
GTK_TYPE_BOXED,
|
||||
GTK_TYPE_FOREIGN,
|
||||
GTK_TYPE_CALLBACK,
|
||||
GTK_TYPE_ARGS,
|
||||
|
||||
GTK_TYPE_POINTER,
|
||||
|
||||
/* It'd be great if GTK_TYPE_POINTER and GTK_TYPE_C_CALLBACK
|
||||
* could be removed eventually
|
||||
*/
|
||||
GTK_TYPE_SIGNAL,
|
||||
GTK_TYPE_C_CALLBACK,
|
||||
|
||||
GTK_TYPE_OBJECT,
|
||||
|
||||
GTK_FUNDAMENTAL_TYPE_LAST
|
||||
/* structured types */
|
||||
GTK_TYPE_SIGNAL,
|
||||
GTK_TYPE_ARGS,
|
||||
GTK_TYPE_CALLBACK,
|
||||
GTK_TYPE_C_CALLBACK,
|
||||
GTK_TYPE_FOREIGN,
|
||||
|
||||
/* base type node of the object system */
|
||||
GTK_TYPE_OBJECT
|
||||
} GtkFundamentalType;
|
||||
|
||||
/* bounds definitions for type sets, these are provided to distinct
|
||||
* between fundamental types with if() statements, and to build
|
||||
* up foreign fundamentals
|
||||
*/
|
||||
#define GTK_TYPE_FLAT_FIRST GTK_TYPE_CHAR
|
||||
#define GTK_TYPE_FLAT_LAST GTK_TYPE_POINTER
|
||||
#define GTK_TYPE_STRUCTURED_FIRST GTK_TYPE_SIGNAL
|
||||
#define GTK_TYPE_STRUCTURED_LAST GTK_TYPE_FOREIGN
|
||||
#define GTK_TYPE_FUNDAMENTAL_LAST GTK_TYPE_OBJECT
|
||||
|
||||
|
||||
typedef guint GtkType;
|
||||
|
||||
/* Builtin Types
|
||||
@ -75,9 +85,9 @@ GtkType gtk_identifier_get_type (void);
|
||||
|
||||
/* Macros
|
||||
*/
|
||||
#define GTK_TYPE_MAKE(parent_t, seqno) (((seqno) << 8) | GTK_FUNDAMENTAL_TYPE (parent_t))
|
||||
#define GTK_TYPE_MAKE(parent_t, seqno) (((seqno) << 8) | GTK_FUNDAMENTAL_TYPE (parent_t))
|
||||
#define GTK_FUNDAMENTAL_TYPE(type) ((GtkFundamentalType) ((type) & 0xFF))
|
||||
#define GTK_TYPE_SEQNO(type) ((type) > 0xFF ? (type) >> 8 : (type))
|
||||
#define GTK_TYPE_SEQNO(type) ((type) > 0xFF ? (type) >> 8 : (type))
|
||||
|
||||
typedef struct _GtkArg GtkArg;
|
||||
typedef struct _GtkObject GtkObject; /* forward declaration of object type */
|
||||
@ -85,27 +95,47 @@ typedef struct _GtkTypeInfo GtkTypeInfo;
|
||||
typedef struct _GtkEnumValue GtkEnumValue;
|
||||
typedef struct _GtkEnumValue GtkFlagValue;
|
||||
|
||||
|
||||
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
|
||||
|
||||
typedef void (*GtkClassInitFunc) (gpointer klass);
|
||||
typedef void (*GtkObjectInitFunc) (gpointer object);
|
||||
typedef void (*GtkArgGetFunc) (GtkObject*, GtkArg*, guint);
|
||||
typedef void (*GtkArgSetFunc) (GtkObject*, GtkArg*, guint);
|
||||
typedef void (*GtkSignalFunc) ();
|
||||
typedef gint (*GtkFunction) (gpointer data);
|
||||
typedef void (*GtkDestroyNotify) (gpointer data);
|
||||
typedef void (*GtkCallbackMarshal) (GtkObject *object,
|
||||
gpointer data,
|
||||
guint n_args,
|
||||
GtkArg *args);
|
||||
typedef void (*GtkDestroyNotify) (gpointer data);
|
||||
typedef void (*GtkSignalMarshaller) (GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer func_data,
|
||||
GtkArg *args);
|
||||
|
||||
|
||||
/* deprecated */
|
||||
typedef void (*GtkArgGetFunc) (GtkObject*, GtkArg*, guint);
|
||||
typedef void (*GtkArgSetFunc) (GtkObject*, GtkArg*, guint);
|
||||
|
||||
|
||||
struct _GtkArg
|
||||
{
|
||||
GtkType type;
|
||||
gchar *name;
|
||||
|
||||
|
||||
/* this union only defines the required storage types for
|
||||
* the possibile values, thus there is no gint enum_data field,
|
||||
* because that would just be a mere alias for gint int_data.
|
||||
* use the GTK_VALUE_*() and GTK_RETLOC_*() macros to access
|
||||
* the discrete memebers.
|
||||
*/
|
||||
union {
|
||||
/* flat values */
|
||||
gchar char_data;
|
||||
guchar uchar_data;
|
||||
gboolean bool_data;
|
||||
gint int_data;
|
||||
guint uint_data;
|
||||
gint bool_data;
|
||||
glong long_data;
|
||||
gulong ulong_data;
|
||||
gfloat float_data;
|
||||
@ -113,31 +143,40 @@ struct _GtkArg
|
||||
gchar *string_data;
|
||||
gpointer pointer_data;
|
||||
GtkObject *object_data;
|
||||
|
||||
/* structured values */
|
||||
struct {
|
||||
GtkSignalFunc f;
|
||||
gpointer d;
|
||||
} signal_data;
|
||||
struct {
|
||||
gint n_args;
|
||||
GtkArg *args;
|
||||
} args_data;
|
||||
struct {
|
||||
GtkCallbackMarshal marshal;
|
||||
gpointer data;
|
||||
GtkDestroyNotify notify;
|
||||
} callback_data;
|
||||
struct {
|
||||
gpointer data;
|
||||
GtkDestroyNotify notify;
|
||||
} foreign_data;
|
||||
struct {
|
||||
gint n_args;
|
||||
GtkArg *args;
|
||||
} args_data;
|
||||
struct {
|
||||
GtkFunction f;
|
||||
gpointer d;
|
||||
} signal_data;
|
||||
struct {
|
||||
GtkFunction func;
|
||||
gpointer func_data;
|
||||
} c_callback_data;
|
||||
struct {
|
||||
gpointer data;
|
||||
GtkDestroyNotify notify;
|
||||
} foreign_data;
|
||||
} d;
|
||||
};
|
||||
|
||||
/* argument value access macros, these must not contain casts,
|
||||
* to allow the usage of these macros in combination with the
|
||||
* adress operator, e.g. >K_VALUE_CHAR (*arg)
|
||||
*/
|
||||
|
||||
/* flat values */
|
||||
#define GTK_VALUE_CHAR(a) ((a).d.char_data)
|
||||
#define GTK_VALUE_UCHAR(a) ((a).d.uchar_data)
|
||||
#define GTK_VALUE_BOOL(a) ((a).d.bool_data)
|
||||
#define GTK_VALUE_INT(a) ((a).d.int_data)
|
||||
#define GTK_VALUE_UINT(a) ((a).d.uint_data)
|
||||
@ -147,30 +186,39 @@ struct _GtkArg
|
||||
#define GTK_VALUE_DOUBLE(a) ((a).d.double_data)
|
||||
#define GTK_VALUE_STRING(a) ((a).d.string_data)
|
||||
#define GTK_VALUE_ENUM(a) ((a).d.int_data)
|
||||
#define GTK_VALUE_FLAGS(a) ((a).d.int_data)
|
||||
#define GTK_VALUE_FLAGS(a) ((a).d.uint_data)
|
||||
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)
|
||||
#define GTK_VALUE_FOREIGN(a) ((a).d.foreign_data)
|
||||
#define GTK_VALUE_CALLBACK(a) ((a).d.callback_data)
|
||||
#define GTK_VALUE_ARGS(a) ((a).d.args_data)
|
||||
#define GTK_VALUE_OBJECT(a) ((a).d.pointer_data)
|
||||
#define GTK_VALUE_POINTER(a) ((a).d.pointer_data)
|
||||
#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data)
|
||||
#define GTK_VALUE_C_CALLBACK(a) ((a).d.c_callback_data)
|
||||
#define GTK_VALUE_OBJECT(a) ((a).d.object_data)
|
||||
|
||||
#define GTK_RETLOC_CHAR(a) ((gchar*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_BOOL(a) ((gint*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_INT(a) ((gint*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_UINT(a) ((guint*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_LONG(a) ((glong*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_ULONG(a) ((gulong*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_FLOAT(a) ((gfloat*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_DOUBLE(a) ((gdouble*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_STRING(a) ((gchar**)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_ENUM(a) ((gint*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_FLAGS(a) ((gint*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_BOXED(a) ((gpointer*)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_OBJECT(a) ((GtkObject**)(a).d.pointer_data)
|
||||
#define GTK_RETLOC_POINTER(a) ((gpointer*)(a).d.pointer_data)
|
||||
/* structured values */
|
||||
#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data)
|
||||
#define GTK_VALUE_ARGS(a) ((a).d.args_data)
|
||||
#define GTK_VALUE_CALLBACK(a) ((a).d.callback_data)
|
||||
#define GTK_VALUE_C_CALLBACK(a) ((a).d.c_callback_data)
|
||||
#define GTK_VALUE_FOREIGN(a) ((a).d.foreign_data)
|
||||
|
||||
/* return location macros, these all narow down to
|
||||
* pointer types, because return values need to be
|
||||
* passed by reference
|
||||
*/
|
||||
|
||||
/* flat values */
|
||||
#define GTK_RETLOC_CHAR(a) ((gchar*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_UCHAR(a) ((guchar*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_BOOL(a) ((gboolean*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_INT(a) ((gint*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_UINT(a) ((guint*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_LONG(a) ((glong*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_ULONG(a) ((gulong*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_FLOAT(a) ((gfloat*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_DOUBLE(a) ((gdouble*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_STRING(a) ((gchar**) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_ENUM(a) ((gint*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_FLAGS(a) ((guint*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_BOXED(a) ((gpointer*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_POINTER(a) ((gpointer*) (a).d.pointer_data)
|
||||
#define GTK_RETLOC_OBJECT(a) ((GtkObject**) (a).d.pointer_data)
|
||||
|
||||
struct _GtkTypeInfo
|
||||
{
|
||||
@ -186,32 +234,32 @@ struct _GtkTypeInfo
|
||||
|
||||
struct _GtkEnumValue
|
||||
{
|
||||
guint value;
|
||||
guint value;
|
||||
gchar *value_name;
|
||||
gchar *value_nick;
|
||||
};
|
||||
|
||||
|
||||
void gtk_type_init (void);
|
||||
GtkType gtk_type_unique (GtkType parent_type,
|
||||
void gtk_type_init (void);
|
||||
GtkType gtk_type_unique (GtkType parent_type,
|
||||
GtkTypeInfo *type_info);
|
||||
void gtk_type_set_chunk_alloc (GtkType type,
|
||||
void gtk_type_set_chunk_alloc (GtkType type,
|
||||
guint n_chunks);
|
||||
gchar* gtk_type_name (guint type);
|
||||
GtkType gtk_type_from_name (const gchar *name);
|
||||
GtkType gtk_type_parent (GtkType type);
|
||||
gpointer gtk_type_class (GtkType type);
|
||||
gpointer gtk_type_parent_class (GtkType type);
|
||||
gchar* gtk_type_name (guint type);
|
||||
GtkType gtk_type_from_name (const gchar *name);
|
||||
GtkType gtk_type_parent (GtkType type);
|
||||
gpointer gtk_type_class (GtkType type);
|
||||
gpointer gtk_type_parent_class (GtkType type);
|
||||
GList* gtk_type_children_types (GtkType type);
|
||||
gpointer gtk_type_new (GtkType type);
|
||||
void gtk_type_free (GtkType type,
|
||||
gpointer gtk_type_new (GtkType type);
|
||||
void gtk_type_free (GtkType type,
|
||||
gpointer mem);
|
||||
void gtk_type_describe_heritage (GtkType type);
|
||||
void gtk_type_describe_tree (GtkType type,
|
||||
void gtk_type_describe_heritage (GtkType type);
|
||||
void gtk_type_describe_tree (GtkType type,
|
||||
gboolean show_size);
|
||||
gint gtk_type_is_a (GtkType type,
|
||||
gint gtk_type_is_a (GtkType type,
|
||||
GtkType is_a_type);
|
||||
GtkType gtk_type_register_enum (const gchar *type_name,
|
||||
GtkType gtk_type_register_enum (const gchar *type_name,
|
||||
GtkEnumValue *values);
|
||||
GtkType gtk_type_register_flags (const gchar *type_name,
|
||||
GtkFlagValue *values);
|
||||
|
@ -2710,10 +2710,21 @@ set_cursor (GtkWidget *spinner,
|
||||
{
|
||||
guint c;
|
||||
GdkCursor *cursor;
|
||||
GtkWidget *label;
|
||||
GtkFlagValue *vals;
|
||||
|
||||
c = CLAMP (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinner)), 0, 152);
|
||||
c &= 0xfe;
|
||||
|
||||
label = gtk_object_get_user_data (GTK_OBJECT (spinner));
|
||||
vals = gtk_type_enum_get_values (GTK_TYPE_GDK_CURSOR_TYPE);
|
||||
while (vals && vals->value != c)
|
||||
vals++;
|
||||
if (vals)
|
||||
gtk_label_set (GTK_LABEL (label), vals->value_nick);
|
||||
else
|
||||
gtk_label_set (GTK_LABEL (label), "<unknown>");
|
||||
|
||||
cursor = gdk_cursor_new (c);
|
||||
gdk_window_set_cursor (widget->window, cursor);
|
||||
gdk_cursor_destroy (cursor);
|
||||
@ -2817,6 +2828,16 @@ create_cursors (void)
|
||||
GTK_SIGNAL_FUNC (set_cursor),
|
||||
darea);
|
||||
|
||||
label = gtk_widget_new (GTK_TYPE_LABEL,
|
||||
"visible", TRUE,
|
||||
"label", "XXX",
|
||||
"parent", vbox,
|
||||
NULL);
|
||||
gtk_container_child_set (GTK_CONTAINER (vbox), label,
|
||||
"expand", FALSE,
|
||||
NULL);
|
||||
gtk_object_set_user_data (GTK_OBJECT (spinner), label);
|
||||
|
||||
any =
|
||||
gtk_widget_new (gtk_hseparator_get_type (),
|
||||
"GtkWidget::visible", TRUE,
|
||||
|
@ -2710,10 +2710,21 @@ set_cursor (GtkWidget *spinner,
|
||||
{
|
||||
guint c;
|
||||
GdkCursor *cursor;
|
||||
GtkWidget *label;
|
||||
GtkFlagValue *vals;
|
||||
|
||||
c = CLAMP (gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spinner)), 0, 152);
|
||||
c &= 0xfe;
|
||||
|
||||
label = gtk_object_get_user_data (GTK_OBJECT (spinner));
|
||||
vals = gtk_type_enum_get_values (GTK_TYPE_GDK_CURSOR_TYPE);
|
||||
while (vals && vals->value != c)
|
||||
vals++;
|
||||
if (vals)
|
||||
gtk_label_set (GTK_LABEL (label), vals->value_nick);
|
||||
else
|
||||
gtk_label_set (GTK_LABEL (label), "<unknown>");
|
||||
|
||||
cursor = gdk_cursor_new (c);
|
||||
gdk_window_set_cursor (widget->window, cursor);
|
||||
gdk_cursor_destroy (cursor);
|
||||
@ -2817,6 +2828,16 @@ create_cursors (void)
|
||||
GTK_SIGNAL_FUNC (set_cursor),
|
||||
darea);
|
||||
|
||||
label = gtk_widget_new (GTK_TYPE_LABEL,
|
||||
"visible", TRUE,
|
||||
"label", "XXX",
|
||||
"parent", vbox,
|
||||
NULL);
|
||||
gtk_container_child_set (GTK_CONTAINER (vbox), label,
|
||||
"expand", FALSE,
|
||||
NULL);
|
||||
gtk_object_set_user_data (GTK_OBJECT (spinner), label);
|
||||
|
||||
any =
|
||||
gtk_widget_new (gtk_hseparator_get_type (),
|
||||
"GtkWidget::visible", TRUE,
|
||||
|
Loading…
Reference in New Issue
Block a user