Inhibit compiler warnings
[clg] / gtk / gtk.lisp
CommitLineData
560af5c5 1;; Common Lisp bindings for GTK+ v2.0
bbaeff4b 2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
560af5c5 3;;
4;; This library is free software; you can redistribute it and/or
5;; modify it under the terms of the GNU Lesser General Public
6;; License as published by the Free Software Foundation; either
7;; version 2 of the License, or (at your option) any later version.
8;;
9;; This library is distributed in the hope that it will be useful,
10;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12;; Lesser General Public License for more details.
13;;
14;; You should have received a copy of the GNU Lesser General Public
15;; License along with this library; if not, write to the Free Software
16;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
53fdee00 18;; $Id: gtk.lisp,v 1.8 2002-03-24 13:28:22 espen Exp $
560af5c5 19
20
21(in-package "GTK")
22
23;;; Gtk version
24
bbaeff4b 25(defbinding check-version () string
560af5c5 26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
29
bbaeff4b 30(defbinding query-version () nil
560af5c5 31 (major unsigned-int :out)
32 (minor unsigned-int :out)
33 (micro unsigned-int :out))
34
35(defun gtk-version ()
36 (multiple-value-bind (major minor micro)
37 (query-version)
38 (if (zerop micro)
39 (format nil "Gtk+ v~A.~A" major minor)
40 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
41
0f476ab5 42(defbinding get-default-language () string)
560af5c5 43
44
0f476ab5 45;;; Acccel group
560af5c5 46
47
48;;; Acccel label
49
bbaeff4b 50(defbinding accel-label-refetch () boolean
560af5c5 51 (accel-label accel-label))
52
53
0f476ab5 54;;; Adjustment
560af5c5 55
0f476ab5 56(defbinding adjustment-changed () nil
57 (adjustment adjustment))
58
59(defbinding adjustment-value-changed () nil
60 (adjustment adjustment))
61
62(defbinding adjustment-clamp-page () nil
63 (adjustment adjustment)
64 (lower single-float)
65 (upper single-float))
560af5c5 66
0f476ab5 67
68
69;;; Alignment -- no functions
70;;; Arrow -- no functions
71
72
73
74;;; Aspect frame
75
76
77;;; Bin
560af5c5 78
53fdee00 79(progn
80 (declaim (optimize (ext:inhibit-warnings 3)))
81 (defun container-remove (container child))
82 (defun container-add (container child)))
83
84
560af5c5 85(defun (setf bin-child) (child bin)
0f476ab5 86 (when-bind (current-child (bin-child bin))
87 (container-remove bin current-child))
560af5c5 88 (container-add bin child)
89 child)
90
f36ca6af 91
0f476ab5 92
93;;; Button box -- no functions
94
95
96;;; Binding
97
98
99
100;;; Box
101
102(defbinding box-pack-start () nil
103 (box box)
104 (child widget)
105 (expand boolean)
106 (fill boolean)
107 (padding unsigned-int))
108
109(defbinding box-pack-end () nil
110 (box box)
111 (child widget)
112 (expand boolean)
113 (fill boolean)
114 (padding unsigned-int))
115
116(defun box-pack (box child &key (pack :start) (expand t) (fill t) (padding 0))
117 (if (eq pack :start)
118 (box-pack-start box child expand fill padding)
119 (box-pack-end box child expand fill padding)))
120
121(defbinding box-reorder-child () nil
122 (box box)
123 (child widget)
124 (position int))
125
126(defbinding box-query-child-packing () nil
127 (box box)
128 (child widget)
129 (expand boolean :out)
130 (fill boolean :out)
131 (padding unsigned-int :out)
132 (pack-type pack-type :out))
133
134(defbinding box-set-child-packing () nil
135 (box box)
136 (child widget)
137 (expand boolean)
138 (fill boolean)
139 (padding unsigned-int)
140 (pack-type pack-type))
141
142
143
560af5c5 144;;; Button
145
bbaeff4b 146(defbinding button-pressed () nil
560af5c5 147 (button button))
148
0f476ab5 149(defbinding button-released () nil
150 (button button))
151
152(defbinding button-clicked () nil
153 (button button))
154
155(defbinding button-enter () nil
156 (button button))
157
158(defbinding button-leave () nil
159 (button button))
160
161
162
163;;; Calendar
164
165(defbinding calendar-select-month () int
166 (calendar calendar)
167 (month unsigned-int)
168 (year unsigned-int))
169
170(defbinding calendar-select-day () nil
171 (calendar calendar)
172 (day unsigned-int))
173
174(defbinding calendar-mark-day () int
175 (calendar calendar)
176 (day unsigned-int))
177
178(defbinding calendar-unmark-day () int
179 (calendar calendar)
180 (day unsigned-int))
181
182(defbinding calendar-clear-marks () nil
183 (calendar calendar))
184
185(defbinding calendar-display-options () nil
186 (calendar calendar)
187 (options calendar-display-options))
188
189(defbinding (calendar-date "gtk_calendar_get_date") () nil
190 (calendar calendar)
191 (year unsigned-int :out)
192 (month unsigned-int :out)
193 (day unsigned-int :out))
194
195(defbinding calendar-freeze () nil
196 (calendar calendar))
197
198(defbinding calendar-thaw () nil
199 (calendar calendar))
200
201
202
203;;; Cell editable
204
205
206
207;;; Cell renderer
208
209
210
211;;; Cell renderer pixbuf -- no functions
212
213
214
215;;; Cell renderer text
216
217
218
219;;; Cell renderer toggle -- no functions
220
221
222
223;;; Check button -- no functions
224
225
226
227;;; Check menu item
228
229(defbinding check-menu-item-toggled () nil
230 (check-menu-item check-menu-item))
231
232
233
234;;; Clipboard
235
236
237;;; Color selection
238
239(defbinding (color-selection-is-adjusting-p
240 "gtk_color_selection_is_adjusting") () boolean
241 (colorsel color-selection))
242
243
244
245;;; Color selection dialog -- no functions
246
247
248
249;;; Combo
250
251(defbinding combo-set-value-in-list () nil
252 (combo combo)
253 (value boolean)
254 (ok-if-empty boolean))
255
256(defbinding combo-set-item-string () nil
257 (combo combo)
258 (item item)
259 (item-value string))
260
261(defbinding combo-set-popdown-strings () nil
262 (combo combo)
263 (strings (glist string)))
264
265(defbinding combo-disable-activate () nil
266 (combo combo))
267
268
269
270;;; Dialog
271
272(defmethod initialize-instance ((dialog dialog) &rest initargs)
273 (apply #'call-next-method dialog (plist-remove initargs :child))
274 (dolist (button-definition (get-all initargs :button))
275 (apply #'dialog-add-button dialog button-definition))
276 (dolist (child (get-all initargs :child))
277 (apply #'dialog-add-child dialog (mklist child))))
278
279
280(defvar %*response-id-key* (gensym))
281
282(defun %dialog-find-response-id-num (dialog response-id create-p)
283 (or
284 (cadr (assoc response-id (rest (type-expand-1 'response-type))))
285 (let* ((response-ids (object-data dialog %*response-id-key*))
286 (response-id-num (position response-id response-ids)))
287 (cond
288 (response-id-num)
289 (create-p
290 (cond
291 (response-ids
292 (setf (cdr (last response-ids)) (list response-id))
293 (1- (length response-ids)))
294 (t
295 (setf (object-data dialog %*response-id-key*) (list response-id))
296 0)))
297 (t
298 (error "Invalid response id: ~A" response-id))))))
299
300(defun %dialog-find-response-id (dialog response-id-num)
301 (if (< response-id-num 0)
302 (car
303 (rassoc
304 (list response-id-num)
305 (rest (type-expand-1 'response-type)) :test #'equalp))
306 (nth response-id-num (object-data dialog %*response-id-key*))))
307
308
309(defmethod signal-connect ((dialog dialog) signal function &key object)
310 (case signal
311 (response
312 #'(lambda (dialog response-id-num)
313 (let ((response-id (%dialog-find-response-id dialog response-id-num)))
314 (cond
315 ((eq object t) (funcall function dialog response-id))
316 (object (funcall function object response-id))
317 (t (funcall function response-id))))))
318 (t
319 (call-next-method))))
320
321
322(defbinding dialog-response (dialog response-id) nil
323 (dialog dialog)
324 ((%dialog-find-response-id-num dialog response-id nil) int))
325
326(defbinding %dialog-set-default-response () nil
327 (dialog dialog)
328 (response-id-num int))
329
330(defun dialog-set-default-response (dialog response-id)
331 (%dialog-set-default-response
332 dialog (%dialog-find-response-id-num dialog response-id nil)))
333
334(defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
335 (dialog dialog)
336 ((%dialog-find-response-id-num dialog response-id nil) int)
337 (sensitive boolean))
338
339
340(defbinding %dialog-add-button () button
341 (dialog dialog)
342 (text string)
343 (response-id-num int))
344
345(defun dialog-add-button (dialog label &optional response-id default-p)
346 (let* ((response-id-num
347 (if response-id
348 (%dialog-find-response-id-num dialog response-id t)
349 (length (object-data dialog %*response-id-key*))))
350 (button (%dialog-add-button dialog label response-id-num)))
351 (unless response-id
352 (%dialog-find-response-id-num dialog button t))
353 (when default-p
354 (%dialog-set-default-response dialog response-id-num))
355 button))
356
357
358(defbinding %dialog-add-action-widget () button
359 (dialog dialog)
360 (action-widget widget)
361 (response-id-num int))
362
363(defun dialog-add-action-widget (dialog widget &optional (response-id widget)
364 default-p)
365 (let ((response-id-num (%dialog-find-response-id-num dialog response-id t)))
366 (%dialog-add-action-widget dialog widget response-id-num)
367 (when default-p
368 (%dialog-set-default-response dialog response-id-num))
369 widget))
370
371
372(defun dialog-add-child (dialog child &rest args)
373 (apply #'container-add (slot-value dialog 'vbox) child args))
374
375(defmethod container-children ((dialog dialog))
376 (container-children (dialog-vbox dialog)))
377
378(defmethod (setf container-children) (children (dialog dialog))
379 (setf (container-children (dialog-vbox dialog)) children))
380
381
382
383;;; Drawing area -- no functions
384
560af5c5 385
560af5c5 386
560af5c5 387
560af5c5 388
389
390
391;;; Toggle button
392
bbaeff4b 393(defbinding toggle-button-toggled () nil
560af5c5 394 (toggle-button toggle-button))
395
396
0f476ab5 397;;; Label
560af5c5 398
0f476ab5 399(defbinding label-select-region () nil
400 (label label)
401 (start int)
402 (end int))
560af5c5 403
f36ca6af 404
560af5c5 405
406
407;;; Radio button
408
e5b416f0 409(defbinding %radio-button-get-group () pointer
d520140e 410 (radio-button radio-button))
411
bbaeff4b 412(defbinding %radio-button-set-group () nil
d520140e 413 (radio-button radio-button)
414 (group pointer))
560af5c5 415
d520140e 416(defun radio-button-add-to-group (button1 button2)
417 "Add BUTTON1 to the group which BUTTON2 belongs to."
418 (%radio-button-set-group button1 (%radio-button-get-group button2)))
419
e5b416f0 420
d520140e 421(defmethod initialize-instance ((button radio-button)
e5b416f0 422 &rest initargs &key group-with)
423 (declare (ignore initargs))
d520140e 424 (call-next-method)
e5b416f0 425 (when group-with
426 (radio-button-add-to-group item group-with)))
560af5c5 427
428
429;;; Option menu
430
bbaeff4b 431(defbinding %option-menu-set-menu () nil
f36ca6af 432 (option-menu option-menu)
433 (menu widget))
560af5c5 434
bbaeff4b 435(defbinding %option-menu-remove-menu () nil
f36ca6af 436 (option-menu option-menu))
560af5c5 437
f36ca6af 438(defun (setf option-menu-menu) (menu option-menu)
439 (if (not menu)
440 (%option-menu-remove-menu option-menu)
441 (%option-menu-set-menu option-menu menu))
442 menu)
560af5c5 443
444
445
446;;; Item
447
bbaeff4b 448(defbinding item-select () nil
560af5c5 449 (item item))
450
bbaeff4b 451(defbinding item-deselect () nil
560af5c5 452 (item item))
453
bbaeff4b 454(defbinding item-toggle () nil
560af5c5 455 (item item))
456
457
458
459;;; Menu item
460
f36ca6af 461(defun (setf menu-item-label) (label menu-item)
462 (make-instance 'accel-label
463 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
464 :visible t :parent menu-item)
465 label)
560af5c5 466
bbaeff4b 467(defbinding %menu-item-set-submenu () nil
f36ca6af 468 (menu-item menu-item)
469 (submenu menu))
560af5c5 470
bbaeff4b 471(defbinding %menu-item-remove-submenu () nil
f36ca6af 472 (menu-item menu-item))
560af5c5 473
f36ca6af 474(defun (setf menu-item-submenu) (submenu menu-item)
475 (if (not submenu)
476 (%menu-item-remove-submenu menu-item)
477 (%menu-item-set-submenu menu-item submenu))
478 submenu)
560af5c5 479
bbaeff4b 480(defbinding menu-item-select () nil
f36ca6af 481 (menu-item menu-item))
560af5c5 482
bbaeff4b 483(defbinding menu-item-deselect () nil
f36ca6af 484 (menu-item menu-item))
560af5c5 485
bbaeff4b 486(defbinding menu-item-activate () nil
f36ca6af 487 (menu-item menu-item))
560af5c5 488
560af5c5 489
490
f36ca6af 491;;; Radio menu item
560af5c5 492
e5b416f0 493(defbinding %radio-menu-item-get-group () pointer
d520140e 494 (radio-menu-item radio-menu-item))
495
bbaeff4b 496(defbinding %radio-menu-item-set-group () nil
d520140e 497 (radio-menu-item radio-menu-item)
498 (group pointer))
499
d520140e 500(defun radio-menu-item-add-to-group (item1 item2)
501 "Add ITEM1 to the group which ITEM2 belongs to."
502 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
503
504(defmethod initialize-instance ((item radio-menu-item)
e5b416f0 505 &rest initargs &key group-with)
506 (declare (ignore initargs))
d520140e 507 (call-next-method)
e5b416f0 508 (when group-with
509 (radio-menu-item-add-to-group item group-with)))
d520140e 510
560af5c5 511
512
560af5c5 513;;; Window
514
bbaeff4b 515(defbinding %window-set-wmclass () nil
560af5c5 516 (window window)
517 (wmclass-name string)
518 (wmclass-class string))
519
520(defun (setf window-wmclass) (wmclass window)
521 (%window-set-wmclass window (svref wmclass 0) (svref wmclass 1))
522 (values (svref wmclass 0) (svref wmclass 1)))
523
f36ca6af 524;; gtkglue.c
bbaeff4b 525(defbinding window-wmclass () nil
560af5c5 526 (window window)
527 (wmclass-name string :out)
528 (wmclass-class string :out))
529
bbaeff4b 530(defbinding window-add-accel-group () nil
560af5c5 531 (window window)
532 (accel-group accel-group))
533
bbaeff4b 534(defbinding window-remove-accel-group () nil
560af5c5 535 (window window)
536 (accel-group accel-group))
537
bbaeff4b 538(defbinding window-activate-focus () int
560af5c5 539 (window window))
540
bbaeff4b 541(defbinding window-activate-default () int
560af5c5 542 (window window))
543
bbaeff4b 544(defbinding window-set-transient-for () nil
560af5c5 545 (window window)
546 (parent window))
547
bbaeff4b 548;(defbinding window-set-geometry-hints)
560af5c5 549
550
551
552;;; File selection
553
bbaeff4b 554(defbinding file-selection-complete () nil
d520140e 555 (file-selection file-selection)
556 (pattern string))
560af5c5 557
560af5c5 558
559
f36ca6af 560;;; Scrolled window
560af5c5 561
560af5c5 562(defun (setf scrolled-window-scrollbar-policy) (policy window)
563 (setf (scrolled-window-hscrollbar-policy window) policy)
564 (setf (scrolled-window-vscrollbar-policy window) policy))
565
bbaeff4b 566(defbinding scrolled-window-add-with-viewport () nil
560af5c5 567 (scrolled-window scrolled-window)
568 (child widget))
569
570
571
d520140e 572
573
574
560af5c5 575
560af5c5 576
560af5c5 577
560af5c5 578
560af5c5 579
560af5c5 580
560af5c5 581
560af5c5 582
f36ca6af 583;;; Statusbar
560af5c5 584
bbaeff4b 585(defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
586 () unsigned-int
f36ca6af 587 (statusbar statusbar)
588 (context-description string))
560af5c5 589
bbaeff4b 590(defbinding statusbar-push () unsigned-int
f36ca6af 591 (statusbar statusbar)
592 (context-id unsigned-int)
593 (text string))
560af5c5 594
bbaeff4b 595(defbinding statusbar-pop () nil
f36ca6af 596 (statusbar statusbar)
597 (context-id unsigned-int))
560af5c5 598
bbaeff4b 599(defbinding statusbar-remove () nil
f36ca6af 600 (statusbar statusbar)
601 (context-id unsigned-int)
602 (message-id unsigned-int))
560af5c5 603
560af5c5 604
605
606;;; Fixed
607
bbaeff4b 608(defbinding fixed-put () nil
f36ca6af 609 (fixed fixed)
610 (widget widget)
611 (x (signed 16))
612 (y (signed 16)))
560af5c5 613
bbaeff4b 614(defbinding fixed-move () nil
f36ca6af 615 (fixed fixed)
616 (widget widget)
617 (x (signed 16))
618 (y (signed 16)))
560af5c5 619
620
621
d520140e 622;;; Notebook
560af5c5 623
bbaeff4b 624(defbinding (notebook-insert-page "gtk_notebook_insert_page_menu")
f36ca6af 625 (notebook position child tab-label &optional menu-label) nil
626 (notebook notebook)
627 (child widget)
628 ((if (stringp tab-label)
629 (label-new tab-label)
630 tab-label) widget)
631 ((if (stringp menu-label)
632 (label-new menu-label)
633 menu-label) (or null widget))
634 (position int))
560af5c5 635
f36ca6af 636(defun notebook-append-page (notebook child tab-label &optional menu-label)
637 (notebook-insert-page notebook -1 child tab-label menu-label))
560af5c5 638
f36ca6af 639(defun notebook-prepend-page (notebook child tab-label &optional menu-label)
640 (notebook-insert-page notebook 0 child tab-label menu-label))
560af5c5 641
bbaeff4b 642(defbinding notebook-remove-page () nil
f36ca6af 643 (notebook notebook)
644 (page-num int))
560af5c5 645
646; (defun notebook-current-page-num (notebook)
647; (let ((page-num (notebook-current-page notebook)))
648; (if (= page-num -1)
649; nil
650; page-num)))
651
bbaeff4b 652(defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page") () widget
f36ca6af 653 (notebook notebook)
654 (page-num int))
560af5c5 655
f36ca6af 656(defun notebook-page-child (notebook)
657 (notebook-nth-page-child notebook (notebook-page notebook)))
560af5c5 658
bbaeff4b 659(defbinding %notebook-page-num () int
f36ca6af 660 (notebook notebook)
661 (child widget))
662
663(defun notebook-child-num (notebook child)
664 (let ((page-num (%notebook-page-num notebook child)))
665 (if (= page-num -1)
666 nil
667 page-num)))
668
bbaeff4b 669(defbinding notebook-next-page () nil
f36ca6af 670 (notebook notebook))
560af5c5 671
bbaeff4b 672(defbinding notebook-prev-page () nil
f36ca6af 673 (notebook notebook))
674
bbaeff4b 675(defbinding notebook-popup-enable () nil
f36ca6af 676 (notebook notebook))
677
bbaeff4b 678(defbinding notebook-popup-disable () nil
f36ca6af 679 (notebook notebook))
680
e5b416f0 681; (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
682; (notebook ref) widget
683; (notebook notebook)
684; ((if (typep ref 'widget)
685; ref
686; (notebook-nth-page-child notebook ref))
687; widget))
688
689; (defbinding %notebook-set-tab-label () nil
690; (notebook notebook)
691; (reference widget)
692; (tab-label widget))
693
694; (defun (setf notebook-tab-label) (tab-label notebook reference)
695; (let ((tab-label-widget (if (stringp tab-label)
696; (label-new tab-label)
697; tab-label)))
698; (%notebook-set-tab-label
699; notebook
700; (if (typep reference 'widget)
701; reference
702; (notebook-nth-page-child notebook reference))
703; tab-label-widget)
704; tab-label-widget))
560af5c5 705
e5b416f0 706; (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
707; (notebook ref) widget
708; (notebook notebook)
709; ((if (typep ref 'widget)
710; ref
711; (notebook-nth-page-child notebook ref))
712; widget))
713
714; (defbinding %notebook-set-menu-label () nil
715; (notebook notebook)
716; (reference widget)
717; (menu-label widget))
718
719; (defun (setf notebook-menu-label) (menu-label notebook reference)
720; (let ((menu-label-widget (if (stringp menu-label)
721; (label-new menu-label)
722; menu-label)))
723; (%notebook-set-menu-label
724; notebook
725; (if (typep reference 'widget)
726; reference
727; (notebook-nth-page-child notebook reference))
728; menu-label-widget)
729; menu-label-widget))
f36ca6af 730
bbaeff4b 731(defbinding notebook-query-tab-label-packing (notebook ref) nil
f36ca6af 732 (notebook notebook)
733 ((if (typep ref 'widget)
734 ref
735 (notebook-nth-page-child notebook ref))
736 widget)
737 (expand boolean :out)
738 (fill boolean :out)
739 (pack-type pack-type :out))
740
bbaeff4b 741(defbinding
f36ca6af 742 notebook-set-tab-label-packing (notebook ref expand fill pack-type) nil
743 (notebook notebook)
744 ((if (typep ref 'widget)
745 ref
746 (notebook-nth-page-child notebook ref))
747 widget)
748 (expand boolean)
749 (fill boolean)
750 (pack-type pack-type))
751
bbaeff4b 752(defbinding notebook-reorder-child () nil
f36ca6af 753 (notebook notebook)
754 (child widget)
755 (position int))
560af5c5 756
757
758
d520140e 759;;; Paned
560af5c5 760
bbaeff4b 761(defbinding paned-pack1 () nil
d520140e 762 (paned paned)
763 (child widget)
764 (resize boolean)
765 (shrink boolean))
560af5c5 766
bbaeff4b 767(defbinding paned-pack2 () nil
d520140e 768 (paned paned)
769 (child widget)
770 (resize boolean)
771 (shrink boolean))
560af5c5 772
d520140e 773;; gtkglue.c
bbaeff4b 774(defbinding paned-child1 () widget
d520140e 775 (paned paned)
776 (resize boolean :out)
777 (shrink boolean :out))
560af5c5 778
d520140e 779;; gtkglue.c
bbaeff4b 780(defbinding paned-child2 () widget
d520140e 781 (paned paned)
782 (resize boolean :out)
783 (shrink boolean :out))
560af5c5 784
d520140e 785(defun (setf paned-child1) (child paned)
786 (paned-pack1 paned child nil t))
560af5c5 787
d520140e 788(defun (setf paned-child2) (child paned)
789 (paned-pack2 paned child t t))
560af5c5 790
560af5c5 791
560af5c5 792
d520140e 793;;; Layout
560af5c5 794
bbaeff4b 795(defbinding layout-put () nil
d520140e 796 (layout layout)
797 (widget widget)
798 (x int)
799 (y int))
560af5c5 800
bbaeff4b 801(defbinding layout-move () nil
d520140e 802 (layout layout)
803 (widget widget)
804 (x int)
805 (y int))
560af5c5 806
bbaeff4b 807(defbinding layout-set-size () nil
d520140e 808 (layout layout)
809 (width int)
810 (height int))
560af5c5 811
bbaeff4b 812(defbinding layout-get-size () nil
d520140e 813 (layout layout)
814 (width int :out)
815 (height int :out))
560af5c5 816
560af5c5 817
818
560af5c5 819;;; Menu shell
820
bbaeff4b 821(defbinding menu-shell-insert () nil
f36ca6af 822 (menu-shell menu-shell)
823 (menu-item menu-item)
824 (position int))
560af5c5 825
f36ca6af 826(defun menu-shell-append (menu-shell menu-item)
827 (menu-shell-insert menu-shell menu-item -1))
560af5c5 828
f36ca6af 829(defun menu-shell-prepend (menu-shell menu-item)
830 (menu-shell-insert menu-shell menu-item 0))
560af5c5 831
bbaeff4b 832(defbinding menu-shell-deactivate () nil
f36ca6af 833 (menu-shell menu-shell))
560af5c5 834
bbaeff4b 835(defbinding menu-shell-select-item () nil
f36ca6af 836 (menu-shell menu-shell)
837 (menu-item menu-item))
560af5c5 838
bbaeff4b 839(defbinding menu-shell-deselect () nil
f36ca6af 840 (menu-shell menu-shell))
560af5c5 841
bbaeff4b 842(defbinding menu-shell-activate-item () nil
f36ca6af 843 (menu-shell menu-shell)
844 (menu-item menu-item)
845 (fore-deactivate boolean))
560af5c5 846
847
848
849; ;;; Menu bar
850
bbaeff4b 851; (defbinding menu-bar-insert () nil
560af5c5 852; (menu-bar menu-bar)
853; (menu menu)
854; (position int))
855
856; (defun menu-bar-append (menu-bar menu)
857; (menu-bar-insert menu-bar menu -1))
858
859; (defun menu-bar-prepend (menu-bar menu)
860; (menu-bar-insert menu-bar menu 0))
861
862
863
864; ;;; Menu
865
f36ca6af 866;(defun menu-popup ...)
560af5c5 867
bbaeff4b 868(defbinding menu-reposition () nil
f36ca6af 869 (menu menu))
560af5c5 870
bbaeff4b 871(defbinding menu-popdown () nil
f36ca6af 872 (menu menu))
560af5c5 873
bbaeff4b 874(defbinding %menu-set-active () nil
f36ca6af 875 (menu menu)
876 (index unsigned-int))
560af5c5 877
d520140e 878(defun (setf menu-active) (menu index)
879 (%menu-set-active menu index))
880
bbaeff4b 881(defbinding menu-reorder-child () nil
f36ca6af 882 (menu menu)
883 (menu-item menu-item)
884 (position int))
560af5c5 885
886
f36ca6af 887;;; Table
560af5c5 888
bbaeff4b 889(defbinding table-resize () nil
f36ca6af 890 (table table)
891 (rows unsigned-int)
892 (columns unsigned-int))
560af5c5 893
bbaeff4b 894(defbinding table-attach (table child left right top bottom
f36ca6af 895 &key (x-options '(:expand :fill))
896 (y-options '(:expand :fill))
897 (x-padding 0) (y-padding 0)) nil
898 (table table)
899 (child widget)
900 (left unsigned-int)
901 (right unsigned-int)
902 (top unsigned-int)
903 (bottom unsigned-int)
904 (x-options attach-options)
905 (y-options attach-options)
906 (x-padding unsigned-int)
907 (y-padding unsigned-int))
908
e5b416f0 909
bbaeff4b 910(defbinding %table-set-row-spacing () nil
f36ca6af 911 (table table)
912 (row unsigned-int)
913 (spacing unsigned-int))
914
e5b416f0 915(defbinding %table-set-row-spacings () nil
916 (table table)
917 (spacing unsigned-int))
918
919(defun (setf table-row-spacing) (spacing table &optional row)
920 (if row
921 (%table-set-row-spacing table row spacing)
922 (%table-set-row-spacings table spacing))
f36ca6af 923 spacing)
924
e5b416f0 925(defbinding %table-get-row-spacing () unsigned-int
f36ca6af 926 (table table)
e5b416f0 927 (row unsigned-int))
928
929(defbinding %table-get-default-row-spacing () unsigned-int
930 (table table))
931
932(defun table-row-spacing (table &optional row)
933 (if row
934 (%table-get-row-spacing table row)
935 (%table-get-default-row-spacing table)))
936
f36ca6af 937
bbaeff4b 938(defbinding %table-set-col-spacing () nil
f36ca6af 939 (table table)
940 (col unsigned-int)
941 (spacing unsigned-int))
942
e5b416f0 943(defbinding %table-set-col-spacings () nil
944 (table table)
945 (spacing unsigned-int))
946
947(defun (setf table-col-spacing) (spacing table &optional col)
948 (if col
949 (%table-set-col-spacing table col spacing)
950 (%table-set-col-spacings table spacing))
f36ca6af 951 spacing)
952
e5b416f0 953(defbinding %table-get-col-spacing () unsigned-int
f36ca6af 954 (table table)
e5b416f0 955 (col unsigned-int))
956
957(defbinding %table-get-default-col-spacing () unsigned-int
958 (table table))
959
960(defun table-col-spacing (table &optional col)
961 (if col
962 (%table-get-col-spacing table col)
963 (%table-get-default-col-spacing table)))
964
965
f36ca6af 966
967;;; Toolbar
968
f36ca6af 969;; gtkglue.c
bbaeff4b 970(defbinding toolbar-num-children () int
f36ca6af 971 (toolbar toolbar))
972
973(defun %toolbar-position-num (toolbar position)
974 (case position
975 (:prepend 0)
976 (:append (toolbar-num-children toolbar))
977 (t
978 (assert (and (>= position 0) (< position (toolbar-num-children toolbar))))
979 position)))
980
bbaeff4b 981(defbinding %toolbar-insert-element () widget
f36ca6af 982 (toolbar toolbar)
983 (type toolbar-child-type)
984 (widget (or null widget))
985 (text string)
986 (tooltip-text string)
987 (tooltip-private-text string)
988 (icon (or null widget))
989 (nil null)
990 (nil null)
991 (position int))
560af5c5 992
f36ca6af 993(defun toolbar-insert-element (toolbar position
994 &key tooltip-text tooltip-private-text
995 type widget icon text callback)
996 (let* ((icon-widget (typecase icon
997 ((or null widget) icon)
998 (t (pixmap-new icon))))
999 (toolbar-child
1000 (%toolbar-insert-element
1001 toolbar (or type (and widget :widget) :button)
1002 widget text tooltip-text tooltip-private-text icon-widget
1003 (%toolbar-position-num toolbar position))))
1004 (when callback
1005 (signal-connect toolbar-child 'clicked callback))
1006 toolbar-child))
1007
1008(defun toolbar-append-element (toolbar &key tooltip-text tooltip-private-text
1009 type widget icon text callback)
1010 (toolbar-insert-element
1011 toolbar :append :type type :widget widget :icon icon :text text
1012 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1013 :callback callback))
1014
1015(defun toolbar-prepend-element (toolbar &key tooltip-text tooltip-private-text
1016 type widget icon text callback)
1017 (toolbar-insert-element
1018 toolbar :prepend :type type :widget widget :icon icon :text text
1019 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1020 :callback callback))
1021
1022(defun toolbar-insert-space (toolbar position)
1023 (toolbar-insert-element toolbar position :type :space))
1024
1025(defun toolbar-append-space (toolbar)
1026 (toolbar-insert-space toolbar :append))
1027
1028(defun toolbar-prepend-space (toolbar)
1029 (toolbar-insert-space toolbar :prepend))
1030
1031(defun toolbar-insert-widget (toolbar widget position &key tooltip-text
1032 tooltip-private-text callback)
1033 (toolbar-insert-element
1034 toolbar position :widget widget :tooltip-text tooltip-text
1035 :tooltip-private-text tooltip-private-text :callback callback))
560af5c5 1036
f36ca6af 1037(defun toolbar-append-widget (toolbar widget &key tooltip-text
1038 tooltip-private-text callback)
1039 (toolbar-insert-widget
1040 toolbar widget :append :tooltip-text tooltip-text
1041 :tooltip-private-text tooltip-private-text :callback callback))
1042
1043(defun toolbar-prepend-widget (toolbar widget &key tooltip-text
1044 tooltip-private-text callback)
1045 (toolbar-insert-widget
1046 toolbar widget :prepend :tooltip-text tooltip-text
1047 :tooltip-private-text tooltip-private-text :callback callback))
1048
1049(defun toolbar-insert-item (toolbar text icon position &key tooltip-text
1050 tooltip-private-text callback)
1051 (toolbar-insert-element
1052 toolbar position :text text :icon icon :callback callback
1053 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text))
1054
1055(defun toolbar-append-item (toolbar text icon &key tooltip-text
1056 tooltip-private-text callback)
1057 (toolbar-insert-item
1058 toolbar text icon :append :callback callback
1059 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text))
560af5c5 1060
1061
f36ca6af 1062(defun toolbar-prepend-item (toolbar text icon &key tooltip-text
1063 tooltip-private-text callback)
1064 (toolbar-insert-item
1065 toolbar text icon :prepend :callback callback
1066 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text))
560af5c5 1067
f36ca6af 1068(defun toolbar-enable-tooltips (toolbar)
1069 (setf (toolbar-tooltips-p toolbar) t))
560af5c5 1070
f36ca6af 1071(defun toolbar-disable-tooltips (toolbar)
1072 (setf (toolbar-tooltips-p toolbar) nil))
560af5c5 1073
1074
1075
560af5c5 1076
560af5c5 1077
560af5c5 1078
1079
1080
bbaeff4b 1081;;; Editable
1082#|
1083(defbinding editable-select-region (editable &optional (start 0) end) nil
f36ca6af 1084 (editable editable)
1085 (start int)
1086 ((or end -1) int))
560af5c5 1087
bbaeff4b 1088(defbinding editable-insert-text
f36ca6af 1089 (editable text &optional (position 0)) nil
1090 (editable editable)
1091 (text string)
1092 ((length text) int)
1093 ((or position -1) int :in-out))
560af5c5 1094
f36ca6af 1095(defun editable-append-text (editable text)
1096 (editable-insert-text editable text nil))
560af5c5 1097
f36ca6af 1098(defun editable-prepend-text (editable text)
1099 (editable-insert-text editable text 0))
560af5c5 1100
bbaeff4b 1101(defbinding editable-delete-text (editable &optional (start 0) end) nil
f36ca6af 1102 (editable editable)
1103 (start int)
1104 ((or end -1) int))
560af5c5 1105
bbaeff4b 1106(defbinding (editable-text "gtk_editable_get_chars")
f36ca6af 1107 (editable &optional (start 0) end) string
1108 (editable editable)
1109 (start int)
1110 ((or end -1) int))
560af5c5 1111
f36ca6af 1112(defun (setf editable-text) (text editable)
1113 (if text
1114 (editable-delete-text
1115 editable
1116 (editable-insert-text editable text))
1117 (editable-delete-text editable))
1118 text)
560af5c5 1119
bbaeff4b 1120(defbinding editable-cut-clipboard () nil
f36ca6af 1121 (editable editable))
560af5c5 1122
bbaeff4b 1123(defbinding editable-copy-clipboard () nil
f36ca6af 1124 (editable editable))
560af5c5 1125
bbaeff4b 1126(defbinding editable-paste-clipboard () nil
f36ca6af 1127 (editable editable))
560af5c5 1128
bbaeff4b 1129; (defbinding editable-claim-selection () nil
b9752933 1130; (editable editable)
1131; (claim boolean)
1132; (time unsigned-int))
560af5c5 1133
bbaeff4b 1134(defbinding editable-delete-selection () nil
f36ca6af 1135 (editable editable))
560af5c5 1136
bbaeff4b 1137; (defbinding editable-changed () nil
b9752933 1138; (editable editable))
bbaeff4b 1139|#
560af5c5 1140
560af5c5 1141
f36ca6af 1142;;; Spin button
560af5c5 1143
f36ca6af 1144(defun spin-button-value-as-int (spin-button)
1145 (round (spin-button-value spin-button)))
560af5c5 1146
bbaeff4b 1147(defbinding spin-button-spin () nil
f36ca6af 1148 (spin-button spin-button)
1149 (direction spin-type)
1150 (increment single-float))
560af5c5 1151
bbaeff4b 1152(defbinding spin-button-update () nil
f36ca6af 1153 (spin-button spin-button))
560af5c5 1154
1155
1156
1157; ;;; Ruler
1158
bbaeff4b 1159(defbinding ruler-set-range () nil
f36ca6af 1160 (ruler ruler)
1161 (lower single-float)
1162 (upper single-float)
1163 (position single-float)
1164 (max-size single-float))
560af5c5 1165
bbaeff4b 1166(defbinding ruler-draw-ticks () nil
f36ca6af 1167 (ruler ruler))
560af5c5 1168
bbaeff4b 1169(defbinding ruler-draw-pos () nil
f36ca6af 1170 (ruler ruler))
560af5c5 1171
560af5c5 1172
560af5c5 1173
d520140e 1174;;; Range
bbaeff4b 1175#|
1176(defbinding range-draw-background () nil
d520140e 1177 (range range))
560af5c5 1178
bbaeff4b 1179(defbinding range-clear-background () nil
d520140e 1180 (range range))
560af5c5 1181
bbaeff4b 1182(defbinding range-draw-trough () nil
d520140e 1183 (range range))
560af5c5 1184
bbaeff4b 1185(defbinding range-draw-slider () nil
d520140e 1186 (range range))
560af5c5 1187
bbaeff4b 1188(defbinding range-draw-step-forw () nil
d520140e 1189 (range range))
560af5c5 1190
bbaeff4b 1191(defbinding range-slider-update () nil
d520140e 1192 (range range))
560af5c5 1193
bbaeff4b 1194(defbinding range-trough-click () int
d520140e 1195 (range range)
1196 (x int)
1197 (y int)
1198 (jump-perc single-float :out))
560af5c5 1199
bbaeff4b 1200(defbinding range-default-hslider-update () nil
d520140e 1201 (range range))
560af5c5 1202
bbaeff4b 1203(defbinding range-default-vslider-update () nil
d520140e 1204 (range range))
560af5c5 1205
bbaeff4b 1206(defbinding range-default-htrough-click () int
d520140e 1207 (range range)
1208 (x int)
1209 (y int)
1210 (jump-perc single-float :out))
560af5c5 1211
bbaeff4b 1212(defbinding range-default-vtrough-click () int
d520140e 1213 (range range)
1214 (x int)
1215 (y int)
1216 (jump-perc single-float :out))
560af5c5 1217
bbaeff4b 1218(defbinding range-default-hmotion () int
d520140e 1219 (range range)
1220 (x-delta int)
1221 (y-delta int))
560af5c5 1222
bbaeff4b 1223(defbinding range-default-vmotion () int
d520140e 1224 (range range)
1225 (x-delta int)
1226 (y-delta int))
bbaeff4b 1227|#
560af5c5 1228
560af5c5 1229
d520140e 1230;;; Scale
560af5c5 1231
e5b416f0 1232; (defbinding scale-draw-value () nil
1233; (scale scale))
560af5c5 1234
560af5c5 1235
560af5c5 1236
d520140e 1237;;; Progress bar
560af5c5 1238
bbaeff4b 1239(defbinding progress-bar-pulse () nil
d520140e 1240 (progress-bar progress-bar))
560af5c5 1241
1242
1243
560af5c5 1244
1245
1246;;; Tooltips
1247
bbaeff4b 1248(defbinding tooltips-enable () nil
d520140e 1249 (tooltips tooltips))
560af5c5 1250
bbaeff4b 1251(defbinding tooltips-disable () nil
d520140e 1252 (tooltips tooltips))
560af5c5 1253
e5b416f0 1254(defun (setf tooltips-enabled-p) (enable tooltips)
1255 (if enable
1256 (tooltips-enable tooltips)
1257 (tooltips-disable tooltips)))
1258
bbaeff4b 1259(defbinding tooltips-set-tip () nil
d520140e 1260 (tooltips tooltips)
1261 (widget widget)
1262 (tip-text string)
1263 (tip-private string))
560af5c5 1264
bbaeff4b 1265(defbinding tooltips-force-window () nil
d520140e 1266 (tooltips tooltips))
560af5c5 1267
1268
1269
d520140e 1270;;; Rc
560af5c5 1271
bbaeff4b 1272(defbinding rc-add-default-file (filename) nil
d520140e 1273 ((namestring (truename filename)) string))
560af5c5 1274
bbaeff4b 1275(defbinding rc-parse (filename) nil
d520140e 1276 ((namestring (truename filename)) string))
560af5c5 1277
bbaeff4b 1278(defbinding rc-parse-string () nil
d520140e 1279 (rc-string string))
560af5c5 1280
bbaeff4b 1281(defbinding rc-reparse-all () nil)
560af5c5 1282
bbaeff4b 1283(defbinding rc-get-style () style
d520140e 1284 (widget widget))
560af5c5 1285
1286
1287
1288;;; Accelerator Groups
bbaeff4b 1289#|
1290(defbinding accel-group-get-default () accel-group)
560af5c5 1291
f36ca6af 1292(deftype-method alien-ref accel-group (type-spec)
1293 (declare (ignore type-spec))
1294 '%accel-group-ref)
560af5c5 1295
f36ca6af 1296(deftype-method alien-unref accel-group (type-spec)
1297 (declare (ignore type-spec))
1298 '%accel-group-unref)
1299
bbaeff4b 1300(defbinding %accel-group-ref () accel-group
f36ca6af 1301 (accel-group (or accel-group pointer)))
1302
bbaeff4b 1303(defbinding %accel-group-unref () nil
f36ca6af 1304 (accel-group (or accel-group pointer)))
560af5c5 1305
bbaeff4b 1306(defbinding accel-group-activate (accel-group key modifiers) boolean
560af5c5 1307 (accel-group accel-group)
1308 ((gdk:keyval-from-name key) unsigned-int)
1309 (modifiers gdk:modifier-type))
1310
bbaeff4b 1311(defbinding accel-groups-activate (object key modifiers) boolean
560af5c5 1312 (object object)
1313 ((gdk:keyval-from-name key) unsigned-int)
1314 (modifiers gdk:modifier-type))
1315
bbaeff4b 1316(defbinding accel-group-attach () nil
560af5c5 1317 (accel-group accel-group)
1318 (object object))
1319
bbaeff4b 1320(defbinding accel-group-detach () nil
560af5c5 1321 (accel-group accel-group)
1322 (object object))
1323
bbaeff4b 1324(defbinding accel-group-lock () nil
560af5c5 1325 (accel-group accel-group))
1326
bbaeff4b 1327(defbinding accel-group-unlock () nil
560af5c5 1328 (accel-group accel-group))
1329
1330
1331;;; Accelerator Groups Entries
1332
bbaeff4b 1333(defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
560af5c5 1334 (accel-group accel-group)
1335 ((gdk:keyval-from-name key) unsigned-int)
1336 (modifiers gdk:modifier-type))
1337
bbaeff4b 1338(defbinding accel-group-lock-entry (accel-group key modifiers) nil
560af5c5 1339 (accel-group accel-group)
1340 ((gdk:keyval-from-name key) unsigned-int)
1341 (modifiers gdk:modifier-type))
1342
bbaeff4b 1343(defbinding accel-group-unlock-entry (accel-group key modifiers) nil
560af5c5 1344 (accel-group accel-group)
1345 ((gdk:keyval-from-name key) unsigned-int)
1346 (modifiers gdk:modifier-type))
1347
bbaeff4b 1348(defbinding accel-group-add
560af5c5 1349 (accel-group key modifiers flags object signal) nil
1350 (accel-group accel-group)
1351 ((gdk:keyval-from-name key) unsigned-int)
1352 (modifiers gdk:modifier-type)
1353 (flags accel-flags)
1354 (object object)
1355 ((name-to-string signal) string))
1356
bbaeff4b 1357(defbinding accel-group-add (accel-group key modifiers object) nil
560af5c5 1358 (accel-group accel-group)
1359 ((gdk:keyval-from-name key) unsigned-int)
1360 (modifiers gdk:modifier-type)
1361 (object object))
1362
1363
1364;;; Accelerator Signals
1365
bbaeff4b 1366(defbinding accel-group-handle-add
560af5c5 1367 (object signal-id accel-group key modifiers flags) nil
1368 (object object)
1369 (signal-id unsigned-int)
1370 (accel-group accel-group)
1371 ((gdk:keyval-from-name key) unsigned-int)
1372 (modifiers gdk:modifier-type)
1373 (flags accel-flags))
1374
bbaeff4b 1375(defbinding accel-group-handle-remove
560af5c5 1376 (object accel-group key modifiers) nil
1377 (object object)
1378 (accel-group accel-group)
1379 ((gdk:keyval-from-name key) unsigned-int)
1380 (modifiers gdk:modifier-type))
bbaeff4b 1381|#