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