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