Skip to content
Newer
Older
100644 72 lines (65 sloc) 2.76 KB
8d1ac0c @mbert Import Elvis 2.1 (written by Steve Kirkendall)
authored Dec 10, 2011
1 /* xdialog.h */
2
3 typedef enum {
4 FT_DEFAULT, /* dummy value, for fields with no explicit type */
5 FT_ONEOF, /* one of a preset list; includes boolean */
6 FT_NUMBER, /* numeric field */
7 FT_STRING, /* string field */
8 FT_FILE, /* string field where <Tab> does filename completion */
9 FT_LOCKED /* non-editable field */
10 } X_FIELDTYPE;
11 typedef struct
12 {
13 CHAR *label; /* displayed name of the option */
14 char *name; /* actual name of the option */
15 CHAR *value; /* option's current value */
16 char *limit; /* legal values, for FT_ONEOF or FT_NUMBER */
17 X_FIELDTYPE ft; /* input type */
18 unsigned lwidth;/* width of the label */
19 unsigned twidth;/* width of the text field, if there is one */
20 } X_FIELD;
21 typedef struct button_s
22 {
23 struct button_s *next;
24 int x, y; /* position of the button */
25 int w, h; /* size of the button */
26 int textx; /* horizontal offset of text (lbearing) */
27 int texty; /* vertical offset of text (ascent) */
28 _char_ shape; /* button shape -- usually 'b' for "button" */
29 int key; /* keystroke to simulate if mouse released on button */
30 char *label; /* label of the button */
31 int lablen; /* length of label */
32 int state; /* height of the button -- usually 2 */
33 } X_BUTTON;
34 typedef struct dialog_s
35 {
36 struct dialog_s *next; /* another, unrelated dialog in list */
37 X11WIN *xw; /* window where command should be run */
38 char *name; /* name of the dialog, from toolbar button */
39 char *desc; /* one-line description of what "submit" does */
40 char *excmd; /* the command to execute if "submit" pressed */
41 char *spec; /* descriptions of the fields */
42 X_FIELD *field; /* details about each field */
43 int nfields;/* number of fields */
44 X_BUTTON *button;/* list of buttons */
45
46 BOOLEAN pinned; /* is this dialog pinned (persistent) ? */
47 int current;/* currently highlighted field -- -1 to start */
48 int cursor; /* cursor position within the current field */
49 int shift; /* shift amount of the current text field */
50 X_BUTTON *click;/* button being clicked */
51
52 unsigned w,h; /* overall width & height of dialog */
53 int x0,y0; /* offsets to corner of first field's input */
54 int rowh; /* height of each option row */
55 int cellw; /* width of an input cell */
56 int base; /* where to draw the label positions (ascent) */
57 X_BUTTON *submit;/* the submit button -- also in "button" list, above */
58 X_BUTTON *cancel;/* the cancel button -- also in "button" list, above */
59
60 Window win; /* X11 window of the dialog */
61 GC gc; /* X11 graphic context */
62 long bg; /* X11 background color */
63 long face; /* X11 button/field color */
64 long fglabel;/* X11 text color */
65 } dialog_t;
66
67
68 extern void x_dl_add P_((X11WIN *xw, char *name, char *desc, char *excmd, char *spec));
69 extern void x_dl_delete P_((dialog_t *dia));
70 extern void x_dl_destroy P_((X11WIN *xw));
71 extern void x_dl_event P_((Window w, XEvent *event));
Something went wrong with that request. Please try again.