/[estron]/trunk/dwi/src/field.h
ViewVC logotype

Contents of /trunk/dwi/src/field.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (show annotations) (download)
Sun Sep 28 15:41:15 2003 UTC (9 years, 7 months ago) by linas
File MIME type: text/plain
File size: 3276 byte(s)
rename fieldsource to field
1 /*
2 * FILE:
3 * field.h
4 *
5 * FUNCTION:
6 * Holder for different field identifiers/handles.
7 *
8 * HISTORY:
9 * Linas Vepstas September 2003
10 */
11
12 #ifndef DUI_FIELD_SOURCE_H
13 #define DUI_FIELD_SOURCE_H
14
15 #include "config.h"
16
17 typedef struct DuiField_s DuiField;
18
19 typedef enum
20 {
21 DUI_FIELD_NONE,
22 DUI_FIELD_GTK_12_WIDGET, /* Value in widget itself */
23 DUI_FIELD_GTK_12_WIDATA, /* Value from widget data */
24 DUI_FIELD_HASH_KEY, /* global hash table key */
25 DUI_FIELD_STATIC, /* static value */
26 DUI_FIELD_SQL, /* database table column */
27 DUI_FIELD_WHERE, /* match to database column */
28 DUI_FIELD_GOBJ, /* glib-2.0 gobject */
29
30 } DuiFieldType;
31
32 struct DuiField_s
33 {
34 DuiFieldType type;
35 union
36 {
37 /* A Gtk-1.2 type widget from which we will read data */
38 struct gtk_12_widget_s
39 {
40 char * widgetname;
41 GtkWidget * widget;
42 int column;
43 int row;
44
45 /* effing ctree not directly addressible by row number,
46 * so cache the node instead */
47 GtkCTreeNode *ctn;
48 } widget;
49
50 /* A Gtk-1.2 type widget which has data hanging from it. */
51 struct gtk_12_widata_s
52 {
53 char * widgetname;
54 GtkWidget * widget;
55 int column;
56 int row;
57 char * datakey; /* key that's attached to gtk_object_data */
58
59 /* effing ctree not directly addressible by row number,
60 * so cache the node instead */
61 GtkCTreeNode *ctn;
62 } widata;
63
64 char * hash_key;
65 char * value;
66
67 /* Data is in a named database field. */
68 struct sql_field_s
69 {
70 char * fieldname;
71 } sql;
72
73 /* Data is compared to a database field. */
74 struct where_field_s
75 {
76 char * fieldname;
77 char * compareop;
78 } where;
79
80 /* A property on a glib-2.0 gobject */
81 struct gobj_field_s
82 {
83 char * instance_name; /* name of the object instance */
84 char * property;
85 } gobj;
86 } u;
87 const char * (*get_field_value) (DuiField *);
88 };
89
90 void dui_field_clear (DuiField *s);
91
92 /** data will come from a GTK-1.2 widget */
93 void dui_field_set_widget (DuiField *fs,
94 const char * widname,
95 int colnum);
96
97 /** data will come from key on the data of a GTK-1.2 widget */
98 void dui_field_set_widata (DuiField *fs,
99 const char * widname,
100 int colnum,
101 const char * datakey);
102
103 /** data will be looked up in a hash tree */
104 void dui_field_set_hash_key (DuiField *fs, const char * key);
105
106 /** data will be a static value */
107 void dui_field_set_static (DuiField *fs,
108 const char *value);
109
110
111 /** data is from an sql table column */
112 void dui_field_set_sql (DuiField *ft, const char * fieldname);
113
114 /** used for matching an sql field */
115 void dui_field_set_where (DuiField *ft,
116 const char * fieldname,
117 const char * compareop);
118
119 /** data is a property on a glib-2.0 gobject */
120 void dui_field_set_gobj (DuiField *ft,
121 const char * obj,
122 const char * prop);
123
124 /* ---------------------------------------------- */
125 /** supply resolved widget pointer for widget type */
126 void dui_field_add_watcher (DuiField *fs, GtkWidget *w);
127
128 #endif /* DUI_FIELD_SOURCE_H */

  ViewVC Help
Powered by ViewVC 1.1.5