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