462
|
1 /* I really wish this entire file could go away, but there is
|
|
2 currently no way to do the following in the Foreign Function
|
|
3 Interface:
|
|
4
|
|
5 1) Deal with return values in the parameter list (ie: int *foo)
|
|
6
|
|
7 So we have to code a few functions by hand. Ick.
|
|
8
|
|
9 William M. Perry 5/8/00
|
|
10 */
|
|
11
|
|
12 #include "gui.h"
|
|
13
|
|
14 DEFUN ("gtk-box-query-child-packing", Fgtk_box_query_child_packing, 2, 2,0, /*
|
|
15 Returns information about how CHILD is packed into BOX.
|
|
16 Return value is a list of (EXPAND FILL PADDING PACK_TYPE).
|
|
17 */
|
|
18 (box, child))
|
|
19 {
|
|
20 gboolean expand, fill;
|
|
21 guint padding;
|
|
22 GtkPackType pack_type;
|
|
23 Lisp_Object result = Qnil;
|
|
24
|
|
25 CHECK_GTK_OBJECT (box);
|
|
26 CHECK_GTK_OBJECT (child);
|
|
27
|
|
28 if (!GTK_IS_BOX (XGTK_OBJECT (box)->object))
|
|
29 {
|
563
|
30 wtaerror ("Object is not a GtkBox", box);
|
462
|
31 }
|
|
32
|
|
33 if (!GTK_IS_WIDGET (XGTK_OBJECT (child)->object))
|
|
34 {
|
563
|
35 wtaerror ("Child is not a GtkWidget", child);
|
462
|
36 }
|
|
37
|
|
38 gtk_box_query_child_packing (GTK_BOX (XGTK_OBJECT (box)->object),
|
|
39 GTK_WIDGET (XGTK_OBJECT (child)->object),
|
|
40 &expand, &fill, &padding, &pack_type);
|
|
41
|
|
42 result = Fcons (make_int (pack_type), result);
|
|
43 result = Fcons (make_int (padding), result);
|
|
44 result = Fcons (fill ? Qt : Qnil, result);
|
|
45 result = Fcons (expand ? Qt : Qnil, result);
|
|
46
|
|
47 return (result);
|
|
48 }
|
|
49
|
|
50 /* void gtk_button_box_get_child_size_default (gint *min_width, gint *min_height); */
|
|
51 DEFUN ("gtk-button-box-get-child-size-default",
|
|
52 Fgtk_button_box_get_child_size_default, 0, 0, 0, /*
|
|
53 Return a cons cell (WIDTH . HEIGHT) of the default button box child size.
|
|
54 */
|
|
55 ())
|
|
56 {
|
|
57 gint width, height;
|
|
58
|
|
59 gtk_button_box_get_child_size_default (&width, &height);
|
|
60
|
|
61 return (Fcons (make_int (width), make_int (height)));
|
|
62 }
|
|
63
|
|
64 /* void gtk_button_box_get_child_ipadding_default (gint *ipad_x, gint *ipad_y); */
|
|
65 DEFUN ("gtk-button-box-get-child-ipadding-default",
|
|
66 Fgtk_button_box_get_child_ipadding_default, 0, 0, 0, /*
|
|
67 Return a cons cell (X . Y) of the default button box ipadding.
|
|
68 */
|
|
69 ())
|
|
70 {
|
|
71 gint x, y;
|
|
72
|
|
73 gtk_button_box_get_child_ipadding_default (&x, &y);
|
|
74
|
|
75 return (Fcons (make_int (x), make_int (y)));
|
|
76 }
|
|
77
|
|
78 /* void gtk_button_box_get_child_size (GtkButtonBox *widget,
|
|
79 gint *min_width, gint *min_height); */
|
|
80 DEFUN ("gtk-button-box-get-child-size", Fgtk_button_box_get_child_size, 1, 1, 0, /*
|
|
81 Get the current size of a child in the buttonbox BOX.
|
|
82 */
|
|
83 (box))
|
|
84 {
|
|
85 gint width, height;
|
|
86
|
|
87 CHECK_GTK_OBJECT (box);
|
|
88
|
|
89 if (!GTK_IS_BUTTON_BOX (XGTK_OBJECT (box)->object))
|
|
90 {
|
563
|
91 wtaerror ("Not a GtkBox object", box);
|
462
|
92 }
|
|
93
|
|
94 gtk_button_box_get_child_size (GTK_BUTTON_BOX (XGTK_OBJECT (box)->object),
|
|
95 &width, &height);
|
|
96
|
|
97 return (Fcons (make_int (width), make_int (height)));
|
|
98 }
|
|
99
|
|
100 /* void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y); */
|
|
101 DEFUN ("gtk-button-box-get-child-ipadding",
|
|
102 Fgtk_button_box_get_child_ipadding, 1, 1, 0, /*
|
|
103 Return a cons cell (X . Y) of the current buttonbox BOX ipadding.
|
|
104 */
|
|
105 (box))
|
|
106 {
|
|
107 gint x, y;
|
|
108
|
|
109 CHECK_GTK_OBJECT (box);
|
|
110
|
|
111 if (!GTK_IS_BUTTON_BOX (XGTK_OBJECT (box)->object))
|
|
112 {
|
563
|
113 wtaerror ("Not a GtkBox object", box);
|
462
|
114 }
|
|
115
|
|
116 gtk_button_box_get_child_ipadding (GTK_BUTTON_BOX (XGTK_OBJECT (box)->object),
|
|
117 &x, &y);
|
|
118
|
|
119 return (Fcons (make_int (x), make_int (y)));
|
|
120 }
|
|
121
|
|
122 /*void gtk_calendar_get_date (GtkCalendar *calendar,
|
|
123 guint *year,
|
|
124 guint *month,
|
|
125 guint *day);
|
|
126 */
|
|
127 DEFUN ("gtk-calendar-get-date", Fgtk_calendar_get_date, 1, 1, 0, /*
|
|
128 Return a list of (YEAR MONTH DAY) from the CALENDAR object.
|
|
129 */
|
|
130 (calendar))
|
|
131 {
|
|
132 guint year, month, day;
|
|
133
|
|
134 CHECK_GTK_OBJECT (calendar);
|
|
135
|
|
136 if (!GTK_IS_CALENDAR (XGTK_OBJECT (calendar)->object))
|
|
137 {
|
563
|
138 wtaerror ("Not a GtkCalendar object", calendar);
|
462
|
139 }
|
|
140
|
|
141 gtk_calendar_get_date (GTK_CALENDAR (XGTK_OBJECT (calendar)->object),
|
|
142 &year, &month, &day);
|
|
143
|
|
144 return (list3 (make_int (year), make_int (month), make_int (day)));
|
|
145 }
|
|
146
|
|
147 /* gint gtk_clist_get_text (GtkCList *clist,
|
|
148 gint row,
|
|
149 gint column,
|
|
150 gchar **text);
|
|
151 */
|
|
152 DEFUN ("gtk-clist-get-text", Fgtk_clist_get_text, 3, 3, 0, /*
|
|
153 Returns the text from GtkCList OBJ cell at coordinates ROW, COLUMN.
|
|
154 */
|
|
155 (obj, row, column))
|
|
156 {
|
|
157 gchar *text = NULL;
|
|
158 Lisp_Object rval = Qnil;
|
|
159
|
|
160 CHECK_GTK_OBJECT (obj);
|
|
161 CHECK_INT (row);
|
|
162 CHECK_INT (column);
|
|
163
|
|
164 if (!GTK_IS_CLIST (XGTK_OBJECT (obj)->object))
|
|
165 {
|
563
|
166 wtaerror ("Object is not a GtkCList", obj);
|
462
|
167 }
|
|
168
|
|
169 gtk_clist_get_text (GTK_CLIST (XGTK_OBJECT (obj)->object), XINT (row), XINT (column), &text);
|
|
170
|
|
171 if (text)
|
|
172 {
|
|
173 rval = build_string (text);
|
|
174 /* NOTE: This is NOT a memory leak. GtkCList returns a pointer
|
|
175 to internally used memory, not a copy of it.
|
|
176 g_free (text);
|
|
177 */
|
|
178 }
|
|
179
|
|
180 return (rval);
|
|
181 }
|
|
182
|
|
183 /* gint gtk_clist_get_selection_info (GtkCList *clist,
|
|
184 gint x,
|
|
185 gint y,
|
|
186 gint *row,
|
|
187 gint *column); */
|
|
188 DEFUN ("gtk-clist-get-selection-info", Fgtk_clist_get_selection, 3, 3, 0, /*
|
|
189 Returns a cons cell of (ROW . COLUMN) of the GtkCList OBJ at coordinates X, Y.
|
|
190 */
|
|
191 (obj, x, y))
|
|
192 {
|
|
193 gint row, column;
|
|
194
|
|
195 CHECK_GTK_OBJECT (obj);
|
|
196 CHECK_INT (x);
|
|
197 CHECK_INT (y);
|
|
198
|
|
199 if (!GTK_IS_CLIST (XGTK_OBJECT (obj)->object))
|
|
200 {
|
563
|
201 wtaerror ("Object is not a GtkCList", obj);
|
462
|
202 }
|
|
203
|
|
204 gtk_clist_get_selection_info (GTK_CLIST (XGTK_OBJECT (obj)->object),
|
|
205 XINT (x), XINT (y), &row, &column);
|
|
206
|
|
207 return (Fcons (make_int (row), make_int (column)));
|
|
208 }
|
|
209
|
|
210 DEFUN ("gtk-clist-get-pixmap", Fgtk_clist_get_pixmap, 3, 3, 0, /*
|
|
211 Return a cons of (pixmap . mask) at ROW,COLUMN in CLIST.
|
|
212 */
|
|
213 (clist, row, column))
|
|
214 {
|
|
215 GdkPixmap *pixmap = NULL;
|
|
216 GdkBitmap *mask = NULL;
|
|
217
|
|
218 CHECK_GTK_OBJECT (clist);
|
|
219 CHECK_INT (row);
|
|
220 CHECK_INT (column);
|
|
221
|
|
222 if (!GTK_IS_CLIST (XGTK_OBJECT (clist)->object))
|
|
223 {
|
563
|
224 wtaerror ("Object is not a GtkCList", clist);
|
462
|
225 }
|
|
226
|
|
227 gtk_clist_get_pixmap (GTK_CLIST (XGTK_OBJECT (clist)->object),
|
|
228 XINT (row), XINT (column),
|
|
229 &pixmap, &mask);
|
|
230
|
|
231 return (Fcons (pixmap ? build_gtk_boxed (pixmap, GTK_TYPE_GDK_WINDOW) : Qnil,
|
|
232 mask ? build_gtk_boxed (mask, GTK_TYPE_GDK_WINDOW) : Qnil));
|
|
233 }
|
|
234
|
|
235 DEFUN ("gtk-clist-get-pixtext", Fgtk_clist_get_pixtext, 3, 3, 0, /*
|
|
236 Return a list of (pixmap mask text) at ROW,COLUMN in CLIST.
|
|
237 */
|
|
238 (clist, row, column))
|
|
239 {
|
|
240 GdkPixmap *pixmap = NULL;
|
|
241 GdkBitmap *mask = NULL;
|
|
242 char *text = NULL;
|
|
243 guint8 spacing;
|
|
244
|
|
245 CHECK_GTK_OBJECT (clist);
|
|
246 CHECK_INT (row);
|
|
247 CHECK_INT (column);
|
|
248
|
|
249 if (!GTK_IS_CLIST (XGTK_OBJECT (clist)->object))
|
|
250 {
|
563
|
251 wtaerror ("Object is not a GtkCList", clist);
|
462
|
252 }
|
|
253
|
|
254 gtk_clist_get_pixtext (GTK_CLIST (XGTK_OBJECT (clist)->object),
|
|
255 XINT (row), XINT (column), &text, &spacing,
|
|
256 &pixmap, &mask);
|
|
257
|
|
258 return (list3 (pixmap ? build_gtk_boxed (pixmap, GTK_TYPE_GDK_WINDOW) : Qnil,
|
|
259 mask ? build_gtk_boxed (mask, GTK_TYPE_GDK_WINDOW) : Qnil,
|
|
260 (text && text[0]) ? build_string (text) : Qnil));
|
|
261 }
|
|
262
|
|
263 /* void gtk_color_selection_get_color(GtkColorSelection *colorsel, gdouble *color); */
|
|
264 DEFUN ("gtk-color-selection-get-color", Fgtk_color_selection_get_color, 1, 1, 0, /*
|
|
265 Return a list of (RED GREEN BLUE ALPHA) from the GtkColorSelection OBJECT.
|
|
266 */
|
|
267 (object))
|
|
268 {
|
|
269 gdouble rgba[4];
|
|
270
|
|
271 CHECK_GTK_OBJECT (object);
|
|
272
|
|
273 if (!GTK_IS_COLOR_SELECTION (XGTK_OBJECT (object)->object))
|
|
274 {
|
563
|
275 wtaerror ("Object is not a GtkColorSelection", object);
|
462
|
276 }
|
|
277
|
|
278 gtk_color_selection_get_color (GTK_COLOR_SELECTION (XGTK_OBJECT (object)), rgba);
|
|
279
|
|
280 return (list4 (make_float (rgba[0]),
|
|
281 make_float (rgba[1]),
|
|
282 make_float (rgba[2]),
|
|
283 make_float (rgba[3])));
|
|
284 }
|
|
285
|
|
286 /* (gtk-import-function nil "gtk_editable_insert_text" 'GtkEditable 'GtkString 'gint 'pointer-to-gint) */
|
|
287 DEFUN ("gtk-editable-insert-text", Fgtk_editable_insert_text, 3, 3, 0, /*
|
|
288 Insert text STRINT at POS in GtkEditable widget OBJ.
|
|
289 Returns the new position of the cursor in the widget.
|
|
290 */
|
|
291 (obj, string, pos))
|
|
292 {
|
|
293 gint the_pos;
|
|
294
|
|
295 CHECK_GTK_OBJECT (obj);
|
|
296 CHECK_STRING (string);
|
|
297 CHECK_INT (pos);
|
|
298
|
|
299 the_pos = XINT (pos);
|
|
300
|
|
301 if (!GTK_IS_EDITABLE (XGTK_OBJECT (obj)->object))
|
|
302 {
|
563
|
303 wtaerror ("Object is not a GtkEditable", obj);
|
462
|
304 }
|
|
305
|
|
306 gtk_editable_insert_text (GTK_EDITABLE (XGTK_OBJECT (obj)->object),
|
|
307 (char *) XSTRING_DATA (string),
|
|
308 XSTRING_LENGTH (string),
|
|
309 &the_pos);
|
|
310
|
|
311 return (make_int (the_pos));
|
|
312 }
|
|
313
|
|
314 DEFUN ("gtk-pixmap-get", Fgtk_pixmap_get, 1, 1, 0, /*
|
|
315 Return a cons cell of (PIXMAP . MASK) from GtkPixmap OBJECT.
|
|
316 */
|
|
317 (object))
|
|
318 {
|
|
319 GdkPixmap *pixmap, *mask;
|
|
320
|
|
321 CHECK_GTK_OBJECT (object);
|
|
322
|
|
323 if (!GTK_IS_PIXMAP (XGTK_OBJECT (object)->object))
|
|
324 {
|
563
|
325 wtaerror ("Object is not a GtkPixmap", object);
|
462
|
326 }
|
|
327
|
|
328 gtk_pixmap_get (GTK_PIXMAP (XGTK_OBJECT (object)->object), &pixmap, &mask);
|
|
329
|
|
330 return (Fcons (pixmap ? build_gtk_object (GTK_OBJECT (pixmap)) : Qnil,
|
|
331 mask ? build_gtk_object (GTK_OBJECT (mask)) : Qnil));
|
|
332 }
|
|
333
|
|
334 DEFUN ("gtk-curve-get-vector", Fgtk_curve_get_vector, 2, 2, 0, /*
|
|
335 Returns a vector of LENGTH points representing the curve of CURVE.
|
|
336 */
|
|
337 (curve, length))
|
|
338 {
|
|
339 gfloat *vector = NULL;
|
|
340 Lisp_Object lisp_vector = Qnil;
|
|
341 int i;
|
|
342
|
|
343 CHECK_GTK_OBJECT (curve);
|
|
344 CHECK_INT (length);
|
|
345
|
|
346 if (!GTK_IS_CURVE (XGTK_OBJECT (curve)->object))
|
|
347 {
|
563
|
348 wtaerror ("Object is not a GtkCurve", curve);
|
462
|
349 }
|
|
350
|
|
351 vector = (gfloat *) alloca (sizeof (gfloat) * XINT (length));
|
|
352
|
|
353 gtk_curve_get_vector (GTK_CURVE (XGTK_OBJECT (curve)->object), XINT (length), vector);
|
|
354 lisp_vector = make_vector (XINT (length), Qnil);
|
|
355
|
|
356 for (i = 0; i < XINT (length); i++)
|
|
357 {
|
|
358 XVECTOR_DATA (lisp_vector)[i] = make_float (vector[i]);
|
|
359 }
|
|
360
|
|
361 return (lisp_vector);
|
|
362 }
|
|
363
|
|
364 DEFUN ("gtk-curve-set-vector", Fgtk_curve_set_vector, 2, 2, 0, /*
|
|
365 Set the vector of points on CURVE to VECTOR.
|
|
366 */
|
|
367 (curve, vector))
|
|
368 {
|
|
369 gfloat *c_vector = NULL;
|
|
370 int vec_length = 0;
|
|
371 int i;
|
|
372
|
|
373 CHECK_GTK_OBJECT (curve);
|
|
374 CHECK_VECTOR (vector);
|
|
375
|
|
376 vec_length = XVECTOR_LENGTH (vector);
|
|
377
|
|
378 if (!GTK_IS_CURVE (XGTK_OBJECT (curve)->object))
|
|
379 {
|
563
|
380 wtaerror ("Object is not a GtkCurve", curve);
|
462
|
381 }
|
|
382
|
|
383 c_vector = (gfloat *) alloca (sizeof (gfloat) * vec_length);
|
|
384
|
|
385 for (i = 0; i < vec_length; i++)
|
|
386 {
|
|
387 CHECK_FLOAT (XVECTOR_DATA (vector)[i]);
|
|
388 c_vector[i] = extract_float (XVECTOR_DATA (vector)[i]);
|
|
389 }
|
|
390
|
|
391 gtk_curve_set_vector (GTK_CURVE (XGTK_OBJECT (curve)->object), vec_length, c_vector);
|
|
392 return (Qt);
|
|
393 }
|
|
394
|
|
395 DEFUN ("gtk-label-get", Fgtk_label_get, 1, 1, 0, /*
|
|
396 Return the text of LABEL.
|
|
397 */
|
|
398 (label))
|
|
399 {
|
|
400 gchar *string;
|
|
401
|
|
402 CHECK_GTK_OBJECT (label);
|
|
403
|
|
404 if (!GTK_IS_LABEL (XGTK_OBJECT (label)->object))
|
|
405 {
|
563
|
406 wtaerror ("Object is not a GtkLabel", label);
|
462
|
407 }
|
|
408
|
|
409 gtk_label_get (GTK_LABEL (XGTK_OBJECT (label)->object), &string);
|
|
410
|
|
411 return (build_string (string));
|
|
412 }
|
|
413
|
|
414 DEFUN ("gtk-notebook-query-tab-label-packing", Fgtk_notebook_query_tab_label_packing, 2, 2, 0, /*
|
|
415 Return a list of packing information (EXPAND FILL PACK_TYPE) for CHILD in NOTEBOOK.
|
|
416 */
|
|
417 (notebook, child))
|
|
418 {
|
|
419 gboolean expand, fill;
|
|
420 GtkPackType pack_type;
|
|
421
|
|
422 CHECK_GTK_OBJECT (notebook);
|
|
423 CHECK_GTK_OBJECT (child);
|
|
424
|
|
425 if (!GTK_IS_NOTEBOOK (XGTK_OBJECT (notebook)->object))
|
|
426 {
|
563
|
427 wtaerror ("Object is not a GtkLabel", notebook);
|
462
|
428 }
|
|
429
|
|
430 if (!GTK_IS_WIDGET (XGTK_OBJECT (child)->object))
|
|
431 {
|
563
|
432 wtaerror ("Object is not a GtkWidget", child);
|
462
|
433 }
|
|
434
|
|
435 gtk_notebook_query_tab_label_packing (GTK_NOTEBOOK (XGTK_OBJECT (notebook)->object),
|
|
436 GTK_WIDGET (XGTK_OBJECT (child)->object),
|
|
437 &expand, &fill, &pack_type);
|
|
438
|
|
439 return (list3 (expand ? Qt : Qnil, fill ? Qt : Qnil, make_int (pack_type)));
|
|
440 }
|
|
441
|
|
442 DEFUN ("gtk-widget-get-pointer", Fgtk_widget_get_pointer, 1, 1, 0, /*
|
|
443 Return the pointer position relative to WIDGET as a cons of (X . Y).
|
|
444 */
|
|
445 (widget))
|
|
446 {
|
|
447 gint x,y;
|
|
448 CHECK_GTK_OBJECT (widget);
|
|
449
|
|
450 if (!GTK_IS_WIDGET (XGTK_OBJECT (widget)->object))
|
|
451 {
|
563
|
452 wtaerror ("Object is not a GtkWidget", widget);
|
462
|
453 }
|
|
454
|
|
455 gtk_widget_get_pointer (GTK_WIDGET (XGTK_OBJECT (widget)->object), &x, &y);
|
|
456
|
|
457 return (Fcons (make_int (x), make_int (y)));
|
|
458 }
|
|
459
|
|
460 /* This is called whenever an item with a GUI_ID associated with it is
|
|
461 destroyed. This allows us to remove the references in gui-gtk.c
|
|
462 that made sure callbacks and such were GCPRO-ed
|
|
463 */
|
|
464 static void
|
|
465 __remove_gcpro_by_id (gpointer user_data)
|
|
466 {
|
|
467 ungcpro_popup_callbacks ((GUI_ID) user_data);
|
|
468 }
|
|
469
|
|
470 static void
|
|
471 __generic_toolbar_callback (GtkWidget *item, gpointer user_data)
|
|
472 {
|
|
473 Lisp_Object callback;
|
|
474 Lisp_Object lisp_user_data;
|
|
475
|
826
|
476 callback = VOID_TO_LISP (user_data);
|
462
|
477
|
|
478 lisp_user_data = XCAR (callback);
|
|
479 callback = XCDR (callback);
|
|
480
|
|
481 signal_special_gtk_user_event (Qnil, callback, lisp_user_data);
|
|
482 }
|
|
483
|
|
484 static Lisp_Object
|
|
485 generic_toolbar_insert_item (Lisp_Object toolbar,
|
|
486 Lisp_Object text,
|
|
487 Lisp_Object tooltip_text,
|
|
488 Lisp_Object tooltip_private_text,
|
|
489 Lisp_Object icon,
|
|
490 Lisp_Object callback,
|
|
491 Lisp_Object data,
|
|
492 Lisp_Object prepend_p,
|
|
493 Lisp_Object position)
|
|
494 {
|
|
495 GUI_ID id;
|
|
496 GtkWidget *w = NULL;
|
|
497
|
|
498 CHECK_GTK_OBJECT (toolbar);
|
|
499 CHECK_GTK_OBJECT (icon);
|
|
500 CHECK_STRING (text);
|
|
501 CHECK_STRING (tooltip_text);
|
|
502 CHECK_STRING (tooltip_private_text);
|
|
503
|
|
504 if (!SYMBOLP (callback) && !LISTP (callback))
|
|
505 {
|
563
|
506 wtaerror ("Callback must be symbol or eval-able form", callback);
|
462
|
507 }
|
|
508
|
|
509 if (!GTK_IS_TOOLBAR (XGTK_OBJECT (toolbar)->object))
|
|
510 {
|
563
|
511 wtaerror ("Object is not a GtkToolbar", toolbar);
|
462
|
512 }
|
|
513
|
|
514 if (!GTK_IS_WIDGET (XGTK_OBJECT (icon)->object))
|
|
515 {
|
563
|
516 wtaerror ("Object is not a GtkWidget", icon);
|
462
|
517 }
|
|
518
|
|
519 callback = Fcons (data, callback);
|
|
520
|
|
521 id = new_gui_id ();
|
|
522 gcpro_popup_callbacks (id, callback);
|
|
523 gtk_object_weakref (XGTK_OBJECT (toolbar)->object, __remove_gcpro_by_id,
|
|
524 (gpointer) id);
|
|
525
|
|
526 if (NILP (position))
|
|
527 {
|
|
528 w = (NILP (prepend_p) ? gtk_toolbar_append_item : gtk_toolbar_prepend_item)
|
|
529 (GTK_TOOLBAR (XGTK_OBJECT (toolbar)->object),
|
|
530 XSTRING_DATA (text),
|
|
531 XSTRING_DATA (tooltip_text),
|
|
532 XSTRING_DATA (tooltip_private_text),
|
|
533 GTK_WIDGET (XGTK_OBJECT (icon)->object),
|
|
534 GTK_SIGNAL_FUNC (__generic_toolbar_callback),
|
|
535 LISP_TO_VOID (callback));
|
|
536 }
|
|
537 else
|
|
538 {
|
|
539 w = gtk_toolbar_insert_item (GTK_TOOLBAR (XGTK_OBJECT (toolbar)->object),
|
|
540 XSTRING_DATA (text),
|
|
541 XSTRING_DATA (tooltip_text),
|
|
542 XSTRING_DATA (tooltip_private_text),
|
|
543 GTK_WIDGET (XGTK_OBJECT (icon)->object),
|
|
544 GTK_SIGNAL_FUNC (__generic_toolbar_callback),
|
|
545 LISP_TO_VOID (callback),
|
|
546 XINT (position));
|
|
547 }
|
|
548
|
|
549
|
|
550 return (w ? build_gtk_object (GTK_OBJECT (w)) : Qnil);
|
|
551 }
|
|
552
|
|
553 DEFUN ("gtk-toolbar-append-item", Fgtk_toolbar_append_item, 6, 7, 0, /*
|
|
554 Appends a new button to the given toolbar.
|
|
555 */
|
|
556 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, data))
|
|
557 {
|
|
558 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qnil,Qnil));
|
|
559 }
|
|
560
|
|
561 DEFUN ("gtk-toolbar-prepend-item", Fgtk_toolbar_prepend_item, 6, 7, 0, /*
|
|
562 Adds a new button to the beginning (left or top edges) of the given toolbar.
|
|
563 */
|
|
564 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, data))
|
|
565 {
|
|
566 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qt,Qnil));
|
|
567 }
|
|
568
|
|
569 DEFUN ("gtk-toolbar-insert-item", Fgtk_toolbar_insert_item, 7, 8, 0, /*
|
|
570 Adds a new button to the beginning (left or top edges) of the given toolbar.
|
|
571 */
|
|
572 (toolbar, text, tooltip_text, tooltip_private_text, icon, callback, position, data))
|
|
573 {
|
|
574 CHECK_INT (position);
|
|
575
|
|
576 return (generic_toolbar_insert_item (toolbar,text,tooltip_text,tooltip_private_text,icon,callback,data,Qnil,position));
|
|
577 }
|
|
578
|
|
579 /* GtkCTree is an abomination in the eyes of the object system. */
|
|
580 static void
|
|
581 __emacs_gtk_ctree_recurse_internal (GtkCTree *ctree, GtkCTreeNode *node, gpointer user_data)
|
|
582 {
|
|
583 Lisp_Object closure;
|
|
584
|
826
|
585 closure = VOID_TO_LISP (user_data);
|
462
|
586
|
|
587 call3 (XCAR (closure),
|
|
588 build_gtk_object (GTK_OBJECT (ctree)),
|
|
589 build_gtk_boxed (node, GTK_TYPE_CTREE_NODE),
|
|
590 XCDR (closure));
|
|
591 }
|
|
592
|
|
593 DEFUN ("gtk-ctree-recurse", Fgtk_ctree_recurse, 3, 6, 0, /*
|
|
594 Recursively apply FUNC to all nodes of CTREE at or below NODE.
|
|
595 FUNC is called with three arguments: CTREE, a GtkCTreeNode, and DATA.
|
|
596 The return value of FUNC is ignored.
|
|
597
|
|
598 If optional 5th argument CHILDFIRSTP is non-nil, then
|
|
599 the function is called for each node after it has been
|
|
600 called for that node's children.
|
|
601
|
|
602 Optional 6th argument DEPTH limits how deeply to recurse.
|
|
603
|
|
604 This function encompasses all the following Gtk functions:
|
|
605
|
|
606 void gtk_ctree_post_recursive (GtkCTree *ctree,
|
|
607 GtkCTreeNode *node,
|
|
608 GtkCTreeFunc func,
|
|
609 gpointer data);
|
|
610 void gtk_ctree_post_recursive_to_depth (GtkCTree *ctree,
|
|
611 GtkCTreeNode *node,
|
|
612 gint depth,
|
|
613 GtkCTreeFunc func,
|
|
614 gpointer data);
|
|
615 void gtk_ctree_pre_recursive (GtkCTree *ctree,
|
|
616 GtkCTreeNode *node,
|
|
617 GtkCTreeFunc func,
|
|
618 gpointer data);
|
|
619 void gtk_ctree_pre_recursive_to_depth (GtkCTree *ctree,
|
|
620 GtkCTreeNode *node,
|
|
621 gint depth,
|
|
622 GtkCTreeFunc func,
|
|
623 gpointer data);
|
|
624 */
|
|
625 (ctree, node, func, data, childfirstp, depth))
|
|
626 {
|
|
627 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
628 Lisp_Object closure = Qnil;
|
|
629
|
|
630 CHECK_GTK_OBJECT (ctree);
|
|
631
|
|
632 if (!NILP (node))
|
|
633 {
|
|
634 CHECK_GTK_BOXED (node);
|
|
635 }
|
|
636
|
|
637 if (!NILP (depth))
|
|
638 {
|
|
639 CHECK_INT (depth);
|
|
640 }
|
|
641
|
|
642 closure = Fcons (func, data);
|
|
643
|
|
644 GCPRO3 (ctree, node, closure);
|
|
645
|
|
646 if (NILP (depth))
|
|
647 {
|
|
648 (NILP (childfirstp) ? gtk_ctree_post_recursive : gtk_ctree_pre_recursive)
|
|
649 (GTK_CTREE (XGTK_OBJECT (ctree)->object),
|
|
650 NILP (node) ? NULL : (GtkCTreeNode *) XGTK_BOXED (node)->object,
|
|
651 __emacs_gtk_ctree_recurse_internal,
|
|
652 LISP_TO_VOID (closure));
|
|
653 }
|
|
654 else
|
|
655 {
|
|
656 (NILP (childfirstp) ? gtk_ctree_post_recursive_to_depth : gtk_ctree_pre_recursive_to_depth)
|
|
657 (GTK_CTREE (XGTK_OBJECT (ctree)->object),
|
|
658 NILP (node) ? NULL : (GtkCTreeNode *) XGTK_BOXED (node)->object,
|
|
659 XINT (depth),
|
|
660 __emacs_gtk_ctree_recurse_internal,
|
|
661 LISP_TO_VOID (closure));
|
|
662 }
|
|
663
|
|
664 UNGCPRO;
|
|
665 return (Qnil);
|
|
666 }
|
|
667
|
|
668 void syms_of_ui_byhand (void)
|
|
669 {
|
|
670 DEFSUBR (Fgtk_toolbar_append_item);
|
|
671 DEFSUBR (Fgtk_toolbar_insert_item);
|
|
672 DEFSUBR (Fgtk_toolbar_prepend_item);
|
|
673 DEFSUBR (Fgtk_box_query_child_packing);
|
|
674 DEFSUBR (Fgtk_button_box_get_child_size_default);
|
|
675 DEFSUBR (Fgtk_button_box_get_child_ipadding_default);
|
|
676 DEFSUBR (Fgtk_button_box_get_child_size);
|
|
677 DEFSUBR (Fgtk_button_box_get_child_ipadding);
|
|
678 DEFSUBR (Fgtk_calendar_get_date);
|
|
679 DEFSUBR (Fgtk_clist_get_text);
|
|
680 DEFSUBR (Fgtk_clist_get_selection);
|
|
681 DEFSUBR (Fgtk_clist_get_pixmap);
|
|
682 DEFSUBR (Fgtk_clist_get_pixtext);
|
|
683 DEFSUBR (Fgtk_color_selection_get_color);
|
|
684 DEFSUBR (Fgtk_editable_insert_text);
|
|
685 DEFSUBR (Fgtk_pixmap_get);
|
|
686 DEFSUBR (Fgtk_curve_get_vector);
|
|
687 DEFSUBR (Fgtk_curve_set_vector);
|
|
688 DEFSUBR (Fgtk_label_get);
|
|
689 DEFSUBR (Fgtk_notebook_query_tab_label_packing);
|
|
690 DEFSUBR (Fgtk_widget_get_pointer);
|
|
691 DEFSUBR (Fgtk_ctree_recurse);
|
|
692 }
|