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