1 | /* |
---|
2 | * bonobo-property-bag.h: property bag object implementation. |
---|
3 | * |
---|
4 | * Authors: |
---|
5 | * Nat Friedman (nat@helixcode.com) |
---|
6 | * Michael Meeks (michael@helixcode.com) |
---|
7 | * |
---|
8 | * Copyright 1999, 2000 Helix Code, Inc. |
---|
9 | */ |
---|
10 | #ifndef __BONOBO_PROPERTY_BAG_H__ |
---|
11 | #define __BONOBO_PROPERTY_BAG_H__ |
---|
12 | |
---|
13 | #include <bonobo/bonobo-xobject.h> |
---|
14 | |
---|
15 | BEGIN_GNOME_DECLS |
---|
16 | |
---|
17 | typedef struct _BonoboPropertyBagPrivate BonoboPropertyBagPrivate; |
---|
18 | typedef struct _BonoboPropertyBag BonoboPropertyBag; |
---|
19 | |
---|
20 | /* Keep this enumeration synced with the docs in bonobo-property.idl */ |
---|
21 | typedef enum { |
---|
22 | BONOBO_PROPERTY_UNSTORED = 1, |
---|
23 | BONOBO_PROPERTY_READABLE = 2, |
---|
24 | BONOBO_PROPERTY_WRITEABLE = 4, |
---|
25 | BONOBO_PROPERTY_USE_DEFAULT_OPT = 8, |
---|
26 | BONOBO_PROPERTY_NO_LISTENING = 16 |
---|
27 | } BonoboPropertyFlags; |
---|
28 | |
---|
29 | #include <bonobo/bonobo-arg.h> |
---|
30 | |
---|
31 | typedef void (*BonoboPropertyGetFn) (BonoboPropertyBag *bag, |
---|
32 | BonoboArg *arg, |
---|
33 | guint arg_id, |
---|
34 | CORBA_Environment *ev, |
---|
35 | gpointer user_data); |
---|
36 | typedef void (*BonoboPropertySetFn) (BonoboPropertyBag *bag, |
---|
37 | const BonoboArg *arg, |
---|
38 | guint arg_id, |
---|
39 | CORBA_Environment *ev, |
---|
40 | gpointer user_data); |
---|
41 | |
---|
42 | #include <bonobo/bonobo-property.h> |
---|
43 | #include <bonobo/bonobo-event-source.h> |
---|
44 | |
---|
45 | struct _BonoboPropertyBag { |
---|
46 | BonoboXObject parent; |
---|
47 | BonoboPropertyBagPrivate *priv; |
---|
48 | BonoboEventSource *es; |
---|
49 | }; |
---|
50 | |
---|
51 | typedef struct { |
---|
52 | BonoboXObjectClass parent; |
---|
53 | |
---|
54 | POA_Bonobo_PropertyBag__epv epv; |
---|
55 | } BonoboPropertyBagClass; |
---|
56 | |
---|
57 | #define BONOBO_PROPERTY_BAG_TYPE (bonobo_property_bag_get_type ()) |
---|
58 | #define BONOBO_PROPERTY_BAG(o) (GTK_CHECK_CAST ((o), BONOBO_PROPERTY_BAG_TYPE, BonoboPropertyBag)) |
---|
59 | #define BONOBO_PROPERTY_BAG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), BONOBO_PROPERTY_BAG_TYPE, BonoboPropertyBagClass)) |
---|
60 | #define BONOBO_IS_PROPERTY_BAG(o) (GTK_CHECK_TYPE ((o), BONOBO_PROPERTY_BAG_TYPE)) |
---|
61 | #define BONOBO_IS_PROPERTY_BAG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_PROPERTY_BAG_TYPE)) |
---|
62 | |
---|
63 | GtkType bonobo_property_bag_get_type (void); |
---|
64 | BonoboPropertyBag *bonobo_property_bag_new (BonoboPropertyGetFn get_prop, |
---|
65 | BonoboPropertySetFn set_prop, |
---|
66 | gpointer user_data); |
---|
67 | |
---|
68 | BonoboPropertyBag *bonobo_property_bag_new_full (BonoboPropertyGetFn get_prop, |
---|
69 | BonoboPropertySetFn set_prop, |
---|
70 | BonoboEventSource *event_source, |
---|
71 | gpointer user_data); |
---|
72 | |
---|
73 | BonoboPropertyBag *bonobo_property_bag_construct (BonoboPropertyBag *pb, |
---|
74 | BonoboPropertyGetFn get_prop, |
---|
75 | BonoboPropertySetFn set_prop, |
---|
76 | BonoboEventSource *event_source, |
---|
77 | gpointer user_data); |
---|
78 | |
---|
79 | void bonobo_property_bag_add (BonoboPropertyBag *pb, |
---|
80 | const char *name, |
---|
81 | int idx, |
---|
82 | BonoboArgType type, |
---|
83 | BonoboArg *default_value, |
---|
84 | const char *docstring, |
---|
85 | BonoboPropertyFlags flags); |
---|
86 | |
---|
87 | void bonobo_property_bag_add_full (BonoboPropertyBag *pb, |
---|
88 | const char *name, |
---|
89 | int idx, |
---|
90 | BonoboArgType type, |
---|
91 | BonoboArg *default_value, |
---|
92 | const char *docstring, |
---|
93 | BonoboPropertyFlags flags, |
---|
94 | BonoboPropertyGetFn get_prop, |
---|
95 | BonoboPropertySetFn set_prop, |
---|
96 | gpointer user_data); |
---|
97 | |
---|
98 | void bonobo_property_bag_add_gtk_args (BonoboPropertyBag *pb, |
---|
99 | GtkObject *object); |
---|
100 | |
---|
101 | BonoboArgType bonobo_property_bag_get_property_type (BonoboPropertyBag *pb, |
---|
102 | const char *name, |
---|
103 | CORBA_Environment *opt_ev); |
---|
104 | |
---|
105 | /* Modifying properties. */ |
---|
106 | void bonobo_property_bag_set_value (BonoboPropertyBag *pb, |
---|
107 | const char *name, |
---|
108 | const BonoboArg *value, |
---|
109 | CORBA_Environment *opt_ev); |
---|
110 | |
---|
111 | BonoboArg *bonobo_property_bag_get_value (BonoboPropertyBag *pb, |
---|
112 | const char *name, |
---|
113 | CORBA_Environment *opt_ev); |
---|
114 | BonoboArg *bonobo_property_bag_get_default (BonoboPropertyBag *pb, |
---|
115 | const char *name, |
---|
116 | CORBA_Environment *opt_ev); |
---|
117 | const char *bonobo_property_bag_get_docstring (BonoboPropertyBag *pb, |
---|
118 | const char *name, |
---|
119 | CORBA_Environment *opt_ev); |
---|
120 | const BonoboPropertyFlags bonobo_property_bag_get_flags (BonoboPropertyBag *pb, |
---|
121 | const char *name, |
---|
122 | CORBA_Environment *opt_ev); |
---|
123 | |
---|
124 | gboolean bonobo_property_bag_has_property (BonoboPropertyBag *pb, |
---|
125 | const char *name); |
---|
126 | void bonobo_property_bag_notify_listeners (BonoboPropertyBag *pb, |
---|
127 | const char *name, |
---|
128 | const BonoboArg *new_value, |
---|
129 | CORBA_Environment *opt_ev); |
---|
130 | |
---|
131 | /* A private function, only to be used by persistence implementations. */ |
---|
132 | GList *bonobo_property_bag_get_prop_list (BonoboPropertyBag *pb); |
---|
133 | |
---|
134 | END_GNOME_DECLS |
---|
135 | |
---|
136 | #endif /* ! __BONOBO_PROPERTY_BAG_H__ */ |
---|