Commit | Line | Data |
---|---|---|
07bf635f RS |
1 | #ifndef LWLIB_H |
2 | #define LWLIB_H | |
3 | ||
4 | #include <X11/Intrinsic.h> | |
5 | ||
6 | /* | |
7 | ** Widget values depend on the Widget type: | |
177c0ea7 | 8 | ** |
07bf635f RS |
9 | ** widget: (name value key enabled data contents/selected) |
10 | ** | |
11 | ** label: ("name" "string" NULL NULL NULL NULL) | |
12 | ** button: ("name" "string" "key" T/F data <default-button-p>) | |
177c0ea7 | 13 | ** button w/menu: |
07bf635f RS |
14 | ** ("name" "string" "key" T/F data (label|button|button w/menu...)) |
15 | ** menubar: ("name" NULL NULL T/F data (button w/menu)) | |
16 | ** selectable thing: | |
17 | ** ("name" "string" "key" T/F data T/F) | |
18 | ** checkbox: selectable thing | |
19 | ** radio: ("name" NULL NULL T/F data (selectable thing...)) | |
20 | ** strings: ("name" NULL NULL T/F data (selectable thing...)) | |
21 | ** text: ("name" "string" <ign> T/F data) | |
dfdcaf49 | 22 | ** main: ("name") |
07bf635f RS |
23 | */ |
24 | ||
25 | typedef unsigned long LWLIB_ID; | |
26 | ||
27 | typedef enum _change_type | |
28 | { | |
29 | NO_CHANGE = 0, | |
30 | INVISIBLE_CHANGE = 1, | |
31 | VISIBLE_CHANGE = 2, | |
32 | STRUCTURAL_CHANGE = 3 | |
33 | } change_type; | |
34 | ||
cedccd2e GM |
35 | enum button_type |
36 | { | |
37 | BUTTON_TYPE_NONE, | |
38 | BUTTON_TYPE_TOGGLE, | |
39 | BUTTON_TYPE_RADIO | |
40 | }; | |
41 | ||
42 | /* Menu separator types. */ | |
43 | ||
44 | enum menu_separator | |
45 | { | |
46 | /* These values are Motif compatible. */ | |
47 | SEPARATOR_NO_LINE, | |
48 | SEPARATOR_SINGLE_LINE, | |
49 | SEPARATOR_DOUBLE_LINE, | |
50 | SEPARATOR_SINGLE_DASHED_LINE, | |
51 | SEPARATOR_DOUBLE_DASHED_LINE, | |
52 | SEPARATOR_SHADOW_ETCHED_IN, | |
53 | SEPARATOR_SHADOW_ETCHED_OUT, | |
54 | SEPARATOR_SHADOW_ETCHED_IN_DASH, | |
55 | SEPARATOR_SHADOW_ETCHED_OUT_DASH, | |
56 | ||
0591102a | 57 | /* The following are supported by Lucid menus. */ |
cedccd2e GM |
58 | SEPARATOR_SHADOW_DOUBLE_ETCHED_IN, |
59 | SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT, | |
60 | SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH, | |
61 | SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH | |
62 | }; | |
63 | ||
07bf635f RS |
64 | typedef struct _widget_value |
65 | { | |
66 | /* name of widget */ | |
05bdae44 | 67 | Lisp_Object lname; |
07bf635f RS |
68 | char* name; |
69 | /* value (meaning depend on widget type) */ | |
70 | char* value; | |
177c0ea7 | 71 | /* keyboard equivalent. no implications for XtTranslations */ |
05bdae44 | 72 | Lisp_Object lkey; |
07bf635f | 73 | char* key; |
0591102a RS |
74 | /* Help string or nil if none. |
75 | GC finds this string through the frame's menu_bar_vector | |
76 | or through menu_items. */ | |
77 | Lisp_Object help; | |
07bf635f RS |
78 | /* true if enabled */ |
79 | Boolean enabled; | |
80 | /* true if selected */ | |
81 | Boolean selected; | |
82 | /* true if was edited (maintained by get_value) */ | |
83 | Boolean edited; | |
cedccd2e GM |
84 | /* The type of a button. */ |
85 | enum button_type button_type; | |
07bf635f RS |
86 | /* true if has changed (maintained by lw library) */ |
87 | change_type change; | |
63e9d970 RS |
88 | /* true if this widget itself has changed, |
89 | but not counting the other widgets found in the `next' field. */ | |
90 | change_type this_one_change; | |
07bf635f RS |
91 | /* Contents of the sub-widgets, also selected slot for checkbox */ |
92 | struct _widget_value* contents; | |
93 | /* data passed to callback */ | |
94 | XtPointer call_data; | |
95 | /* next one in the list */ | |
96 | struct _widget_value* next; | |
97 | /* slot for the toolkit dependent part. Always initialize to NULL. */ | |
98 | void* toolkit_data; | |
99 | /* tell us if we should free the toolkit data slot when freeing the | |
100 | widget_value itself. */ | |
101 | Boolean free_toolkit_data; | |
102 | ||
103 | /* we resource the widget_value structures; this points to the next | |
104 | one on the free list if this one has been deallocated. | |
105 | */ | |
106 | struct _widget_value *free_list; | |
107 | } widget_value; | |
108 | ||
109 | ||
99570665 DL |
110 | typedef void (*lw_callback) __P ((Widget w, LWLIB_ID id, void* data)); |
111 | ||
112 | void lw_register_widget __P ((char* type, char* name, LWLIB_ID id, | |
113 | widget_value* val, lw_callback pre_activate_cb, | |
114 | lw_callback selection_cb, | |
115 | lw_callback post_activate_cb, | |
116 | lw_callback highlight_cb)); | |
117 | Widget lw_get_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p)); | |
118 | Widget lw_make_widget __P ((LWLIB_ID id, Widget parent, Boolean pop_up_p)); | |
119 | Widget lw_create_widget __P ((char* type, char* name, LWLIB_ID id, | |
120 | widget_value* val, Widget parent, Boolean pop_up_p, | |
121 | lw_callback pre_activate_cb, | |
122 | lw_callback selection_cb, | |
123 | lw_callback post_activate_cb, | |
124 | lw_callback highlight_cb)); | |
125 | LWLIB_ID lw_get_widget_id __P ((Widget w)); | |
126 | int lw_modify_all_widgets __P ((LWLIB_ID id, widget_value* val, Boolean deep_p)); | |
127 | void lw_destroy_widget __P ((Widget w)); | |
128 | void lw_destroy_all_widgets __P ((LWLIB_ID id)); | |
129 | void lw_destroy_everything __P ((void)); | |
130 | void lw_destroy_all_pop_ups __P ((void)); | |
131 | Widget lw_raise_all_pop_up_widgets __P ((void)); | |
132 | widget_value* lw_get_all_values __P ((LWLIB_ID id)); | |
133 | Boolean lw_get_some_values __P ((LWLIB_ID id, widget_value* val)); | |
134 | void lw_pop_up_all_widgets __P ((LWLIB_ID id)); | |
135 | void lw_pop_down_all_widgets __P ((LWLIB_ID id)); | |
07bf635f | 136 | widget_value *malloc_widget_value (); |
99570665 DL |
137 | void free_widget_value __P ((widget_value *)); |
138 | void lw_popup_menu __P ((Widget, XEvent *)); | |
07bf635f RS |
139 | |
140 | /* Toolkit independent way of focusing on a Widget at the Xt level. */ | |
99570665 | 141 | void lw_set_keyboard_focus __P ((Widget parent, Widget w)); |
07bf635f RS |
142 | |
143 | /* Silly Energize hack to invert the "sheet" button */ | |
99570665 | 144 | void lw_show_busy __P ((Widget w, Boolean busy)); |
dfdcaf49 PR |
145 | |
146 | /* Silly hack to assist with Lucid/Athena geometry management. */ | |
99570665 | 147 | void lw_refigure_widget __P ((Widget w, Boolean doit)); |
dfdcaf49 PR |
148 | |
149 | /* Toolkit independent way of determining if an event occurred on a | |
150 | menubar. */ | |
99570665 | 151 | Boolean lw_window_is_in_menubar __P ((Window win, Widget menubar_widget)); |
dfdcaf49 PR |
152 | |
153 | /* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */ | |
99570665 | 154 | void lw_allow_resizing __P ((Widget w, Boolean flag)); |
07bf635f | 155 | |
11bcd7d4 | 156 | /* Set up the main window. */ |
99570665 | 157 | void lw_set_main_areas __P ((Widget parent, |
11bcd7d4 | 158 | Widget menubar, |
99570665 | 159 | Widget work_area)); |
11bcd7d4 | 160 | |
cedccd2e GM |
161 | /* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is |
162 | set to an appropriate enumerator of type enum menu_separator. | |
163 | MOTIF_P non-zero means map separator types not supported by Motif | |
164 | to similar ones that are supported. */ | |
165 | ||
99570665 DL |
166 | int lw_separator_p __P ((char *label, enum menu_separator *type, |
167 | int motif_p)); | |
168 | ||
169 | void lwlib_bcopy __P ((char*, char*, int)); | |
cedccd2e | 170 | |
07bf635f | 171 | #endif /* LWLIB_H */ |
ab5796a9 MB |
172 | |
173 | /* arch-tag: 44d818d5-7eb2-4d87-acd7-b992bb0d5d20 | |
174 | (do not change this comment) */ |