]>
Commit | Line | Data |
---|---|---|
f212ae81 | 1 | /* |
2 | ** Buttons & Pulldown menus across the top of the application. | |
3 | ** When selected, it will continue to the submenu if non-null, | |
4 | ** otherwise call the general callback. | |
5 | */ | |
6 | ||
7 | typedef struct MenuItemS { | |
8 | char *label; /* the displayed label */ | |
9 | struct MenuItemS **submenu; /* if non-null, a submenu to display */ | |
4eedb296 | 10 | char *accel; /* accelerator */ |
f212ae81 | 11 | int operation; /* op identifer */ |
12 | char *form; /* name of form to popup */ | |
13 | char *query; | |
14 | int argc; | |
15 | } MenuItem; | |
16 | ||
17 | ||
18 | typedef struct { | |
19 | char *prompt; /* text displayed to left of input */ | |
20 | int type; /* what sort of input expected */ | |
21 | union { /* default value / return value */ | |
22 | char *stringvalue; | |
23 | Boolean booleanvalue; | |
24 | int integervalue; | |
25 | } returnvalue; | |
26 | Boolean insensitive; /* grayed-out or not... */ | |
4eedb296 | 27 | Boolean changed; /* true when prog changes config */ |
f212ae81 | 28 | int (*valuechanged)(); /* if non-NULL, call */ |
29 | char **keywords; /* list of possible values */ | |
4eedb296 | 30 | char *keyword_name; /* name of keyword */ |
f212ae81 | 31 | Widget mywidget; |
4eedb296 | 32 | caddr_t parent; /* parent form */ |
f212ae81 | 33 | } UserPrompt; |
34 | ||
35 | /* field types */ | |
36 | #define FT_STRING 1 | |
37 | #define FT_BOOLEAN 2 | |
38 | #define FT_KEYWORD 3 | |
39 | #define FT_NUMBER 4 | |
40 | ||
41 | /* max length of character fields */ | |
42 | #define MAXFIELDSIZE 256 | |
43 | ||
44 | #define stringval(f, n) ((f)->inputlines[n]->returnvalue.stringvalue) | |
45 | #define boolval(f, n) ((f)->inputlines[n]->returnvalue.booleanvalue) | |
46 | ||
47 | /* | |
48 | ** All (foo **) entries are assumed to be null-terminated lists of foos. | |
49 | */ | |
50 | ||
51 | typedef struct { | |
52 | char *label; /* text displayed on button */ | |
53 | int (*returnfunction) (); /* function called when button hit */ | |
54 | } BottomButton; | |
55 | ||
56 | /* | |
57 | ** Pass a pointer to the filled-in EntryForm structure back to the | |
58 | ** returnfunction when the button is hit. | |
59 | */ | |
60 | ||
61 | typedef struct { | |
62 | char *formname; /* name of form (duh!) */ | |
63 | char *instructions; /* text at top of form */ | |
64 | UserPrompt **inputlines; /* list of input lines */ | |
65 | BottomButton **buttons; /* list of buttons on the bottom */ | |
66 | Widget formpointer; /* already exists? */ | |
67 | MenuItem *menu; | |
68 | caddr_t extrastuff; /* for future expansion */ | |
69 | } EntryForm; | |
70 | ||
71 | /* | |
72 | ** When you're coming up, check to see if formpointer is initialized. | |
73 | ** If so, map it. Otherwise, create the form and set formpointer to | |
74 | ** the new toplevel widget id. Then map it. | |
75 | */ | |
76 |