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

4 5
#include <glib-object.h>

Jose Maria Celorio's avatar
Jose Maria Celorio committed
6 7
G_BEGIN_DECLS

8 9
#define GLADE_TYPE_PROPERTY            (glade_property_get_type())
#define GLADE_PROPERTY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_PROPERTY, GladeProperty))
10
#define GLADE_PROPERTY_KLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_PROPERTY, GladePropertyKlass))
11
#define GLADE_IS_PROPERTY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROPERTY))
12 13
#define GLADE_IS_PROPERTY_KLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROPERTY))
#define GLADE_PROPERTY_GET_KLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_PROPERTY, GladePropertyKlass))
14

15 16
typedef struct _GladePropertyKlass   GladePropertyKlass;
typedef struct _GladePropertyPrivate GladePropertyPrivate;
Tristan Van Berkom's avatar
Tristan Van Berkom committed
17

18
typedef enum {
19 20 21 22
  GLADE_STATE_NORMAL              = 0,
  GLADE_STATE_CHANGED             = (1 << 0),
  GLADE_STATE_UNSUPPORTED         = (1 << 1),
  GLADE_STATE_SUPPORT_DISABLED    = (1 << 2)
23 24
} GladePropertyState;

Jose Maria Celorio's avatar
Jose Maria Celorio committed
25 26 27 28
/* A GladeProperty is an instance of a GladePropertyClass.
 * There will be one GladePropertyClass for "GtkLabel->label" but one
 * GladeProperty for each GtkLabel in the GladeProject.
 */
29 30
struct _GladeProperty
{
31 32 33
  GObject             parent_instance;

  GladePropertyPrivate *priv;
34 35 36
};


37
struct _GladePropertyKlass
38
{
39 40 41
  GObjectClass  parent_class;

  /* Class methods */
42 43 44 45 46 47
  GladeProperty *         (* dup)                   (GladeProperty *template_prop, GladeWidget *widget);
  gboolean                (* equals_value)          (GladeProperty *property, const GValue *value);
  gboolean                (* set_value)             (GladeProperty *property, const GValue *value);
  void                    (* get_value)             (GladeProperty *property, GValue *value);
  void                    (* sync)                  (GladeProperty *property);
  void                    (* load)                  (GladeProperty *property);
48 49

  /* Signals */
50 51 52
  void             (* value_changed)         (GladeProperty *property, GValue *old_value, GValue *new_value);
  void             (* tooltip_changed)       (GladeProperty *property, const gchar *tooltip, 
                                              const gchar   *insensitive_tooltip, const gchar *support_warning);
53 54 55 56 57 58
  void   (* glade_reserved1)   (void);
  void   (* glade_reserved2)   (void);
  void   (* glade_reserved3)   (void);
  void   (* glade_reserved4)   (void);
  void   (* glade_reserved5)   (void);
  void   (* glade_reserved6)   (void);
59
};
Chema Celorio's avatar
Chema Celorio committed
60

61

62
GType                   glade_property_get_type              (void) G_GNUC_CONST;
63

64
GladeProperty          *glade_property_new                   (GladePropertyClass *klass,
65 66
                                                              GladeWidget        *widget,
                                                              GValue             *value);
67

68
GladeProperty          *glade_property_dup                   (GladeProperty      *template_prop,
69
                                                              GladeWidget        *widget);
70

71
void                    glade_property_reset                 (GladeProperty      *property);
72

73
void                    glade_property_original_reset        (GladeProperty      *property);
74

75
gboolean                glade_property_default               (GladeProperty      *property);
76

77
gboolean                glade_property_original_default      (GladeProperty      *property);
78

79
gboolean                glade_property_equals_value          (GladeProperty      *property, 
80
                                                              const GValue       *value);
81

82
gboolean                glade_property_equals                (GladeProperty      *property, 
83
                                                              ...);
84

85
gboolean                glade_property_set_value             (GladeProperty      *property, 
86
                                                              const GValue       *value);
87

88
gboolean                glade_property_set_va_list           (GladeProperty      *property,
89
                                                              va_list             vl);
90

91
gboolean                glade_property_set                   (GladeProperty      *property,
92
                                                              ...);
93

94
void                    glade_property_get_value             (GladeProperty      *property, 
95
                                                              GValue             *value);
96

97
void                    glade_property_get_default           (GladeProperty      *property, 
98
                                                              GValue             *value);
99

100
void                    glade_property_get_va_list           (GladeProperty      *property,
101
                                                              va_list             vl);
102

103
void                    glade_property_get                   (GladeProperty      *property, 
104
                                                              ...);
105

Tristan Van Berkom's avatar
Tristan Van Berkom committed
106
void                    glade_property_add_object            (GladeProperty      *property,
107
                                                              GObject            *object);
108

Tristan Van Berkom's avatar
Tristan Van Berkom committed
109
void                    glade_property_remove_object         (GladeProperty      *property,
110
                                                              GObject            *object);
111

112
void                    glade_property_sync                  (GladeProperty      *property);
113

114
void                    glade_property_load                  (GladeProperty      *property);
115

116
void                    glade_property_read                  (GladeProperty      *property,
117 118
                                                              GladeProject       *project,
                                                              GladeXmlNode       *node);
119

120 121 122
void                    glade_property_write                 (GladeProperty      *property,        
                                                              GladeXmlContext    *context,
                                                              GladeXmlNode       *node);
123

124 125
GladePropertyClass     *glade_property_get_class             (GladeProperty      *property);

126
void                    glade_property_set_sensitive         (GladeProperty      *property,
127 128
                                                              gboolean            sensitive,
                                                              const gchar        *reason);
129
G_CONST_RETURN gchar   *glade_propert_get_insensitive_tooltip(GladeProperty      *property);
130

131
void                    glade_property_set_support_warning   (GladeProperty      *property,
132 133
                                                              gboolean            disable,
                                                              const gchar        *reason);
134
G_CONST_RETURN gchar   *glade_property_get_support_warning   (GladeProperty      *property);
135 136

gboolean                glade_property_warn_usage            (GladeProperty      *property);
137

138
gboolean                glade_property_get_sensitive         (GladeProperty      *property);
139

140

141
void                    glade_property_set_save_always       (GladeProperty      *property,
142
                                                              gboolean            setting);
143

144 145
gboolean                glade_property_get_save_always       (GladeProperty      *property);

146

147
void                    glade_property_set_enabled           (GladeProperty      *property,
148
                                                              gboolean            enabled);
149

150 151
gboolean                glade_property_get_enabled           (GladeProperty      *property);

152

153 154 155 156
gchar                  *glade_property_make_string           (GladeProperty      *property);

GladeWidget            *glade_property_get_widget            (GladeProperty      *property);
void                    glade_property_set_widget            (GladeProperty      *property,
157
                                                              GladeWidget        *widget);
158 159 160 161 162

GValue                 *glade_property_inline_value          (GladeProperty      *property);

GladePropertyState      glade_property_get_state             (GladeProperty      *property);

163
void                    glade_property_i18n_set_comment      (GladeProperty      *property, 
164
                                                              const gchar        *str);
165

166
G_CONST_RETURN gchar   *glade_property_i18n_get_comment      (GladeProperty      *property);
167

168
void                    glade_property_i18n_set_context      (GladeProperty      *property, 
169
                                                              const gchar        *str);
170 171 172

G_CONST_RETURN gchar   *glade_property_i18n_get_context      (GladeProperty      *property);

173
void                    glade_property_i18n_set_translatable (GladeProperty      *property,
174
                                                              gboolean            translatable);
175

176
gboolean                glade_property_i18n_get_translatable (GladeProperty      *property);
177

178
void                    glade_property_push_superuser        (void);
179

180
void                    glade_property_pop_superuser         (void);
181

182 183
gboolean                glade_property_superuser             (void);

Jose Maria Celorio's avatar
Jose Maria Celorio committed
184 185 186
G_END_DECLS

#endif /* __GLADE_PROPERTY_H__ */