chiark / gitweb /
Renamed CHILD-SLOTS to CHILD-PROPERTIES
[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
1dd03ab8 18;; $Id: gtk.lisp,v 1.23 2004-12-20 20:00:07 espen Exp $
560af5c5 19
20
21(in-package "GTK")
22
23;;; Gtk version
24
6bb23851 25(defbinding check-version () (copy-of 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
6bb23851 42(defbinding get-default-language () (copy-of pango:language))
560af5c5 43
44
9adccb27 45;;;; Initalization
46
47(defbinding (gtk-init "gtk_parse_args") () nil
48 "Initializes the library without opening the display."
49 (nil null)
50 (nil null))
51
52(defun clg-init (&optional display)
53 "Initializes the system and starts the event handling"
54 (unless (gdk:display-get-default)
55 (gdk:gdk-init)
56 (gtk-init)
57 (prog1
58 (gdk:display-open display)
59 (system:add-fd-handler
60 (gdk:display-connection-number) :input #'main-iterate-all)
61 (setq lisp::*periodic-polling-function* #'main-iterate-all)
62 (setq lisp::*max-event-to-sec* 0)
63 (setq lisp::*max-event-to-usec* 1000))))
64
65
0f476ab5 66;;; Acccel group
560af5c5 67
68
1047e159 69
560af5c5 70;;; Acccel label
71
bbaeff4b 72(defbinding accel-label-refetch () boolean
560af5c5 73 (accel-label accel-label))
74
75
0f476ab5 76;;; Adjustment
560af5c5 77
1047e159 78(defmethod shared-initialize ((adjustment adjustment) names &key value)
79 (prog1
80 (call-next-method)
81 ;; we need to make sure that the value is set last, otherwise it
82 ;; may be outside current limits
83 (when value
84 (setf (slot-value adjustment 'value) value))))
85
86
0f476ab5 87(defbinding adjustment-changed () nil
88 (adjustment adjustment))
89
90(defbinding adjustment-value-changed () nil
91 (adjustment adjustment))
92
93(defbinding adjustment-clamp-page () nil
94 (adjustment adjustment)
95 (lower single-float)
96 (upper single-float))
560af5c5 97
0f476ab5 98
0f476ab5 99;;; Arrow -- no functions
100
101
102
103;;; Aspect frame
104
105
106;;; Bin
560af5c5 107
108(defun (setf bin-child) (child bin)
0f476ab5 109 (when-bind (current-child (bin-child bin))
110 (container-remove bin current-child))
560af5c5 111 (container-add bin child)
112 child)
113
f36ca6af 114
0f476ab5 115;;; Binding
116
117
118
119;;; Box
120
121(defbinding box-pack-start () nil
122 (box box)
123 (child widget)
124 (expand boolean)
125 (fill boolean)
126 (padding unsigned-int))
127
128(defbinding box-pack-end () nil
129 (box box)
130 (child widget)
131 (expand boolean)
132 (fill boolean)
133 (padding unsigned-int))
134
1a1949c7 135(defun box-pack (box child &key end expand fill (padding 0))
136 (if end
f5b67f2b 137 (box-pack-end box child expand fill padding)
138 (box-pack-start box child expand fill padding)))
0f476ab5 139
140(defbinding box-reorder-child () nil
141 (box box)
142 (child widget)
143 (position int))
144
145(defbinding box-query-child-packing () nil
146 (box box)
147 (child widget)
148 (expand boolean :out)
149 (fill boolean :out)
150 (padding unsigned-int :out)
151 (pack-type pack-type :out))
152
153(defbinding box-set-child-packing () nil
154 (box box)
155 (child widget)
156 (expand boolean)
157 (fill boolean)
158 (padding unsigned-int)
159 (pack-type pack-type))
160
161
162
560af5c5 163;;; Button
164
bbaeff4b 165(defbinding button-pressed () nil
560af5c5 166 (button button))
167
0f476ab5 168(defbinding button-released () nil
169 (button button))
170
171(defbinding button-clicked () nil
172 (button button))
173
174(defbinding button-enter () nil
175 (button button))
176
177(defbinding button-leave () nil
178 (button button))
179
180
181
182;;; Calendar
183
184(defbinding calendar-select-month () int
185 (calendar calendar)
186 (month unsigned-int)
187 (year unsigned-int))
188
189(defbinding calendar-select-day () nil
190 (calendar calendar)
191 (day unsigned-int))
192
193(defbinding calendar-mark-day () int
194 (calendar calendar)
195 (day unsigned-int))
196
197(defbinding calendar-unmark-day () int
198 (calendar calendar)
199 (day unsigned-int))
200
201(defbinding calendar-clear-marks () nil
202 (calendar calendar))
203
204(defbinding calendar-display-options () nil
205 (calendar calendar)
206 (options calendar-display-options))
207
208(defbinding (calendar-date "gtk_calendar_get_date") () nil
209 (calendar calendar)
210 (year unsigned-int :out)
211 (month unsigned-int :out)
212 (day unsigned-int :out))
213
214(defbinding calendar-freeze () nil
215 (calendar calendar))
216
217(defbinding calendar-thaw () nil
218 (calendar calendar))
219
220
221
222;;; Cell editable
223
224
225
226;;; Cell renderer
227
228
229
230;;; Cell renderer pixbuf -- no functions
231
232
233
234;;; Cell renderer text
235
236
237
238;;; Cell renderer toggle -- no functions
239
240
241
242;;; Check button -- no functions
243
244
245
246;;; Check menu item
247
248(defbinding check-menu-item-toggled () nil
249 (check-menu-item check-menu-item))
250
251
252
253;;; Clipboard
254
255
256;;; Color selection
257
258(defbinding (color-selection-is-adjusting-p
259 "gtk_color_selection_is_adjusting") () boolean
260 (colorsel color-selection))
261
262
263
264;;; Color selection dialog -- no functions
265
266
267
1a1949c7 268;;;; Combo Box
0f476ab5 269
1a1949c7 270(defmethod shared-initialize ((combo-box combo-box) names &key model content)
271 (unless model
272 (setf
273 (combo-box-model combo-box)
6bb23851 274 (make-instance 'list-store :column-types '(string)))
1a1949c7 275 (unless (typep combo-box 'combo-box-entry)
276 (let ((cell (make-instance 'cell-renderer-text)))
277 (cell-layout-pack combo-box cell :expand t)
278 (cell-layout-add-attribute combo-box cell :text 0)))
279 (when content
280 (map 'nil #'(lambda (text)
281 (combo-box-append-text combo-box text))
282 content)))
283 (call-next-method))
284
285;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
286;; (when active
287;; (signal-emit combo-box 'changed)))
288
289(defbinding combo-box-append-text () nil
290 (combo-box combo-box)
291 (text string))
292
293(defbinding combo-box-insert-text () nil
294 (combo-box combo-box)
295 (position int)
296 (text string))
297
298(defbinding combo-box-prepend-text () nil
299 (combo-box combo-box)
300 (text string))
301
302#+gtk2.6
303(defbinding combo-box-get-active-text () string
304 (combo-box combo-box))
0f476ab5 305
1a1949c7 306(defbinding combo-box-popup () nil
307 (combo-box combo-box))
0f476ab5 308
1a1949c7 309(defbinding combo-box-popdown () nil
310 (combo-box combo-box))
311
312
313
314;;;; Combo Box Entry
315
316(defmethod shared-initialize ((combo-box-entry combo-box-entry) names &key model)
317 (call-next-method)
318 (unless model
319 (setf (combo-box-entry-text-column combo-box-entry) 0)))
0f476ab5 320
321
48da76bf 322;;;; Dialog
0f476ab5 323
c49be931 324(defmethod shared-initialize ((dialog dialog) names &rest initargs
325 &key button buttons)
326 (declare (ignore button buttons))
327 (prog1
328 (call-next-method)
329 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
48da76bf 330
0f476ab5 331
332(defvar %*response-id-key* (gensym))
333
1047e159 334(defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
0f476ab5 335 (or
1047e159 336 (cadr (assoc id (rest (type-expand-1 'response-type))))
337 (let ((response-ids (object-data dialog %*response-id-key*)))
0f476ab5 338 (cond
1047e159 339 ((and response-ids (position id response-ids :test #'equal)))
340 (create-p
341 (cond
342 (response-ids
343 (vector-push-extend id response-ids)
344 (1- (length response-ids)))
345 (t
346 (setf
347 (object-data dialog %*response-id-key*)
348 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
349 0)))
350 (error-p
351 (error "Invalid response: ~A" id))))))
0f476ab5 352
353(defun %dialog-find-response-id (dialog response-id-num)
354 (if (< response-id-num 0)
355 (car
356 (rassoc
357 (list response-id-num)
1047e159 358 (rest (type-expand-1 'response-type)) :test #'equal))
359 (aref (object-data dialog %*response-id-key*) response-id-num )))
0f476ab5 360
361
48da76bf 362(defmethod signal-connect ((dialog dialog) signal function &key object after)
363 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
364 (cond
365 (response-id-num
366 (call-next-method
367 dialog 'response
368 #'(lambda (dialog id)
369 (when (= id response-id-num)
370 (cond
371 ((eq object t) (funcall function dialog))
372 (object (funcall function object))
373 (t (funcall function)))))
374 :object t :after after))
1047e159 375 ((call-next-method)))))
0f476ab5 376
377
48da76bf 378(defbinding dialog-run () nil
379 (dialog dialog))
0f476ab5 380
48da76bf 381(defbinding dialog-response (dialog response-id) nil
0f476ab5 382 (dialog dialog)
48da76bf 383 ((%dialog-find-response-id-num dialog response-id nil t) int))
0f476ab5 384
385
386(defbinding %dialog-add-button () button
387 (dialog dialog)
388 (text string)
389 (response-id-num int))
390
1047e159 391(defun dialog-add-button (dialog label &optional (response label)
392 &key default object after)
393 "Adds a button to the dialog. If no response is given, then label
394 will be used."
395 (let* ((id (if (functionp response)
396 label
397 response))
398 (id-num (%dialog-find-response-id-num dialog id t))
399 (button (%dialog-add-button dialog label id-num)))
400 (when (functionp response)
401 (signal-connect dialog id response :object object :after after))
402 (when default
403 (%dialog-set-default-response dialog id-num))
0f476ab5 404 button))
405
406
407(defbinding %dialog-add-action-widget () button
408 (dialog dialog)
409 (action-widget widget)
410 (response-id-num int))
411
1047e159 412(defun dialog-add-action-widget (dialog widget &optional (response widget)
413 &key default object after)
414 (let* ((id (if (functionp response)
415 widget
416 response))
417 (id-num (%dialog-find-response-id-num dialog id t)))
418 (%dialog-add-action-widget dialog widget id-num)
419 (when (functionp response)
420 (signal-connect dialog id response :object object :after after))
421 (when default
422 (%dialog-set-default-response dialog id-num))
0f476ab5 423 widget))
0f476ab5 424
0f476ab5 425
48da76bf 426(defbinding %dialog-set-default-response () nil
427 (dialog dialog)
428 (response-id-num int))
0f476ab5 429
48da76bf 430(defun dialog-set-default-response (dialog response-id)
431 (%dialog-set-default-response
432 dialog (%dialog-find-response-id-num dialog response-id nil t)))
0f476ab5 433
48da76bf 434(defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
435 (dialog dialog)
436 ((%dialog-find-response-id-num dialog response-id nil t) int)
437 (sensitive boolean))
0f476ab5 438
439
48da76bf 440;; Addition dialog functions
441
442(defmethod container-add ((dialog dialog) (child widget) &rest args)
1047e159 443 (apply #'container-add (dialog-vbox dialog) child args))
48da76bf 444
445(defmethod container-remove ((dialog dialog) (child widget))
1047e159 446 (container-remove (dialog-vbox dialog) child))
0f476ab5 447
48da76bf 448(defmethod container-children ((dialog dialog))
1047e159 449 (container-children (dialog-vbox dialog)))
48da76bf 450
451(defmethod (setf container-children) (children (dialog dialog))
1047e159 452 (setf (container-children (dialog-vbox dialog)) children))
560af5c5 453
560af5c5 454
560af5c5 455
2e852f7b 456;;; Drawing area
457
458(defbinding drawing-area-get-size () nil
459 (drawing-area drawing-area)
460 (width int :out)
461 (height int :out))
560af5c5 462
463
aaa6e6cb 464;;; Entry
560af5c5 465
60e5d937 466(defbinding entry-get-layout () pango:layout
aaa6e6cb 467 (entry entry))
468
469(defbinding entry-get-layout-offsets () nil
470 (entry entry)
471 (x int :out)
472 (y int :out))
560af5c5 473
560af5c5 474
1047e159 475;;; Image
476
477(defbinding image-set-from-file () nil
478 (image image)
479 (filename pathname))
480
481(defbinding image-set-from-pixmap () nil
482 (image image)
483 (pixmap gdk:pixmap)
484 (mask gdk:bitmap))
485
486(defbinding image-set-from-stock () nil
487 (image image)
488 (stock-id string)
489 (icon-size icon-size))
490
491(defun image-set-from-pixmap-data (image pixmap-data)
492 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap-data)
493 (image-set-from-pixmap image pixmap mask)))
494
495(defun image-set-from-source (image source)
496 (etypecase source
497 (pathname (image-set-from-file image source))
498 (string (if (stock-lookup source)
499 (setf (image-stock image) source)
500 (image-set-from-file image source)))
501 (vector (image-set-from-pixmap-data image source))))
502
503
504(defmethod shared-initialize ((image image) names &rest initargs
505 &key file pixmap source)
506 (prog1
507 (if (vectorp pixmap)
508 (progn
509 (remf initargs :pixmap)
510 (apply #'call-next-method image names initargs))
511 (call-next-method))
512 (cond
513 (file (image-set-from-file image file))
514 ((vectorp pixmap) (image-set-from-pixmap-data image pixmap))
515 (source (image-set-from-source image source)))))
516
560af5c5 517
0f476ab5 518;;; Label
560af5c5 519
aaa6e6cb 520(defbinding label-get-layout-offsets () nil
1047e159 521 (label label)
aaa6e6cb 522 (x int :out)
523 (y int :out))
524
0f476ab5 525(defbinding label-select-region () nil
526 (label label)
527 (start int)
528 (end int))
560af5c5 529
1047e159 530(defbinding label-get-text () string
aaa6e6cb 531 (label label))
532
60e5d937 533(defbinding label-get-layout () pango:layout
aaa6e6cb 534 (label label))
535
1047e159 536(defbinding label-get-selection-bounds () boolean
aaa6e6cb 537 (label label)
538 (start int :out)
539 (end int :out))
f36ca6af 540
560af5c5 541
542
543;;; Radio button
544
e5b416f0 545(defbinding %radio-button-get-group () pointer
d520140e 546 (radio-button radio-button))
547
bbaeff4b 548(defbinding %radio-button-set-group () nil
d520140e 549 (radio-button radio-button)
550 (group pointer))
560af5c5 551
d520140e 552(defun radio-button-add-to-group (button1 button2)
553 "Add BUTTON1 to the group which BUTTON2 belongs to."
554 (%radio-button-set-group button1 (%radio-button-get-group button2)))
555
e5b416f0 556
d520140e 557(defmethod initialize-instance ((button radio-button)
e5b416f0 558 &rest initargs &key group-with)
559 (declare (ignore initargs))
d520140e 560 (call-next-method)
e5b416f0 561 (when group-with
f5b67f2b 562 (radio-button-add-to-group button group-with)))
560af5c5 563
564
560af5c5 565;;; Item
566
bbaeff4b 567(defbinding item-select () nil
560af5c5 568 (item item))
569
bbaeff4b 570(defbinding item-deselect () nil
560af5c5 571 (item item))
572
bbaeff4b 573(defbinding item-toggle () nil
560af5c5 574 (item item))
575
576
577
578;;; Menu item
579
f36ca6af 580(defun (setf menu-item-label) (label menu-item)
581 (make-instance 'accel-label
582 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
583 :visible t :parent menu-item)
584 label)
560af5c5 585
f5b67f2b 586(defun menu-item-label (menu-item)
587 (with-slots (child) menu-item
588 (when (typep child 'label)
589 (label-label child))))
590
bbaeff4b 591(defbinding %menu-item-set-submenu () nil
f36ca6af 592 (menu-item menu-item)
593 (submenu menu))
560af5c5 594
bbaeff4b 595(defbinding %menu-item-remove-submenu () nil
f36ca6af 596 (menu-item menu-item))
560af5c5 597
f36ca6af 598(defun (setf menu-item-submenu) (submenu menu-item)
599 (if (not submenu)
600 (%menu-item-remove-submenu menu-item)
601 (%menu-item-set-submenu menu-item submenu))
602 submenu)
560af5c5 603
f5b67f2b 604(defbinding menu-item-set-accel-path () nil
605 (menu-item menu-item)
606 (accel-path string))
607
bbaeff4b 608(defbinding menu-item-select () nil
f36ca6af 609 (menu-item menu-item))
560af5c5 610
bbaeff4b 611(defbinding menu-item-deselect () nil
f36ca6af 612 (menu-item menu-item))
560af5c5 613
bbaeff4b 614(defbinding menu-item-activate () nil
f36ca6af 615 (menu-item menu-item))
560af5c5 616
f5b67f2b 617(defbinding menu-item-toggle-size-request () nil
618 (menu-item menu-item)
619 (requisition int :out))
620
621(defbinding menu-item-toggle-size-allocate () nil
622 (menu-item menu-item)
623 (allocation int))
624
560af5c5 625
626
f36ca6af 627;;; Radio menu item
560af5c5 628
e5b416f0 629(defbinding %radio-menu-item-get-group () pointer
d520140e 630 (radio-menu-item radio-menu-item))
631
bbaeff4b 632(defbinding %radio-menu-item-set-group () nil
d520140e 633 (radio-menu-item radio-menu-item)
634 (group pointer))
635
d520140e 636(defun radio-menu-item-add-to-group (item1 item2)
637 "Add ITEM1 to the group which ITEM2 belongs to."
638 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
639
640(defmethod initialize-instance ((item radio-menu-item)
e5b416f0 641 &rest initargs &key group-with)
642 (declare (ignore initargs))
f5b67f2b 643 (prog1
644 (call-next-method)
645 (when group-with
646 (radio-menu-item-add-to-group item group-with))))
d520140e 647
560af5c5 648
649
aaa6e6cb 650;;; Toggle button
651
652(defbinding toggle-button-toggled () nil
653 (toggle-button toggle-button))
654
655
656
560af5c5 657;;; Window
658
c49be931 659(defmethod initialize-instance ((window window) &rest initargs
660 &key accel-group accel-groups)
661 (declare (ignore accel-group accel-groups))
662 (prog1
663 (call-next-method)
664 (initial-add window #'window-add-accel-group
665 initargs :accel-group :accel-groups)))
73d58e01 666
667
7625ebd8 668(defbinding window-set-wmclass () nil
560af5c5 669 (window window)
670 (wmclass-name string)
671 (wmclass-class string))
672
bbaeff4b 673(defbinding window-add-accel-group () nil
560af5c5 674 (window window)
675 (accel-group accel-group))
676
bbaeff4b 677(defbinding window-remove-accel-group () nil
560af5c5 678 (window window)
679 (accel-group accel-group))
680
bbaeff4b 681(defbinding window-activate-focus () int
560af5c5 682 (window window))
683
bbaeff4b 684(defbinding window-activate-default () int
560af5c5 685 (window window))
686
7625ebd8 687(defbinding window-set-default-size (window width height) int
560af5c5 688 (window window)
7625ebd8 689 ((or width -1) int)
690 ((or height -1) int))
560af5c5 691
bbaeff4b 692;(defbinding window-set-geometry-hints)
560af5c5 693
73d58e01 694(defbinding window-list-toplevels () (glist (copy-of window))
695 "Returns a list of all existing toplevel windows.")
7625ebd8 696
697(defbinding window-add-mnemonic (window key target) nil
698 (window window)
699 ((gdk:keyval-from-name key) unsigned-int)
700 (target widget))
701
702(defbinding window-remove-mnemonic (window key target) nil
703 (window window)
704 ((gdk:keyval-from-name key) unsigned-int)
705 (target widget))
706
707(defbinding window-mnemonic-activate (window key modifier) nil
708 (window window)
709 ((gdk:keyval-from-name key) unsigned-int)
710 (modifier gdk:modifier-type))
711
712(defbinding window-present () nil
713 (window window))
714
715(defbinding window-iconify () nil
716 (window window))
717
718(defbinding window-deiconify () nil
719 (window window))
720
721(defbinding window-stick () nil
722 (window window))
723
724(defbinding window-unstick () nil
725 (window window))
726
727(defbinding window-maximize () nil
728 (window window))
729
730(defbinding window-unmaximize () nil
731 (window window))
732
733(defbinding window-begin-resize-drag () nil
734 (window window)
735 (edge gdk:window-edge)
736 (button int)
737 (root-x int) (root-y int)
9adccb27 738 (timestamp unsigned-int))
7625ebd8 739
740(defbinding window-begin-move-drag () nil
741 (window window)
742 (edge gdk:window-edge)
743 (button int)
744 (root-x int) (root-y int)
9adccb27 745 (timestamp unsigned-int))
7625ebd8 746
747(defbinding window-set-frame-dimensions () nil
748 (window window)
749 (left int) (top int) (rigth int) (bottom int))
750
751(defbinding (window-default-icons "gtk_window_get_default_icon_list")
752 () (glist gdk:pixbuf))
753
754(defbinding %window-get-default-size () nil
755 (window window)
756 (width int :out)
757 (height int :out))
758
759(defun window-get-default-size (window)
760 (multiple-value-bind (width height) (%window-get-default-size window)
761 (values (unless (= width -1) width) (unless (= height -1) height))))
762
763(defbinding window-get-frame-dimensions () nil
764 (window window)
765 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
766
767(defbinding %window-get-icon-list () (glist gdk:pixbuf)
768 (window window))
769
770(defmethod window-icon ((window window))
771 (let ((icon-list (%window-get-icon-list window)))
772 (if (endp (rest icon-list))
773 (first icon-list)
774 icon-list)))
775
776(defbinding window-get-position () nil
777 (window window)
778 (root-x int :out)
779 (root-y int :out))
780
781(defbinding window-get-size () nil
782 (window window)
783 (width int :out)
784 (height int :out))
785
786(defbinding window-move () nil
787 (window window)
788 (x int)
789 (y int))
790
791(defbinding window-parse-geometry () boolean
792 (window window)
793 (geometry string))
794
795(defbinding window-reshow-with-initial-size () nil
796 (window window))
797
798(defbinding window-resize () nil
799 (window window)
800 (width int)
801 (heigth int))
802
803(defbinding %window-set-icon-list () nil
804 (window window)
805 (icon-list (glist gdk:pixbuf)))
806
807(defmethod (setf window-icon) (icon (window window))
808 (%window-set-icon-list window (mklist icon)))
809
810
560af5c5 811
812
1047e159 813;;; File chooser
560af5c5 814
560af5c5 815
560af5c5 816
817
f36ca6af 818;;; Scrolled window
560af5c5 819
560af5c5 820(defun (setf scrolled-window-scrollbar-policy) (policy window)
821 (setf (scrolled-window-hscrollbar-policy window) policy)
822 (setf (scrolled-window-vscrollbar-policy window) policy))
823
bbaeff4b 824(defbinding scrolled-window-add-with-viewport () nil
560af5c5 825 (scrolled-window scrolled-window)
826 (child widget))
827
828
829
d520140e 830
831
832
560af5c5 833
f36ca6af 834;;; Statusbar
560af5c5 835
bbaeff4b 836(defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
837 () unsigned-int
f36ca6af 838 (statusbar statusbar)
839 (context-description string))
560af5c5 840
bbaeff4b 841(defbinding statusbar-push () unsigned-int
f36ca6af 842 (statusbar statusbar)
843 (context-id unsigned-int)
844 (text string))
560af5c5 845
bbaeff4b 846(defbinding statusbar-pop () nil
f36ca6af 847 (statusbar statusbar)
848 (context-id unsigned-int))
560af5c5 849
bbaeff4b 850(defbinding statusbar-remove () nil
f36ca6af 851 (statusbar statusbar)
852 (context-id unsigned-int)
853 (message-id unsigned-int))
560af5c5 854
560af5c5 855
856
857;;; Fixed
858
bbaeff4b 859(defbinding fixed-put () nil
f36ca6af 860 (fixed fixed)
861 (widget widget)
f5b67f2b 862 (x int) (y int))
560af5c5 863
bbaeff4b 864(defbinding fixed-move () nil
f36ca6af 865 (fixed fixed)
866 (widget widget)
f5b67f2b 867 (x int) (y int))
560af5c5 868
869
870
d520140e 871;;; Notebook
560af5c5 872
f5b67f2b 873(defun %notebook-position (notebook page)
874 (etypecase page
875 (int page)
876 (keyword (case page
877 (:first 0)
878 (:last -1)
1047e159 879 (t (error "Invalid position keyword: ~A" page))))
f5b67f2b 880 (widget (notebook-page-num notebook page t))))
881
882(defun %notebook-child (notebook position)
883 (typecase position
884 (widget position)
885 (t (notebook-nth-page-child notebook position))))
886
887
888(defbinding (notebook-insert "gtk_notebook_insert_page_menu")
f36ca6af 889 (notebook position child tab-label &optional menu-label) nil
890 (notebook notebook)
891 (child widget)
892 ((if (stringp tab-label)
f5b67f2b 893 (make-instance 'label :label tab-label)
f36ca6af 894 tab-label) widget)
895 ((if (stringp menu-label)
f5b67f2b 896 (make-instance 'label :label menu-label)
f36ca6af 897 menu-label) (or null widget))
f5b67f2b 898 ((%notebook-position notebook position) int))
560af5c5 899
f5b67f2b 900(defun notebook-append (notebook child tab-label &optional menu-label)
901 (notebook-insert notebook :last child tab-label menu-label))
560af5c5 902
f5b67f2b 903(defun notebook-prepend (notebook child tab-label &optional menu-label)
904 (notebook-insert notebook :first child tab-label menu-label))
560af5c5 905
f5b67f2b 906(defbinding notebook-remove-page (notebook page) nil
f36ca6af 907 (notebook notebook)
1047e159 908 ((%notebook-position notebook page) int))
560af5c5 909
bbaeff4b 910(defbinding %notebook-page-num () int
f36ca6af 911 (notebook notebook)
912 (child widget))
913
f5b67f2b 914(defun notebook-page-num (notebook child &optional error-p)
f36ca6af 915 (let ((page-num (%notebook-page-num notebook child)))
916 (if (= page-num -1)
f5b67f2b 917 (when error-p
918 (error "~A is not a child of ~A" child notebook))
f36ca6af 919 page-num)))
920
bbaeff4b 921(defbinding notebook-next-page () nil
f36ca6af 922 (notebook notebook))
560af5c5 923
bbaeff4b 924(defbinding notebook-prev-page () nil
f36ca6af 925 (notebook notebook))
926
f5b67f2b 927(defbinding notebook-reorder-child (notebook child position) nil
928 (notebook notebook)
929 (child widget)
930 ((%notebook-position notebook position) int))
931
bbaeff4b 932(defbinding notebook-popup-enable () nil
f36ca6af 933 (notebook notebook))
934
bbaeff4b 935(defbinding notebook-popup-disable () nil
f36ca6af 936 (notebook notebook))
937
f5b67f2b 938(defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
939 (notebook page) widget
940 (notebook notebook)
941 ((case page
942 (:first 0)
943 (:last -1)
944 (t page)) int))
945
1047e159 946
947(defbinding %notebook-get-current-page () int
f5b67f2b 948 (notebook notebook))
949
1047e159 950(defun notebook-current-page-num (notebook)
951 (let ((num (%notebook-get-current-page notebook)))
952 (when (>= num 0)
953 num)))
954
f5b67f2b 955(defun notebook-current-page (notebook)
1047e159 956 (let ((page-num (notebook-current-page-num notebook)))
957 (when page-num
958 (notebook-nth-page-child notebook page-num))))
f5b67f2b 959
960(defbinding %notebook-set-current-page () nil
961 (notebook notebook)
962 (page-num int))
963
964(defun (setf notebook-current-page) (page notebook)
965 (%notebook-set-current-page notebook (%notebook-position notebook page))
966 page)
967
968
1047e159 969(defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
970 (notebook page) widget
971 (notebook notebook)
972 ((%notebook-child notebook page) widget))
f5b67f2b 973
1047e159 974(defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
6bb23851 975 (notebook page) (copy-of string)
1047e159 976 (notebook notebook)
977 ((%notebook-child notebook page) widget))
f5b67f2b 978
1047e159 979(defbinding %notebook-set-tab-label () nil
980 (notebook notebook)
981 (page widget)
982 (tab-label widget))
983
984(defun (setf notebook-tab-label) (tab-label notebook page)
985 (let ((widget (if (stringp tab-label)
986 (make-instance 'label :label tab-label)
987 tab-label)))
988 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
989 widget))
f5b67f2b 990
f5b67f2b 991
1047e159 992(defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
993 (notebook page) widget
994 (notebook notebook)
995 ((%notebook-child notebook page) widget))
f5b67f2b 996
1047e159 997(defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
6bb23851 998 (notebook page) (copy-of string)
1047e159 999 (notebook notebook)
1000 ((%notebook-child notebook page) widget))
f5b67f2b 1001
1047e159 1002(defbinding %notebook-set-menu-label () nil
1003 (notebook notebook)
1004 (page widget)
1005 (menu-label widget))
1006
1007(defun (setf notebook-menu-label) (menu-label notebook page)
1008 (let ((widget (if (stringp menu-label)
1009 (make-instance 'label :label menu-label)
1010 menu-label)))
1011 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1012 widget))
f5b67f2b 1013
1014
1015(defbinding notebook-query-tab-label-packing (notebook page) nil
f36ca6af 1016 (notebook notebook)
f5b67f2b 1017 ((%notebook-child notebook page) widget)
f36ca6af 1018 (expand boolean :out)
1019 (fill boolean :out)
1020 (pack-type pack-type :out))
1021
f5b67f2b 1022(defbinding notebook-set-tab-label-packing
1023 (notebook page expand fill pack-type) nil
f36ca6af 1024 (notebook notebook)
f5b67f2b 1025 ((%notebook-child notebook page) widget)
f36ca6af 1026 (expand boolean)
1027 (fill boolean)
1028 (pack-type pack-type))
1029
560af5c5 1030
1031
d520140e 1032;;; Paned
560af5c5 1033
bbaeff4b 1034(defbinding paned-pack1 () nil
d520140e 1035 (paned paned)
1036 (child widget)
1037 (resize boolean)
1038 (shrink boolean))
560af5c5 1039
bbaeff4b 1040(defbinding paned-pack2 () nil
d520140e 1041 (paned paned)
1042 (child widget)
1043 (resize boolean)
1044 (shrink boolean))
560af5c5 1045
560af5c5 1046
d520140e 1047;;; Layout
560af5c5 1048
bbaeff4b 1049(defbinding layout-put () nil
d520140e 1050 (layout layout)
1051 (widget widget)
1052 (x int)
1053 (y int))
560af5c5 1054
bbaeff4b 1055(defbinding layout-move () nil
d520140e 1056 (layout layout)
1057 (widget widget)
1058 (x int)
1059 (y int))
560af5c5 1060
560af5c5 1061
1062
560af5c5 1063;;; Menu shell
1064
f5b67f2b 1065(defbinding menu-shell-insert (menu-shell menu-item position) nil
f36ca6af 1066 (menu-shell menu-shell)
1067 (menu-item menu-item)
f5b67f2b 1068 ((case position
1069 (:first 0)
1070 (:last -1)
1071 (t position)) int))
560af5c5 1072
f36ca6af 1073(defun menu-shell-append (menu-shell menu-item)
f5b67f2b 1074 (menu-shell-insert menu-shell menu-item :last))
560af5c5 1075
f36ca6af 1076(defun menu-shell-prepend (menu-shell menu-item)
f5b67f2b 1077 (menu-shell-insert menu-shell menu-item :fisrt))
560af5c5 1078
bbaeff4b 1079(defbinding menu-shell-deactivate () nil
f36ca6af 1080 (menu-shell menu-shell))
560af5c5 1081
bbaeff4b 1082(defbinding menu-shell-select-item () nil
f36ca6af 1083 (menu-shell menu-shell)
1084 (menu-item menu-item))
560af5c5 1085
bbaeff4b 1086(defbinding menu-shell-deselect () nil
f36ca6af 1087 (menu-shell menu-shell))
560af5c5 1088
bbaeff4b 1089(defbinding menu-shell-activate-item () nil
f36ca6af 1090 (menu-shell menu-shell)
1091 (menu-item menu-item)
1092 (fore-deactivate boolean))
560af5c5 1093
1094
1095
f5b67f2b 1096;;; Menu
560af5c5 1097
f5b67f2b 1098(defun %menu-position (menu child)
1099 (etypecase child
1100 (int child)
1101 (keyword (case child
1102 (:first 0)
1103 (:last -1)
1047e159 1104 (t (error "Invalid position keyword: ~A" child))))
f5b67f2b 1105 (widget (menu-child-position menu child))))
560af5c5 1106
1107
f5b67f2b 1108(defbinding menu-reorder-child (menu menu-item position) nil
1109 (menu menu)
1110 (menu-item menu-item)
1111 ((%menu-position menu position) int))
560af5c5 1112
8755b1a5 1113(def-callback-marshal %menu-popup-callback (nil (x int) (y int) (push-in boolean)))
560af5c5 1114
f5b67f2b 1115(defbinding %menu-popup () nil
1116 (menu menu)
1117 (parent-menu-shell (or null menu-shell))
1118 (parent-menu-item (or null menu-item))
1119 (callback-func (or null pointer))
1120 (callback-id unsigned-int)
1121 (button unsigned-int)
1122 (activate-time (unsigned 32)))
1123
1124(defun menu-popup (menu button activate-time &key callback parent-menu-shell
1125 parent-menu-item)
1126 (if callback
1a1949c7 1127 (with-callback-function (id callback)
1128 (%menu-popup
1129 menu parent-menu-shell parent-menu-item
1130 (callback %menu-popup-callback) id button activate-time))
f5b67f2b 1131 (%menu-popup
1132 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1133
1134(defbinding menu-set-accel-path () nil
1135 (menu menu)
1136 (accel-path string))
560af5c5 1137
bbaeff4b 1138(defbinding menu-reposition () nil
f36ca6af 1139 (menu menu))
560af5c5 1140
bbaeff4b 1141(defbinding menu-popdown () nil
f36ca6af 1142 (menu menu))
560af5c5 1143
f5b67f2b 1144(defun menu-child-position (menu child)
1145 (position child (container-children menu)))
1146
1147(defun menu-active-num (menu)
1148 (menu-child-position menu (menu-active menu)))
1149
bbaeff4b 1150(defbinding %menu-set-active () nil
f36ca6af 1151 (menu menu)
1152 (index unsigned-int))
560af5c5 1153
f5b67f2b 1154(defun (setf menu-active) (menu child)
1155 (%menu-set-active menu (%menu-position menu child))
1156 child)
d520140e 1157
560af5c5 1158
1159
f36ca6af 1160;;; Table
560af5c5 1161
bbaeff4b 1162(defbinding table-resize () nil
f36ca6af 1163 (table table)
1164 (rows unsigned-int)
1165 (columns unsigned-int))
560af5c5 1166
bbaeff4b 1167(defbinding table-attach (table child left right top bottom
c49be931 1168 &key options x-options y-options
1169 (x-padding 0) (y-padding 0)) nil
f36ca6af 1170 (table table)
1171 (child widget)
1172 (left unsigned-int)
1173 (right unsigned-int)
1174 (top unsigned-int)
1175 (bottom unsigned-int)
c49be931 1176 ((append (mklist options) (mklist x-options)) attach-options)
1177 ((append (mklist options) (mklist y-options)) attach-options)
f36ca6af 1178 (x-padding unsigned-int)
1179 (y-padding unsigned-int))
1180
e5b416f0 1181
bbaeff4b 1182(defbinding %table-set-row-spacing () nil
f36ca6af 1183 (table table)
1184 (row unsigned-int)
1185 (spacing unsigned-int))
1186
e5b416f0 1187(defbinding %table-set-row-spacings () nil
1188 (table table)
1189 (spacing unsigned-int))
1190
1191(defun (setf table-row-spacing) (spacing table &optional row)
1192 (if row
1193 (%table-set-row-spacing table row spacing)
1194 (%table-set-row-spacings table spacing))
f36ca6af 1195 spacing)
1196
e5b416f0 1197(defbinding %table-get-row-spacing () unsigned-int
f36ca6af 1198 (table table)
e5b416f0 1199 (row unsigned-int))
1200
1201(defbinding %table-get-default-row-spacing () unsigned-int
1202 (table table))
1203
1204(defun table-row-spacing (table &optional row)
1205 (if row
1206 (%table-get-row-spacing table row)
1207 (%table-get-default-row-spacing table)))
1208
f36ca6af 1209
bbaeff4b 1210(defbinding %table-set-col-spacing () nil
f36ca6af 1211 (table table)
1212 (col unsigned-int)
1213 (spacing unsigned-int))
1214
e5b416f0 1215(defbinding %table-set-col-spacings () nil
1216 (table table)
1217 (spacing unsigned-int))
1218
1219(defun (setf table-col-spacing) (spacing table &optional col)
1220 (if col
1221 (%table-set-col-spacing table col spacing)
1222 (%table-set-col-spacings table spacing))
f36ca6af 1223 spacing)
1224
e5b416f0 1225(defbinding %table-get-col-spacing () unsigned-int
f36ca6af 1226 (table table)
e5b416f0 1227 (col unsigned-int))
1228
1229(defbinding %table-get-default-col-spacing () unsigned-int
1230 (table table))
1231
1232(defun table-col-spacing (table &optional col)
1233 (if col
1234 (%table-get-col-spacing table col)
1235 (%table-get-default-col-spacing table)))
1236
1237
f36ca6af 1238
1239;;; Toolbar
1240
bbaeff4b 1241(defbinding %toolbar-insert-element () widget
f36ca6af 1242 (toolbar toolbar)
1243 (type toolbar-child-type)
1244 (widget (or null widget))
1245 (text string)
1246 (tooltip-text string)
1247 (tooltip-private-text string)
1248 (icon (or null widget))
1249 (nil null)
1250 (nil null)
1251 (position int))
560af5c5 1252
f5b67f2b 1253(defbinding %toolbar-insert-stock () widget
1254 (toolbar toolbar)
1255 (stock-id string)
1256 (tooltip-text string)
1257 (tooltip-private-text string)
1258 (nil null)
1259 (nil null)
1260 (position int))
1261
1262(defun toolbar-insert (toolbar position element
1263 &key tooltip-text tooltip-private-text
1264 type icon group callback object)
1265 (let* ((numpos (case position
1047e159 1266 (:first -1)
1267 (:last 0)
f5b67f2b 1268 (t position)))
1269 (widget
1270 (cond
1271 ((or
1272 (eq type :space)
1273 (and (not type) (eq element :space)))
1274 (%toolbar-insert-element
1275 toolbar :space nil nil
1276 tooltip-text tooltip-private-text nil numpos))
1277 ((or
1278 (eq type :widget)
1279 (and (not type) (typep element 'widget)))
1280 (%toolbar-insert-element
1281 toolbar :widget element nil
1282 tooltip-text tooltip-private-text nil numpos))
1283 ((or
1284 (eq type :stock)
1285 (and
1286 (not type)
1287 (typep element 'string)
1288 (stock-lookup element)))
1289 (%toolbar-insert-stock
1290 toolbar element tooltip-text tooltip-private-text numpos))
1291 ((typep element 'string)
1292 (%toolbar-insert-element
1293 toolbar (or type :button) (when (eq type :radio-button) group)
1047e159 1294 element tooltip-text tooltip-private-text
1295 (etypecase icon
1296 (null nil)
1297 (widget icon)
1298 ((or pathname string vector)
1299 (make-instance 'image
1300 :source icon ; :icon-size (toolbar-icon-size toolbar)
1301 )))
1302 numpos))
f5b67f2b 1303 ((error "Invalid element type: ~A" element)))))
f36ca6af 1304 (when callback
f5b67f2b 1305 (signal-connect widget 'clicked callback :object object))
1306 widget))
f36ca6af 1307
f5b67f2b 1308(defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text
1309 type icon group callback object)
1310 (toolbar-insert
1311 toolbar :first element :type type :icon icon :group group
f36ca6af 1312 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
f5b67f2b 1313 :callback callback :object object))
f36ca6af 1314
f5b67f2b 1315(defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text
1316 type icon group callback object)
1317 (toolbar-insert
1318 toolbar :last element :type type :icon icon :group group
f36ca6af 1319 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
f5b67f2b 1320 :callback callback :object object))
1321
f36ca6af 1322
1323(defun toolbar-insert-space (toolbar position)
f5b67f2b 1324 (toolbar-insert toolbar position :space))
f36ca6af 1325
1326(defun toolbar-append-space (toolbar)
f5b67f2b 1327 (toolbar-append toolbar :space))
f36ca6af 1328
1329(defun toolbar-prepend-space (toolbar)
f5b67f2b 1330 (toolbar-prepend toolbar :space))
f36ca6af 1331
560af5c5 1332
f36ca6af 1333(defun toolbar-enable-tooltips (toolbar)
1334 (setf (toolbar-tooltips-p toolbar) t))
560af5c5 1335
f36ca6af 1336(defun toolbar-disable-tooltips (toolbar)
1337 (setf (toolbar-tooltips-p toolbar) nil))
560af5c5 1338
1339
f5b67f2b 1340(defbinding toolbar-remove-space () nil
1341 (toolbar toolbar)
1342 (position int))
560af5c5 1343
f5b67f2b 1344(defbinding toolbar-unset-icon-size () nil
1345 (toolbar toolbar))
560af5c5 1346
f5b67f2b 1347(defbinding toolbar-unset-style () nil
1348 (toolbar toolbar))
560af5c5 1349
1350
bbaeff4b 1351;;; Editable
1047e159 1352
bbaeff4b 1353(defbinding editable-select-region (editable &optional (start 0) end) nil
f36ca6af 1354 (editable editable)
1355 (start int)
1356 ((or end -1) int))
560af5c5 1357
1047e159 1358(defbinding editable-get-selection-bounds (editable) nil
1359 (editable editable)
1360 (start int :out)
1361 (end int :out))
1362
bbaeff4b 1363(defbinding editable-insert-text
f36ca6af 1364 (editable text &optional (position 0)) nil
1365 (editable editable)
1366 (text string)
1367 ((length text) int)
1368 ((or position -1) int :in-out))
560af5c5 1369
f36ca6af 1370(defun editable-append-text (editable text)
1371 (editable-insert-text editable text nil))
560af5c5 1372
f36ca6af 1373(defun editable-prepend-text (editable text)
1374 (editable-insert-text editable text 0))
560af5c5 1375
bbaeff4b 1376(defbinding editable-delete-text (editable &optional (start 0) end) nil
f36ca6af 1377 (editable editable)
1378 (start int)
1379 ((or end -1) int))
560af5c5 1380
bbaeff4b 1381(defbinding (editable-text "gtk_editable_get_chars")
f36ca6af 1382 (editable &optional (start 0) end) string
1383 (editable editable)
1384 (start int)
1385 ((or end -1) int))
560af5c5 1386
f36ca6af 1387(defun (setf editable-text) (text editable)
1388 (if text
1389 (editable-delete-text
1390 editable
1391 (editable-insert-text editable text))
1392 (editable-delete-text editable))
1393 text)
560af5c5 1394
bbaeff4b 1395(defbinding editable-cut-clipboard () nil
f36ca6af 1396 (editable editable))
560af5c5 1397
bbaeff4b 1398(defbinding editable-copy-clipboard () nil
f36ca6af 1399 (editable editable))
560af5c5 1400
bbaeff4b 1401(defbinding editable-paste-clipboard () nil
f36ca6af 1402 (editable editable))
560af5c5 1403
bbaeff4b 1404(defbinding editable-delete-selection () nil
f36ca6af 1405 (editable editable))
560af5c5 1406
560af5c5 1407
560af5c5 1408
f36ca6af 1409;;; Spin button
560af5c5 1410
f36ca6af 1411(defun spin-button-value-as-int (spin-button)
1412 (round (spin-button-value spin-button)))
560af5c5 1413
bbaeff4b 1414(defbinding spin-button-spin () nil
f36ca6af 1415 (spin-button spin-button)
1416 (direction spin-type)
1417 (increment single-float))
560af5c5 1418
bbaeff4b 1419(defbinding spin-button-update () nil
f36ca6af 1420 (spin-button spin-button))
560af5c5 1421
1422
1423
1424; ;;; Ruler
1425
bbaeff4b 1426(defbinding ruler-set-range () nil
f36ca6af 1427 (ruler ruler)
1428 (lower single-float)
1429 (upper single-float)
1430 (position single-float)
1431 (max-size single-float))
560af5c5 1432
bbaeff4b 1433(defbinding ruler-draw-ticks () nil
f36ca6af 1434 (ruler ruler))
560af5c5 1435
bbaeff4b 1436(defbinding ruler-draw-pos () nil
f36ca6af 1437 (ruler ruler))
560af5c5 1438
560af5c5 1439
560af5c5 1440
d520140e 1441;;; Range
560af5c5 1442
1047e159 1443(defun range-lower (range)
1444 (adjustment-lower (range-adjustment range)))
560af5c5 1445
1047e159 1446(defun range-upper (range)
1447 (adjustment-upper (range-adjustment range)))
560af5c5 1448
1047e159 1449(defun (setf range-lower) (value range)
1450 (setf (adjustment-lower (range-adjustment range)) value))
560af5c5 1451
1047e159 1452(defun (setf range-upper) (value range)
1453 (setf (adjustment-upper (range-adjustment range)) value))
560af5c5 1454
1047e159 1455(defun range-page-increment (range)
1456 (adjustment-page-increment (range-adjustment range)))
560af5c5 1457
1047e159 1458(defun range-step-increment (range)
1459 (adjustment-step-increment (range-adjustment range)))
560af5c5 1460
1047e159 1461(defun (setf range-page-increment) (value range)
1462 (setf (adjustment-page-increment (range-adjustment range)) value))
560af5c5 1463
1047e159 1464(defun (setf range-step-increment) (value range)
1465 (setf (adjustment-step-increment (range-adjustment range)) value))
560af5c5 1466
1047e159 1467(defbinding range-set-range () nil
d520140e 1468 (range range)
1047e159 1469 (lower double-float)
1470 (upper double-float))
560af5c5 1471
1047e159 1472(defbinding range-set-increments () nil
d520140e 1473 (range range)
1047e159 1474 (step double-float)
1475 (page double-float))
560af5c5 1476
560af5c5 1477
d520140e 1478;;; Scale
560af5c5 1479
e5b416f0 1480; (defbinding scale-draw-value () nil
1481; (scale scale))
560af5c5 1482
560af5c5 1483
560af5c5 1484
d520140e 1485;;; Progress bar
560af5c5 1486
bbaeff4b 1487(defbinding progress-bar-pulse () nil
d520140e 1488 (progress-bar progress-bar))
560af5c5 1489
1490
c49be931 1491;;; Size group
1492
1493(defmethod initialize-instance ((size-group size-group) &rest initargs
1494 &key widget widgets)
1495 (declare (ignore widget widgets))
1496 (prog1
1497 (call-next-method)
1498 (initial-add size-group #'size-group-add-widget
1499 initargs :widget :widgets)))
1500
1501
1502(defbinding size-group-add-widget () nil
1503 (size-group size-group)
1504 (widget widget))
1505
1506(defbinding size-group-remove-widget () nil
1507 (size-group size-group)
1508 (widget widget))
1509
560af5c5 1510
f5b67f2b 1511;;; Stock items
1512
73d58e01 1513(defbinding %stock-item-copy () pointer
1514 (location pointer))
1515
1516(defbinding %stock-item-free () nil
1517 (location pointer))
f5b67f2b 1518
73d58e01 1519(defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1520 (%stock-item-copy location))
1521
1522(defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1523 (%stock-item-free location))
1524
1525(defbinding stock-add (stock-item) nil
1526 (stock-item stock-item)
1527 (1 unsigned-int))
1528
1529(defbinding stock-list-ids () (gslist string))
1530
1531(defbinding %stock-lookup () boolean
1532 (stock-id string)
1533 (location pointer))
1534
1535(defun stock-lookup (stock-id)
1536 (let ((location
1537 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1538 (unwind-protect
1539 (when (%stock-lookup stock-id location)
1540 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1541 (deallocate-memory location))))
560af5c5 1542
1543
1544;;; Tooltips
1545
bbaeff4b 1546(defbinding tooltips-enable () nil
d520140e 1547 (tooltips tooltips))
560af5c5 1548
bbaeff4b 1549(defbinding tooltips-disable () nil
d520140e 1550 (tooltips tooltips))
560af5c5 1551
e5b416f0 1552(defun (setf tooltips-enabled-p) (enable tooltips)
1553 (if enable
1554 (tooltips-enable tooltips)
1555 (tooltips-disable tooltips)))
1556
bbaeff4b 1557(defbinding tooltips-set-tip () nil
d520140e 1558 (tooltips tooltips)
1559 (widget widget)
1560 (tip-text string)
1561 (tip-private string))
560af5c5 1562
bbaeff4b 1563(defbinding tooltips-force-window () nil
d520140e 1564 (tooltips tooltips))
560af5c5 1565
1566
1567
d520140e 1568;;; Rc
560af5c5 1569
bbaeff4b 1570(defbinding rc-add-default-file (filename) nil
d520140e 1571 ((namestring (truename filename)) string))
560af5c5 1572
bbaeff4b 1573(defbinding rc-parse (filename) nil
d520140e 1574 ((namestring (truename filename)) string))
560af5c5 1575
bbaeff4b 1576(defbinding rc-parse-string () nil
d520140e 1577 (rc-string string))
560af5c5 1578
bbaeff4b 1579(defbinding rc-reparse-all () nil)
560af5c5 1580
bbaeff4b 1581(defbinding rc-get-style () style
d520140e 1582 (widget widget))
560af5c5 1583
1584
1585
1586;;; Accelerator Groups
bbaeff4b 1587#|
bbaeff4b 1588(defbinding accel-group-activate (accel-group key modifiers) boolean
560af5c5 1589 (accel-group accel-group)
1590 ((gdk:keyval-from-name key) unsigned-int)
1591 (modifiers gdk:modifier-type))
1592
bbaeff4b 1593(defbinding accel-groups-activate (object key modifiers) boolean
560af5c5 1594 (object object)
1595 ((gdk:keyval-from-name key) unsigned-int)
1596 (modifiers gdk:modifier-type))
1597
bbaeff4b 1598(defbinding accel-group-attach () nil
560af5c5 1599 (accel-group accel-group)
1600 (object object))
1601
bbaeff4b 1602(defbinding accel-group-detach () nil
560af5c5 1603 (accel-group accel-group)
1604 (object object))
1605
bbaeff4b 1606(defbinding accel-group-lock () nil
560af5c5 1607 (accel-group accel-group))
1608
bbaeff4b 1609(defbinding accel-group-unlock () nil
560af5c5 1610 (accel-group accel-group))
1611
1612
1613;;; Accelerator Groups Entries
1614
bbaeff4b 1615(defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
560af5c5 1616 (accel-group accel-group)
1617 ((gdk:keyval-from-name key) unsigned-int)
1618 (modifiers gdk:modifier-type))
1619
bbaeff4b 1620(defbinding accel-group-lock-entry (accel-group key modifiers) nil
560af5c5 1621 (accel-group accel-group)
1622 ((gdk:keyval-from-name key) unsigned-int)
1623 (modifiers gdk:modifier-type))
1624
bbaeff4b 1625(defbinding accel-group-unlock-entry (accel-group key modifiers) nil
560af5c5 1626 (accel-group accel-group)
1627 ((gdk:keyval-from-name key) unsigned-int)
1628 (modifiers gdk:modifier-type))
1629
bbaeff4b 1630(defbinding accel-group-add
560af5c5 1631 (accel-group key modifiers flags object signal) nil
1632 (accel-group accel-group)
1633 ((gdk:keyval-from-name key) unsigned-int)
1634 (modifiers gdk:modifier-type)
1635 (flags accel-flags)
1636 (object object)
1637 ((name-to-string signal) string))
1638
bbaeff4b 1639(defbinding accel-group-add (accel-group key modifiers object) nil
560af5c5 1640 (accel-group accel-group)
1641 ((gdk:keyval-from-name key) unsigned-int)
1642 (modifiers gdk:modifier-type)
1643 (object object))
1644
1645
1646;;; Accelerator Signals
1647
bbaeff4b 1648(defbinding accel-group-handle-add
560af5c5 1649 (object signal-id accel-group key modifiers flags) nil
1650 (object object)
1651 (signal-id unsigned-int)
1652 (accel-group accel-group)
1653 ((gdk:keyval-from-name key) unsigned-int)
1654 (modifiers gdk:modifier-type)
1655 (flags accel-flags))
1656
bbaeff4b 1657(defbinding accel-group-handle-remove
560af5c5 1658 (object accel-group key modifiers) nil
1659 (object object)
1660 (accel-group accel-group)
1661 ((gdk:keyval-from-name key) unsigned-int)
1662 (modifiers gdk:modifier-type))
bbaeff4b 1663|#