comparison lwlib/lwlib.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 1f50e6fe4f3f
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
1 #ifndef LWLIB_H 1 #ifndef INCLUDED_lwlib_h_
2 #define LWLIB_H 2 #define INCLUDED_lwlib_h_
3
4 #undef CONST
5 3
6 #include <X11/Intrinsic.h> 4 #include <X11/Intrinsic.h>
7
8 /* To eliminate use of `const' in the lwlib sources, define CONST_IS_LOSING. */
9 #ifdef CONST_IS_LOSING
10 # define CONST
11 #else
12 # define CONST const
13 #endif
14 5
15 #if defined (LWLIB_MENUBARS_LUCID) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_MENUBARS_ATHENA) 6 #if defined (LWLIB_MENUBARS_LUCID) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_MENUBARS_ATHENA)
16 #define NEED_MENUBARS 7 #define NEED_MENUBARS
17 #endif 8 #endif
18 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_ATHENA) 9 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_ATHENA)
103 int slider_position; 94 int slider_position;
104 95
105 int scrollbar_width, scrollbar_height; 96 int scrollbar_width, scrollbar_height;
106 int scrollbar_x, scrollbar_y; 97 int scrollbar_x, scrollbar_y;
107 } scrollbar_values; 98 } scrollbar_values;
99
100 typedef struct _widget_args
101 {
102 /* some things are only possible at creation time. args are applied
103 to widgets at creation time. */
104 ArgList args;
105 int nargs;
106 /* Copying args is impossible so we make the caller give us heap allocated
107 args and free them when on-one wants them any more. */
108 int ref_count;
109 } widget_args;
108 110
109 typedef struct _widget_value 111 typedef struct _widget_value
110 { 112 {
111 /* This slot is only partially utilized right now. */ 113 /* This slot is only partially utilized right now. */
112 widget_value_type type; 114 widget_value_type type;
145 Boolean free_toolkit_data; 147 Boolean free_toolkit_data;
146 148
147 /* data defining a scrollbar; only valid if type == "scrollbar" */ 149 /* data defining a scrollbar; only valid if type == "scrollbar" */
148 scrollbar_values *scrollbar_data; 150 scrollbar_values *scrollbar_data;
149 151
152 /* A reference counted arg structure. */
153 struct _widget_args *args;
150 /* we resource the widget_value structures; this points to the next 154 /* we resource the widget_value structures; this points to the next
151 one on the free list if this one has been deallocated. 155 one on the free list if this one has been deallocated. */
152 */
153 struct _widget_value *free_list; 156 struct _widget_value *free_list;
157
154 } widget_value; 158 } widget_value;
155 159
156 160
157 typedef void (*lw_callback) (Widget w, LWLIB_ID id, XtPointer data); 161 typedef void (*lw_callback) (Widget w, LWLIB_ID id, XtPointer data);
158 162
174 #define lw_menu_level xlw_menu_level 178 #define lw_menu_level xlw_menu_level
175 #else /* LWLIB_MENUBARS_LUCID */ 179 #else /* LWLIB_MENUBARS_LUCID */
176 /* do this for the other toolkits too */ 180 /* do this for the other toolkits too */
177 #endif /* LWLIB_MENUBARS_LUCID */ 181 #endif /* LWLIB_MENUBARS_LUCID */
178 182
179 void lw_register_widget (CONST char* type, CONST char* name, LWLIB_ID id, 183 #if defined (LWLIB_TABS_LUCID)
184 #include "xlwtabs.h"
185 #endif
186
187 void lw_register_widget (const char* type, const char* name, LWLIB_ID id,
180 widget_value* val, lw_callback pre_activate_cb, 188 widget_value* val, lw_callback pre_activate_cb,
181 lw_callback selection_cb, 189 lw_callback selection_cb,
182 lw_callback post_activate_cb); 190 lw_callback post_activate_cb);
183 Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); 191 Widget lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
184 Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p); 192 Widget lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p);
185 Widget lw_create_widget (CONST char* type, CONST char* name, LWLIB_ID id, 193 Widget lw_create_widget (const char* type, const char* name, LWLIB_ID id,
186 widget_value* val, Widget parent, Boolean pop_up_p, 194 widget_value* val, Widget parent, Boolean pop_up_p,
187 lw_callback pre_activate_cb, 195 lw_callback pre_activate_cb,
188 lw_callback selection_cb, 196 lw_callback selection_cb,
189 lw_callback post_activate_cb); 197 lw_callback post_activate_cb);
190 LWLIB_ID lw_get_widget_id (Widget w); 198 LWLIB_ID lw_get_widget_id (Widget w);
199 Widget lw_raise_all_pop_up_widgets (void); 207 Widget lw_raise_all_pop_up_widgets (void);
200 widget_value* lw_get_all_values (LWLIB_ID id); 208 widget_value* lw_get_all_values (LWLIB_ID id);
201 Boolean lw_get_some_values (LWLIB_ID id, widget_value* val); 209 Boolean lw_get_some_values (LWLIB_ID id, widget_value* val);
202 void lw_pop_up_all_widgets (LWLIB_ID id); 210 void lw_pop_up_all_widgets (LWLIB_ID id);
203 void lw_pop_down_all_widgets (LWLIB_ID id); 211 void lw_pop_down_all_widgets (LWLIB_ID id);
212 void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset);
213 void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value);
214 void lw_copy_widget_value_args (widget_value* copy, widget_value* val);
204 215
205 widget_value *malloc_widget_value (void); 216 widget_value *malloc_widget_value (void);
206 void free_widget_value (widget_value *); 217 void free_widget_value (widget_value *);
218 void free_widget_value_tree (widget_value *wv);
207 widget_value *replace_widget_value_tree (widget_value*, widget_value*); 219 widget_value *replace_widget_value_tree (widget_value*, widget_value*);
208 220
209 void lw_popup_menu (Widget, XEvent *); 221 void lw_popup_menu (Widget, XEvent *);
210 222
211 /* Toolkit independent way of focusing on a Widget at the Xt level. */ 223 /* Toolkit independent way of focusing on a Widget at the Xt level. */
212 void lw_set_keyboard_focus (Widget parent, Widget w); 224 void lw_set_keyboard_focus (Widget parent, Widget w);
213 225
214 /* Silly Energize hack to invert the "sheet" button */ 226 /* Silly Energize hack to invert the "sheet" button */
215 void lw_show_busy (Widget w, Boolean busy); 227 void lw_show_busy (Widget w, Boolean busy);
216 228
217 #endif /* LWLIB_H */ 229 #endif /* INCLUDED_lwlib_h_ */