summaryrefslogtreecommitdiff
path: root/src/glade-property.h
blob: 1bf02543f68b93d2e966bb2b22a6a590d023058f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_PROPERTY_H__
#define __GLADE_PROPERTY_H__

G_BEGIN_DECLS

/* 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.
 */
struct _GladeProperty {

	GladePropertyClass *class; /* A pointer to the GladeProperty that this
				    * setting specifies
				    */
	GladeWidget *widget; /* A pointer to the GladeWidget that this
			      * GladeProperty is modifying
			      */
	
	gchar *value; /* A string representation of the value. Depending
		       * on the property->type it can contain an integer
		       * a "False" or "True" string or a string itself
		       */

	gboolean enabled; /* Enables is a flag that is used for GladeProperties
			   * that have the optional flag set to let us know
			   * if this widget has this GladeSetting enabled or
			   * not. (Like default size, it can be specified or
			   * unspecified). This flag also sets the state
			   * of the property->input state for the loaded
			   * widget.
			   */

	GList *views; /* A list of GladePropertyView items */
		       
};

struct _GladePropertyQuery {
	gchar *window_title;
	gchar *question;
};

struct _GladePropertyQueryResult {
	GHashTable *hash;
};
	

GList * glade_property_list_new_from_widget_class (GladeWidgetClass *class,
						   GladeWidget *widget);

void glade_property_changed_text    (GladeProperty *property, const gchar *text);
void glade_property_changed_integer (GladeProperty *property, gint val);
void glade_property_changed_float   (GladeProperty *property, gfloat val);
void glade_property_changed_boolean (GladeProperty *property, gboolean val);
void glade_property_changed_choice  (GladeProperty *property, GladeChoice *choice);

const gchar * glade_property_get_text    (GladeProperty *property);
gint          glade_property_get_integer (GladeProperty *property);
gfloat        glade_property_get_float   (GladeProperty *property);
gboolean      glade_property_get_boolean (GladeProperty *property);
GladeChoice * glade_property_get_choice  (GladeProperty *property);


/* Get a GladeProperty */
GladeProperty * glade_property_get_from_name (GList *property_list,
					      const gchar *name);
GladeProperty * glade_property_get_from_class (GladeWidget *widget,
					       GladePropertyClass *class);
GladeProperty * glade_property_get_from_gtk_arg (GList *settings_list,
						 const gchar *arg);

/* Property Queries */
GladePropertyQueryResult * glade_property_query_result_new (void);
void                       glade_property_query_result_destroy (GladePropertyQueryResult *result);

void glade_property_query_result_get_int (GladePropertyQueryResult *result,
					  const gchar *name,
					  gint *return_value);
void glade_property_query_result_set_int (GladePropertyQueryResult *result,
					  const gchar *key,
					  gint value);


G_END_DECLS

#endif /* __GLADE_PROPERTY_H__ */