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