Types

Types — Handle run-time type creation

Synopsis

#include <gtk/gtk.h>

gboolean            (*GtkFunction)                      (gpointer data);
void                (*GtkCallbackMarshal)               (GtkObject *object,
                                                         gpointer data,
                                                         guint n_args,
                                                         GtkArg *args);
                    GtkArg;

Description

The GTK+ type system is extensible. Because of that, types have to be managed at runtime.

Details

GtkFunction ()

gboolean            (*GtkFunction)                      (gpointer data);

Defines a function pointer.

data :

gpointer

Returns :

gint

GtkCallbackMarshal ()

void                (*GtkCallbackMarshal)               (GtkObject *object,
                                                         gpointer data,
                                                         guint n_args,
                                                         GtkArg *args);

Defines a function pointer.

object :

GtkObject*

data :

gpointer

n_args :

guint

args :

GtkArg*

GtkArg

typedef struct {
  GType 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;
    GtkObject *object_data;
    gpointer pointer_data;

    /* structured values */
    struct {
      GCallback f;
      gpointer d;
    } signal_data;
  } d;
} GtkArg;

This is a structure that we use to pass in typed values (and names).