1 ;; Common Lisp bindings for GTK+ v2.0
2 ;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
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.
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.
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
18 ;; $Id: gtk.lisp,v 1.30 2005-01-12 13:38:18 espen Exp $
25 (defbinding check-version () (copy-of string)
26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
30 (defbinding query-version () nil
31 (major unsigned-int :out)
32 (minor unsigned-int :out)
33 (micro unsigned-int :out))
36 (multiple-value-bind (major minor micro)
39 (format nil "Gtk+ v~A.~A" major minor)
40 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
42 (defbinding get-default-language () (copy-of pango:language))
47 (defbinding (gtk-init "gtk_parse_args") () nil
48 "Initializes the library without opening the display."
52 (defun clg-init (&optional display)
53 "Initializes the system and starts the event handling"
54 (unless (gdk:display-get-default)
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))))
72 (defbinding accel-label-refetch () boolean
73 (accel-label accel-label))
78 (defbinding accessible-connect-widget-destroyed () nil
79 (accessible accessible))
84 (defmethod initialize-instance ((adjustment adjustment) &key value)
87 ;; we need to make sure that the value is set last, otherwise it
88 ;; may be outside current limits and ignored
90 (setf (slot-value adjustment 'value) value))))
93 (defbinding adjustment-changed () nil
94 (adjustment adjustment))
96 (defbinding adjustment-value-changed () nil
97 (adjustment adjustment))
99 (defbinding adjustment-clamp-page () nil
100 (adjustment adjustment)
102 (upper single-float))
107 (defbinding alignment-set () nil
108 (alognment alignment)
109 (x-align single-float)
110 (y-align single-float)
111 (x-scale single-float)
112 (y-scale single-float))
114 (defbinding alignment-get-padding () nil
115 (alognment alignment)
116 (top unsigned-int :out)
117 (bottom unsigned-int :out)
118 (left unsigned-int :out)
119 (right unsigned-int :out))
121 (defbinding alignment-set-padding () nil
122 (alognment alignment)
124 (bottom unsigned-int)
126 (right unsigned-int))
134 (defun (setf bin-child) (child bin)
135 (when-bind (current-child (bin-child bin))
136 (container-remove bin current-child))
137 (container-add bin child)
140 (defmethod create-callback-function ((bin bin) function arg1)
142 #'(lambda (&rest args)
143 (apply function (bin-child bin) (rest args)))
149 (defbinding box-pack-start () nil
154 (padding unsigned-int))
156 (defbinding box-pack-end () nil
161 (padding unsigned-int))
163 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
165 (box-pack-end box child expand fill padding)
166 (box-pack-start box child expand fill padding)))
168 (defbinding box-reorder-child () nil
173 (defbinding box-query-child-packing () nil
176 (expand boolean :out)
178 (padding unsigned-int :out)
179 (pack-type pack-type :out))
181 (defbinding box-set-child-packing () nil
186 (padding unsigned-int)
187 (pack-type pack-type))
193 (defmethod initialize-instance ((button button) &rest initargs &key stock)
195 (apply #'call-next-method button :label stock :use-stock t initargs)
199 (defbinding button-pressed () nil
202 (defbinding button-released () nil
205 (defbinding button-clicked () nil
208 (defbinding button-enter () nil
211 (defbinding button-leave () nil
218 (defbinding calendar-select-month () int
223 (defbinding calendar-select-day () nil
227 (defbinding calendar-mark-day () int
231 (defbinding calendar-unmark-day () int
235 (defbinding calendar-clear-marks () nil
238 (defbinding calendar-get-date () nil
240 (year unsigned-int :out)
241 (month unsigned-int :out)
242 (day unsigned-int :out))
244 (defbinding calendar-freeze () nil
247 (defbinding calendar-thaw () nil
253 (defbinding check-menu-item-toggled () nil
254 (check-menu-item check-menu-item))
263 (defbinding (color-selection-is-adjusting-p
264 "gtk_color_selection_is_adjusting") () boolean
265 (colorsel color-selection))
269 ;;; Color selection dialog -- no functions
275 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
276 &key model content active)
277 (remf initargs :active)
279 (apply #'call-next-method combo-box initargs)
281 (apply #'call-next-method combo-box
282 :model (make-instance 'list-store :column-types '(string))
284 (unless (typep combo-box 'combo-box-entry)
285 (let ((cell (make-instance 'cell-renderer-text)))
286 (cell-layout-pack combo-box cell :expand t)
287 (cell-layout-add-attribute combo-box cell :text 0)))))
289 (mapc #'(lambda (text)
290 (combo-box-append-text combo-box text))
293 (setf (combo-box-active combo-box) active)))
296 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
298 ;; (signal-emit combo-box 'changed)))
300 (defbinding combo-box-append-text () nil
301 (combo-box combo-box)
304 (defbinding combo-box-insert-text () nil
305 (combo-box combo-box)
309 (defbinding combo-box-prepend-text () nil
310 (combo-box combo-box)
314 (defbinding combo-box-get-active-text () string
315 (combo-box combo-box))
317 (defbinding combo-box-popup () nil
318 (combo-box combo-box))
320 (defbinding combo-box-popdown () nil
321 (combo-box combo-box))
327 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
330 (setf (combo-box-entry-text-column combo-box-entry) 0)))
335 (defmethod shared-initialize ((dialog dialog) names &rest initargs
337 (declare (ignore button buttons))
340 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
343 (defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
345 (cadr (assoc id (rest (type-expand-1 'response-type))))
346 (let ((response-ids (object-data dialog 'response-id-key)))
348 ((and response-ids (position id response-ids :test #'equal)))
352 (vector-push-extend id response-ids)
353 (1- (length response-ids)))
356 (object-data dialog 'response-id-key)
357 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
360 (error "Invalid response: ~A" id))))))
362 (defun %dialog-find-response-id (dialog response-id-num)
363 (if (< response-id-num 0)
366 (list response-id-num)
367 (rest (type-expand-1 'response-type)) :test #'equal))
368 (aref (object-data dialog 'response-id-key) response-id-num )))
371 (defmethod signal-connect ((dialog dialog) signal function &key object after)
372 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
377 #'(lambda (dialog id)
378 (when (= id response-id-num)
380 ((eq object t) (funcall function dialog))
381 (object (funcall function object))
382 (t (funcall function)))))
383 :object t :after after))
384 ((call-next-method)))))
387 (defbinding dialog-run () nil
390 (defbinding dialog-response (dialog response-id) nil
392 ((%dialog-find-response-id-num dialog response-id nil t) int))
395 (defbinding %dialog-add-button () button
398 (response-id-num int))
400 (defun dialog-add-button (dialog label &optional (response label)
401 &key default object after)
402 "Adds a button to the dialog."
403 (let* ((id (if (functionp response)
406 (id-num (%dialog-find-response-id-num dialog id t))
407 (button (%dialog-add-button dialog label id-num)))
408 (when (functionp response)
409 (signal-connect dialog id response :object object :after after))
411 (%dialog-set-default-response dialog id-num))
415 (defbinding %dialog-add-action-widget () button
417 (action-widget widget)
418 (response-id-num int))
420 (defun dialog-add-action-widget (dialog widget &optional (response widget)
421 &key default object after)
422 (let* ((id (if (functionp response)
425 (id-num (%dialog-find-response-id-num dialog id t)))
426 (%dialog-add-action-widget dialog widget id-num)
427 (when (functionp response)
428 (signal-connect dialog id response :object object :after after))
430 (%dialog-set-default-response dialog id-num))
434 (defbinding %dialog-set-default-response () nil
436 (response-id-num int))
438 (defun dialog-set-default-response (dialog response-id)
439 (%dialog-set-default-response
440 dialog (%dialog-find-response-id-num dialog response-id nil t)))
442 (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
444 ((%dialog-find-response-id-num dialog response-id nil t) int)
448 (defbinding alternative-dialog-button-order-p(&optional screen)
449 (screen (or null screen)))
452 (defbinding (dialog-set-alternative-button-order
453 "gtk_dialog_set_alternative_button_order_from_array")
456 ((length new-order) int)
457 ((map 'vector #'(lambda (id)
458 (%dialog-find-response-id-num dialog id nil t))
459 new-order) (vector int)))
462 (defmethod container-add ((dialog dialog) (child widget) &rest args)
463 (apply #'container-add (dialog-vbox dialog) child args))
465 (defmethod container-remove ((dialog dialog) (child widget))
466 (container-remove (dialog-vbox dialog) child))
468 (defmethod container-children ((dialog dialog))
469 (container-children (dialog-vbox dialog)))
471 (defmethod (setf container-children) (children (dialog dialog))
472 (setf (container-children (dialog-vbox dialog)) children))
477 (defbinding entry-get-layout-offsets () nil
482 (defbinding entry-layout-index-to-text-index () int
486 (defbinding entry-text-index-to-layout-index () int
493 (def-callback-marshal %entry-completion-match-func
494 (boolean entry-completion string (copy-of tree-iter)))
496 (defbinding entry-completion-set-match-func (completion function) nil
497 (completion entry-completion)
498 ((callback %entry-completion-match-func) pointer)
499 ((register-callback-function function) unsigned-int)
500 ((callback %destroy-user-data) pointer))
502 (defbinding entry-completion-complete () nil
503 (completion entry-completion))
506 (defbinding entry-completion-insert-prefix () nil
507 (completion entry-completion))
509 (defbinding entry-completion-insert-action-text () nil
510 (completion entry-completion)
514 (defbinding entry-completion-insert-action-markup () nil
515 (completion entry-completion)
519 (defbinding entry-completion-delete-action () nil
520 (completion entry-completion)
526 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
527 &key filter filters shortcut-folder
528 shortcut-folders shortcut-folder-uti
529 shortcut-folder-uris)
530 (declare (ignore filter filters shortcut-folder shortcut-folders
531 shortcut-folder-uti shortcut-folder-uris))
534 (initial-add file-chooser #'file-chooser-add-filter
535 initargs :filer :filters)
536 (initial-add file-chooser #'file-chooser-add-shortcut-folder
537 initargs :shortcut-folder :shortcut-folders)
538 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
539 initargs :shortcut-folder-uri :shortcut-folders-uris)))
542 (defbinding file-chooser-select-filename () boolean
543 (file-chooser file-chooser)
546 (defbinding file-chooser-unselect-filename () nil
547 (file-chooser file-chooser)
550 (defbinding file-chooser-select-all () boolean
551 (file-chooser file-chooser))
553 (defbinding file-chooser-unselect-all () boolean
554 (file-chooser file-chooser))
556 (defbinding file-chooser-get-filenames () (gslist string)
557 (file-chooser file-chooser))
559 (defbinding file-chooser-select-uri () boolean
560 (file-chooser file-chooser)
563 (defbinding file-chooser-unselect-uri () nil
564 (file-chooser file-chooser)
567 (defbinding file-chooser-get-uris () (gslist string)
568 (file-chooser file-chooser))
570 (defbinding file-chooser-add-filter () nil
571 (file-chooser file-chooser)
572 (filter file-filter))
574 (defbinding file-chooser-remove-filter () nil
575 (file-chooser file-chooser)
576 (filter file-filter))
578 (defbinding file-chooser-list-filters () (gslist file-filter)
579 (file-chooser file-chooser))
581 (defbinding file-chooser-add-shortcut-folder () boolean
582 (file-chooser file-chooser)
586 (defbinding file-chooser-remove-shortcut-folder () nil
587 (file-chooser file-chooser)
591 (defbinding file-chooser-list-shortcut-folders () (gslist string)
592 (file-chooser file-chooser))
594 (defbinding file-chooser-add-shortcut-folder-uri () boolean
595 (file-chooser file-chooser)
599 (defbinding file-chooser-remove-shortcut-folder-uri () nil
600 (file-chooser file-chooser)
604 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
605 (file-chooser file-chooser))
610 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
611 &key mime-type mime-types pattern patterns
613 (declare (ignore mime-type mime-types pattern patterns))
617 #-gtk2.6(warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
618 #+gtk2.6(file-filter-add-pixbuf-formats file-filter))
619 (initial-add file-filter #'file-filter-add-mime-type
620 initargs :mime-type :mime-types)
621 (initial-add file-filter #'file-filter-add-pattern
622 initargs :pattern :patterns)))
625 (defbinding file-filter-add-mime-type () nil
629 (defbinding file-filter-add-pattern () nil
634 (defbinding file-filter-add-pixbuf-formats () nil
638 (def-callback-marshal %file-filter-func (boolean file-filter-info))
640 (defbinding file-filter-add-custom () nil
642 (needed file-filter-flags)
643 ((callback %file-filter-func) pointer)
644 ((register-callback-function function) unsigned-int)
645 ((callback %destroy-user-data) pointer))
647 (defbinding file-filter-get-needed () file-filter-flags
648 (filter file-filter))
650 (defbinding file-filter-filter () boolean
652 (filter-info file-filter-info))
658 (defbinding image-set-from-file () nil
662 (defmethod (setf image-pixmap) ((data vector) (image image))
663 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
664 (setf (image-pixmap image) pixmap)
665 (setf (image-mask image) mask)))
667 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
669 ((typep pixmap 'vector)
670 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
671 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
675 (image-set-from-file image file)))
676 ((call-next-method))))
678 (defun create-image-widget (source &optional mask)
680 (gdk:pixbuf (make-instance 'image :pixbuf source))
681 (string (make-instance 'image :stock source))
682 (pathname (make-instance 'image :file source))
683 ((or list vector) (make-instance 'image :pixmap source))
684 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
689 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
690 (if (and image (not (typep image 'widget)))
691 (apply #'call-next-method item :image (create-image-widget image) initargs)
695 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
696 (setf (slot-value item 'image) widget))
698 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
699 (setf (image-menu-item-image item) (create-image-widget image)))
704 (defbinding label-get-layout-offsets () nil
709 (defbinding label-select-region () nil
714 (defbinding label-get-selection-bounds () boolean
723 (defbinding %radio-button-get-group () pointer
724 (radio-button radio-button))
726 (defbinding %radio-button-set-group () nil
727 (radio-button radio-button)
730 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
731 "Add BUTTON1 to the group which BUTTON2 belongs to."
732 (%radio-button-set-group button1 (%radio-button-get-group button2)))
734 (defmethod initialize-instance ((button radio-button) &key group)
738 (add-to-radio-group button group))))
743 (defbinding item-select () nil
746 (defbinding item-deselect () nil
749 (defbinding item-toggle () nil
756 (defmethod initialize-instance ((item menu-item) &key label)
760 (setf (menu-item-label item) label))))
763 (defun (setf menu-item-label) (label menu-item)
764 (make-instance 'accel-label
765 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
766 :use-underline (menu-item-use-underline-p menu-item)
767 :visible t :parent menu-item)
770 (defun menu-item-label (menu-item)
771 (when (and (slot-boundp menu-item 'child)
772 (typep (bin-child menu-item) 'label))
773 (label-label (bin-child menu-item))))
775 (defbinding menu-item-remove-submenu () nil
776 (menu-item menu-item))
778 (defbinding menu-item-set-accel-path () nil
779 (menu-item menu-item)
782 (defbinding menu-item-select () nil
783 (menu-item menu-item))
785 (defbinding menu-item-deselect () nil
786 (menu-item menu-item))
788 (defbinding menu-item-activate () nil
789 (menu-item menu-item))
791 (defbinding menu-item-toggle-size-request () nil
792 (menu-item menu-item)
793 (requisition int :out))
795 (defbinding menu-item-toggle-size-allocate () nil
796 (menu-item menu-item)
803 (defbinding menu-tool-button-set-arrow-tip () nil
804 (menu-tool-button menu-tool-button)
807 (tip-private string))
812 (defmethod initialize-instance ((dialog message-dialog) &rest initargs
813 &key (type :info) (buttons :close) ; or :ok?
814 flags message parent)
815 (remf initargs :parent)
817 (slot-value dialog 'location)
818 (%message-dialog-new parent flags type buttons nil))
819 (message-dialog-set-markup dialog message)
820 (apply #'call-next-method dialog initargs))
823 (defbinding %message-dialog-new () pointer
824 (parent (or null window))
827 (buttons buttons-type)
828 (message (or null string)))
830 (defbinding %message-dialog-new-with-markup () pointer
831 (parent (or null window))
834 (buttons buttons-type)
837 (defbinding message-dialog-set-markup () nil
838 (message-dialog message-dialog)
842 (defbinding message-dialog-format-secondary-text () nil
843 (message-dialog message-dialog)
847 (defbinding message-dialog-format-secondary-markup () nil
848 (message-dialog message-dialog)
855 (defbinding %radio-menu-item-get-group () pointer
856 (radio-menu-item radio-menu-item))
858 (defbinding %radio-menu-item-set-group () nil
859 (radio-menu-item radio-menu-item)
862 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
863 "Add ITEM1 to the group which ITEM2 belongs to."
864 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
866 (defmethod initialize-instance ((item radio-menu-item) &key group)
870 (add-to-radio-group item group))))
874 ;;; Radio tool button
876 (defbinding %radio-tool-button-get-group () pointer
877 (radio-tool-button radio-tool-button))
879 (defbinding %radio-tool-button-set-group () nil
880 (radio-tool-button radio-tool-button)
883 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
884 "Add BUTTON1 to the group which BUTTON2 belongs to."
885 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
887 (defmethod add-activate-callback ((widget widget) function &key object after)
889 (signal-connect widget 'clicked
891 (when (slot-value widget 'active)
892 (funcall function object (slot-value widget 'value))))
893 :object object :after after)
894 (signal-connect widget 'clicked
896 (when (slot-value widget 'active)
897 (funcall function (slot-value widget 'value))))
900 (defmethod initialize-instance ((button radio-tool-button) &key group)
904 (add-to-radio-group button group))))
910 (defbinding toggle-button-toggled () nil
911 (toggle-button toggle-button))
916 (defmethod initialize-instance ((window window) &rest initargs
917 &key accel-group accel-groups)
918 (declare (ignore accel-group accel-groups))
921 (initial-add window #'window-add-accel-group
922 initargs :accel-group :accel-groups)))
925 (defbinding window-set-wmclass () nil
927 (wmclass-name string)
928 (wmclass-class string))
930 (defbinding window-add-accel-group () nil
932 (accel-group accel-group))
934 (defbinding window-remove-accel-group () nil
936 (accel-group accel-group))
938 (defbinding window-activate-focus () int
941 (defbinding window-activate-default () int
944 (defbinding window-set-default-size (window width height) int
947 ((or height -1) int))
949 (defbinding %window-set-geometry-hints () nil
951 (geometry gdk:geometry)
952 (geometry-mask gdk:window-hints))
954 (defun window-set-geometry-hints (window &key min-width min-height
955 max-width max-height base-width base-height
956 width-inc height-inc min-aspect max-aspect
957 (gravity nil gravity-p) min-size max-size)
958 (let ((geometry (make-instance 'gdk:geometry
959 :min-width (or min-width -1)
960 :min-height (or min-height -1)
961 :max-width (or max-width -1)
962 :max-height (or max-height -1)
963 :base-width (or base-width 0)
964 :base-height (or base-height 0)
965 :width-inc (or width-inc 0)
966 :height-inc (or height-inc 0)
967 :min-aspect (or min-aspect 0)
968 :max-aspect (or max-aspect 0)
971 (when (or min-size min-width min-height)
972 (push :min-size mask))
973 (when (or max-size max-width max-height)
974 (push :max-size mask))
975 (when (or base-width base-height)
976 (push :base-size mask))
977 (when (or width-inc height-inc)
978 (push :resize-inc mask))
979 (when (or min-aspect max-aspect)
982 (push :win-gravity mask))
983 (%window-set-geometry-hints window geometry mask)))
985 (defbinding window-list-toplevels () (glist (copy-of window))
986 "Returns a list of all existing toplevel windows.")
988 (defbinding window-add-mnemonic (window key target) nil
990 ((gdk:keyval-from-name key) unsigned-int)
993 (defbinding window-remove-mnemonic (window key target) nil
995 ((gdk:keyval-from-name key) unsigned-int)
998 (defbinding window-mnemonic-activate (window key modifier) nil
1000 ((gdk:keyval-from-name key) unsigned-int)
1001 (modifier gdk:modifier-type))
1003 (defbinding window-activate-key () boolean
1005 (event gdk:key-event))
1007 (defbinding window-propagate-key-event () boolean
1009 (event gdk:key-event))
1011 (defbinding window-present () nil
1014 (defbinding window-iconify () nil
1017 (defbinding window-deiconify () nil
1020 (defbinding window-stick () nil
1023 (defbinding window-unstick () nil
1026 (defbinding window-maximize () nil
1029 (defbinding window-unmaximize () nil
1032 (defbinding window-fullscreen () nil
1035 (defbinding window-unfullscreen () nil
1038 (defbinding window-set-keep-above () nil
1042 (defbinding window-set-keep-below () nil
1046 (defbinding window-begin-resize-drag () nil
1048 (edge gdk:window-edge)
1050 (root-x int) (root-y int)
1051 (timestamp unsigned-int))
1053 (defbinding window-begin-move-drag () nil
1055 (edge gdk:window-edge)
1057 (root-x int) (root-y int)
1058 (timestamp unsigned-int))
1060 (defbinding window-set-frame-dimensions () nil
1062 (left int) (top int) (rigth int) (bottom int))
1064 (defbinding %window-get-default-size () nil
1069 (defun window-get-default-size (window)
1070 (multiple-value-bind (width height) (%window-get-default-size window)
1071 (values (unless (= width -1) width) (unless (= height -1) height))))
1073 (defbinding window-get-frame-dimensions () nil
1075 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1077 (defbinding %window-get-icon-list () (glist gdk:pixbuf)
1080 (defbinding window-get-position () nil
1085 (defbinding window-get-size () nil
1090 (defbinding window-move () nil
1095 (defbinding window-parse-geometry () boolean
1099 (defbinding window-reshow-with-initial-size () nil
1102 (defbinding window-resize () nil
1107 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1108 () (glist gdk:pixbuf))
1110 (defun window-default-icon ()
1111 (first (window-default-icon-list)))
1113 (defbinding %window-set-default-icon-list () nil
1114 (icons (glist gdk:pixbuf)))
1116 (defun (setf window-default-icon-list) (icons)
1117 (%window-set-default-icon-list icons)
1120 (defbinding %window-set-default-icon () nil
1121 (icons (glist gdk:pixbuf)))
1123 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1124 (%window-set-default-icon icon)
1127 (defmethod (setf window-group) ((group window-group) (window window))
1128 (window-group-add-window group window)
1131 (defbinding %window-set-default-icon-from-file () boolean
1135 (defmethod (setf window-default-icon) ((icon-file pathname))
1136 (%window-set-default-icon-from-file icon-file)
1139 (defbinding %window-set-icon-from-file () boolean
1144 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1145 (%window-set-icon-from-file window icon-file)
1148 (defbinding window-set-auto-startup-notification () nil
1151 (defbinding decorated-window-init () nil
1154 (defbinding decorated-window-calculate-frame-size () nil
1157 (defbinding decorated-window-set-title () nil
1161 (defbinding decorated-window-move-resize-window () nil
1171 (defmethod initialize-instance ((window-group window-group) &rest initargs
1172 &key window windows)
1173 (declare (ignore window windows))
1176 (initial-add window-group #'window-group-add-window
1177 initargs :window :windows)))
1180 (defbinding window-group-add-window () nil
1181 (window-group window-group)
1184 (defbinding window-group-remove-window () nil
1185 (window-group window-group)
1191 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1192 (setf (scrolled-window-hscrollbar-policy window) policy)
1193 (setf (scrolled-window-vscrollbar-policy window) policy))
1195 (defbinding scrolled-window-add-with-viewport () nil
1196 (scrolled-window scrolled-window)
1199 (defmethod initialize-instance ((window scrolled-window) &rest initargs
1202 (apply #'call-next-method window
1203 :vscrollbar-policy policy :hscrollbar-policy policy initargs)
1204 (call-next-method)))
1209 (defbinding statusbar-get-context-id () unsigned-int
1210 (statusbar statusbar)
1211 (context-description string))
1213 (defbinding statusbar-push () unsigned-int
1214 (statusbar statusbar)
1215 (context-id unsigned-int)
1218 (defbinding statusbar-pop () nil
1219 (statusbar statusbar)
1220 (context-id unsigned-int))
1222 (defbinding statusbar-remove () nil
1223 (statusbar statusbar)
1224 (context-id unsigned-int)
1225 (message-id unsigned-int))
1231 (defbinding fixed-put () nil
1236 (defbinding fixed-move () nil
1245 (defun %ensure-notebook-position (notebook page)
1248 (widget (notebook-page-num notebook page t))))
1250 (defun %ensure-notebook-child (notebook position)
1253 (t (notebook-get-nth-page notebook position))))
1255 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1256 (notebook position child tab-label &optional menu-label) nil
1259 ((if (stringp tab-label)
1260 (make-instance 'label :label tab-label)
1262 ((if (stringp menu-label)
1263 (make-instance 'label :label menu-label)
1264 menu-label) (or null widget))
1265 ((%ensure-notebook-position notebook position) position))
1267 (defun notebook-append (notebook child tab-label &optional menu-label)
1268 (notebook-insert notebook :last child tab-label menu-label))
1270 (defun notebook-prepend (notebook child tab-label &optional menu-label)
1271 (notebook-insert notebook :first child tab-label menu-label))
1273 (defbinding notebook-remove-page (notebook page) nil
1275 ((%ensure-notebook-position notebook page) position))
1277 (defbinding %notebook-page-num () int
1281 (defun notebook-page-num (notebook child &optional error-p)
1282 (let ((page-num (%notebook-page-num notebook child)))
1285 (error "~A is not a page in ~A" child notebook))
1288 (defbinding notebook-next-page () nil
1289 (notebook notebook))
1291 (defbinding notebook-prev-page () nil
1292 (notebook notebook))
1294 (defbinding notebook-reorder-child (notebook child position) nil
1297 ((%notebook-position notebook position) int))
1299 (defbinding notebook-popup-enable () nil
1300 (notebook notebook))
1302 (defbinding notebook-popup-disable () nil
1303 (notebook notebook))
1305 (defbinding notebook-get-nth-page () widget
1309 (defun %notebook-current-page (notebook)
1310 (when (slot-boundp notebook 'current-page-num)
1311 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1313 (defun (setf notebook-current-page) (page notebook)
1314 (setf (notebook-current-page notebook) (notebook-page-num notebook page)))
1316 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1317 (notebook page) widget
1319 ((%ensure-notebook-child notebook page) widget))
1321 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1322 (notebook page) (copy-of string)
1324 ((%ensure-notebook-child notebook page) widget))
1326 (defbinding %notebook-set-tab-label () nil
1331 (defun (setf notebook-tab-label) (tab-label notebook page)
1332 (let ((widget (if (stringp tab-label)
1333 (make-instance 'label :label tab-label)
1335 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1339 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1340 (notebook page) widget
1342 ((%ensure-notebook-child notebook page) widget))
1344 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1345 (notebook page) (copy-of string)
1347 ((%ensure-notebook-child notebook page) widget))
1349 (defbinding %notebook-set-menu-label () nil
1352 (menu-label widget))
1354 (defun (setf notebook-menu-label) (menu-label notebook page)
1355 (let ((widget (if (stringp menu-label)
1356 (make-instance 'label :label menu-label)
1358 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1362 (defbinding notebook-query-tab-label-packing (notebook page) nil
1364 ((%notebook-child notebook page) widget)
1365 (expand boolean :out)
1367 (pack-type pack-type :out))
1369 (defbinding notebook-set-tab-label-packing
1370 (notebook page expand fill pack-type) nil
1372 ((%notebook-child notebook page) widget)
1375 (pack-type pack-type))
1381 (defbinding paned-pack1 () nil
1387 (defbinding paned-pack2 () nil
1396 (defbinding layout-put () nil
1402 (defbinding layout-move () nil
1408 (defbinding layout-set-size () nil
1410 (width unsigned-int)
1411 (height unsigned-int))
1413 (defbinding layout-get-size () nil
1415 (width unsigned-int :out)
1416 (height unsigned-int :out))
1421 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1422 (menu-shell menu-shell)
1423 (menu-item menu-item)
1429 (defun menu-shell-append (menu-shell menu-item)
1430 (menu-shell-insert menu-shell menu-item :last))
1432 (defun menu-shell-prepend (menu-shell menu-item)
1433 (menu-shell-insert menu-shell menu-item :fisrt))
1435 (defbinding menu-shell-deactivate () nil
1436 (menu-shell menu-shell))
1438 (defbinding menu-shell-select-item () nil
1439 (menu-shell menu-shell)
1440 (menu-item menu-item))
1442 (defbinding menu-shell-select-first () nil
1443 (menu-shell menu-shell)
1444 (search-sensitive boolean))
1446 (defbinding menu-shell-deselect () nil
1447 (menu-shell menu-shell))
1449 (defbinding menu-shell-activate-item () nil
1450 (menu-shell menu-shell)
1451 (menu-item menu-item)
1452 (fore-deactivate boolean))
1454 (defbinding menu-shell-cancel () nil
1455 (menu-shell menu-shell))
1460 (defun %menu-position (menu child)
1463 (keyword (case child
1466 (t (error "Invalid position keyword: ~A" child))))
1467 (widget (menu-child-position menu child))))
1470 (defbinding menu-reorder-child (menu menu-item position) nil
1472 (menu-item menu-item)
1473 ((%menu-position menu position) int))
1475 (defbinding menu-attach () nil
1477 (menu-item menu-item)
1478 (left-attach unsigned-int)
1479 (right-attach unsigned-int)
1480 (top-attach unsigned-int)
1481 (bottom-attach unsigned-int))
1483 (def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean)))
1485 (defbinding %menu-popup () nil
1487 (parent-menu-shell (or null menu-shell))
1488 (parent-menu-item (or null menu-item))
1489 (callback-func (or null pointer))
1490 (callback-id unsigned-int)
1491 (button unsigned-int)
1492 (activate-time (unsigned 32)))
1494 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1497 (with-callback-function (id callback)
1499 menu parent-menu-shell parent-menu-item
1500 (callback %menu-position-func) id button activate-time))
1502 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1504 (defbinding menu-set-accel-path () nil
1506 (accel-path string))
1508 (defbinding menu-reposition () nil
1511 (defbinding menu-popdown () nil
1514 (defun menu-child-position (menu child)
1515 (position child (container-children menu)))
1517 (defun menu-active-num (menu)
1518 (menu-child-position menu (menu-active menu)))
1520 (defbinding %menu-set-active () nil
1522 (index unsigned-int))
1524 (defun (setf menu-active) (menu child)
1525 (%menu-set-active menu (%menu-position menu child))
1528 (defcallback %menu-detach-func (nil (widget widget) (menu menu))
1529 (funcall (object-data menu 'detach-func) widget menu))
1531 (defbinding %menu-attach-to-widget () nil
1534 ((callback %menu-detach-func) pointer))
1536 (defun menu-attach-to-widget (menu widget function)
1537 (setf (object-data menu 'detach-func) function)
1538 (%menu-attach-to-widget menu widget))
1540 (defbinding menu-detach () nil
1544 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1547 (defbinding menu-set-monitor () nil
1554 (defbinding table-resize () nil
1557 (columns unsigned-int))
1559 (defbinding table-attach (table child left right top bottom
1560 &key options x-options y-options
1561 (x-padding 0) (y-padding 0)) nil
1565 (right unsigned-int)
1567 (bottom unsigned-int)
1568 ((append (mklist options) (mklist x-options)) attach-options)
1569 ((append (mklist options) (mklist y-options)) attach-options)
1570 (x-padding unsigned-int)
1571 (y-padding unsigned-int))
1574 (defbinding %table-set-row-spacing () nil
1577 (spacing unsigned-int))
1579 (defbinding %table-set-row-spacings () nil
1581 (spacing unsigned-int))
1583 (defun (setf table-row-spacing) (spacing table &optional row)
1585 (%table-set-row-spacing table row spacing)
1586 (%table-set-row-spacings table spacing))
1589 (defbinding %table-get-row-spacing () unsigned-int
1593 (defbinding %table-get-default-row-spacing () unsigned-int
1596 (defun table-row-spacing (table &optional row)
1598 (%table-get-row-spacing table row)
1599 (%table-get-default-row-spacing table)))
1602 (defbinding %table-set-col-spacing () nil
1605 (spacing unsigned-int))
1607 (defbinding %table-set-col-spacings () nil
1609 (spacing unsigned-int))
1611 (defun (setf table-col-spacing) (spacing table &optional col)
1613 (%table-set-col-spacing table col spacing)
1614 (%table-set-col-spacings table spacing))
1617 (defbinding %table-get-col-spacing () unsigned-int
1621 (defbinding %table-get-default-col-spacing () unsigned-int
1624 (defun table-col-spacing (table &optional col)
1626 (%table-get-col-spacing table col)
1627 (%table-get-default-col-spacing table)))
1633 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1635 (apply #'call-next-method toolbar
1636 :tooltips (make-instance 'tooltips) initargs)
1637 (call-next-method)))
1639 (defbinding %toolbar-insert () nil
1641 (tool-item tool-item)
1642 (position position))
1644 (defun toolbar-insert (toolbar tool-item &optional (position :end))
1645 (%toolbar-insert toolbar tool-item position)
1646 (%tool-item-update-tooltips tool-item))
1648 (defbinding toolbar-get-item-index () int
1652 (defbinding toolbar-get-nth-item () tool-item
1656 (defbinding toolbar-get-drop-index () int
1660 (defbinding toolbar-set-drop-highlight-item () nil
1662 (tool-item tool-item)
1668 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
1669 (if (and icon (not (typep icon 'widget)))
1670 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
1671 (call-next-method)))
1676 (defbinding tool-item-set-tooltip () nil
1677 (tool-item tool-item)
1680 (tip-private string))
1683 (defun %tool-item-update-tooltips (tool-item)
1685 (slot-boundp tool-item 'parent)
1687 (user-data-p tool-item 'tip-text)
1688 (user-data-p tool-item 'tip-private)))
1689 (tool-item-set-tooltip
1690 tool-item (toolbar-tooltips (widget-parent tool-item))
1691 (or (user-data tool-item 'tip-text) "")
1692 (or (user-data tool-item 'tip-private) ""))))
1694 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
1695 (setf (user-data tool-item 'tip-text) tip-text)
1696 (%tool-item-update-tooltips tool-item)
1699 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
1700 (setf (user-data tool-item 'tip-private) tip-private)
1701 (%tool-item-update-tooltips tool-item)
1704 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
1705 (declare (ignore args))
1708 (%tool-item-update-tooltips tool-item)))
1711 (defbinding tool-item-retrieve-proxy-menu-item () widget
1712 (tool-item tool-item))
1714 (defbinding (tool-item-proxy-menu-item
1715 "gtk_tool_item_get_proxy_menu_item") () menu-item
1716 (tool-item tool-item)
1717 (menu-item-id string))
1719 (defbinding %tool-item-set-proxy-menu-item () nil
1720 (tool-item tool-item)
1721 (menu-item-id string)
1722 (menu-item menu-item))
1724 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
1725 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
1729 (defbinding tool-item-rebuild-menu () nil
1730 (tool-item tool-item))
1735 (defbinding editable-select-region (editable &optional (start 0) end) nil
1740 (defbinding editable-get-selection-bounds (editable) nil
1745 (defbinding editable-insert-text (editable text &optional (position 0)) nil
1749 (position position-type :in-out))
1751 (defun editable-append-text (editable text)
1752 (editable-insert-text editable text nil))
1754 (defun editable-prepend-text (editable text)
1755 (editable-insert-text editable text 0))
1757 (defbinding editable-delete-text (editable &optional (start 0) end) nil
1762 (defbinding (editable-text "gtk_editable_get_chars")
1763 (editable &optional (start 0) end) string
1768 (defun (setf editable-text) (text editable)
1770 (editable-delete-text
1772 (editable-insert-text editable text))
1773 (editable-delete-text editable))
1776 (defbinding editable-cut-clipboard () nil
1777 (editable editable))
1779 (defbinding editable-copy-clipboard () nil
1780 (editable editable))
1782 (defbinding editable-paste-clipboard () nil
1783 (editable editable))
1785 (defbinding editable-delete-selection () nil
1786 (editable editable))
1792 (defbinding spin-button-configure () nil
1793 (spin-button spin-button)
1794 (adjustment adjustment)
1795 (climb-rate double-float)
1796 (digits unsigned-int))
1798 (defbinding spin-button-set-range () nil
1799 (spin-button spin-button)
1803 (defbinding spin-button-get-range () nil
1804 (spin-button spin-button)
1805 (min double-float :out)
1806 (max double-float :out))
1808 (defun spin-button-value-as-int (spin-button)
1809 (round (spin-button-value spin-button)))
1811 (defbinding spin-button-spin () nil
1812 (spin-button spin-button)
1813 (direction spin-type)
1814 (increment single-float))
1816 (defbinding spin-button-update () nil
1817 (spin-button spin-button))
1823 (defbinding ruler-set-range () nil
1825 (lower single-float)
1826 (upper single-float)
1827 (position single-float)
1828 (max-size single-float))
1830 (defbinding ruler-get-range () nil
1832 (lower single-float :out)
1833 (upper single-float :out)
1834 (position single-float :out)
1835 (max-size single-float :out))
1841 (defun range-lower (range)
1842 (adjustment-lower (range-adjustment range)))
1844 (defun range-upper (range)
1845 (adjustment-upper (range-adjustment range)))
1847 (defun (setf range-lower) (value range)
1848 (setf (adjustment-lower (range-adjustment range)) value))
1850 (defun (setf range-upper) (value range)
1851 (setf (adjustment-upper (range-adjustment range)) value))
1853 (defun range-page-increment (range)
1854 (adjustment-page-increment (range-adjustment range)))
1856 (defun range-step-increment (range)
1857 (adjustment-step-increment (range-adjustment range)))
1859 (defun (setf range-page-increment) (value range)
1860 (setf (adjustment-page-increment (range-adjustment range)) value))
1862 (defun (setf range-step-increment) (value range)
1863 (setf (adjustment-step-increment (range-adjustment range)) value))
1865 (defbinding range-set-range () nil
1867 (lower double-float)
1868 (upper double-float))
1870 (defbinding range-set-increments () nil
1873 (page double-float))
1878 (defbinding scale-get-layout-offsets () nil
1886 (defbinding progress-bar-pulse () nil
1887 (progress-bar progress-bar))
1892 (defmethod initialize-instance ((size-group size-group) &rest initargs
1893 &key widget widgets)
1894 (declare (ignore widget widgets))
1897 (initial-add size-group #'size-group-add-widget
1898 initargs :widget :widgets)))
1901 (defbinding size-group-add-widget () nil
1902 (size-group size-group)
1905 (defbinding size-group-remove-widget () nil
1906 (size-group size-group)
1912 (defbinding %stock-item-copy () pointer
1915 (defbinding %stock-item-free () nil
1918 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1919 (%stock-item-copy location))
1921 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1922 (%stock-item-free location))
1924 (defbinding stock-add (stock-item) nil
1925 (stock-item stock-item)
1928 (defbinding stock-list-ids () (gslist string))
1930 (defbinding %stock-lookup () boolean
1934 (defun stock-lookup (stock-id)
1936 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1938 (when (%stock-lookup stock-id location)
1939 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1940 (deallocate-memory location))))
1945 (defbinding tooltips-enable () nil
1946 (tooltips tooltips))
1948 (defbinding tooltips-disable () nil
1949 (tooltips tooltips))
1951 (defun (setf tooltips-enabled-p) (enable tooltips)
1953 (tooltips-enable tooltips)
1954 (tooltips-disable tooltips)))
1956 (defbinding tooltips-set-tip () nil
1960 (tip-private string))
1962 (defbinding tooltips-data-get () tooltips-data
1965 (defbinding tooltips-force-window () nil
1966 (tooltips tooltips))
1968 (defbinding tooltips-get-info-from-tip-window () boolean
1970 (tooltips tooltips :out)
1971 (current-widget widget :out))
1976 (defbinding rc-add-default-file (filename) nil
1977 ((namestring (truename filename)) string))
1979 (defbinding rc-parse (filename) nil
1980 ((namestring (truename filename)) string))
1982 (defbinding rc-parse-string () nil
1985 (defbinding rc-reparse-all () nil)
1987 (defbinding rc-get-style () style
1992 ;;; Accelerator Groups
1994 (defbinding accel-group-activate (accel-group key modifiers) boolean
1995 (accel-group accel-group)
1996 ((gdk:keyval-from-name key) unsigned-int)
1997 (modifiers gdk:modifier-type))
1999 (defbinding accel-groups-activate (object key modifiers) boolean
2001 ((gdk:keyval-from-name key) unsigned-int)
2002 (modifiers gdk:modifier-type))
2004 (defbinding accel-group-attach () nil
2005 (accel-group accel-group)
2008 (defbinding accel-group-detach () nil
2009 (accel-group accel-group)
2012 (defbinding accel-group-lock () nil
2013 (accel-group accel-group))
2015 (defbinding accel-group-unlock () nil
2016 (accel-group accel-group))
2019 ;;; Accelerator Groups Entries
2021 (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
2022 (accel-group accel-group)
2023 ((gdk:keyval-from-name key) unsigned-int)
2024 (modifiers gdk:modifier-type))
2026 (defbinding accel-group-lock-entry (accel-group key modifiers) nil
2027 (accel-group accel-group)
2028 ((gdk:keyval-from-name key) unsigned-int)
2029 (modifiers gdk:modifier-type))
2031 (defbinding accel-group-unlock-entry (accel-group key modifiers) nil
2032 (accel-group accel-group)
2033 ((gdk:keyval-from-name key) unsigned-int)
2034 (modifiers gdk:modifier-type))
2036 (defbinding accel-group-add
2037 (accel-group key modifiers flags object signal) nil
2038 (accel-group accel-group)
2039 ((gdk:keyval-from-name key) unsigned-int)
2040 (modifiers gdk:modifier-type)
2043 ((name-to-string signal) string))
2045 (defbinding accel-group-add (accel-group key modifiers object) nil
2046 (accel-group accel-group)
2047 ((gdk:keyval-from-name key) unsigned-int)
2048 (modifiers gdk:modifier-type)
2052 ;;; Accelerator Signals
2054 (defbinding accel-group-handle-add
2055 (object signal-id accel-group key modifiers flags) nil
2057 (signal-id unsigned-int)
2058 (accel-group accel-group)
2059 ((gdk:keyval-from-name key) unsigned-int)
2060 (modifiers gdk:modifier-type)
2061 (flags accel-flags))
2063 (defbinding accel-group-handle-remove
2064 (object accel-group key modifiers) nil
2066 (accel-group accel-group)
2067 ((gdk:keyval-from-name key) unsigned-int)
2068 (modifiers gdk:modifier-type))