#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif

#ifndef __G_PROPERTY_H__
#define __G_PROPERTY_H__

#include <glib.h>
#include <gobject/gparam.h>
#include <gobject/gobject.h>

G_BEGIN_DECLS

#define G_TYPE_PROPERTY         (g_property_get_type ())
#define G_PROPERTY(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_PROPERTY, GProperty))
#define G_IS_PROPERTY(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_PROPERTY))

typedef struct _GProperty       GProperty;

/* general purpose API */
gchar *         g_property_canonicalize         (const gchar         *name);

void            g_property_set_static_nick      (GProperty           *property,
                                                 const gchar         *nick);
void            g_property_set_static_blurb     (GProperty           *property,
                                                 const gchar         *blurb);

void            g_property_set_range            (GProperty           *property,
                                                 ...);
void            g_property_set_range_values     (GProperty           *property,
                                                 const GValue        *min_value,
                                                 const GValue        *max_value);
void            g_property_set_default          (GProperty           *property,
                                                 ...);
void            g_property_set_default_value    (GProperty           *property,
                                                 const GValue        *value);

void            g_property_set_prerequisite     (GProperty           *property,
                                                 GType                gtype);

GType           g_property_get_value_type       (GProperty           *property);

void            g_property_invoke_set           (GProperty           *property,
                                                 GObject             *gobject,
                                                 const GValue        *value);
void            g_property_invoke_get           (GProperty           *property,
                                                 GObject             *gobject,
                                                 GValue              *value);

/* per-type specific accessors */
typedef void          (* GPropertyBooleanSet) (gpointer       gobject,
                                               gboolean       value);
typedef gboolean      (* GPropertyBooleanGet) (gpointer       gobject);

typedef void          (* GPropertyIntSet)     (gpointer       gobject,
                                               gint           value);
typedef gint          (* GPropertyIntGet)     (gpointer       gobject);

typedef void          (* GPropertyInt8Set)    (gpointer       gobject,
                                               gint8          value);
typedef gint8         (* GPropertyInt8Get)    (gpointer       gobject);

typedef void          (* GPropertyInt16Set)   (gpointer       gobject,
                                               gint16         value);
typedef gint16        (* GPropertyInt16Get)   (gpointer       gobject);

typedef void          (* GPropertyInt32Set)   (gpointer       gobject,
                                               gint32         value);
typedef gint32        (* GPropertyInt32Get)   (gpointer       gobject);

typedef void          (* GPropertyInt64Set)   (gpointer       gobject,
                                               gint64         value);
typedef gint64        (* GPropertyInt64Get)   (gpointer       gobject);

typedef void          (* GPropertyLongSet)    (gpointer       gobject,
                                               glong          value);
typedef glong         (* GPropertyLongGet)    (gpointer       gobject);

typedef void          (* GPropertyUIntSet)    (gpointer       gobject,
                                               guint          value);
typedef guint         (* GPropertyUIntGet)    (gpointer       gobject);

typedef void          (* GPropertyUInt8Set)   (gpointer       gobject,
                                               guint8         value);
typedef guint8        (* GPropertyUInt8Get)   (gpointer       gobject);

typedef void          (* GPropertyUInt16Set)  (gpointer       gobject,
                                               guint16        value);
typedef guint16       (* GPropertyUInt16Get)  (gpointer       gobject);

typedef void          (* GPropertyUInt32Set)  (gpointer       gobject,
                                               guint32        value);
typedef guint32       (* GPropertyUInt32Get)  (gpointer       gobject);

typedef void          (* GPropertyUInt64Set)  (gpointer       gobject,
                                               guint64        value);
typedef guint64       (* GPropertyUInt64Get)  (gpointer       gobject);

typedef void          (* GPropertyULongSet)   (gpointer       gobject,
                                               gulong         value);
typedef gulong        (* GPropertyULongGet)   (gpointer       gobject);

typedef void          (* GPropertyEnumSet)    (gpointer       gobject,
                                               glong          value);
typedef glong         (* GPropertyEnumGet)    (gpointer       gobject);

typedef void          (* GPropertyFlagsSet)   (gpointer       gobject,
                                               glong          value);
typedef glong         (* GPropertyFlagsGet)   (gpointer       gobject);

typedef void          (* GPropertyStringSet)  (gpointer       gobject,
                                               const gchar   *value);
typedef const gchar * (* GPropertyStringGet)  (gpointer       gobject);

typedef void          (* GPropertyBoxedSet)   (gpointer       gobject,
                                               gconstpointer  value);
typedef void          (* GPropertyBoxedGet)   (gpointer       gobject,
                                               gpointer       out_value);

typedef void          (* GPropertyObjectSet)  (gpointer       gobject,
                                               gpointer       value);
typedef gpointer      (* GPropertyObjectGet)  (gpointer       gobject);

typedef void          (* GPropertyPointerSet) (gpointer       gobject,
                                               gpointer       value);
typedef gpointer      (* GPropertyPointerGet) (gpointer       gobject);

/**
 * GPropertyFlags:
 * @G_PROPERTY_READABLE: Whether the property is readable
 * @G_PROPERTY_WRITABLE: Whether the property is writable
 * @G_PROPERTY_READWRITE: Whether the property is readable and writable
 * @G_PROPERTY_CONSTRUCT: Whether the property is used at construction time;
 *   requires %G_PROPERTY_WRITABLE
 * @G_PROPERTY_CONSTRUCT_ONLY: Whether the property is used only at
 *   construction time; requires %G_PROPERTY_WRITABLE
 * @G_PROPERTY_NO_ACCESSORS: Whether the property does not have public
 *   accessor functions, and directly modifies a field of the either the
 *   public or the private instance structure
 * @G_PROPERTY_PUBLIC_FIELD: Whether the property updates a member of the
 *   public instance structure
 * @G_PROPERTY_PRIVATE_FIELD: Whether the property updates a member of the
 *   private instance data structure
 * @G_PROPERTY_DEPRECATED: Whether the property is deprecated and should
 *   not be accessed in newly written code
 * @G_PROPERTY_ATOMIC: Whether the autogenerated setter function should
 *   be thread-safe, and acquire a lock when changing the value of the
 *   property.
 *
 * Flags for properties declared using #GProperty and relative macros.
 *
 * This enumeration might be extended at later date.
 *
 * Since: 2.32
 */
typedef enum {
  G_PROPERTY_READABLE       = 1 << 0,
  G_PROPERTY_WRITABLE       = 1 << 1,
  G_PROPERTY_READWRITE      = (G_PROPERTY_READABLE | G_PROPERTY_WRITABLE),

  G_PROPERTY_CONSTRUCT      = 1 << 2,
  G_PROPERTY_CONSTRUCT_ONLY = 1 << 3,

  G_PROPERTY_NO_ACCESSORS   = 1 << 4,
  G_PROPERTY_PUBLIC_FIELD   = 1 << 5,
  G_PROPERTY_PRIVATE_FIELD  = 1 << 6,

  G_PROPERTY_DEPRECATED     = 1 << 7,
  G_PROPERTY_ATOMIC         = 1 << 8
} GPropertyFlags;

/* per-type specific constructors */
GParamSpec *    g_boolean_property_new  (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyBooleanSet  setter,
                                         GPropertyBooleanGet  getter);

GParamSpec *    g_int_property_new      (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyIntSet      setter,
                                         GPropertyIntGet      getter);
GParamSpec *    g_int8_property_new     (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyInt8Set     setter,
                                         GPropertyInt8Get     getter);
GParamSpec *    g_int16_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyInt16Set    setter,
                                         GPropertyInt16Get    getter);
GParamSpec *    g_int32_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyInt32Set    setter,
                                         GPropertyInt32Get    getter);
GParamSpec *    g_int64_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyInt64Set    setter,
                                         GPropertyInt64Get    getter);
GParamSpec *    g_long_property_new     (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyLongSet     setter,
                                         GPropertyLongGet     getter);

GParamSpec *    g_uint_property_new     (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyUIntSet     setter,
                                         GPropertyUIntGet     getter);
GParamSpec *    g_uint8_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyUInt8Set    setter,
                                         GPropertyUInt8Get    getter);
GParamSpec *    g_uint16_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyUInt16Set   setter,
                                         GPropertyUInt16Get   getter);
GParamSpec *    g_uint32_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyUInt32Set   setter,
                                         GPropertyUInt32Get   getter);
GParamSpec *    g_uint64_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyUInt64Set   setter,
                                         GPropertyUInt64Get   getter);
GParamSpec *    g_ulong_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyULongSet    setter,
                                         GPropertyULongGet    getter);

#define g_enum_property_new     g_long_property_new
#define g_flags_property_new    g_ulong_property_new

GParamSpec *    g_float_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyFloatSet    setter,
                                         GPropertyFloatGet    getter);
GParamSpec *    g_double_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyDoubleSet   setter,
                                         GPropertyDoubleGet   getter);

GParamSpec *    g_string_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyStringSet   setter,
                                         GPropertyStringGet   getter);

GParamSpec *    g_boxed_property_new    (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyBoxedSet    setter,
                                         GPropertyBoxedGet    getter);

GParamSpec *    g_object_property_new   (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyObjectSet   setter,
                                         GPropertyObjectGet   getter);

GParamSpec *    g_pointer_property_new  (const gchar         *name,
                                         GPropertyFlags       flags,
                                         gssize               field_offset,
                                         GPropertyPointerSet  setter,
                                         GPropertyPointerGet  getter);

#define g_char_property_new     g_int8_property_new
#define g_uchar_property_new    g_uint8_property_new
#define g_unichar_property_new  g_uint32_property_new

/* macros */
#define _G_PROPERTY_BEGIN(T_n, t_n, field_type, field_name, _flags) \
{ \
  GTypeClass *g_property_class = g_type_class_peek (t_n##_get_type ()); \
  gpointer g_property_setter = NULL; \
  gpointer g_property_getter = NULL; \
  gssize g_property_offset = 0; \
  gchar *g_property_name = NULL; \
  GProperty *g_property; \
\
  if (_flags & G_PROPERTY_NO_ACCESSORS) \
    { \
      if (_flags & G_PROPERTY_PRIVATE_FIELD) \
        g_property_offset = G_STRUCT_OFFSET (T_n##Private, field_name); \
      else if (_flags & G_PROPERTY_PUBLIC_FIELD) \
        g_property_offset = G_STRUCT_OFFSET (T_n, field_name); \
      else \
        { \
          g_critical (G_STRLOC ": G_PROPERTY_NO_ACCESSORS requires " \
                      "either G_PROPERTY_PUBLIC_FIELD or " \
                      "G_PROPERTY_PRIVATE_FIELD"); \
          g_property_offset = -1; \
        } \
    } \
  else \
    { \
      g_property_offset = -1; \
\
      if (_flags & G_PROPERTY_READABLE) \
        g_property_setter = t_n##_set_##field_name; \
      if (_flags & G_PROPERTY_WRITABLE) \
        g_property_getter = t_n##_get_##field_name; \
    } \
\
  g_property_name = g_property_canonicalize (#field_name); \
  g_property = \
    g_##field_type##_property_new (g_property_name, \
                                   flags, \
                                   g_property_offset, \
                                   g_property_setter, \
                                   g_property_getter); \
  { /* custom code follows */
#define _G_PROPERTY_END() \
  } /* following custom code */ \
  g_free (g_property_name); \
  g_object_class_install_property ((GObjectClass *) g_property_class, \
                                   (GParamSpec *) g_property);
}

/**
 * G_PROPERTY_DESCRIPTION:
 * @nick: a user readable, and optionally translatable name of the property
 * @blurb: a user readable, and optionally translatable description of
 *   the property
 *
 * A macro for setting the @nick and @blurb of a #GProperty. This macro
 * assumes that it is being used inside a %G_PROPERTY_FULL definition.
 *
 * Since: 2.32
 */
#define G_PROPERTY_DESCRIPTION(nick, blurb)             G_STMT_START {  \
  g_property_set_static_nick (g_property, (nick));                      \
  g_property_set_static_blurb (g_property, (blurb));    } G_STMT_END;

/**
 * G_PROPERTY_RANGE:
 * @minVal: minimum value of the range, using the same type as
 *  the property
 * @maxVal: maximum value of the range, using the same type as
 *  the property
 *
 * For properties that allow a range, this macro specifies the minimum
 * and maximum values of the range.
 *
 * This macro assumes that it is being used inside a %G_PROPERTY_FULL
 * definition.
 *
 * Since: 2.32
 */
#define G_PROPERTY_RANGE(minVal, maxVal)        g_property_set_range (g_property, minVal, maxVal);

/**
 * G_PROPERTY_DEFAULT:
 * @defaultVal: the default value of the property
 *
 * For properties that allow a default value, this macro specifies
 * tht value.
 *
 * This macro assumes that it is being used inside a %G_PROPERTY_FULL
 * definition.
 *
 * Since: 2.32
 */
#define G_PROPERTY_DEFAULT(defaultVal)          g_property_set_default (g_property, defaultVal);

/**
 * G_PROPERTY_PREREQUISITE:
 * @prereqType: a #GType
 *
 * Sets the prerequisite type for a property.
 *
 * When validating a value being set for this property, the #GProperty
 * will use both its type and this prerequisite type to verify the
 * compatibility.
 *
 * This macro assumes that it is being used inside a %G_PROPERTY_FULL
 * definition.
 *
 * Since: 2.32
 */
#define G_PROPERTY_PREREQUISITE(prereqType)     g_property_set_prerequisite (g_property, prereqType);

/**
 * G_PROPERTY_FULL:
 * @field_type: the C type of the property
 * @field_name: the name of the field to set in the private data structure
 * @_flags: #GPropertyFlags
 * @_C_: custom code to be called prior to the installation of the property
 *
 * Defines and installs a #GObject property, and allows calling other
 * macros and custom code before installing the property onto the class;
 * for instance, the following code:
 *
 * |[
 *  G_PROPERTY_FULL (ClutterActor, clutter_actor, double, x_align,
 *                   G_PROPERTY_READWRITE,
 *                   G_PROPERTY_DESCRIPTION (_("Horizontal alignment"),
 *                                           _("The alignment on the X axis"))
 *                   G_PROPERTY_RANGE (0.0, 1.0)
 *                   G_PROPERTY_DEFAULT (0.5));
 * ]|
 *
 * will install a "x-align", read-write property, and set the nick and blurb
 * strings, and set a [ 0.0, 1.0 ] range of allowed values, with a default
 * value of 0.5.
 *
 * This macro will use the %G_TYPE_NAME and %G_TYPE_PREFIX macros if they
 * are defined.
 *
 * Since: 2.32
 */
#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)

#define G_PROPERTY_FULL(field_type, field_name, _flags, _C_) \
_G_PROPERTY_BEGIN (G_TYPE_NAME, G_TYPE_PREFIX, field_type, field_name, _C_) \
{ _C_; } \
_G_PROPERTY_END ()

#else /* !G_TYPE_NAME && !G_TYPE_PREFIX */

#define G_PROPERTY_FULL(T_n, t_n, field_type, field_name, _nick, _blurb, _flags, _C_) \
_G_PROPERTY_BEGIN (T_n, t_n, field_type, field_name, _nick, _blurb, _flags) \
{ _C_; } \
_G_PROPERTY_END ()

#endif

/**
 * G_PROPERTY:
 * @T_n: the name of the type of the class, in CamelCase
 * @t_n: the name of the type of the class, in lower case
 * @field_type: the C type of the property
 * @field_name: the name of the field to set in the private data structure
 * @_nick: a user-readable name for the property (may be translated)
 * @_blurb: a user-readable description for the property (may be translated)
 * @_flags: #GParamFlags
 *
 * Defines and installs a #GObject property.
 *
 * This code:
 *
 * |[
 *  static void
 *  clutter_actor_class_init (ClutterActorClass *klass)
 *  {
 *    G_PROPERTY (ClutterActor, clutter_actor, float, margin_top, G_PROPERTY_READWRITE);
 *  }
 * ]|
 *
 * will generate the equivalent of the following code:
 *
 * |[
 * {
 *   GProperty *g_property =
 *     g_float_property_new ("margin-top",
 *                           G_PROPERTY_READWRITE,
 *                           -1,
 *                           clutter_actor_set_margin_top,
 *                           clutter_actor_get_margin_top);
 *   GTypeClass *_klass = g_type_class_peek (clutter_actor_get_type ());
 *   g_object_class_install_property ((GObjectClass *) _klass,
 *                                    (GParamSpec *) g_property);
 * }
 * ]|
 *
 * If the property requires further annotations, like a range, you should
 * use the %G_PROPERTY_FULL() macro instead.
 *
 * If the %G_TYPE_NAME and %G_TYPE_PREFIX macros have been defined, this
 * macro will use them and will not require the @T_n and @t_n arguments,
 * for instance:
 *
 * |[
 *   #define G_TYPE_NAME        ClutterActor
 *   #define G_TYPE_PREFIX      clutter_actor
 *
 *   static void
 *   clutter_actor_class_init (ClutterActorClass *klass)
 *   {
 *     G_PROPERTY (int, margin_top, G_PROPERTY_READWRITE);
 *   }
 * ]|
 *
 * Since: 2.32
 */
#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)
#define G_PROPERTY(field_type, field_name, _flags)              G_PROPERTY_FULL (field_type, field_name, _flags, ;)
#else
#define G_PROPERTY(T_n, t_n, field_type, field_name, _flags)    G_PROPERTY_FULL (T_n, t_n, field_type, field_name, _flags, ;)
#endif

#define G_BEGIN_PROPERTIES

#define G_END_PROPERTIES

/* accessors generation */
#define _G_DECLARE_PROPERTY_GETTER(T_n, t_n, f_t, f_n)  f_t t_n##_get_##f_n (T_n *self)

#define _G_DEFINE_PROPERTY_GETTER_BEGIN(T_n, t_n, f_t, f_n, flags) \
{ \
  f_t *_retval; \
\
  g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (self, t_n##_get_type ()), (f_t) 0); \
\
  if (flags & G_PROPERTY_PUBLIC_FIELD) \
    *_retval = self->f_n; \
  else \
    *_retval = self->priv->f_n; \
\
  { /* custom code follows */
#define _G_DEFINE_PROPERTY_SYNTH_GET_END()      \
  } /* following custom code */                 \
  return *_retval;                              \
}

#define _G_DECLARE_PROPERTY_SETTER(T_n, t_n, f_t, f_n)  void t_n##_set_##f_n (T_n *self, f_t value)

#define _G_DEFINE_PROPERTY_SETTER_BEGIN(T_n, t_n, f_t, f_n, flags) \
{ \
  f_t *cur_value; \
\
  g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (self, t_n##_get_type ())); \
\
  if (!(flags & G_PROPERTY_WRITABLE)) \
    { \
      g_critical (G_STRLOC ": The property " #f_n " is not writable"); \
      return; \
    } \
\
  if (flags & G_PROPERTY_PUBLIC_FIELD) \
    cur_value = &(self->f_n); \
  else \
    cur_value = &(self->priv->f_n); \
\
  if (*cur_value == value) \
    return; \
\
  if (flags & G_PROPERTY_ATOMIC) \
    { \
      G_LOCK_DEFINE_STATIC (f_n); \
\
      G_LOCK (f_n); \
      *cur_value = value; \
      G_UNLOCK (f_n); \
    } \
  else \
    *cur_value = value; \
\
  { /* custom code follows */
#define _G_DEFINE_PROPERTY_SETTER_END(f_n)      \
  }/* following custom code */                  \
  g_object_notify (G_OBJECT (self), #f_n);      \
}

/**
 * G_DECLARE_PROPERTY_GET_SET:
 * @TypeName: the name of the type, in Camel case
 * @type_name: the name of the type, in lowercase, with words separated by '_'
 * @field_type: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @field_name: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 *
 * Declares the accessor functions for a @field_name property in the
 * class @TypeName. This macro should only be used in header files.
 */
#define G_DECLARE_PROPERTY_GET_SET(T_n, t_n, f_t, f_n)  \
_G_DECLARE_PROPERTY_SETTER (T_n, t_n, f_t, f_n);        \
_G_DECLARE_PROPERTY_GETTER (T_n, t_n, f_t, f_n);

/**
 * G_DECLARE_PROPERTY_GET:
 * @T_n: the name of the type, in Camel case
 * @t_n: the name of the type, in lowercase, with words separated by '_'
 * @f_t: the type of the property, which must match the type of the field
 * @f_n: the name of the property, which must match the name of the field
 *
 * Declares the getter function for a @f_n property in the @T_n class.
 *
 * This macro should only be used in header files.
 *
 * Since: 2.32
 */
#define G_DECLARE_PROPERTY_GET(T_n, t_n, f_t, f_n)      _G_DECLARE_PROPERTY_GETTER (T_n, t_n, f_t, f_n);

/**
 * G_DECLARE_PROPERTY_SET:
 * @T_n: the name of the type, in Camel case
 * @t_n: the name of the type, in lowercase, with words separated by '_'
 * @f_t: the type of the property, which must match the type of the field
 * @f_n: the name of the property, which must match the name of the field
 *
 * Declares the setter function for a @f_n property in the @T_n class.
 *
 * This macro should only be used in header files.
 *
 * Since: 2.32
 */
#define G_DECLARE_PROPERTY_SET(T_n, t_n, f_t, f_n)      _G_DECLARE_PROPERTY_SETTER (T_n, t_n, f_t, f_n);

/**
 * G_DEFINE_PROPERTY_SET_WITH_CODE:
 * @TypeName: the name of the type, in Camel case
 * @type_name: the name of the type, in lowercase, with words separated by '_'
 * @field_type: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @field_name: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 *
 * Defines the setter function for a @field_name property in the
 * class @TypeName, with the possibility of calling custom code.
 *
 * This macro should only be used in C source files.
 *
 * |[
 * G_DEFINE_PROPERTY_SET_WITH_CODE (ClutterActor, clutter_actor,
 *                                  int, margin_top,
 *                                  clutter_actor_queue_redraw (self))
 * ]|
 *
 * If the %G_TYPE_NAME and %G_TYPE_PREFIX macros are defined, this macro
 * will not require the type name and prefix arguments.
 *
 * Since: 2.32
 */

#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)

#define G_DEFINE_PROPERTY_SET_WITH_CODE(f_t, f_n, flags, _C_)                   \
_G_DECLARE_PROPERTY_SETTER (G_TYPE_NAME, G_TYPE_PREFIX, f_t, f_n)               \
_G_DEFINE_PROPERTY_SETTER_BEGIN (G_TYPE_NAME, G_TYPE_PREFIX, f_t, f_n, flags)   \
{ _C_; } \
_G_DEFINE_PROPERTY_SETTER_END (f_n)

#else /* !G_TYPE_NAME || !G_TYPE_PREFIX */

#define G_DEFINE_PROPERTY_SET_WITH_CODE(T_n, t_n, f_t, f_n, flags, _C_)         \
_G_DECLARE_PROPERTY_SETTER (T_n, t_n, f_t, f_n)                                 \
_G_DEFINE_PROPERTY_SETTER_BEGIN (T_n, t_n, f_t, f_n, flags)                     \
{ _C_; } \
_G_DEFINE_PROPERTY_SETTER_END (f_n)

#endif /* G_TYPE_NAME && G_TYPE_PREFIX */

/**
 * G_DEFINE_PROPERTY_GET_WITH_CODE:
 * @TypeName: the name of the type, in Camel case
 * @type_name: the name of the type, in lowercase, with words separated by '_'
 * @field_type: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @field_name: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 *
 * Defines the getter function for a @field_name property in the
 * class @TypeName, with the possibility of calling custom code.
 *
 * This macro should only be used in C source files.
 */

#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)

#define G_DEFINE_PROPERTY_GET_WITH_CODE(f_t, f_n, flags, _C_)                   \
_G_DECLARE_PROPERTY_GETTER (G_TYPE_NAME, G_TYPE_PREFIX, f_t, f_n)               \
_G_DEFINE_PROPERTY_GETTER_BEGIN (G_TYPE_NAME, G_TYPE_PREFIX, f_t, f_n, flags)   \
{ _C_; } \
_G_DEFINE_PROPERTY_GETTER_END (f_n)

#else /* !G_TYPE_NAME || !G_TYPE_PREFIX */

#define G_DEFINE_PROPERTY_GET_WITH_CODE(T_n, t_n, f_t, f_n, flags, _C_)         \
_G_DECLARE_PROPERTY_GETTER (T_n, t_n, f_t, f_n)                                 \
_G_DEFINE_PROPERTY_GETTER_BEGIN (T_n, t_n, f_t, f_n, flags)                     \
{ _C_; } \
_G_DEFINE_PROPERTY_GETTER_END (f_n);

#endif /* G_TYPE_NAME && G_TYPE_PREFIX */

/**
 * G_DEFINE_PROPERTY_SET:
 * @TypeName: the name of the type, in Camel case
 * @type_name: the name of the type, in lowercase, with words separated by '_'
 * @field_type: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @field_name: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 *
 * Defines the setter function for a @field_name property in the
 * class @TypeName. This macro should only be used in C source files.
 *
 * See also %G_DEFINE_PROPERTY_SET_WITH_CODE.
 */
#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)
#define G_DEFINE_PROPERTY_SET(f_t, f_n, flags)                  G_DEFINE_PROPERTY_SET_WITH_CODE (f_t, f_n, flags, ;)
#else
#define G_DEFINE_PROPERTY_SET(T_n, t_n, f_t, f_n, flags)        G_DEFINE_PROPERTY_SET_WITH_CODE (T_n, t_n, f_t, f_n, flags, ;)
#endif /* G_TYPE_NAME && G_TYPE_PREFIX */

/**
 * G_DEFINE_PROPERTY_GET:
 * @TypeName: the name of the type, in Camel case
 * @type_name: the name of the type, in lowercase, with words separated by '_'
 * @field_type: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @field_name: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 *
 * Defines the getter function for a @field_name property in the
 * class @TypeName. This macro should only be used in C source files.
 *
 * See also %G_DEFINE_PROPERTY_GET_WITH_CODE.
 */

#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)
#define G_DEFINE_PROPERTY_GET(f_t, f_n, flags)                  G_DEFINE_PROPERTY_GET_WITH_CODE (f_t, f_n, flags, ;)
#else
#define G_DEFINE_PROPERTY_GET(T_n, t_n, f_t, f_n, flags)        G_DEFINE_PROPERTY_GET_WITH_CODE (T_n, t_n, f_t, f_n, flags, ;)
#endif /* G_TYPE_NAME && G_TYPE_PREFIX */

/**
 * G_DEFINE_PROPERTY_ACCESSORS:
 * @T_n: the name of the type, in Camel case
 * @t_n: the name of the type, in lowercase, with words separated by '_'
 * @f_t: the type of the property, which must match the type of the
 *   field in the @TypeName<!-- -->Private structure
 * @f_n: the name of the property, which must match the name of the
 *   field in the @TypeName<!-- -->Private structure
 * @flags: #GPropertyFlags to
 *
 * Defines the accessor functions for a @f_n property in the class @T_n.
 *
 * This macro should only be used in C source files, for instance:
 *
 * |[
 *   G_DEFINE_PROPERTY_ACCESSORS (ClutterActor, clutter_actor,
 *                                int, margin_top,
 *                                G_PROPERTY_READWRITE)
 * ]|
 *
 * will synthesize the equivalent of the following code:
 *
 * |[
 * void
 * clutter_actor_set_margin_top (ClutterActor *self,
 *                               int           value)
 * {
 *   ClutterActorPrivate *priv;
 *
 *   g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (self, clutter_actor_get_type ()));
 *
 *   priv = self->priv;
 *
 *   if (priv->margin_top == value)
 *     return;
 *
 *   priv->value = value;
 *
 *   g_object_notify (G_OBJECT (self), "margin-top");
 * }
 *
 * int
 * clutter_actor_get_margin_top (ClutterActor *self)
 * {
 *   g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (self, clutter_actor_get_type ()), 0);
 *
 *   return self->priv->margin_top;
 * }
 * ]|
 *
 * This macro will generate both the setter and getter functions, but the @flags will
 * be used to determine whether the setter or the getter functions will be implemented.
 *
 * If both %G_TYPE_NAME and %G_TYPE_PREFIX are defined then this macro will not require
 * the type name and prefix, e.g.:
 *
 * |[
 * #define G_TYPE_NAME          ClutterActor
 * #define G_TYPE_PREFIX        clutter_actor
 *
 * G_DEFINE_PROPERTY_GET_SET (int, margin_top, G_PROPERTY_READWRITE)
 * ]|
 *
 * For greater control on the setter and getter implementation, see also the
 * %G_DEFINE_PROPERTY_GET and %G_DEFINE_PROPERTY_SET macros, along with their
 * %G_DEFINE_PROPERTY_GET_WITH_CODE and %G_DEFINE_PROPERTY_SET_WITH_CODE
 * variants.
 *
 * Since: 2.32
 */

#if defined(G_TYPE_NAME) && defined(G_TYPE_PREFIX)

#define G_DEFINE_PROPERTY_GET_SET(f_t, f_n, flags)      \
G_DEFINE_PROPERTY_GET (f_t, f_n, flags)                 \
G_DEFINE_PROPERTY_SET (f_t, f_n, flags)

#else /* !G_TYPE_NAME || !G_TYPE_PREFIX */

#define G_DEFINE_PROPERTY_GET_SET(T_n, t_n, f_t, f_n, flags)    \
G_DEFINE_PROPERTY_GET (T_n, t_n, f_t, f_n, flags)               \
G_DEFINE_PROPERTY_SET (T_n, t_n, f_t, f_n, flags)

#endif /* G_TYPE_NAME && G_TYPE_PREFIX */

G_END_DECLS

#endif /* __G_PROPERTY_H__ */
