(xaw_popup_menu): Add EVENT arg.
[bpt/emacs.git] / lwlib / lwlib.h
CommitLineData
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:
8**
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>)
13** button w/menu:
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
25typedef unsigned long LWLIB_ID;
26
27typedef 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
35enum button_type
36{
37 BUTTON_TYPE_NONE,
38 BUTTON_TYPE_TOGGLE,
39 BUTTON_TYPE_RADIO
40};
41
42/* Menu separator types. */
43
44enum 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
57 /* The following are supported by XEmacs' Lucid menus. */
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
64typedef struct _widget_value
65{
66 /* name of widget */
67 char* name;
68 /* value (meaning depend on widget type) */
69 char* value;
70 /* keyboard equivalent. no implications for XtTranslations */
71 char* key;
6431de0a
GM
72 /* Help string or null if none. */
73 char *help;
07bf635f
RS
74 /* true if enabled */
75 Boolean enabled;
76 /* true if selected */
77 Boolean selected;
78 /* true if was edited (maintained by get_value) */
79 Boolean edited;
cedccd2e
GM
80 /* The type of a button. */
81 enum button_type button_type;
07bf635f
RS
82 /* true if has changed (maintained by lw library) */
83 change_type change;
63e9d970
RS
84 /* true if this widget itself has changed,
85 but not counting the other widgets found in the `next' field. */
86 change_type this_one_change;
07bf635f
RS
87 /* Contents of the sub-widgets, also selected slot for checkbox */
88 struct _widget_value* contents;
89 /* data passed to callback */
90 XtPointer call_data;
91 /* next one in the list */
92 struct _widget_value* next;
93 /* slot for the toolkit dependent part. Always initialize to NULL. */
94 void* toolkit_data;
95 /* tell us if we should free the toolkit data slot when freeing the
96 widget_value itself. */
97 Boolean free_toolkit_data;
98
99 /* we resource the widget_value structures; this points to the next
100 one on the free list if this one has been deallocated.
101 */
102 struct _widget_value *free_list;
103} widget_value;
104
105
dfdcaf49 106typedef void (*lw_callback) (/* Widget w, LWLIB_ID id, void* data */);
07bf635f 107
dfdcaf49
PR
108void lw_register_widget (/* char* type, char* name, LWLIB_ID id,
109 widget_value* val, lw_callback pre_activate_cb,
110 lw_callback selection_cb,
111 lw_callback post_activate_cb */);
112Widget lw_get_widget (/* LWLIB_ID id, Widget parent, Boolean pop_up_p */);
113Widget lw_make_widget (/* LWLIB_ID id, Widget parent, Boolean pop_up_p */);
114Widget lw_create_widget (/* char* type, char* name, LWLIB_ID id,
115 widget_value* val, Widget parent, Boolean pop_up_p,
116 lw_callback pre_activate_cb,
117 lw_callback selection_cb,
118 lw_callback post_activate_cb */);
119LWLIB_ID lw_get_widget_id (/* Widget w */);
23b4d91d 120int lw_modify_all_widgets (/* LWLIB_ID id, widget_value* val, Boolean deep_p */);
dfdcaf49
PR
121void lw_destroy_widget (/* Widget w */);
122void lw_destroy_all_widgets (/* LWLIB_ID id */);
123void lw_destroy_everything (/* void */);
124void lw_destroy_all_pop_ups (/* void */);
125Widget lw_raise_all_pop_up_widgets (/* void */);
126widget_value* lw_get_all_values (/* LWLIB_ID id */);
127Boolean lw_get_some_values (/* LWLIB_ID id, widget_value* val */);
128void lw_pop_up_all_widgets (/* LWLIB_ID id */);
129void lw_pop_down_all_widgets (/* LWLIB_ID id */);
07bf635f 130widget_value *malloc_widget_value ();
dfdcaf49
PR
131void free_widget_value (/* widget_value * */);
132void lw_popup_menu (/* Widget */);
07bf635f
RS
133
134/* Toolkit independent way of focusing on a Widget at the Xt level. */
dfdcaf49 135void lw_set_keyboard_focus (/* Widget parent, Widget w */);
07bf635f
RS
136
137/* Silly Energize hack to invert the "sheet" button */
dfdcaf49
PR
138void lw_show_busy (/* Widget w, Boolean busy */);
139
140/* Silly hack to assist with Lucid/Athena geometry management. */
908ff139 141void lw_refigure_widget (/* Widget w, Boolean doit */);
dfdcaf49
PR
142
143/* Toolkit independent way of determining if an event occurred on a
144 menubar. */
145Boolean lw_window_is_in_menubar (/* Window win, Widget menubar_widget */);
146
147/* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */
148void lw_allow_resizing (/* Widget w, Boolean flag */);
07bf635f 149
11bcd7d4
PR
150/* Set up the main window. */
151void lw_set_main_areas (/* Widget parent,
152 Widget menubar,
153 Widget work_area */);
154
cedccd2e
GM
155/* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is
156 set to an appropriate enumerator of type enum menu_separator.
157 MOTIF_P non-zero means map separator types not supported by Motif
158 to similar ones that are supported. */
159
160int lw_separator_p (/* char *label, enum menu_separator *type,
161 int motif_p */);
162
07bf635f 163#endif /* LWLIB_H */