Details
GtkType
GtkType is unique integer identifying the type. The guts of the
information about the type is held in a private struct named
GtkTypeNode.
enum GtkFundamentalType
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,
GTK_TYPE_LONG,
GTK_TYPE_ULONG,
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_TYPE_STRING,
GTK_TYPE_ENUM,
GTK_TYPE_FLAGS,
GTK_TYPE_BOXED,
GTK_TYPE_POINTER,
/* 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; |
GtkFundamentalType is an enumerated type which lists all the possible
fundamental types (e.g. char, uchar, int, long, float, etc).
GTK_TYPE_NUM_BUILTINS
#define GTK_TYPE_NUM_BUILTINS (121) |
No idea.
GTK_TYPE_FLAT_FIRST
#define GTK_TYPE_FLAT_FIRST GTK_TYPE_CHAR |
The first "flat" (no struct) enumerated type value.
GTK_TYPE_FLAT_LAST
#define GTK_TYPE_FLAT_LAST GTK_TYPE_POINTER |
The last "flat" (no struct) enumerated type value.
GTK_TYPE_STRUCTURED_FIRST
#define GTK_TYPE_STRUCTURED_FIRST GTK_TYPE_SIGNAL |
The first structured enumerated type value.
GTK_TYPE_STRUCTURED_LAST
#define GTK_TYPE_STRUCTURED_LAST GTK_TYPE_FOREIGN |
The last structured enumerated type value.
GTK_TYPE_FUNDAMENTAL_LAST
#define GTK_TYPE_FUNDAMENTAL_LAST GTK_TYPE_OBJECT |
The highest-numbered structured or flat enumerated type value.
GTK_TYPE_FUNDAMENTAL_MAX
#define GTK_TYPE_FUNDAMENTAL_MAX (32) |
The highest maximum fundamental enumerated type value.
GTK_STRUCT_OFFSET()
#define GTK_STRUCT_OFFSET(struct, field) |
Use in place of offsetof(), which is used if it exists.
GTK_CHECK_CAST()
#define GTK_CHECK_CAST(tobj, cast_type, cast) |
Cast the object in tobj into cast. If GTK_NO_CHECK_CASTS is
defined, just cast it. Otherwise, check to see if we can cast tobj
into a cast.
GTK_CHECK_CLASS_CAST()
#define GTK_CHECK_CLASS_CAST(tclass,cast_type,cast) |
Cast the object in tobj into cast. If GTK_NO_CHECK_CASTS is
defined, just cast it. Otherwise, check to see if we can cast tobj
into a cast.
GTK_CHECK_TYPE()
#define GTK_CHECK_TYPE(type_object, otype) |
Determines whether type_object is a type of otype.
GTK_CHECK_CLASS_TYPE()
#define GTK_CHECK_CLASS_TYPE(type_class, otype) |
Determines whether type_class is a type of otype.
GTK_TYPE_IDENTIFIER
#define GTK_TYPE_IDENTIFIER (gtk_identifier_get_type ()) |
Hide the name of gtk_identifier_get_type
gtk_identifier_get_type ()
GtkType gtk_identifier_get_type (void); |
Get the type of GtkIdentifier.
GTK_TYPE_MAKE()
#define GTK_TYPE_MAKE(parent_t, seqno) (((seqno) << 8) | GTK_FUNDAMENTAL_TYPE (parent_t)) |
Combine a fundemantal type and a sequence number to create a gtk type.
GTK_FUNDAMENTAL_TYPE()
#define GTK_FUNDAMENTAL_TYPE(type) ((GtkFundamentalType) ((type) & 0xFF)) |
Convert a gtk type into a fundamental type
GTK_TYPE_SEQNO()
#define GTK_TYPE_SEQNO(type) ((type) > 0xFF ? (type) >> 8 : (type)) |
Convert a gtk type into its sequence number
GTK_SIGNAL_FUNC()
#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f) |
Just a macroized cast into a GtkSignalFunc
GtkClassInitFunc ()
void (*GtkClassInitFunc) (gpointer klass); |
Define a function pointer.
GtkObjectInitFunc ()
Define a function pointer.
GtkSignalFunc ()
void (*GtkSignalFunc) (); |
Define a function pointer.
GtkFunction ()
Define a function pointer.
GtkDestroyNotify ()
void (*GtkDestroyNotify) (gpointer data); |
Define a function pointer.
GtkCallbackMarshal ()
Define a function pointer.
GtkSignalMarshaller ()
Define a function pointer.
GtkArgGetFunc ()
Define a function pointer. Deprecated.
GtkArgSetFunc ()
Define a function pointer. Deprecated.
struct GtkTypeObject
struct GtkTypeObject
{
/* A pointer to the objects class. This will actually point to
* the derived objects class struct (which will be derived from
* GtkTypeClass).
*/
GtkTypeClass *klass;
}; |
A GtkTypeObject defines the minimum structure requirements
for type instances. Type instances returned from gtk_type_new()
and initialized through a GtkObjectInitFunc need to directly inherit
from this structure or at least copy its fields one by one.
struct GtkArg
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;
glong long_data;
gulong ulong_data;
gfloat float_data;
gdouble double_data;
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 {
GtkFunction func;
gpointer func_data;
} c_callback_data;
struct {
gpointer data;
GtkDestroyNotify notify;
} foreign_data;
} d;
}; |
This is a structure that we use to pass in typed values (and names).
GTK_VALUE_CHAR()
#define GTK_VALUE_CHAR(a) ((a).d.char_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_CHAR
GTK_VALUE_UCHAR()
#define GTK_VALUE_UCHAR(a) ((a).d.uchar_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_UCHAR
GTK_VALUE_BOOL()
#define GTK_VALUE_BOOL(a) ((a).d.bool_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_BOOL
GTK_VALUE_INT()
#define GTK_VALUE_INT(a) ((a).d.int_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_INT
GTK_VALUE_UINT()
#define GTK_VALUE_UINT(a) ((a).d.uint_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_UINT
GTK_VALUE_LONG()
#define GTK_VALUE_LONG(a) ((a).d.long_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_LONG
GTK_VALUE_ULONG()
#define GTK_VALUE_ULONG(a) ((a).d.ulong_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ULONG
GTK_VALUE_FLOAT()
#define GTK_VALUE_FLOAT(a) ((a).d.float_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_FLOAT
GTK_VALUE_DOUBLE()
#define GTK_VALUE_DOUBLE(a) ((a).d.double_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_DOUBLE
GTK_VALUE_STRING()
#define GTK_VALUE_STRING(a) ((a).d.string_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_STRING
GTK_VALUE_ENUM()
#define GTK_VALUE_ENUM(a) ((a).d.int_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ENUM
GTK_VALUE_FLAGS()
#define GTK_VALUE_FLAGS(a) ((a).d.uint_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_FLAGS
GTK_VALUE_BOXED()
#define GTK_VALUE_BOXED(a) ((a).d.pointer_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_BOXED
GTK_VALUE_POINTER()
#define GTK_VALUE_POINTER(a) ((a).d.pointer_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_POINTER
GTK_VALUE_OBJECT()
#define GTK_VALUE_OBJECT(a) ((a).d.object_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_OBJECT
GTK_VALUE_SIGNAL()
#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_SIGNAL
GTK_VALUE_ARGS()
#define GTK_VALUE_ARGS(a) ((a).d.args_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_ARGS
GTK_VALUE_CALLBACK()
#define GTK_VALUE_CALLBACK(a) ((a).d.callback_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_CALLBACK
GTK_VALUE_C_CALLBACK()
#define GTK_VALUE_C_CALLBACK(a) ((a).d.c_callback_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_CALLBACK
GTK_VALUE_FOREIGN()
#define GTK_VALUE_FOREIGN(a) ((a).d.foreign_data) |
Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_FOREIGN
GTK_RETLOC_CHAR()
#define GTK_RETLOC_CHAR(a) ((gchar*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_CHAR
GTK_RETLOC_UCHAR()
#define GTK_RETLOC_UCHAR(a) ((guchar*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_UCHAR
GTK_RETLOC_BOOL()
#define GTK_RETLOC_BOOL(a) ((gboolean*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_BOOL
GTK_RETLOC_INT()
#define GTK_RETLOC_INT(a) ((gint*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_INT
GTK_RETLOC_UINT()
#define GTK_RETLOC_UINT(a) ((guint*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_UINT
GTK_RETLOC_LONG()
#define GTK_RETLOC_LONG(a) ((glong*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_LONG
GTK_RETLOC_ULONG()
#define GTK_RETLOC_ULONG(a) ((gulong*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_ULONG
GTK_RETLOC_FLOAT()
#define GTK_RETLOC_FLOAT(a) ((gfloat*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_FLOAT
GTK_RETLOC_DOUBLE()
#define GTK_RETLOC_DOUBLE(a) ((gdouble*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_DOUBLE
GTK_RETLOC_STRING()
#define GTK_RETLOC_STRING(a) ((gchar**) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_STRING
GTK_RETLOC_ENUM()
#define GTK_RETLOC_ENUM(a) ((gint*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_ENUM
GTK_RETLOC_FLAGS()
#define GTK_RETLOC_FLAGS(a) ((guint*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_FLAGS
GTK_RETLOC_BOXED()
#define GTK_RETLOC_BOXED(a) ((gpointer*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_BOXED
GTK_RETLOC_POINTER()
#define GTK_RETLOC_POINTER(a) ((gpointer*) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_POINTER
GTK_RETLOC_OBJECT()
#define GTK_RETLOC_OBJECT(a) ((GtkObject**) (a).d.pointer_data) |
If the GtkArg contains a pointer to the value, this macro will be a pointer to a GTK_TYPE_OBJECT
struct GtkTypeInfo
struct GtkTypeInfo
{
gchar *type_name;
guint object_size;
guint class_size;
GtkClassInitFunc class_init_func;
GtkObjectInitFunc object_init_func;
gpointer reserved_1;
gpointer reserved_2;
GtkClassInitFunc base_class_init_func;
}; |
Holds information about the type. gtk_type_name returns the name.
object_size is somehow set to the number of bytes that an instance of
the object will occupy. class_init_func holds the type's
initialization function. object_init_func holds the initialization
function for an instance of the object. reserved_1 is used for
GtkEnumValue to hold the enumerated values.
struct GtkTypeQuery
struct GtkTypeQuery
{
GtkType type;
const gchar *type_name;
guint object_size;
guint class_size;
}; |
A structure used to return values from gtk_type_query.
struct GtkTypeClass
The base structure for a Gtk Type. Every type inherits this as a base structure.
struct GtkEnumValue
struct GtkEnumValue
{
guint value;
gchar *value_name;
gchar *value_nick;
}; |
A structure which contains a single enum value, and its name, and it's
nickname.
gtk_type_init ()
void gtk_type_init (void); |
Initialize the data structures associated with gtk types.
gtk_type_unique ()
Create a new, unique type.
gtk_type_set_chunk_alloc ()
void gtk_type_set_chunk_alloc (GtkType type,
guint n_chunks); |
Set the mem_chunk size so it will hold n_chunks of the objects of that type.
gtk_type_from_name ()
Get the internal representation of a type given its name.
gtk_type_class ()
Return a gpointer pointing to the class of type or NULL if there was
any trouble identifying type. Initialize the class if necessary.
gtk_type_parent_class ()
Return the class of the parent. Initialize the class if necessary.
Return NULL if anything goes wrong.
gtk_type_children_types ()
Return the pointer to the type's children's types.
gtk_type_new ()
Create a new object of a given type, and return a gpointer to it.
Returns NULL if you give it an invalid type. It allocates the object
out of the type's memory chunk if there is a memory chunk. The object
has all the proper initializers called.
gtk_type_free ()
Given the type of an object and a pointer to it, the object is freed.
gtk_type_describe_heritage ()
void gtk_type_describe_heritage (GtkType type); |
Print the types type inherits from.
gtk_type_describe_tree ()
Given a type, describe all of its children, and their children. Only
show the size if show_size is true.
gtk_type_is_a ()
Look in the type hierarchy to see if type has is_a_type among its
ancestors. Do so with a simple lookup, not a loop.
gtk_type_check_object_cast ()
Given a pointer to a GtkTypeObject type_object, and a GtkType cast_type,
make sure that it's okay to cast type_object into a cast_type.
gtk_type_check_class_cast ()
Given a GtkTypeClass pointer klass, and a GtkType cast_type, make
sure that it's okay to cast something of that klass into a cast_type.
gtk_type_register_enum ()
Register a new set of enum values and give them the name in
type_name.
gtk_type_register_flags ()
GtkType gtk_type_register_flags (const gchar *type_name,
GtkFlagValue *values); |
Register a new set of flags values and give them the name in
type_name.
gtk_type_enum_get_values ()
If enum_type has values, then return a pointer to all of them.
gtk_type_flags_get_values ()
GtkFlagValue* gtk_type_flags_get_values (GtkType flags_type); |
If flags_type has values, then return a pointer to all of them.
gtk_type_enum_find_value ()
Return a pointer to one of enum_type's GtkEnumValues's whose name (or nickname) matches value_name.
gtk_type_flags_find_value ()
GtkFlagValue* gtk_type_flags_find_value (GtkType flag_type,
const gchar *value_name); |
Return a pointer to one of flag_type's GtkFlagValue's whose name (or nickname) matches value_name.
gtk_type_set_varargs_type ()
void gtk_type_set_varargs_type (GtkType foreign_type,
GtkType varargs_type); |
Set the varargs type for a fundamental type foreign_type.
gtk_type_get_varargs_type ()
Get the varargs type associated with foreign_type
gtk_type_query ()
Given a type, return various interesting parameters of the type.