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