1 #ifndef __GLADE_PROPERTY_CLASS_H__
2 #define __GLADE_PROPERTY_CLASS_H__
3 
4 #include <glib.h>
5 #include <glib-object.h>
6 #include <gtk/gtk.h>
7 
8 #include <gladeui/glade-xml-utils.h>
9 
10 G_BEGIN_DECLS
11 
12 /* The GladePropertyClass structure parameters of a GladeProperty.
13  * All entries in the GladeEditor are GladeProperties (except signals)
14  * All GladeProperties are associated with a GParamSpec.
15  */
16 #define GLADE_PROPERTY_CLASS(gpc)     ((GladePropertyClass *) gpc)
17 #define GLADE_IS_PROPERTY_CLASS(gpc)  (gpc != NULL)
18 
19 
20 /**
21  * GLADE_PROPERTY_CLASS_IS_TYPE:
22  * gpc: A #GladePropertyClass
23  * type: The #GladeEditorPageType to query
24  *
25  * Checks if @gpc is good to be loaded as @type
26  */
27 #define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type)				\
28   (((type) == GLADE_PAGE_GENERAL &&					\
29     !glade_property_class_common (gpc) &&				\
30     !glade_property_class_get_is_packing (gpc) &&			\
31     !glade_property_class_atk (gpc)) ||					\
32    ((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  * @klass: A #GladePropertyClass
40  * @major_version: The major version to check
41  * @minor_version: The minor version to check
42  *
43  * Evaluates to %TRUE if @klass is available in its owning library version-@major_verion.@minor_version.
44  *
45  */
46 #define GPC_VERSION_CHECK(klass, major_version, minor_version)		\
47   ((glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) == major_version) ? \
48    (glade_property_class_since_minor (GLADE_PROPERTY_CLASS (klass)) <= minor_version) : \
49    (glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) <= major_version))
50 
51 
52 #define GPC_OBJECT_DELIMITER ", "
53 #define GPC_PROPERTY_NAMELEN 512  /* Enough space for a property name I think */
54 
55 typedef struct _GladePropertyClass GladePropertyClass;
56 
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 								    GParamSpec          *spec,
64 								    gboolean             need_handle);
65 GladePropertyClass   *glade_property_class_clone                   (GladePropertyClass  *property_class,
66 								    gboolean             reset_version);
67 void                  glade_property_class_free                    (GladePropertyClass  *property_class);
68 
69 void                  glade_property_class_set_adaptor             (GladePropertyClass  *property_class,
70 								    GladeWidgetAdaptor  *adaptor);
71 GladeWidgetAdaptor   *glade_property_class_get_adaptor             (GladePropertyClass  *property_class);
72 void                  glade_property_class_set_pspec               (GladePropertyClass  *property_class,
73 								    GParamSpec          *pspec);
74 GParamSpec           *glade_property_class_get_pspec               (GladePropertyClass  *property_class);
75 void                  glade_property_class_set_is_packing          (GladePropertyClass  *property_class,
76 								    gboolean             is_packing);
77 gboolean              glade_property_class_get_is_packing          (GladePropertyClass  *property_class);
78 gboolean              glade_property_class_save                    (GladePropertyClass  *property_class);
79 gboolean              glade_property_class_save_always             (GladePropertyClass  *property_class);
80 gboolean              glade_property_class_is_visible              (GladePropertyClass  *property_class);
81 gboolean              glade_property_class_is_object               (GladePropertyClass  *property_class);
82 void                  glade_property_class_set_virtual             (GladePropertyClass  *property_class,
83 								    gboolean             value);
84 gboolean              glade_property_class_get_virtual             (GladePropertyClass  *property_class);
85 void                  glade_property_class_set_ignore              (GladePropertyClass  *property_class,
86 								    gboolean             ignore);
87 gboolean              glade_property_class_get_ignore              (GladePropertyClass  *property_class);
88 void                  glade_property_class_set_name                (GladePropertyClass  *property_class,
89 								    const gchar         *name);
90 G_CONST_RETURN gchar *glade_property_class_get_name                (GladePropertyClass  *property_class);
91 void                  glade_property_class_set_tooltip             (GladePropertyClass  *property_class,
92 								    const gchar         *tooltip);
93 G_CONST_RETURN gchar *glade_property_class_get_tooltip             (GladePropertyClass  *property_class);
94 G_CONST_RETURN gchar *glade_property_class_id                      (GladePropertyClass  *property_class);
95 gboolean              glade_property_class_themed_icon             (GladePropertyClass  *property_class);
96 void                  glade_property_class_set_construct_only      (GladePropertyClass  *property_class,
97 								    gboolean             construct_only);
98 gboolean              glade_property_class_get_construct_only      (GladePropertyClass  *property_class);
99 G_CONST_RETURN GValue *glade_property_class_get_default            (GladePropertyClass  *property_class);
100 G_CONST_RETURN GValue *glade_property_class_get_original_default   (GladePropertyClass  *property_class);
101 gboolean              glade_property_class_translatable            (GladePropertyClass  *property_class);
102 gboolean              glade_property_class_needs_sync              (GladePropertyClass  *property_class);
103 
104 gboolean              glade_property_class_query                   (GladePropertyClass  *property_class);
105 gboolean              glade_property_class_atk                     (GladePropertyClass  *property_class);
106 gboolean              glade_property_class_common                  (GladePropertyClass  *property_class);
107 gboolean              glade_property_class_parentless_widget       (GladePropertyClass  *property_class);
108 gboolean              glade_property_class_optional                (GladePropertyClass  *property_class);
109 gboolean              glade_property_class_optional_default        (GladePropertyClass  *property_class);
110 gboolean              glade_property_class_multiline               (GladePropertyClass  *property_class);
111 gboolean              glade_property_class_stock                   (GladePropertyClass  *property_class);
112 gboolean              glade_property_class_stock_icon              (GladePropertyClass  *property_class);
113 gboolean              glade_property_class_transfer_on_paste       (GladePropertyClass  *property_class);
114 gboolean              glade_property_class_custom_layout           (GladePropertyClass  *property_class);
115 gdouble               glade_property_class_weight                  (GladePropertyClass  *property_class);
116 
117 G_CONST_RETURN gchar *glade_property_class_create_type             (GladePropertyClass  *property_class);
118 
119 guint16               glade_property_class_since_major             (GladePropertyClass  *property_class);
120 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 								  const gchar         *string,
125 								  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 								  GValue              *value,
135 								  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 								  GValue              *value,
142 								  ...);
143 
144 gboolean            glade_property_class_update_from_node        (GladeXmlNode        *node,
145 								  GType                object_type,
146 								  GladePropertyClass **property_class,
147 								  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 								  const GValue       *value1,
159 								  const GValue       *value2);
160 
161 GValue             *glade_property_class_get_default_from_spec   (GParamSpec *spec);
162 
163 void                glade_property_class_set_weights             (GList **properties, GType parent);
164 
165 void                glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class);
166 
167 G_END_DECLS
168 
169 #endif /* __GLADE_PROPERTY_CLASS_H__ */
170