epoc32/include/stdapis/glib-2.0/gobject/gobject.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 0 061f57f2323e
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /* GObject - GLib Type, Object, Parameter and Signal Library
     2  * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
     3  * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
     4  *
     5  * This library is free software; you can redistribute it and/or
     6  * modify it under the terms of the GNU Lesser General Public
     7  * License as published by the Free Software Foundation; either
     8  * version 2 of the License, or (at your option) any later version.
     9  *
    10  * This library is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  * Lesser General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU Lesser General
    16  * Public License along with this library; if not, write to the
    17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    18  * Boston, MA 02111-1307, USA.
    19  */
    20 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
    21 #error "Only <glib-object.h> can be included directly."
    22 #endif
    23 
    24 #ifndef __G_OBJECT_H__
    25 #define __G_OBJECT_H__
    26 
    27 #include <_ansi.h>
    28 #include        <gobject/gtype.h>
    29 #include        <gobject/gvalue.h>
    30 #include        <gobject/gparam.h>
    31 #include        <gobject/gclosure.h>
    32 #include        <gobject/gsignal.h>
    33 
    34 G_BEGIN_DECLS
    35 
    36 /* --- type macros --- */
    37 #define G_TYPE_IS_OBJECT(type)      (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
    38 #define G_OBJECT(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
    39 #define G_OBJECT_CLASS(class)       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
    40 #define G_IS_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
    41 #define G_IS_OBJECT_CLASS(class)    (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
    42 #define G_OBJECT_GET_CLASS(object)  (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
    43 #define G_OBJECT_TYPE(object)       (G_TYPE_FROM_INSTANCE (object))
    44 #define G_OBJECT_TYPE_NAME(object)  (g_type_name (G_OBJECT_TYPE (object)))
    45 #define G_OBJECT_CLASS_TYPE(class)  (G_TYPE_FROM_CLASS (class))
    46 #define G_OBJECT_CLASS_NAME(class)  (g_type_name (G_OBJECT_CLASS_TYPE (class)))
    47 #define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT))
    48 
    49 /* --- type macros --- */
    50 #define G_TYPE_INITIALLY_UNOWNED	      (g_initially_unowned_get_type())
    51 #define G_INITIALLY_UNOWNED(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned))
    52 #define G_INITIALLY_UNOWNED_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass))
    53 #define G_IS_INITIALLY_UNOWNED(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_INITIALLY_UNOWNED))
    54 #define G_IS_INITIALLY_UNOWNED_CLASS(class)   (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_INITIALLY_UNOWNED))
    55 #define G_INITIALLY_UNOWNED_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass))
    56 /* GInitiallyUnowned ia a GObject with initially floating reference count */
    57 
    58 
    59 /* --- typedefs & structures --- */
    60 typedef struct _GObject                  GObject;
    61 typedef struct _GObjectClass             GObjectClass;
    62 typedef struct _GObject                  GInitiallyUnowned;
    63 typedef struct _GObjectClass             GInitiallyUnownedClass;
    64 typedef struct _GObjectConstructParam    GObjectConstructParam;
    65 typedef void (*GObjectGetPropertyFunc)  (GObject      *object,
    66                                          guint         property_id,
    67                                          GValue       *value,
    68                                          GParamSpec   *pspec);
    69 typedef void (*GObjectSetPropertyFunc)  (GObject      *object,
    70                                          guint         property_id,
    71                                          const GValue *value,
    72                                          GParamSpec   *pspec);
    73 typedef void (*GObjectFinalizeFunc)     (GObject      *object);
    74 typedef void (*GWeakNotify)		(gpointer      data,
    75 					 GObject      *where_the_object_was);
    76 struct  _GObject
    77 {
    78   GTypeInstance  g_type_instance;
    79   
    80   /*< private >*/
    81   volatile guint ref_count;
    82   GData         *qdata;
    83 };
    84 struct  _GObjectClass
    85 {
    86   GTypeClass   g_type_class;
    87 
    88   /*< private >*/
    89   GSList      *construct_properties;
    90 
    91   /*< public >*/
    92   /* overridable methods */
    93   GObject*   (*constructor)     (GType                  type,
    94                                  guint                  n_construct_properties,
    95                                  GObjectConstructParam *construct_properties);
    96   void       (*set_property)		(GObject        *object,
    97                                          guint           property_id,
    98                                          const GValue   *value,
    99                                          GParamSpec     *pspec);
   100   void       (*get_property)		(GObject        *object,
   101                                          guint           property_id,
   102                                          GValue         *value,
   103                                          GParamSpec     *pspec);
   104   void       (*dispose)			(GObject        *object);
   105   void       (*finalize)		(GObject        *object);
   106   
   107   /* seldomly overidden */
   108   void       (*dispatch_properties_changed) (GObject      *object,
   109 					     guint	   n_pspecs,
   110 					     GParamSpec  **pspecs);
   111 
   112   /* signals */
   113   void	     (*notify)			(GObject	*object,
   114 					 GParamSpec	*pspec);
   115   /*< private >*/
   116   /* padding */
   117   gpointer	pdummy[8];
   118 };
   119 struct _GObjectConstructParam
   120 {
   121   GParamSpec *pspec;
   122   GValue     *value;
   123 };
   124 
   125 
   126 /* --- prototypes --- */
   127 IMPORT_C GType       g_initially_unowned_get_type      (void);
   128 IMPORT_C void        g_object_class_install_property   (GObjectClass   *oclass,
   129 					       guint           property_id,
   130 					       GParamSpec     *pspec);
   131 IMPORT_C GParamSpec* g_object_class_find_property      (GObjectClass   *oclass,
   132 					       const gchar    *property_name);
   133 IMPORT_C GParamSpec**g_object_class_list_properties    (GObjectClass   *oclass,
   134 					       guint	      *n_properties);
   135 IMPORT_C void        g_object_class_override_property  (GObjectClass   *oclass,
   136 					       guint           property_id,
   137 					       const gchar    *name);
   138 
   139 IMPORT_C void        g_object_interface_install_property (gpointer     g_iface,
   140 						 GParamSpec  *pspec);
   141 IMPORT_C GParamSpec* g_object_interface_find_property    (gpointer     g_iface,
   142 						 const gchar *property_name);
   143 IMPORT_C GParamSpec**g_object_interface_list_properties  (gpointer     g_iface,
   144 						 guint       *n_properties_p);
   145 
   146 IMPORT_C gpointer    g_object_new                      (GType           object_type,
   147 					       const gchar    *first_property_name,
   148 					       ...);
   149 IMPORT_C gpointer    g_object_newv		      (GType           object_type,
   150 					       guint	       n_parameters,
   151 					       GParameter     *parameters);
   152 IMPORT_C GObject*    g_object_new_valist               (GType           object_type,
   153 					       const gchar    *first_property_name,
   154 					       va_list         var_args);
   155 IMPORT_C void	    g_object_set                      (gpointer	       object,
   156 					       const gchar    *first_property_name,
   157 					       ...) G_GNUC_NULL_TERMINATED;
   158 IMPORT_C void        g_object_get                      (gpointer        object,
   159 					       const gchar    *first_property_name,
   160 					       ...) G_GNUC_NULL_TERMINATED;
   161 IMPORT_C gpointer    g_object_connect                  (gpointer	       object,
   162 					       const gchar    *signal_spec,
   163 					       ...) G_GNUC_NULL_TERMINATED;
   164 IMPORT_C void	    g_object_disconnect               (gpointer	       object,
   165 					       const gchar    *signal_spec,
   166 					       ...) G_GNUC_NULL_TERMINATED;
   167 IMPORT_C void        g_object_set_valist               (GObject        *object,
   168 					       const gchar    *first_property_name,
   169 					       va_list         var_args);
   170 IMPORT_C void        g_object_get_valist               (GObject        *object,
   171 					       const gchar    *first_property_name,
   172 					       va_list         var_args);
   173 IMPORT_C void        g_object_set_property             (GObject        *object,
   174 					       const gchar    *property_name,
   175 					       const GValue   *value);
   176 IMPORT_C void        g_object_get_property             (GObject        *object,
   177 					       const gchar    *property_name,
   178 					       GValue         *value);
   179 IMPORT_C void        g_object_freeze_notify            (GObject        *object);
   180 IMPORT_C void        g_object_notify                   (GObject        *object,
   181 					       const gchar    *property_name);
   182 IMPORT_C void        g_object_thaw_notify              (GObject        *object);
   183 IMPORT_C gboolean    g_object_is_floating    	      (gpointer        object);
   184 IMPORT_C gpointer    g_object_ref_sink       	      (gpointer	       object);
   185 IMPORT_C gpointer    g_object_ref                      (gpointer        object);
   186 IMPORT_C void        g_object_unref                    (gpointer        object);
   187 IMPORT_C void	    g_object_weak_ref		      (GObject	      *object,
   188 					       GWeakNotify     notify,
   189 					       gpointer	       data);
   190 IMPORT_C void	    g_object_weak_unref		      (GObject	      *object,
   191 					       GWeakNotify     notify,
   192 					       gpointer	       data);
   193 IMPORT_C void        g_object_add_weak_pointer         (GObject        *object, 
   194                                                gpointer       *weak_pointer_location);
   195 IMPORT_C void        g_object_remove_weak_pointer      (GObject        *object, 
   196                                                gpointer       *weak_pointer_location);
   197 
   198 typedef void (*GToggleNotify) (gpointer      data,
   199 			       GObject      *object,
   200 			       gboolean      is_last_ref);
   201 
   202 IMPORT_C void g_object_add_toggle_ref    (GObject       *object,
   203 				 GToggleNotify  notify,
   204 				 gpointer       data);
   205 IMPORT_C void g_object_remove_toggle_ref (GObject       *object,
   206 				 GToggleNotify  notify,
   207 				 gpointer       data);
   208 
   209 IMPORT_C gpointer    g_object_get_qdata                (GObject        *object,
   210 					       GQuark          quark);
   211 IMPORT_C void        g_object_set_qdata                (GObject        *object,
   212 					       GQuark          quark,
   213 					       gpointer        data);
   214 IMPORT_C void        g_object_set_qdata_full           (GObject        *object,
   215 					       GQuark          quark,
   216 					       gpointer        data,
   217 					       GDestroyNotify  destroy);
   218 IMPORT_C gpointer    g_object_steal_qdata              (GObject        *object,
   219 					       GQuark          quark);
   220 IMPORT_C gpointer    g_object_get_data                 (GObject        *object,
   221 					       const gchar    *key);
   222 IMPORT_C void        g_object_set_data                 (GObject        *object,
   223 					       const gchar    *key,
   224 					       gpointer        data);
   225 IMPORT_C void        g_object_set_data_full            (GObject        *object,
   226 					       const gchar    *key,
   227 					       gpointer        data,
   228 					       GDestroyNotify  destroy);
   229 IMPORT_C gpointer    g_object_steal_data               (GObject        *object,
   230 					       const gchar    *key);
   231 IMPORT_C void        g_object_watch_closure            (GObject        *object,
   232 					       GClosure       *closure);
   233 IMPORT_C GClosure*   g_cclosure_new_object             (GCallback       callback_func,
   234 					       GObject	      *object);
   235 IMPORT_C GClosure*   g_cclosure_new_object_swap        (GCallback       callback_func,
   236 					       GObject	      *object);
   237 IMPORT_C GClosure*   g_closure_new_object              (guint           sizeof_closure,
   238 					       GObject        *object);
   239 IMPORT_C void        g_value_set_object                (GValue         *value,
   240 					       gpointer        v_object);
   241 IMPORT_C gpointer    g_value_get_object                (const GValue   *value);
   242 IMPORT_C GObject*    g_value_dup_object                (const GValue   *value);
   243 IMPORT_C gulong	    g_signal_connect_object           (gpointer	       instance,
   244 					       const gchar    *detailed_signal,
   245 					       GCallback       c_handler,
   246 					       gpointer	       gobject,
   247 					       GConnectFlags   connect_flags);
   248 
   249 
   250 /*< protected >*/
   251 IMPORT_C void        g_object_force_floating           (GObject        *object);
   252 IMPORT_C void        g_object_run_dispose	      (GObject	      *object);
   253 
   254 
   255 IMPORT_C void        g_value_take_object               (GValue         *value,
   256 					       gpointer        v_object);
   257 #ifndef G_DISABLE_DEPRECATED
   258 IMPORT_C void        g_value_set_object_take_ownership (GValue         *value,
   259 					       gpointer        v_object);
   260 #endif
   261 
   262 #if !defined(G_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
   263 gsize	    g_object_compat_control	      (gsize	       what,
   264 					       gpointer	       data);
   265 #endif
   266 
   267 /* --- implementation macros --- */
   268 #define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \
   269 G_STMT_START { \
   270   GObject *_object = (GObject*) (object); \
   271   GParamSpec *_pspec = (GParamSpec*) (pspec); \
   272   guint _property_id = (property_id); \
   273   g_warning ("%s: invalid %s id %u for \"%s\" of type `%s' in `%s'", \
   274              G_STRLOC, \
   275              (pname), \
   276              _property_id, \
   277              _pspec->name, \
   278              g_type_name (G_PARAM_SPEC_TYPE (_pspec)), \
   279              G_OBJECT_TYPE_NAME (_object)); \
   280 } G_STMT_END
   281 #define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \
   282     G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
   283 
   284 G_END_DECLS
   285 
   286 #endif /* __G_OBJECT_H__ */