glade-property-class.h 11.1 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1 2 3
#ifndef __GLADE_PROPERTY_CLASS_H__
#define __GLADE_PROPERTY_CLASS_H__

4 5
#include <glib.h>
#include <glib-object.h>
6
#include <gtk/gtk.h>
7

8 9
#include <gladeui/glade-xml-utils.h>

Jose Maria Celorio's avatar
Jose Maria Celorio committed
10 11
G_BEGIN_DECLS

12 13 14
/* The GladePropertyClass structure parameters of a GladeProperty.
 * All entries in the GladeEditor are GladeProperties (except signals)
 * All GladeProperties are associated with a GParamSpec.
Jose Maria Celorio's avatar
Jose Maria Celorio committed
15
 */
Tristan Van Berkom's avatar
Tristan Van Berkom committed
16 17
#define GLADE_PROPERTY_CLASS(gpc)     ((GladePropertyClass *) gpc)
#define GLADE_IS_PROPERTY_CLASS(gpc)  (gpc != NULL)
18

19 20 21

/**
 * GLADE_PROPERTY_CLASS_IS_TYPE:
22 23
 * @gpc: A #GladePropertyClass
 * @type: The #GladeEditorPageType to query
24 25 26
 *
 * Checks if @gpc is good to be loaded as @type
 */
27 28 29 30 31 32
#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type)                                     \
  (((type) == GLADE_PAGE_GENERAL &&                                                 \
    !glade_property_class_common (gpc) &&                                           \
    !glade_property_class_get_is_packing (gpc) &&                                   \
    !glade_property_class_atk (gpc)) ||                                             \
   ((type) == GLADE_PAGE_COMMON  && glade_property_class_common (gpc))    ||        \
33
   ((type) == GLADE_PAGE_PACKING && glade_property_class_get_is_packing (gpc))   || \
34
   ((type) == GLADE_PAGE_ATK     && glade_property_class_atk (gpc))       ||        \
35
   ((type) == GLADE_PAGE_QUERY   && glade_property_class_query (gpc)))
36

37
/**
38
 * GPC_VERSION_CHECK:
39 40 41 42 43 44 45
 * @klass: A #GladePropertyClass
 * @major_version: The major version to check
 * @minor_version: The minor version to check
 *
 * Evaluates to %TRUE if @klass is available in its owning library version-@major_verion.@minor_version.
 *
 */
46
#define GPC_VERSION_CHECK(klass, major_version, minor_version)                          \
47 48 49
  ((glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) == major_version) ? \
   (glade_property_class_since_minor (GLADE_PROPERTY_CLASS (klass)) <= minor_version) : \
   (glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) <= major_version))
50

51

Tristan Van Berkom's avatar
Tristan Van Berkom committed
52
#define GPC_OBJECT_DELIMITER ", "
53
#define GPC_PROPERTY_NAMELEN 512  /* Enough space for a property name I think */
Tristan Van Berkom's avatar
Tristan Van Berkom committed
54

Tristan Van Berkom's avatar
Tristan Van Berkom committed
55 56
typedef struct _GladePropertyClass GladePropertyClass;

57 58

GladePropertyClass   *glade_property_class_new                     (GladeWidgetAdaptor  *adaptor,
59
                                                                    const gchar         *id);
60
GladePropertyClass   *glade_property_class_new_from_spec           (GladeWidgetAdaptor  *adaptor,
61
                                                                    GParamSpec          *spec);
62
GladePropertyClass   *glade_property_class_new_from_spec_full      (GladeWidgetAdaptor  *adaptor,
63 64
                                                                    GParamSpec          *spec,
                                                                    gboolean             need_handle);
65
GladePropertyClass   *glade_property_class_clone                   (GladePropertyClass  *property_class,
66
                                                                    gboolean             reset_version);
67 68 69
void                  glade_property_class_free                    (GladePropertyClass  *property_class);

void                  glade_property_class_set_adaptor             (GladePropertyClass  *property_class,
70
                                                                    GladeWidgetAdaptor  *adaptor);
71 72
GladeWidgetAdaptor   *glade_property_class_get_adaptor             (GladePropertyClass  *property_class);
void                  glade_property_class_set_pspec               (GladePropertyClass  *property_class,
73
                                                                    GParamSpec          *pspec);
74 75
GParamSpec           *glade_property_class_get_pspec               (GladePropertyClass  *property_class);
void                  glade_property_class_set_is_packing          (GladePropertyClass  *property_class,
76
                                                                    gboolean             is_packing);
77 78 79 80 81 82
gboolean              glade_property_class_get_is_packing          (GladePropertyClass  *property_class);
gboolean              glade_property_class_save                    (GladePropertyClass  *property_class);
gboolean              glade_property_class_save_always             (GladePropertyClass  *property_class);
gboolean              glade_property_class_is_visible              (GladePropertyClass  *property_class);
gboolean              glade_property_class_is_object               (GladePropertyClass  *property_class);
void                  glade_property_class_set_virtual             (GladePropertyClass  *property_class,
83
                                                                    gboolean             value);
84 85
gboolean              glade_property_class_get_virtual             (GladePropertyClass  *property_class);
void                  glade_property_class_set_ignore              (GladePropertyClass  *property_class,
86
                                                                    gboolean             ignore);
87 88
gboolean              glade_property_class_get_ignore              (GladePropertyClass  *property_class);
void                  glade_property_class_set_name                (GladePropertyClass  *property_class,
89
                                                                    const gchar         *name);
90 91
G_CONST_RETURN gchar *glade_property_class_get_name                (GladePropertyClass  *property_class);
void                  glade_property_class_set_tooltip             (GladePropertyClass  *property_class,
92
                                                                    const gchar         *tooltip);
93 94 95 96
G_CONST_RETURN gchar *glade_property_class_get_tooltip             (GladePropertyClass  *property_class);
G_CONST_RETURN gchar *glade_property_class_id                      (GladePropertyClass  *property_class);
gboolean              glade_property_class_themed_icon             (GladePropertyClass  *property_class);
void                  glade_property_class_set_construct_only      (GladePropertyClass  *property_class,
97
                                                                    gboolean             construct_only);
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
gboolean              glade_property_class_get_construct_only      (GladePropertyClass  *property_class);
G_CONST_RETURN GValue *glade_property_class_get_default            (GladePropertyClass  *property_class);
G_CONST_RETURN GValue *glade_property_class_get_original_default   (GladePropertyClass  *property_class);
gboolean              glade_property_class_translatable            (GladePropertyClass  *property_class);
gboolean              glade_property_class_needs_sync              (GladePropertyClass  *property_class);

gboolean              glade_property_class_query                   (GladePropertyClass  *property_class);
gboolean              glade_property_class_atk                     (GladePropertyClass  *property_class);
gboolean              glade_property_class_common                  (GladePropertyClass  *property_class);
gboolean              glade_property_class_parentless_widget       (GladePropertyClass  *property_class);
gboolean              glade_property_class_optional                (GladePropertyClass  *property_class);
gboolean              glade_property_class_optional_default        (GladePropertyClass  *property_class);
gboolean              glade_property_class_multiline               (GladePropertyClass  *property_class);
gboolean              glade_property_class_stock                   (GladePropertyClass  *property_class);
gboolean              glade_property_class_stock_icon              (GladePropertyClass  *property_class);
gboolean              glade_property_class_transfer_on_paste       (GladePropertyClass  *property_class);
gboolean              glade_property_class_custom_layout           (GladePropertyClass  *property_class);
gdouble               glade_property_class_weight                  (GladePropertyClass  *property_class);

G_CONST_RETURN gchar *glade_property_class_create_type             (GladePropertyClass  *property_class);

guint16               glade_property_class_since_major             (GladePropertyClass  *property_class);
guint16               glade_property_class_since_minor             (GladePropertyClass  *property_class);
121
gboolean              glade_property_class_deprecated              (GladePropertyClass  *property_class);
122

123
GValue             *glade_property_class_make_gvalue_from_string (GladePropertyClass  *property_class,
124 125
                                                                  const gchar         *string,
                                                                  GladeProject        *project);
126

127
gchar              *glade_property_class_make_string_from_gvalue (GladePropertyClass  *property_class,
128
                                                                  const GValue        *value);
129

130
GValue             *glade_property_class_make_gvalue_from_vl     (GladePropertyClass  *property_class,
131
                                                                  va_list              vl);
132

133
void                glade_property_class_set_vl_from_gvalue      (GladePropertyClass  *klass,
134 135
                                                                  GValue              *value,
                                                                  va_list              vl);
136

137
GValue             *glade_property_class_make_gvalue             (GladePropertyClass  *klass,
138
                                                                  ...);
139

140
void                glade_property_class_get_from_gvalue         (GladePropertyClass  *klass,
141 142
                                                                  GValue              *value,
                                                                  ...);
143

144
gboolean            glade_property_class_update_from_node        (GladeXmlNode        *node,
145 146 147
                                                                  GType                object_type,
                                                                  GladePropertyClass **property_class,
                                                                  const gchar         *domain);
148

149
GtkAdjustment      *glade_property_class_make_adjustment         (GladePropertyClass *property_class);
150

151
gboolean            glade_property_class_match                   (GladePropertyClass *klass,
152
                                                                  GladePropertyClass *comp);
153

154
gboolean            glade_property_class_void_value              (GladePropertyClass *klass,
155
                                                                  GValue             *value);
156

157
gint                glade_property_class_compare                 (GladePropertyClass *klass,
158 159
                                                                  const GValue       *value1,
                                                                  const GValue       *value2);
160

161 162
GValue             *glade_property_class_get_default_from_spec   (GParamSpec *spec);

163 164 165 166
void                glade_property_class_set_weights             (GList **properties, GType parent);

void                glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class);

Jose Maria Celorio's avatar
Jose Maria Celorio committed
167 168 169
G_END_DECLS

#endif /* __GLADE_PROPERTY_CLASS_H__ */