auth-source.el (auth-source-debug): Enable by default and don't mention the obsolete...
[emacs.git] / lwlib / lwlib.h
blobcdd1e790efe1c59d82cce943de142dd4383561da
1 /*
2 Copyright (C) 1992, 1993 Lucid, Inc.
3 Copyright (C) 1994, 1999-2011 Free Software Foundation, Inc.
5 This file is part of the Lucid Widget Library.
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.
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.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
23 #ifndef LWLIB_H
24 #define LWLIB_H
26 #include <X11/Intrinsic.h>
29 ** Widget values depend on the Widget type:
31 ** widget: (name value key enabled data contents/selected)
33 ** label: ("name" "string" NULL NULL NULL NULL)
34 ** button: ("name" "string" "key" T/F data <default-button-p>)
35 ** button w/menu:
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)
44 ** main: ("name")
47 typedef unsigned long LWLIB_ID;
49 typedef enum _change_type
51 NO_CHANGE = 0,
52 INVISIBLE_CHANGE = 1,
53 VISIBLE_CHANGE = 2,
54 STRUCTURAL_CHANGE = 3
55 } change_type;
57 enum button_type
59 BUTTON_TYPE_NONE,
60 BUTTON_TYPE_TOGGLE,
61 BUTTON_TYPE_RADIO
64 /* Menu separator types. */
66 enum menu_separator
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,
79 /* The following are supported by Lucid menus. */
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
86 typedef struct _widget_value
88 /* name of widget */
89 Lisp_Object lname;
90 char* name;
91 /* value (meaning depend on widget type) */
92 char* value;
93 /* keyboard equivalent. no implications for XtTranslations */
94 Lisp_Object lkey;
95 char* key;
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;
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;
106 /* The type of a button. */
107 enum button_type button_type;
108 /* true if has changed (maintained by lw library) */
109 change_type change;
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;
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;
125 /* we resource the widget_value structures; this points to the next
126 one on the free list if this one has been deallocated.
128 struct _widget_value *free_list;
129 } widget_value;
132 typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data);
134 void lw_register_widget (const char* type, const char* name, LWLIB_ID id,
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);
139 Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
140 Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
141 Widget lw_create_widget (const char* type, const char* name, LWLIB_ID id,
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);
147 LWLIB_ID lw_get_widget_id (Widget w);
148 int lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p);
149 void lw_destroy_widget (Widget w);
150 void lw_destroy_all_widgets (LWLIB_ID id);
151 void lw_destroy_everything (void);
152 void lw_destroy_all_pop_ups (void);
153 Widget lw_raise_all_pop_up_widgets (void);
154 widget_value* lw_get_all_values (LWLIB_ID id);
155 Boolean lw_get_some_values (LWLIB_ID id, widget_value* val);
156 void lw_pop_up_all_widgets (LWLIB_ID id);
157 void lw_pop_down_all_widgets (LWLIB_ID id);
158 widget_value *malloc_widget_value (void);
159 void free_widget_value (widget_value *);
160 void lw_popup_menu (Widget, XEvent *);
162 /* Toolkit independent way of focusing on a Widget at the Xt level. */
163 void lw_set_keyboard_focus (Widget parent, Widget w);
165 /* Silly Energize hack to invert the "sheet" button */
166 void lw_show_busy (Widget w, Boolean busy);
168 /* Silly hack to assist with Lucid/Athena geometry management. */
169 void lw_refigure_widget (Widget w, Boolean doit);
171 /* Toolkit independent way of determining if an event occurred on a
172 menubar. */
173 Boolean lw_window_is_in_menubar (Window win, Widget menubar_widget);
175 /* Manage resizing: TRUE permits resizing widget w; FALSE disallows it. */
176 void lw_allow_resizing (Widget w, Boolean flag);
178 /* Set up the main window. */
179 void lw_set_main_areas (Widget parent,
180 Widget menubar,
181 Widget work_area);
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. */
188 int lw_separator_p (const char *label, enum menu_separator *type,
189 int motif_p);
191 #endif /* LWLIB_H */