chiark / gitweb /
A lot of binding changes
[clg] / gtk / gtk.lisp
CommitLineData
0d07716f 1;; Common Lisp bindings for GTK+ v2.0
a60bd055 2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
0d07716f 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
d404b3af 18;; $Id: gtk.lisp,v 1.7 2001/11/12 22:34:28 espen Exp $
0d07716f 19
20
21(in-package "GTK")
22
23;;; Gtk version
24
a60bd055 25(defbinding check-version () string
0d07716f 26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
29
a60bd055 30(defbinding query-version () nil
0d07716f 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
d404b3af 42(defbinding get-default-language () string)
0d07716f 43
44
d404b3af 45;;; Acccel group
0d07716f 46
47
48;;; Acccel label
49
a60bd055 50(defbinding accel-label-refetch () boolean
0d07716f 51 (accel-label accel-label))
52
53
d404b3af 54;;; Adjustment
0d07716f 55
d404b3af 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))
0d07716f 66
d404b3af 67
68
69;;; Alignment -- no functions
70;;; Arrow -- no functions
71
72
73
74;;; Aspect frame
75
76
77;;; Bin
0d07716f 78
79(defun (setf bin-child) (child bin)
d404b3af 80 (when-bind (current-child (bin-child bin))
81 (container-remove bin current-child))
0d07716f 82 (container-add bin child)
83 child)
84
30481825 85
d404b3af 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
0d07716f 138;;; Button
139
a60bd055 140(defbinding button-pressed () nil
0d07716f 141 (button button))
142
d404b3af 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
0d07716f 379
0d07716f 380
0d07716f 381
0d07716f 382
383
384
385;;; Toggle button
386
a60bd055 387(defbinding toggle-button-toggled () nil
0d07716f 388 (toggle-button toggle-button))
389
390
d404b3af 391;;; Label
0d07716f 392
d404b3af 393(defbinding label-select-region () nil
394 (label label)
395 (start int)
396 (end int))
0d07716f 397
30481825 398
0d07716f 399
400
401;;; Radio button
402
dd392521 403(defbinding %radio-button-get-group () pointer
2afcd8bd 404 (radio-button radio-button))
405
a60bd055 406(defbinding %radio-button-set-group () nil
2afcd8bd 407 (radio-button radio-button)
408 (group pointer))
0d07716f 409
2afcd8bd 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
dd392521 414
2afcd8bd 415(defmethod initialize-instance ((button radio-button)
dd392521 416 &rest initargs &key group-with)
417 (declare (ignore initargs))
2afcd8bd 418 (call-next-method)
dd392521 419 (when group-with
420 (radio-button-add-to-group item group-with)))
0d07716f 421
422
423;;; Option menu
424
a60bd055 425(defbinding %option-menu-set-menu () nil
30481825 426 (option-menu option-menu)
427 (menu widget))
0d07716f 428
a60bd055 429(defbinding %option-menu-remove-menu () nil
30481825 430 (option-menu option-menu))
0d07716f 431
30481825 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)
0d07716f 437
438
439
440;;; Item
441
a60bd055 442(defbinding item-select () nil
0d07716f 443 (item item))
444
a60bd055 445(defbinding item-deselect () nil
0d07716f 446 (item item))
447
a60bd055 448(defbinding item-toggle () nil
0d07716f 449 (item item))
450
451
452
453;;; Menu item
454
30481825 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)
0d07716f 460
a60bd055 461(defbinding %menu-item-set-submenu () nil
30481825 462 (menu-item menu-item)
463 (submenu menu))
0d07716f 464
a60bd055 465(defbinding %menu-item-remove-submenu () nil
30481825 466 (menu-item menu-item))
0d07716f 467
30481825 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)
0d07716f 473
a60bd055 474(defbinding menu-item-select () nil
30481825 475 (menu-item menu-item))
0d07716f 476
a60bd055 477(defbinding menu-item-deselect () nil
30481825 478 (menu-item menu-item))
0d07716f 479
a60bd055 480(defbinding menu-item-activate () nil
30481825 481 (menu-item menu-item))
0d07716f 482
0d07716f 483
484
30481825 485;;; Radio menu item
0d07716f 486
dd392521 487(defbinding %radio-menu-item-get-group () pointer
2afcd8bd 488 (radio-menu-item radio-menu-item))
489
a60bd055 490(defbinding %radio-menu-item-set-group () nil
2afcd8bd 491 (radio-menu-item radio-menu-item)
492 (group pointer))
493
2afcd8bd 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)
dd392521 499 &rest initargs &key group-with)
500 (declare (ignore initargs))
2afcd8bd 501 (call-next-method)
dd392521 502 (when group-with
503 (radio-menu-item-add-to-group item group-with)))
2afcd8bd 504
0d07716f 505
506
0d07716f 507;;; Window
508
a60bd055 509(defbinding %window-set-wmclass () nil
0d07716f 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
30481825 518;; gtkglue.c
a60bd055 519(defbinding window-wmclass () nil
0d07716f 520 (window window)
521 (wmclass-name string :out)
522 (wmclass-class string :out))
523
a60bd055 524(defbinding window-add-accel-group () nil
0d07716f 525 (window window)
526 (accel-group accel-group))
527
a60bd055 528(defbinding window-remove-accel-group () nil
0d07716f 529 (window window)
530 (accel-group accel-group))
531
a60bd055 532(defbinding window-activate-focus () int
0d07716f 533 (window window))
534
a60bd055 535(defbinding window-activate-default () int
0d07716f 536 (window window))
537
a60bd055 538(defbinding window-set-transient-for () nil
0d07716f 539 (window window)
540 (parent window))
541
a60bd055 542;(defbinding window-set-geometry-hints)
0d07716f 543
544
545
546;;; File selection
547
a60bd055 548(defbinding file-selection-complete () nil
2afcd8bd 549 (file-selection file-selection)
550 (pattern string))
0d07716f 551
0d07716f 552
553
30481825 554;;; Scrolled window
0d07716f 555
0d07716f 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
a60bd055 560(defbinding scrolled-window-add-with-viewport () nil
0d07716f 561 (scrolled-window scrolled-window)
562 (child widget))
563
564
565
2afcd8bd 566
567
568
0d07716f 569
0d07716f 570
0d07716f 571
0d07716f 572
0d07716f 573
0d07716f 574
0d07716f 575
0d07716f 576
30481825 577;;; Statusbar
0d07716f 578
a60bd055 579(defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
580 () unsigned-int
30481825 581 (statusbar statusbar)
582 (context-description string))
0d07716f 583
a60bd055 584(defbinding statusbar-push () unsigned-int
30481825 585 (statusbar statusbar)
586 (context-id unsigned-int)
587 (text string))
0d07716f 588
a60bd055 589(defbinding statusbar-pop () nil
30481825 590 (statusbar statusbar)
591 (context-id unsigned-int))
0d07716f 592
a60bd055 593(defbinding statusbar-remove () nil
30481825 594 (statusbar statusbar)
595 (context-id unsigned-int)
596 (message-id unsigned-int))
0d07716f 597
0d07716f 598
599
600;;; Fixed
601
a60bd055 602(defbinding fixed-put () nil
30481825 603 (fixed fixed)
604 (widget widget)
605 (x (signed 16))
606 (y (signed 16)))
0d07716f 607
a60bd055 608(defbinding fixed-move () nil
30481825 609 (fixed fixed)
610 (widget widget)
611 (x (signed 16))
612 (y (signed 16)))
0d07716f 613
614
615
2afcd8bd 616;;; Notebook
0d07716f 617
a60bd055 618(defbinding (notebook-insert-page "gtk_notebook_insert_page_menu")
30481825 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))
0d07716f 629
30481825 630(defun notebook-append-page (notebook child tab-label &optional menu-label)
631 (notebook-insert-page notebook -1 child tab-label menu-label))
0d07716f 632
30481825 633(defun notebook-prepend-page (notebook child tab-label &optional menu-label)
634 (notebook-insert-page notebook 0 child tab-label menu-label))
0d07716f 635
a60bd055 636(defbinding notebook-remove-page () nil
30481825 637 (notebook notebook)
638 (page-num int))
0d07716f 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
a60bd055 646(defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page") () widget
30481825 647 (notebook notebook)
648 (page-num int))
0d07716f 649
30481825 650(defun notebook-page-child (notebook)
651 (notebook-nth-page-child notebook (notebook-page notebook)))
0d07716f 652
a60bd055 653(defbinding %notebook-page-num () int
30481825 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
a60bd055 663(defbinding notebook-next-page () nil
30481825 664 (notebook notebook))
0d07716f 665
a60bd055 666(defbinding notebook-prev-page () nil
30481825 667 (notebook notebook))
668
a60bd055 669(defbinding notebook-popup-enable () nil
30481825 670 (notebook notebook))
671
a60bd055 672(defbinding notebook-popup-disable () nil
30481825 673 (notebook notebook))
674
dd392521 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))
0d07716f 699
dd392521 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))
30481825 724
a60bd055 725(defbinding notebook-query-tab-label-packing (notebook ref) nil
30481825 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
a60bd055 735(defbinding
30481825 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
a60bd055 746(defbinding notebook-reorder-child () nil
30481825 747 (notebook notebook)
748 (child widget)
749 (position int))
0d07716f 750
751
752
2afcd8bd 753;;; Paned
0d07716f 754
a60bd055 755(defbinding paned-pack1 () nil
2afcd8bd 756 (paned paned)
757 (child widget)
758 (resize boolean)
759 (shrink boolean))
0d07716f 760
a60bd055 761(defbinding paned-pack2 () nil
2afcd8bd 762 (paned paned)
763 (child widget)
764 (resize boolean)
765 (shrink boolean))
0d07716f 766
2afcd8bd 767;; gtkglue.c
a60bd055 768(defbinding paned-child1 () widget
2afcd8bd 769 (paned paned)
770 (resize boolean :out)
771 (shrink boolean :out))
0d07716f 772
2afcd8bd 773;; gtkglue.c
a60bd055 774(defbinding paned-child2 () widget
2afcd8bd 775 (paned paned)
776 (resize boolean :out)
777 (shrink boolean :out))
0d07716f 778
2afcd8bd 779(defun (setf paned-child1) (child paned)
780 (paned-pack1 paned child nil t))
0d07716f 781
2afcd8bd 782(defun (setf paned-child2) (child paned)
783 (paned-pack2 paned child t t))
0d07716f 784
0d07716f 785
0d07716f 786
2afcd8bd 787;;; Layout
0d07716f 788
a60bd055 789(defbinding layout-put () nil
2afcd8bd 790 (layout layout)
791 (widget widget)
792 (x int)
793 (y int))
0d07716f 794
a60bd055 795(defbinding layout-move () nil
2afcd8bd 796 (layout layout)
797 (widget widget)
798 (x int)
799 (y int))
0d07716f 800
a60bd055 801(defbinding layout-set-size () nil
2afcd8bd 802 (layout layout)
803 (width int)
804 (height int))
0d07716f 805
a60bd055 806(defbinding layout-get-size () nil
2afcd8bd 807 (layout layout)
808 (width int :out)
809 (height int :out))
0d07716f 810
0d07716f 811
812
0d07716f 813;;; Menu shell
814
a60bd055 815(defbinding menu-shell-insert () nil
30481825 816 (menu-shell menu-shell)
817 (menu-item menu-item)
818 (position int))
0d07716f 819
30481825 820(defun menu-shell-append (menu-shell menu-item)
821 (menu-shell-insert menu-shell menu-item -1))
0d07716f 822
30481825 823(defun menu-shell-prepend (menu-shell menu-item)
824 (menu-shell-insert menu-shell menu-item 0))
0d07716f 825
a60bd055 826(defbinding menu-shell-deactivate () nil
30481825 827 (menu-shell menu-shell))
0d07716f 828
a60bd055 829(defbinding menu-shell-select-item () nil
30481825 830 (menu-shell menu-shell)
831 (menu-item menu-item))
0d07716f 832
a60bd055 833(defbinding menu-shell-deselect () nil
30481825 834 (menu-shell menu-shell))
0d07716f 835
a60bd055 836(defbinding menu-shell-activate-item () nil
30481825 837 (menu-shell menu-shell)
838 (menu-item menu-item)
839 (fore-deactivate boolean))
0d07716f 840
841
842
843; ;;; Menu bar
844
a60bd055 845; (defbinding menu-bar-insert () nil
0d07716f 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
30481825 860;(defun menu-popup ...)
0d07716f 861
a60bd055 862(defbinding menu-reposition () nil
30481825 863 (menu menu))
0d07716f 864
a60bd055 865(defbinding menu-popdown () nil
30481825 866 (menu menu))
0d07716f 867
a60bd055 868(defbinding %menu-set-active () nil
30481825 869 (menu menu)
870 (index unsigned-int))
0d07716f 871
2afcd8bd 872(defun (setf menu-active) (menu index)
873 (%menu-set-active menu index))
874
a60bd055 875(defbinding menu-reorder-child () nil
30481825 876 (menu menu)
877 (menu-item menu-item)
878 (position int))
0d07716f 879
880
30481825 881;;; Table
0d07716f 882
a60bd055 883(defbinding table-resize () nil
30481825 884 (table table)
885 (rows unsigned-int)
886 (columns unsigned-int))
0d07716f 887
a60bd055 888(defbinding table-attach (table child left right top bottom
30481825 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
dd392521 903
a60bd055 904(defbinding %table-set-row-spacing () nil
30481825 905 (table table)
906 (row unsigned-int)
907 (spacing unsigned-int))
908
dd392521 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))
30481825 917 spacing)
918
dd392521 919(defbinding %table-get-row-spacing () unsigned-int
30481825 920 (table table)
dd392521 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
30481825 931
a60bd055 932(defbinding %table-set-col-spacing () nil
30481825 933 (table table)
934 (col unsigned-int)
935 (spacing unsigned-int))
936
dd392521 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))
30481825 945 spacing)
946
dd392521 947(defbinding %table-get-col-spacing () unsigned-int
30481825 948 (table table)
dd392521 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
30481825 960
961;;; Toolbar
962
30481825 963;; gtkglue.c
a60bd055 964(defbinding toolbar-num-children () int
30481825 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
a60bd055 975(defbinding %toolbar-insert-element () widget
30481825 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))
0d07716f 986
30481825 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))
0d07716f 1030
30481825 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))
0d07716f 1054
1055
30481825 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))
0d07716f 1061
30481825 1062(defun toolbar-enable-tooltips (toolbar)
1063 (setf (toolbar-tooltips-p toolbar) t))
0d07716f 1064
30481825 1065(defun toolbar-disable-tooltips (toolbar)
1066 (setf (toolbar-tooltips-p toolbar) nil))
0d07716f 1067
1068
1069
0d07716f 1070
0d07716f 1071
0d07716f 1072
1073
1074
a60bd055 1075;;; Editable
1076#|
1077(defbinding editable-select-region (editable &optional (start 0) end) nil
30481825 1078 (editable editable)
1079 (start int)
1080 ((or end -1) int))
0d07716f 1081
a60bd055 1082(defbinding editable-insert-text
30481825 1083 (editable text &optional (position 0)) nil
1084 (editable editable)
1085 (text string)
1086 ((length text) int)
1087 ((or position -1) int :in-out))
0d07716f 1088
30481825 1089(defun editable-append-text (editable text)
1090 (editable-insert-text editable text nil))
0d07716f 1091
30481825 1092(defun editable-prepend-text (editable text)
1093 (editable-insert-text editable text 0))
0d07716f 1094
a60bd055 1095(defbinding editable-delete-text (editable &optional (start 0) end) nil
30481825 1096 (editable editable)
1097 (start int)
1098 ((or end -1) int))
0d07716f 1099
a60bd055 1100(defbinding (editable-text "gtk_editable_get_chars")
30481825 1101 (editable &optional (start 0) end) string
1102 (editable editable)
1103 (start int)
1104 ((or end -1) int))
0d07716f 1105
30481825 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)
0d07716f 1113
a60bd055 1114(defbinding editable-cut-clipboard () nil
30481825 1115 (editable editable))
0d07716f 1116
a60bd055 1117(defbinding editable-copy-clipboard () nil
30481825 1118 (editable editable))
0d07716f 1119
a60bd055 1120(defbinding editable-paste-clipboard () nil
30481825 1121 (editable editable))
0d07716f 1122
a60bd055 1123; (defbinding editable-claim-selection () nil
32483ef6 1124; (editable editable)
1125; (claim boolean)
1126; (time unsigned-int))
0d07716f 1127
a60bd055 1128(defbinding editable-delete-selection () nil
30481825 1129 (editable editable))
0d07716f 1130
a60bd055 1131; (defbinding editable-changed () nil
32483ef6 1132; (editable editable))
a60bd055 1133|#
0d07716f 1134
0d07716f 1135
30481825 1136;;; Spin button
0d07716f 1137
30481825 1138(defun spin-button-value-as-int (spin-button)
1139 (round (spin-button-value spin-button)))
0d07716f 1140
a60bd055 1141(defbinding spin-button-spin () nil
30481825 1142 (spin-button spin-button)
1143 (direction spin-type)
1144 (increment single-float))
0d07716f 1145
a60bd055 1146(defbinding spin-button-update () nil
30481825 1147 (spin-button spin-button))
0d07716f 1148
1149
1150
1151; ;;; Ruler
1152
a60bd055 1153(defbinding ruler-set-range () nil
30481825 1154 (ruler ruler)
1155 (lower single-float)
1156 (upper single-float)
1157 (position single-float)
1158 (max-size single-float))
0d07716f 1159
a60bd055 1160(defbinding ruler-draw-ticks () nil
30481825 1161 (ruler ruler))
0d07716f 1162
a60bd055 1163(defbinding ruler-draw-pos () nil
30481825 1164 (ruler ruler))
0d07716f 1165
0d07716f 1166
0d07716f 1167
2afcd8bd 1168;;; Range
a60bd055 1169#|
1170(defbinding range-draw-background () nil
2afcd8bd 1171 (range range))
0d07716f 1172
a60bd055 1173(defbinding range-clear-background () nil
2afcd8bd 1174 (range range))
0d07716f 1175
a60bd055 1176(defbinding range-draw-trough () nil
2afcd8bd 1177 (range range))
0d07716f 1178
a60bd055 1179(defbinding range-draw-slider () nil
2afcd8bd 1180 (range range))
0d07716f 1181
a60bd055 1182(defbinding range-draw-step-forw () nil
2afcd8bd 1183 (range range))
0d07716f 1184
a60bd055 1185(defbinding range-slider-update () nil
2afcd8bd 1186 (range range))
0d07716f 1187
a60bd055 1188(defbinding range-trough-click () int
2afcd8bd 1189 (range range)
1190 (x int)
1191 (y int)
1192 (jump-perc single-float :out))
0d07716f 1193
a60bd055 1194(defbinding range-default-hslider-update () nil
2afcd8bd 1195 (range range))
0d07716f 1196
a60bd055 1197(defbinding range-default-vslider-update () nil
2afcd8bd 1198 (range range))
0d07716f 1199
a60bd055 1200(defbinding range-default-htrough-click () int
2afcd8bd 1201 (range range)
1202 (x int)
1203 (y int)
1204 (jump-perc single-float :out))
0d07716f 1205
a60bd055 1206(defbinding range-default-vtrough-click () int
2afcd8bd 1207 (range range)
1208 (x int)
1209 (y int)
1210 (jump-perc single-float :out))
0d07716f 1211
a60bd055 1212(defbinding range-default-hmotion () int
2afcd8bd 1213 (range range)
1214 (x-delta int)
1215 (y-delta int))
0d07716f 1216
a60bd055 1217(defbinding range-default-vmotion () int
2afcd8bd 1218 (range range)
1219 (x-delta int)
1220 (y-delta int))
a60bd055 1221|#
0d07716f 1222
0d07716f 1223
2afcd8bd 1224;;; Scale
0d07716f 1225
dd392521 1226; (defbinding scale-draw-value () nil
1227; (scale scale))
0d07716f 1228
0d07716f 1229
0d07716f 1230
2afcd8bd 1231;;; Progress bar
0d07716f 1232
a60bd055 1233(defbinding progress-bar-pulse () nil
2afcd8bd 1234 (progress-bar progress-bar))
0d07716f 1235
1236
1237
0d07716f 1238
1239
1240;;; Tooltips
1241
a60bd055 1242(defbinding tooltips-enable () nil
2afcd8bd 1243 (tooltips tooltips))
0d07716f 1244
a60bd055 1245(defbinding tooltips-disable () nil
2afcd8bd 1246 (tooltips tooltips))
0d07716f 1247
dd392521 1248(defun (setf tooltips-enabled-p) (enable tooltips)
1249 (if enable
1250 (tooltips-enable tooltips)
1251 (tooltips-disable tooltips)))
1252
a60bd055 1253(defbinding tooltips-set-tip () nil
2afcd8bd 1254 (tooltips tooltips)
1255 (widget widget)
1256 (tip-text string)
1257 (tip-private string))
0d07716f 1258
a60bd055 1259(defbinding tooltips-force-window () nil
2afcd8bd 1260 (tooltips tooltips))
0d07716f 1261
1262
1263
2afcd8bd 1264;;; Rc
0d07716f 1265
a60bd055 1266(defbinding rc-add-default-file (filename) nil
2afcd8bd 1267 ((namestring (truename filename)) string))
0d07716f 1268
a60bd055 1269(defbinding rc-parse (filename) nil
2afcd8bd 1270 ((namestring (truename filename)) string))
0d07716f 1271
a60bd055 1272(defbinding rc-parse-string () nil
2afcd8bd 1273 (rc-string string))
0d07716f 1274
a60bd055 1275(defbinding rc-reparse-all () nil)
0d07716f 1276
a60bd055 1277(defbinding rc-get-style () style
2afcd8bd 1278 (widget widget))
0d07716f 1279
1280
1281
1282;;; Accelerator Groups
a60bd055 1283#|
1284(defbinding accel-group-get-default () accel-group)
0d07716f 1285
30481825 1286(deftype-method alien-ref accel-group (type-spec)
1287 (declare (ignore type-spec))
1288 '%accel-group-ref)
0d07716f 1289
30481825 1290(deftype-method alien-unref accel-group (type-spec)
1291 (declare (ignore type-spec))
1292 '%accel-group-unref)
1293
a60bd055 1294(defbinding %accel-group-ref () accel-group
30481825 1295 (accel-group (or accel-group pointer)))
1296
a60bd055 1297(defbinding %accel-group-unref () nil
30481825 1298 (accel-group (or accel-group pointer)))
0d07716f 1299
a60bd055 1300(defbinding accel-group-activate (accel-group key modifiers) boolean
0d07716f 1301 (accel-group accel-group)
1302 ((gdk:keyval-from-name key) unsigned-int)
1303 (modifiers gdk:modifier-type))
1304
a60bd055 1305(defbinding accel-groups-activate (object key modifiers) boolean
0d07716f 1306 (object object)
1307 ((gdk:keyval-from-name key) unsigned-int)
1308 (modifiers gdk:modifier-type))
1309
a60bd055 1310(defbinding accel-group-attach () nil
0d07716f 1311 (accel-group accel-group)
1312 (object object))
1313
a60bd055 1314(defbinding accel-group-detach () nil
0d07716f 1315 (accel-group accel-group)
1316 (object object))
1317
a60bd055 1318(defbinding accel-group-lock () nil
0d07716f 1319 (accel-group accel-group))
1320
a60bd055 1321(defbinding accel-group-unlock () nil
0d07716f 1322 (accel-group accel-group))
1323
1324
1325;;; Accelerator Groups Entries
1326
a60bd055 1327(defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
0d07716f 1328 (accel-group accel-group)
1329 ((gdk:keyval-from-name key) unsigned-int)
1330 (modifiers gdk:modifier-type))
1331
a60bd055 1332(defbinding accel-group-lock-entry (accel-group key modifiers) nil
0d07716f 1333 (accel-group accel-group)
1334 ((gdk:keyval-from-name key) unsigned-int)
1335 (modifiers gdk:modifier-type))
1336
a60bd055 1337(defbinding accel-group-unlock-entry (accel-group key modifiers) nil
0d07716f 1338 (accel-group accel-group)
1339 ((gdk:keyval-from-name key) unsigned-int)
1340 (modifiers gdk:modifier-type))
1341
a60bd055 1342(defbinding accel-group-add
0d07716f 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
a60bd055 1351(defbinding accel-group-add (accel-group key modifiers object) nil
0d07716f 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
a60bd055 1360(defbinding accel-group-handle-add
0d07716f 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
a60bd055 1369(defbinding accel-group-handle-remove
0d07716f 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))
a60bd055 1375|#