1 ;; Common Lisp bindings for GTK+ v2.x
2 ;; Copyright 1999-2006 Espen S. Johnsen <espen@users.sf.net>
4 ;; Permission is hereby granted, free of charge, to any person obtaining
5 ;; a copy of this software and associated documentation files (the
6 ;; "Software"), to deal in the Software without restriction, including
7 ;; without limitation the rights to use, copy, modify, merge, publish,
8 ;; distribute, sublicense, and/or sell copies of the Software, and to
9 ;; permit persons to whom the Software is furnished to do so, subject to
10 ;; the following conditions:
12 ;; The above copyright notice and this permission notice shall be
13 ;; included in all copies or substantial portions of the Software.
15 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 ;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 ;; $Id: gtk.lisp,v 1.70 2007/05/10 20:17:17 espen Exp $
30 (defbinding check-version () (copy-of string)
31 (required-major unsigned-int)
32 (required-minor unsigned-int)
33 (required-micro unsigned-int))
35 (defbinding query-version () nil
36 (major unsigned-int :out)
37 (minor unsigned-int :out)
38 (micro unsigned-int :out))
41 (multiple-value-bind (major minor micro)
44 (format nil "Gtk+ v~A.~A" major minor)
45 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
51 ;;;; Initalization and display handling
53 (defbinding (gtk-init "gtk_parse_args") () boolean
54 "Initializes the library without opening the display."
58 (defparameter *event-poll-interval* 10000)
60 (defun clg-init (&optional display)
61 "Initializes the system and starts event handling"
63 (find-package "SWANK")
64 (eq (symbol-value (find-symbol "*COMMUNICATION-STYLE*" "SWANK")) :spawn))
65 (error "When running clg in Slime the communication style :spawn can not be used. See the README file and <http://common-lisp.net/project/slime/doc/html/slime_45.html> for more information."))
67 (unless (gdk:display-get-default)
68 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
70 #+sbcl(sb-int:set-floating-point-modes :traps nil)
71 #+cmu(ext:set-floating-point-modes :traps nil))
75 (error "Initialization of GTK+ failed."))
78 (signal-connect (gdk:display-manager) 'display-opened
80 (let ((handler (add-fd-handler
81 (gdk:display-connection-number display)
82 :input #'main-iterate-all)))
83 (signal-connect display 'closed
84 #'(lambda (is-error-p)
85 (declare (ignore is-error-p))
86 (remove-fd-handler handler))))))
87 (setq *periodic-polling-function* #'main-iterate-all)
88 (setq *max-event-to-sec* 0)
89 (setq *max-event-to-usec* *event-poll-interval*))
90 #+(and clisp readline)
91 ;; Readline will call the event hook at most ten times per second
92 (setf readline:event-hook #'main-iterate-all)
94 ;; When running in Slime we need to hook into the Swank server
95 ;; to handle events asynchronously
96 (if (find-package "SWANK")
97 (let ((read-from-emacs (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK")))
98 (stream (funcall (find-symbol "CONNECTION.SOCKET-IO" "SWANK") (symbol-value (find-symbol "*EMACS-CONNECTION*" "SWANK")))))
99 (setf (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK"))
102 (case (socket:socket-status (cons stream :input) 0 *event-poll-interval*)
103 (:input (return (funcall read-from-emacs)))
104 (:eof (read-char stream))
105 (otherwise (main-iterate-all)))))))
106 #-readline(warn "Not running in Slime and Readline support is missing, so the Gtk main loop has to be invoked explicit."))
108 (gdk:display-open display)))
113 (defun clg-init-with-threading (&optional display)
114 "Initializes the system and starts event handling"
115 (unless (gdk:display-get-default)
116 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
118 #+sbcl(sb-int:set-floating-point-modes :traps nil)
119 #+cmu(ext:set-floating-point-modes :traps nil))
122 (gdk:threads-set-lock-functions)
124 (error "Initialization of GTK+ failed."))
125 (sb-thread:make-thread
127 (gdk:display-open display)
128 (gdk:with-global-lock (main)))
129 :name "gtk event loop")))
132 ;;; Generic functions
134 (defgeneric add-to-radio-group (item1 item2))
135 (defgeneric activate-radio-widget (item))
136 (defgeneric (setf tool-item-tip-text) (tip-text tool-item))
137 (defgeneric (setf tool-item-tip-private) (tip-private tool-item))
143 (defbinding grab-add () nil
146 (defbinding grab-get-current () widget)
148 (defbinding grab-remove () nil
151 (defbinding get-default-language () (copy-of pango:language))
156 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
158 (define-callback-marshal %about-dialog-activate-link-callback nil
159 (about-dialog (link string)))
161 (defbinding about-dialog-set-email-hook (function) nil
162 (%about-dialog-activate-link-callback callback)
163 ((register-callback-function function) unsigned-int)
164 (user-data-destroy-callback callback))
166 (defbinding about-dialog-set-url-hook (function) nil
167 (%about-dialog-activate-link-callback callback)
168 ((register-callback-function function) unsigned-int)
169 (user-data-destroy-callback callback)))
174 (defbinding %accel-group-connect () nil
175 (accel-group accel-group)
177 (modifiers gdk:modifier-type)
181 (defun accel-group-connect (group accelerator function &optional flags)
182 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
183 (let ((gclosure (make-callback-closure function)))
184 (%accel-group-connect group key modifiers flags gclosure)
187 (defbinding accel-group-connect-by-path (group path function) nil
190 ((make-callback-closure function) gclosure :in/return))
192 (defbinding %accel-group-disconnect (group gclosure) boolean
196 (defbinding %accel-group-disconnect-key () boolean
199 (modifiers gdk:modifier-type))
201 (defun accel-group-disconnect (group accelerator)
202 (etypecase accelerator
203 (gclosure (%accel-group-disconnect group accelerator))
205 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
206 (%accel-group-disconnect-key group key modifiers)))))
208 (defbinding %accel-group-query () (copy-of (vector (inlined accel-group-entry) n))
209 (accel-group accel-group)
211 (modifiers gdk:modifier-type)
214 (defun accel-group-query (accel-group accelerator)
215 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
216 (%accel-group-query accel-group key modifiers)))
218 (defbinding %accel-group-activate () boolean
219 (accel-group accel-group)
220 (acceleratable gobject)
222 (modifiers gdk:modifier-type))
224 (defun accel-group-activate (accel-group acceleratable accelerator)
225 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
226 (%accel-group-activate accel-group acceleratable key modifiers)))
228 (defbinding accel-group-lock () nil
229 (accel-group accel-group))
231 (defbinding accel-group-unlock () nil
232 (accel-group accel-group))
234 (defbinding accel-group-from-accel-closure () accel-group
237 (defbinding %accel-groups-activate () boolean
240 (modifiers gdk:modifier-type))
242 (defun accel-groups-activate (object accelerator)
243 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
244 (%accel-groups-activate object key modifiers)))
246 (defbinding accel-groups-from-object () (gslist accel-groups)
249 (defbinding accelerator-valid-p (key &optional modifiers) boolean
251 (modifiers gdk:modifier-type))
253 (defbinding %accelerator-parse () nil
255 (key unsigned-int :out)
256 (modifiers gdk:modifier-type :out))
258 (defgeneric parse-accelerator (accelerator))
260 (defmethod parse-accelerator ((accelerator string))
261 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
263 (error "Invalid accelerator: ~A" accelerator)
264 (values key modifiers))))
266 (defmethod parse-accelerator ((accelerator cons))
267 (destructuring-bind (key modifiers) accelerator
273 (gdk:keyval-from-name key)
274 (error "Invalid key name: ~A" key)))
275 (character (parse-accelerator key)))
278 (defmethod parse-accelerator ((key integer))
281 (defmethod parse-accelerator ((key character))
283 (gdk:keyval-from-name (string key))
284 (error "Invalid key name: ~A" key)))
287 (defbinding accelerator-name () string
289 (modifiers gdk:modifier-type))
291 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
292 (defbinding accelerator-get-label () string
294 (modifiers gdk:modifier-type))
296 (defbinding %accelerator-set-default-mod-mask () nil
297 (default-modifiers gdk:modifier-type))
299 (defun (setf accelerator-default-modifier-mask) (default-modifiers)
300 (%accelerator-set-default-mod-mask default-modifiers))
302 (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
307 (defbinding accel-label-get-accel-width () unsigned-int
308 (accel-label accel-label))
310 (defbinding accel-label-refetch () boolean
311 (accel-label accel-label))
317 (defbinding %accel-map-add-entry () nil
320 (modifiers gdk:modifier-type))
322 (defun accel-map-add-entry (path accelerator)
323 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
324 (%accel-map-add-entry path key modifiers)))
326 (defbinding %accel-map-lookup-entry () boolean
328 ((make-instance 'accel-key) accel-key :in/return))
330 (defun accel-map-lookup-entry (path)
331 (multiple-value-bind (found-p accel-key) (%accel-map-lookup-entry path)
334 (slot-value accel-key 'key)
335 (slot-value accel-key 'modifiers)
336 (slot-value accel-key 'flags)))))
338 (defbinding %accel-map-change-entry () boolean
341 (modifiers gdk:modifier-type)
344 (defun accel-map-change-entry (path accelerator &optional replace)
345 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
346 (%accel-map-change-entry path key modifiers replace)))
348 (defbinding accel-map-load () nil
351 (defbinding accel-map-save () nil
354 (define-callback-marshal %accel-map-foreach-callback nil
355 ((accel-path string) (key unsigned-int)
356 (modifiers gdk:modifier-type) (changed boolean)) :callback-id :first)
358 (defbinding %accel-map-foreach (callback-id) nil
359 (callback-id unsigned-int)
360 (%accel-map-foreach-callback callback))
362 (defbinding %accel-map-foreach-unfiltered (callback-id) nil
363 (callback-id unsigned-int)
364 (%accel-map-foreach-callback callback))
366 (defun accel-map-foreach (function &optional (filter-p t))
367 (with-callback-function (id function)
369 (%accel-map-foreach id)
370 (%accel-map-foreach-unfiltered id))))
372 (defbinding accel-map-add-filter () nil
375 (defbinding accel-map-get () accel-map)
377 (defbinding accel-map-lock-path () nil
380 (defbinding accel-map-unlock-path () nil
387 (defbinding accessible-connect-widget-destroyed () nil
388 (accessible accessible))
393 (defmethod initialize-instance ((adjustment adjustment) &key value)
396 ;; we need to make sure that the value is set last, otherwise it
397 ;; may be outside current limits and ignored
399 (setf (slot-value adjustment 'value) value))))
402 (defbinding adjustment-changed () nil
403 (adjustment adjustment))
405 (defbinding adjustment-value-changed () nil
406 (adjustment adjustment))
408 (defbinding adjustment-clamp-page () nil
409 (adjustment adjustment)
411 (upper single-float))
416 (defbinding alignment-set () nil
417 (alognment alignment)
418 (x-align single-float)
419 (y-align single-float)
420 (x-scale single-float)
421 (y-scale single-float))
423 (defbinding alignment-get-padding () nil
424 (alognment alignment)
425 (top unsigned-int :out)
426 (bottom unsigned-int :out)
427 (left unsigned-int :out)
428 (right unsigned-int :out))
430 (defbinding alignment-set-padding () nil
431 (alognment alignment)
433 (bottom unsigned-int)
435 (right unsigned-int))
443 (defun (setf bin-child) (child bin)
444 (when-bind (current-child (bin-child bin))
445 (container-remove bin current-child))
446 (container-add bin child)
449 (defmethod compute-signal-function ((bin bin) signal function object args)
450 (declare (ignore signal))
451 (if (eq object :child)
452 #'(lambda (&rest emission-args)
453 (apply function (bin-child bin) (nconc (rest emission-args) args)))
459 (defbinding box-pack-start () nil
464 (padding unsigned-int))
466 (defbinding box-pack-end () nil
471 (padding unsigned-int))
473 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
475 (box-pack-end box child expand fill padding)
476 (box-pack-start box child expand fill padding)))
478 (defbinding box-reorder-child () nil
483 (defbinding box-query-child-packing () nil
486 (expand boolean :out)
488 (padding unsigned-int :out)
489 (pack-type pack-type :out))
491 (defbinding box-set-child-packing () nil
496 (padding unsigned-int)
497 (pack-type pack-type))
503 (defmethod initialize-instance ((button button) &rest initargs &key stock)
505 (apply #'call-next-method button
506 :label stock :use-stock t :use-underline t initargs)
510 (defbinding button-pressed () nil
513 (defbinding button-released () nil
516 (defbinding button-clicked () nil
519 (defbinding button-enter () nil
522 (defbinding button-leave () nil
529 (defbinding calendar-select-month () int
534 (defbinding calendar-select-day () nil
538 (defbinding calendar-mark-day () int
542 (defbinding calendar-unmark-day () int
546 (defbinding calendar-clear-marks () nil
549 (defbinding calendar-get-date () nil
551 (year unsigned-int :out)
552 (month unsigned-int :out)
553 (day unsigned-int :out))
555 (defbinding calendar-freeze () nil
558 (defbinding calendar-thaw () nil
564 (defbinding check-menu-item-toggled () nil
565 (check-menu-item check-menu-item))
570 (defbinding (color-selection-is-adjusting-p
571 "gtk_color_selection_is_adjusting") () boolean
572 (colorsel color-selection))
576 ;;; Color selection dialog -- no functions
582 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
583 &key model content active)
584 (remf initargs :active)
586 (apply #'call-next-method combo-box initargs)
588 (apply #'call-next-method combo-box
589 :model (make-instance 'list-store :column-types '(string))
591 (unless (typep combo-box 'combo-box-entry)
592 (let ((cell (make-instance 'cell-renderer-text)))
593 (cell-layout-pack combo-box cell :expand t)
594 (cell-layout-add-attribute combo-box cell :text 0)))))
596 (mapc #'(lambda (text)
597 (combo-box-append-text combo-box text))
600 (setf (combo-box-active combo-box) active)))
603 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
605 ;; (signal-emit combo-box 'changed)))
607 (defbinding combo-box-append-text () nil
608 (combo-box combo-box)
611 (defbinding combo-box-insert-text () nil
612 (combo-box combo-box)
616 (defbinding combo-box-prepend-text () nil
617 (combo-box combo-box)
620 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
621 (defbinding combo-box-get-active-text () string
622 (combo-box combo-box))
624 (defbinding combo-box-popup () nil
625 (combo-box combo-box))
627 (defbinding combo-box-popdown () nil
628 (combo-box combo-box))
634 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
637 (setf (combo-box-entry-text-column combo-box-entry) 0)))
642 (defmethod shared-initialize ((dialog dialog) names &rest initargs
644 (declare (ignore names button buttons))
647 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
650 (defun dialog-response-id (dialog response &optional create-p error-p)
651 "Returns a numeric response id"
652 (if (typep response 'response-type)
653 (response-type-to-int response)
654 (let ((responses (user-data dialog 'responses)))
656 ((and responses (position response responses :test #'equal)))
660 (vector-push-extend response responses)
661 (1- (length responses)))
664 (user-data dialog 'responses)
665 (make-array 1 :adjustable t :fill-pointer t
666 :initial-element response))
669 (error "Invalid response: ~A" response))))))
671 (defun dialog-find-response (dialog id)
672 "Finds a symbolic response given a numeric id"
674 (int-to-response-type id)
675 (aref (user-data dialog 'responses) id)))
678 (defmethod compute-signal-id ((dialog dialog) signal)
679 (if (dialog-response-id dialog signal)
680 (ensure-signal-id 'response dialog)
683 (defmethod compute-signal-function ((dialog dialog) signal function object args)
684 (declare (ignore function object args))
685 (let ((callback (call-next-method))
686 (id (dialog-response-id dialog signal)))
688 #'(lambda (dialog response)
689 (when (= response id)
690 (funcall callback dialog)))
693 (defbinding dialog-run () nil
696 (defbinding dialog-response (dialog response) nil
698 ((dialog-response-id dialog response nil t) int))
701 (defbinding %dialog-add-button () button
706 (defun dialog-add-button (dialog label &optional (response label)
707 &key default object after)
708 "Adds a button to the dialog."
709 (let* ((signal (if (functionp response)
712 (id (dialog-response-id dialog signal t))
713 (button (%dialog-add-button dialog label id)))
714 (when (functionp response)
715 (signal-connect dialog signal response :object object :after after))
717 (%dialog-set-default-response dialog id))
721 (defbinding %dialog-add-action-widget () nil
723 (action-widget widget)
726 (defun dialog-add-action-widget (dialog widget &optional (response widget)
727 &key default object after)
728 (let* ((signal (if (functionp response)
731 (id (dialog-response-id dialog signal t)))
732 (unless (widget-hidden-p widget)
733 (widget-show widget))
734 (%dialog-add-action-widget dialog widget id)
735 (when (functionp response)
736 (signal-connect dialog signal response :object object :after after))
738 (%dialog-set-default-response dialog id))
742 (defbinding %dialog-set-default-response () nil
746 (defun dialog-set-default-response (dialog response)
747 (%dialog-set-default-response
748 dialog (dialog-response-id dialog response nil t)))
750 (defbinding dialog-set-response-sensitive (dialog response sensitive) nil
752 ((dialog-response-id dialog response nil t) int)
755 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
756 (defbinding alternative-dialog-button-order-p (&optional screen) boolean
757 (screen (or null gdk:screen)))
759 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
760 (defbinding (dialog-set-alternative-button-order
761 "gtk_dialog_set_alternative_button_order_from_array")
762 (dialog new-order) nil
764 ((length new-order) int)
765 ((map 'vector #'(lambda (response)
766 (dialog-response-id dialog response nil t))
767 new-order) (vector int)))
770 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
772 (defbinding %dialog-get-response-for-widget () int
776 (defun dialog-get-response-for-widget (dialog widget)
777 (dialog-find-response dialog (dialog-get-response-for-widget dialog widget))))
780 (defmethod container-add ((dialog dialog) (child widget) &rest args)
781 (apply #'container-add (dialog-vbox dialog) child args))
784 (defmethod container-remove ((dialog dialog) (child widget))
785 (container-remove (dialog-vbox dialog) child))
787 (defmethod container-children ((dialog dialog))
788 (container-children (dialog-vbox dialog)))
790 (defmethod (setf container-children) (children (dialog dialog))
791 (setf (container-children (dialog-vbox dialog)) children))
796 (defun drawing-area-scroll (drawing-area dx dy)
797 (gdk:window-scroll (widget-window drawing-area) dx dy))
802 (defbinding entry-get-layout-offsets () nil
807 (defbinding entry-layout-index-to-text-index () int
811 (defbinding entry-text-index-to-layout-index () int
818 (define-callback-marshal %entry-completion-match-callback boolean
819 (entry-completion string tree-iter))
821 (defbinding entry-completion-set-match-func (completion function) nil
822 (completion entry-completion)
823 (%entry-completion-match-callback callback)
824 ((register-callback-function function) unsigned-int)
825 (user-data-destroy-callback callback))
827 (defbinding entry-completion-complete () nil
828 (completion entry-completion))
830 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
831 (defbinding entry-completion-insert-prefix () nil
832 (completion entry-completion))
834 (defbinding entry-completion-insert-action-text () nil
835 (completion entry-completion)
839 (defbinding entry-completion-insert-action-markup () nil
840 (completion entry-completion)
844 (defbinding entry-completion-delete-action () nil
845 (completion entry-completion)
851 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
852 &key filter filters shortcut-folder
853 shortcut-folders shortcut-folder-uti
854 shortcut-folder-uris)
855 (declare (ignore filter filters shortcut-folder shortcut-folders
856 shortcut-folder-uti shortcut-folder-uris))
859 (initial-add file-chooser #'file-chooser-add-filter
860 initargs :filer :filters)
861 (initial-add file-chooser #'file-chooser-add-shortcut-folder
862 initargs :shortcut-folder :shortcut-folders)
863 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
864 initargs :shortcut-folder-uri :shortcut-folders-uris)))
867 (defbinding file-chooser-select-filename () boolean
868 (file-chooser file-chooser)
871 (defbinding file-chooser-unselect-filename () nil
872 (file-chooser file-chooser)
875 (defbinding file-chooser-select-all () boolean
876 (file-chooser file-chooser))
878 (defbinding file-chooser-unselect-all () boolean
879 (file-chooser file-chooser))
881 (defbinding file-chooser-get-filenames () (gslist string)
882 (file-chooser file-chooser))
884 (defbinding file-chooser-select-uri () boolean
885 (file-chooser file-chooser)
888 (defbinding file-chooser-unselect-uri () nil
889 (file-chooser file-chooser)
892 (defbinding file-chooser-get-uris () (gslist string)
893 (file-chooser file-chooser))
895 (defbinding file-chooser-add-filter () nil
896 (file-chooser file-chooser)
897 (filter file-filter))
899 (defbinding file-chooser-remove-filter () nil
900 (file-chooser file-chooser)
901 (filter file-filter))
903 (defbinding file-chooser-list-filters () (gslist file-filter)
904 (file-chooser file-chooser))
906 (defbinding file-chooser-add-shortcut-folder () boolean
907 (file-chooser file-chooser)
911 (defbinding file-chooser-remove-shortcut-folder () nil
912 (file-chooser file-chooser)
916 (defbinding file-chooser-list-shortcut-folders () (gslist string)
917 (file-chooser file-chooser))
919 (defbinding file-chooser-add-shortcut-folder-uri () boolean
920 (file-chooser file-chooser)
924 (defbinding file-chooser-remove-shortcut-folder-uri () nil
925 (file-chooser file-chooser)
929 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
930 (file-chooser file-chooser))
935 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
936 &key mime-type mime-types pattern patterns
938 (declare (ignore mime-type mime-types pattern patterns))
942 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
943 (warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
944 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
945 (file-filter-add-pixbuf-formats file-filter))
946 (initial-add file-filter #'file-filter-add-mime-type
947 initargs :mime-type :mime-types)
948 (initial-add file-filter #'file-filter-add-pattern
949 initargs :pattern :patterns)))
952 (defbinding file-filter-add-mime-type () nil
956 (defbinding file-filter-add-pattern () nil
960 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
961 (defbinding file-filter-add-pixbuf-formats () nil
962 (filter file-filter))
964 (define-callback-marshal %file-filter-callback boolean (file-filter-info))
966 (defbinding file-filter-add-custom (filter needed function) nil
968 (needed file-filter-flags)
969 (%file-filter-callback callback)
970 ((register-callback-function function) unsigned-int)
971 (user-data-destroy-callback callback))
973 (defbinding file-filter-get-needed () file-filter-flags
974 (filter file-filter))
976 (defbinding file-filter-filter () boolean
978 (filter-info file-filter-info))
984 (defbinding image-set-from-file () nil
988 (defmethod (setf image-pixmap) ((data vector) (image image))
989 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
990 (setf (image-pixmap image) pixmap)
991 (setf (image-mask image) mask)))
993 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
995 ((typep pixmap 'vector)
996 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
997 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
1001 (image-set-from-file image file)))
1002 ((call-next-method))))
1004 (defun create-image-widget (source &optional mask)
1006 (gdk:pixbuf (make-instance 'image :pixbuf source))
1007 (string (make-instance 'image :stock source))
1008 (pathname (make-instance 'image :file source))
1009 ((or list vector) (make-instance 'image :pixmap source))
1010 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
1012 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1013 (defbinding image-clear () nil
1020 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
1021 (if (and image (not (typep image 'widget)))
1022 (apply #'call-next-method item :image (create-image-widget image) initargs)
1023 (call-next-method)))
1026 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
1027 (setf (slot-value item 'image) widget))
1029 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
1030 (setf (image-menu-item-image item) (create-image-widget image)))
1035 (defmethod shared-initialize ((label label) names &key pattern)
1036 (declare (ignore names))
1039 (setf (label-pattern label) pattern)))
1041 (defbinding label-get-layout-offsets () nil
1046 (defbinding label-select-region () nil
1051 (defbinding label-get-selection-bounds () boolean
1060 (defbinding %radio-button-get-group () pointer
1061 (radio-button radio-button))
1063 (defbinding %radio-button-set-group () nil
1064 (radio-button radio-button)
1067 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
1068 "Add BUTTON1 to the group which BUTTON2 belongs to."
1069 (%radio-button-set-group button1 (%radio-button-get-group button2)))
1071 (defun %add-activate-callback (widget signal function object after)
1073 (signal-connect widget signal
1075 (when (slot-value widget 'active)
1076 (funcall function object (slot-value widget 'value))))
1077 :object object :after after)
1078 (signal-connect widget signal
1080 (when (slot-value widget 'active)
1081 (funcall function (slot-value widget 'value))))
1084 (defmethod activate-radio-widget ((button radio-button))
1085 (signal-emit button 'clicked))
1087 (defgeneric add-activate-callback (action function &key object after))
1089 (defmethod add-activate-callback ((button radio-button) function &key object after)
1090 (%add-activate-callback button 'clicked function object after))
1092 (defmethod initialize-instance ((button radio-button) &key group)
1096 (add-to-radio-group button group))))
1101 (defbinding item-select () nil
1104 (defbinding item-deselect () nil
1107 (defbinding item-toggle () nil
1114 (defmethod initialize-instance ((item menu-item) &key label)
1118 (setf (menu-item-label item) label))))
1121 (defun (setf menu-item-label) (label menu-item)
1122 (make-instance 'accel-label
1123 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
1124 :use-underline (menu-item-use-underline-p menu-item)
1125 :visible t :parent menu-item)
1128 (defun menu-item-label (menu-item)
1129 (when (and (slot-boundp menu-item 'child)
1130 (typep (bin-child menu-item) 'label))
1131 (label-label (bin-child menu-item))))
1133 (defbinding menu-item-remove-submenu () nil
1134 (menu-item menu-item))
1136 (defbinding menu-item-set-accel-path () nil
1137 (menu-item menu-item)
1138 (accel-path string))
1140 (defbinding menu-item-select () nil
1141 (menu-item menu-item))
1143 (defbinding menu-item-deselect () nil
1144 (menu-item menu-item))
1146 (defbinding menu-item-activate () nil
1147 (menu-item menu-item))
1149 (defbinding menu-item-toggle-size-request () nil
1150 (menu-item menu-item)
1151 (requisition int :out))
1153 (defbinding menu-item-toggle-size-allocate () nil
1154 (menu-item menu-item)
1158 ;;; Menu tool button
1160 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1161 (defbinding menu-tool-button-set-arrow-tooltip () nil
1162 (menu-tool-button menu-tool-button)
1165 (tip-private string))
1170 (defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
1171 (buttons :close) flags transient-parent)
1172 (%message-dialog-new transient-parent flags message-type buttons))
1175 (defmethod shared-initialize ((dialog message-dialog) names &key text
1176 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1178 (declare (ignore names))
1180 (message-dialog-set-markup dialog text))
1181 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1182 (when secondary-text
1183 (message-dialog-format-secondary-markup dialog secondary-text))
1187 (defbinding %message-dialog-new () pointer
1188 (parent (or null window))
1189 (flags dialog-flags)
1191 (buttons buttons-type)
1194 (defbinding message-dialog-set-markup () nil
1195 (message-dialog message-dialog)
1198 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1199 (defbinding message-dialog-format-secondary-text () nil
1200 (message-dialog message-dialog)
1203 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1204 (defbinding message-dialog-format-secondary-markup () nil
1205 (message-dialog message-dialog)
1212 (defbinding %radio-menu-item-get-group () pointer
1213 (radio-menu-item radio-menu-item))
1215 (defbinding %radio-menu-item-set-group () nil
1216 (radio-menu-item radio-menu-item)
1219 (defmethod activate-radio-widget ((item radio-menu-item))
1220 (menu-item-activate item))
1222 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
1223 "Add ITEM1 to the group which ITEM2 belongs to."
1224 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1226 (defmethod add-activate-callback ((item radio-menu-item) function &key object after)
1227 (%add-activate-callback item 'activate function object after))
1229 (defmethod initialize-instance ((item radio-menu-item) &key group)
1233 (add-to-radio-group item group))))
1237 ;;; Radio tool button
1239 (defbinding %radio-tool-button-get-group () pointer
1240 (radio-tool-button radio-tool-button))
1242 (defbinding %radio-tool-button-set-group () nil
1243 (radio-tool-button radio-tool-button)
1246 (defmethod activate-radio-widget ((button radio-tool-button))
1247 (signal-emit button 'clicked))
1249 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
1250 "Add BUTTON1 to the group which BUTTON2 belongs to."
1251 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1252 (defmethod add-activate-callback ((button radio-tool-button) function &key object after)
1253 (%add-activate-callback button 'clicked function object after))
1255 (defmethod initialize-instance ((button radio-tool-button) &key group)
1259 (add-to-radio-group button group))))
1265 (defbinding toggle-button-toggled () nil
1266 (toggle-button toggle-button))
1271 (defmethod initialize-instance ((window window) &rest initargs
1272 &key accel-group accel-groups)
1273 (declare (ignore accel-group accel-groups))
1276 (initial-add window #'window-add-accel-group
1277 initargs :accel-group :accel-groups)))
1279 #-debug-ref-counting
1280 (defmethod print-object ((window window) stream)
1282 (proxy-valid-p window)
1283 (slot-boundp window 'title)
1284 (not (zerop (length (window-title window)))))
1285 (print-unreadable-object (window stream :type t :identity nil)
1286 (format stream "~S at 0x~X"
1287 (window-title window) (pointer-address (foreign-location window))))
1288 (call-next-method)))
1290 (defbinding window-set-wmclass () nil
1292 (wmclass-name string)
1293 (wmclass-class string))
1295 (defbinding window-add-accel-group () nil
1297 (accel-group accel-group))
1299 (defbinding window-remove-accel-group () nil
1301 (accel-group accel-group))
1303 (defbinding window-activate-focus () int
1306 (defbinding window-activate-default () int
1309 (defbinding window-set-default-size (window width height) int
1312 ((or height -1) int))
1314 (defbinding %window-set-geometry-hints () nil
1316 (geometry gdk:geometry)
1317 (geometry-mask gdk:window-hints))
1319 (defun window-set-geometry-hints (window &key min-width min-height
1320 max-width max-height base-width base-height
1321 width-inc height-inc min-aspect max-aspect
1322 (gravity nil gravity-p) min-size max-size)
1323 (let ((geometry (make-instance 'gdk:geometry
1324 :min-width (or min-width -1)
1325 :min-height (or min-height -1)
1326 :max-width (or max-width -1)
1327 :max-height (or max-height -1)
1328 :base-width (or base-width 0)
1329 :base-height (or base-height 0)
1330 :width-inc (or width-inc 0)
1331 :height-inc (or height-inc 0)
1332 :min-aspect (or min-aspect 0)
1333 :max-aspect (or max-aspect 0)
1336 (when (or min-size min-width min-height)
1337 (push :min-size mask))
1338 (when (or max-size max-width max-height)
1339 (push :max-size mask))
1340 (when (or base-width base-height)
1341 (push :base-size mask))
1342 (when (or width-inc height-inc)
1343 (push :resize-inc mask))
1344 (when (or min-aspect max-aspect)
1345 (push :aspect mask))
1347 (push :win-gravity mask))
1348 (%window-set-geometry-hints window geometry mask)))
1350 (defbinding window-list-toplevels () (glist (copy-of window))
1351 "Returns a list of all existing toplevel windows.")
1353 (defbinding window-add-mnemonic (window key target) nil
1355 ((gdk:keyval-from-name key) unsigned-int)
1358 (defbinding window-remove-mnemonic (window key target) nil
1360 ((gdk:keyval-from-name key) unsigned-int)
1363 (defbinding window-mnemonic-activate (window key modifier) nil
1365 ((gdk:keyval-from-name key) unsigned-int)
1366 (modifier gdk:modifier-type))
1368 (defbinding window-activate-key () boolean
1370 (event gdk:key-event))
1372 (defbinding window-propagate-key-event () boolean
1374 (event gdk:key-event))
1376 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1377 (defbinding window-present () nil
1380 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1382 (defbinding %window-present () nil
1385 (defbinding %window-present-with-time () nil
1387 (timespamp unsigned-int))
1389 (defun window-present (window &optional timestamp)
1391 (%window-present-with-time window timestamp)
1392 (%window-present window))))
1394 (defbinding window-iconify () nil
1397 (defbinding window-deiconify () nil
1400 (defbinding window-stick () nil
1403 (defbinding window-unstick () nil
1406 (defbinding window-maximize () nil
1409 (defbinding window-unmaximize () nil
1412 (defbinding window-fullscreen () nil
1415 (defbinding window-unfullscreen () nil
1418 (defbinding window-set-keep-above () nil
1422 (defbinding window-set-keep-below () nil
1426 (defbinding window-begin-resize-drag () nil
1428 (edge gdk:window-edge)
1430 (root-x int) (root-y int)
1431 (timestamp unsigned-int))
1433 (defbinding window-begin-move-drag () nil
1435 (edge gdk:window-edge)
1437 (root-x int) (root-y int)
1438 (timestamp unsigned-int))
1440 (defbinding window-set-frame-dimensions () nil
1442 (left int) (top int) (rigth int) (bottom int))
1444 (defbinding %window-get-default-size () nil
1449 (defun window-get-default-size (window)
1450 (multiple-value-bind (width height) (%window-get-default-size window)
1451 (values (unless (= width -1) width) (unless (= height -1) height))))
1453 (defbinding window-get-frame-dimensions () nil
1455 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1457 (defbinding %window-get-icon-list () (glist (copy-of gdk:pixbuf))
1460 (defbinding window-get-position () nil
1465 (defbinding window-get-size () nil
1470 (defbinding window-move () nil
1475 (defbinding window-parse-geometry () boolean
1479 (defbinding window-reshow-with-initial-size () nil
1482 (defbinding window-resize () nil
1487 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1488 () (glist gdk:pixbuf))
1490 (defun window-default-icon ()
1491 (first (window-default-icon-list)))
1493 (defbinding %window-set-default-icon-list () nil
1494 (icons (glist gdk:pixbuf)))
1496 (defun (setf window-default-icon-list) (icons)
1497 (%window-set-default-icon-list icons)
1500 (defbinding %window-set-default-icon () nil
1501 (icons (glist gdk:pixbuf)))
1503 (defgeneric (setf window-default-icon) (icon))
1505 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1506 (%window-set-default-icon icon)
1509 (defgeneric (setf window-group) (group window))
1511 (defmethod (setf window-group) ((group window-group) (window window))
1512 (window-group-add-window group window)
1515 (defbinding %window-set-default-icon-from-file () boolean
1519 (defmethod (setf window-default-icon) ((icon-file pathname))
1520 (%window-set-default-icon-from-file icon-file)
1523 (defbinding %window-set-icon-from-file () boolean
1528 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1529 (%window-set-icon-from-file window icon-file)
1532 (defbinding window-set-auto-startup-notification () nil
1535 (defbinding decorated-window-init () nil
1538 (defbinding decorated-window-calculate-frame-size () nil
1541 (defbinding decorated-window-set-title () nil
1545 (defbinding decorated-window-move-resize-window () nil
1555 (defmethod initialize-instance ((window-group window-group) &rest initargs
1556 &key window windows)
1557 (declare (ignore window windows))
1560 (initial-add window-group #'window-group-add-window
1561 initargs :window :windows)))
1564 (defbinding window-group-add-window () nil
1565 (window-group window-group)
1568 (defbinding window-group-remove-window () nil
1569 (window-group window-group)
1575 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1576 (setf (scrolled-window-hscrollbar-policy window) policy)
1577 (setf (scrolled-window-vscrollbar-policy window) policy))
1579 (defbinding scrolled-window-add-with-viewport () nil
1580 (scrolled-window scrolled-window)
1583 (defmethod shared-initialize ((window scrolled-window) names &key policy)
1584 (declare (ignore names))
1586 (setf (slot-value window 'hscrollbar-policy) policy)
1587 (setf (slot-value window 'vscrollbar-policy) policy))
1593 (defbinding statusbar-get-context-id () unsigned-int
1594 (statusbar statusbar)
1595 (context-description string))
1597 (defbinding statusbar-push () unsigned-int
1598 (statusbar statusbar)
1599 (context-id unsigned-int)
1602 (defbinding statusbar-pop () nil
1603 (statusbar statusbar)
1604 (context-id unsigned-int))
1606 (defbinding statusbar-remove () nil
1607 (statusbar statusbar)
1608 (context-id unsigned-int)
1609 (message-id unsigned-int))
1615 (defbinding fixed-put () nil
1620 (defbinding fixed-move () nil
1629 (defun %ensure-notebook-position (notebook page)
1632 (widget (notebook-page-num notebook page t))))
1634 (defun %ensure-notebook-child (notebook position)
1637 (t (notebook-get-nth-page notebook position))))
1639 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1640 (notebook position child &optional tab-label menu-label) nil
1643 ((if (stringp tab-label)
1644 (make-instance 'label :label tab-label)
1645 tab-label) (or null widget))
1646 ((if (stringp menu-label)
1647 (make-instance 'label :label menu-label)
1648 menu-label) (or null widget))
1649 ((%ensure-notebook-position notebook position) position))
1651 (defun notebook-append (notebook child &optional tab-label menu-label)
1652 (notebook-insert notebook :last child tab-label menu-label))
1654 (defun notebook-prepend (notebook child &optional tab-label menu-label)
1655 (notebook-insert notebook :first child tab-label menu-label))
1657 (defbinding notebook-remove-page (notebook page) nil
1659 ((%ensure-notebook-position notebook page) position))
1661 (defbinding %notebook-page-num () int
1665 (defun notebook-page-num (notebook child &optional error-p)
1666 (let ((page-num (%notebook-page-num notebook child)))
1669 (error "~A is not a page in ~A" child notebook))
1672 (defbinding notebook-next-page () nil
1673 (notebook notebook))
1675 (defbinding notebook-prev-page () nil
1676 (notebook notebook))
1678 (defbinding notebook-reorder-child (notebook child position) nil
1681 ((%ensure-notebook-position notebook position) int))
1683 (defbinding notebook-popup-enable () nil
1684 (notebook notebook))
1686 (defbinding notebook-popup-disable () nil
1687 (notebook notebook))
1689 (defbinding notebook-get-nth-page () widget
1693 (defun %notebook-current-page (notebook)
1694 (when (slot-boundp notebook 'current-page-num)
1695 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1697 (defun (setf notebook-current-page) (page notebook)
1698 (setf (notebook-current-page-num notebook) (notebook-page-num notebook page)))
1700 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1701 (notebook page) widget
1703 ((%ensure-notebook-child notebook page) widget))
1705 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1706 (notebook page) (copy-of string)
1708 ((%ensure-notebook-child notebook page) widget))
1710 (defbinding %notebook-set-tab-label () nil
1715 (defun (setf notebook-tab-label) (tab-label notebook page)
1716 (let ((widget (if (stringp tab-label)
1717 (make-instance 'label :label tab-label)
1719 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1723 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1724 (notebook page) widget
1726 ((%ensure-notebook-child notebook page) widget))
1728 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1729 (notebook page) (copy-of string)
1731 ((%ensure-notebook-child notebook page) widget))
1733 (defbinding %notebook-set-menu-label () nil
1736 (menu-label widget))
1738 (defun (setf notebook-menu-label) (menu-label notebook page)
1739 (let ((widget (if (stringp menu-label)
1740 (make-instance 'label :label menu-label)
1742 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1746 (defbinding notebook-query-tab-label-packing (notebook page) nil
1748 ((%ensure-notebook-child notebook page) widget)
1749 (expand boolean :out)
1751 (pack-type pack-type :out))
1753 (defbinding notebook-set-tab-label-packing
1754 (notebook page expand fill pack-type) nil
1756 ((%ensure-notebook-child notebook page) widget)
1759 (pack-type pack-type))
1765 (defbinding paned-pack1 () nil
1771 (defbinding paned-pack2 () nil
1780 (defbinding layout-put () nil
1786 (defbinding layout-move () nil
1792 (defbinding layout-set-size () nil
1794 (width unsigned-int)
1795 (height unsigned-int))
1797 (defbinding layout-get-size () nil
1799 (width unsigned-int :out)
1800 (height unsigned-int :out))
1805 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1806 (menu-shell menu-shell)
1807 (menu-item menu-item)
1813 (defun menu-shell-append (menu-shell menu-item)
1814 (menu-shell-insert menu-shell menu-item :last))
1816 (defun menu-shell-prepend (menu-shell menu-item)
1817 (menu-shell-insert menu-shell menu-item :fisrt))
1819 (defbinding menu-shell-deactivate () nil
1820 (menu-shell menu-shell))
1822 (defbinding menu-shell-select-item () nil
1823 (menu-shell menu-shell)
1824 (menu-item menu-item))
1826 (defbinding menu-shell-select-first () nil
1827 (menu-shell menu-shell)
1828 (search-sensitive boolean))
1830 (defbinding menu-shell-deselect () nil
1831 (menu-shell menu-shell))
1833 (defbinding menu-shell-activate-item () nil
1834 (menu-shell menu-shell)
1835 (menu-item menu-item)
1836 (fore-deactivate boolean))
1838 (defbinding menu-shell-cancel () nil
1839 (menu-shell menu-shell))
1844 (defun %menu-position (menu child)
1847 (keyword (case child
1850 (t (error "Invalid position keyword: ~A" child))))
1851 (widget (menu-child-position menu child))))
1854 (defbinding menu-reorder-child (menu menu-item position) nil
1856 (menu-item menu-item)
1857 ((%menu-position menu position) int))
1859 (defbinding menu-attach () nil
1861 (menu-item menu-item)
1862 (left-attach unsigned-int)
1863 (right-attach unsigned-int)
1864 (top-attach unsigned-int)
1865 (bottom-attach unsigned-int))
1867 (define-callback-marshal %menu-position-callback nil
1868 (menu (x int) (y int) (push-in boolean)))
1870 (defbinding %menu-popup () nil
1872 (parent-menu-shell (or null menu-shell))
1873 (parent-menu-item (or null menu-item))
1874 (callback (or null callback))
1875 (callback-id unsigned-int)
1876 (button unsigned-int)
1877 (activate-time (unsigned 32)))
1879 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1882 (with-callback-function (id callback)
1884 menu parent-menu-shell parent-menu-item
1885 %menu-position-callback id button activate-time))
1887 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1889 (defbinding menu-set-accel-path () nil
1891 (accel-path string))
1893 (defbinding menu-reposition () nil
1896 (defbinding menu-popdown () nil
1899 (defun menu-child-position (menu child)
1900 (position child (container-children menu)))
1902 (defun menu-active-num (menu)
1903 (menu-child-position menu (menu-active menu)))
1905 (defbinding %menu-set-active () nil
1907 (index unsigned-int))
1909 (defun (setf menu-active) (menu child)
1910 (%menu-set-active menu (%menu-position menu child))
1913 (define-callback %menu-detach-callback nil ((widget widget) (menu menu))
1914 (funcall (user-data menu 'detach-func) widget menu))
1916 (defbinding %menu-attach-to-widget (menu widget) nil
1919 (%menu-detach-callback callback))
1921 (defun menu-attach-to-widget (menu widget function)
1922 (setf (user-data menu 'detach-func) function)
1923 (%menu-attach-to-widget menu widget))
1925 (defbinding menu-detach () nil
1928 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1929 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1932 (defbinding menu-set-monitor () nil
1939 (defbinding table-resize () nil
1942 (columns unsigned-int))
1944 (defbinding table-attach (table child left right top bottom
1945 &key options x-options y-options
1946 (x-padding 0) (y-padding 0)) nil
1950 (right unsigned-int)
1952 (bottom unsigned-int)
1953 ((append (mklist options) (mklist x-options)) attach-options)
1954 ((append (mklist options) (mklist y-options)) attach-options)
1955 (x-padding unsigned-int)
1956 (y-padding unsigned-int))
1959 (defbinding %table-set-row-spacing () nil
1962 (spacing unsigned-int))
1964 (defbinding %table-set-row-spacings () nil
1966 (spacing unsigned-int))
1968 (defun (setf table-row-spacing) (spacing table &optional row)
1970 (%table-set-row-spacing table row spacing)
1971 (%table-set-row-spacings table spacing))
1974 (defbinding %table-get-row-spacing () unsigned-int
1978 (defbinding %table-get-default-row-spacing () unsigned-int
1981 (defun table-row-spacing (table &optional row)
1983 (%table-get-row-spacing table row)
1984 (%table-get-default-row-spacing table)))
1987 (defbinding %table-set-col-spacing () nil
1990 (spacing unsigned-int))
1992 (defbinding %table-set-col-spacings () nil
1994 (spacing unsigned-int))
1996 (defun (setf table-column-spacing) (spacing table &optional column)
1998 (%table-set-col-spacing table column spacing)
1999 (%table-set-col-spacings table spacing))
2002 (defun (setf table-col-spacing) (spacing table &optional col)
2003 (warn "TABLE-COL-SPACING is deprecatet, use TABLE-COLUMN-SPACING instead")
2004 (setf (table-column-spacing table col) spacing))
2006 (defbinding %table-get-col-spacing () unsigned-int
2010 (defbinding %table-get-default-col-spacing () unsigned-int
2013 (defun table-column-spacing (table &optional column)
2015 (%table-get-col-spacing table column)
2016 (%table-get-default-col-spacing table)))
2018 (defun table-col-spacing (table &optional col)
2019 (warn "TABLE-COL-SPACING is deprecatet, use TABLE-COLUMN-SPACING instead")
2020 (table-column-spacing table col))
2026 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
2028 (apply #'call-next-method toolbar
2029 :tooltips (make-instance 'tooltips) initargs)
2030 (call-next-method)))
2032 (defbinding %toolbar-insert () nil
2034 (tool-item tool-item)
2035 (position position))
2037 (defun toolbar-insert (toolbar tool-item &optional (position :end))
2038 (%toolbar-insert toolbar tool-item position)
2039 (%tool-item-update-tooltips tool-item))
2041 (defbinding toolbar-get-item-index () int
2045 (defbinding toolbar-get-nth-item () tool-item
2049 (defbinding toolbar-get-drop-index () int
2053 (defbinding toolbar-set-drop-highlight-item () nil
2055 (tool-item tool-item)
2061 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
2062 (if (and icon (not (typep icon 'widget)))
2063 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
2064 (call-next-method)))
2069 (defbinding tool-item-set-tooltip () nil
2070 (tool-item tool-item)
2073 (tip-private string))
2076 (defun %tool-item-update-tooltips (tool-item)
2078 (slot-boundp tool-item 'parent)
2080 (user-data-p tool-item 'tip-text)
2081 (user-data-p tool-item 'tip-private)))
2082 (tool-item-set-tooltip
2083 tool-item (toolbar-tooltips (widget-parent tool-item))
2084 (or (user-data tool-item 'tip-text) "")
2085 (or (user-data tool-item 'tip-private) ""))))
2087 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
2088 (setf (user-data tool-item 'tip-text) tip-text)
2089 (%tool-item-update-tooltips tool-item)
2092 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
2093 (setf (user-data tool-item 'tip-private) tip-private)
2094 (%tool-item-update-tooltips tool-item)
2097 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
2098 (declare (ignore args))
2101 (%tool-item-update-tooltips tool-item)))
2104 (defbinding tool-item-retrieve-proxy-menu-item () widget
2105 (tool-item tool-item))
2107 (defbinding (tool-item-proxy-menu-item
2108 "gtk_tool_item_get_proxy_menu_item") () menu-item
2109 (tool-item tool-item)
2110 (menu-item-id string))
2112 (defbinding %tool-item-set-proxy-menu-item () nil
2113 (tool-item tool-item)
2114 (menu-item-id string)
2115 (menu-item menu-item))
2117 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
2118 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
2121 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
2122 (defbinding tool-item-rebuild-menu () nil
2123 (tool-item tool-item))
2128 (defbinding editable-select-region (editable &optional (start 0) end) nil
2133 (defbinding editable-get-selection-bounds (editable) nil
2138 (defbinding editable-insert-text (editable text &optional (position 0)) nil
2142 (position position :in/out))
2144 (defun editable-append-text (editable text)
2145 (editable-insert-text editable text nil))
2147 (defun editable-prepend-text (editable text)
2148 (editable-insert-text editable text 0))
2150 (defbinding editable-delete-text (editable &optional (start 0) end) nil
2155 (defbinding (editable-text "gtk_editable_get_chars")
2156 (editable &optional (start 0) end) string
2161 (defun (setf editable-text) (text editable)
2163 (editable-delete-text
2165 (editable-insert-text editable text))
2166 (editable-delete-text editable))
2169 (defbinding editable-cut-clipboard () nil
2170 (editable editable))
2172 (defbinding editable-copy-clipboard () nil
2173 (editable editable))
2175 (defbinding editable-paste-clipboard () nil
2176 (editable editable))
2178 (defbinding editable-delete-selection () nil
2179 (editable editable))
2185 (defbinding spin-button-configure () nil
2186 (spin-button spin-button)
2187 (adjustment adjustment)
2188 (climb-rate double-float)
2189 (digits unsigned-int))
2191 (defbinding spin-button-set-range () nil
2192 (spin-button spin-button)
2196 (defbinding spin-button-get-range () nil
2197 (spin-button spin-button)
2198 (min double-float :out)
2199 (max double-float :out))
2201 (defun spin-button-value-as-int (spin-button)
2202 (round (spin-button-value spin-button)))
2204 (defbinding %spin-button-spin () nil
2205 (spin-button spin-button)
2206 (direction spin-type)
2207 (increment double-float))
2209 (defun spin-button-spin (spin-button value)
2211 (real (%spin-button-spin spin-button :spin-user-defined value))
2212 (spin-type (%spin-button-spin spin-button value 0))))
2215 (defbinding spin-button-update () nil
2216 (spin-button spin-button))
2222 (defbinding ruler-set-range () nil
2224 (lower single-float)
2225 (upper single-float)
2226 (position single-float)
2227 (max-size single-float))
2229 (defbinding ruler-get-range () nil
2231 (lower single-float :out)
2232 (upper single-float :out)
2233 (position single-float :out)
2234 (max-size single-float :out))
2240 (defun range-lower (range)
2241 (adjustment-lower (range-adjustment range)))
2243 (defun range-upper (range)
2244 (adjustment-upper (range-adjustment range)))
2246 (defun (setf range-lower) (value range)
2247 (setf (adjustment-lower (range-adjustment range)) value))
2249 (defun (setf range-upper) (value range)
2250 (setf (adjustment-upper (range-adjustment range)) value))
2252 (defun range-page-increment (range)
2253 (adjustment-page-increment (range-adjustment range)))
2255 (defun range-step-increment (range)
2256 (adjustment-step-increment (range-adjustment range)))
2258 (defun (setf range-page-increment) (value range)
2259 (setf (adjustment-page-increment (range-adjustment range)) value))
2261 (defun (setf range-step-increment) (value range)
2262 (setf (adjustment-step-increment (range-adjustment range)) value))
2264 (defbinding range-set-range () nil
2266 (lower double-float)
2267 (upper double-float))
2269 (defbinding range-set-increments () nil
2272 (page double-float))
2277 (defbinding scale-get-layout-offsets () nil
2285 (defbinding progress-bar-pulse () nil
2286 (progress-bar progress-bar))
2291 (defmethod initialize-instance ((size-group size-group) &rest initargs
2292 &key widget widgets)
2293 (declare (ignore widget widgets))
2296 (initial-add size-group #'size-group-add-widget
2297 initargs :widget :widgets)))
2300 (defbinding size-group-add-widget () nil
2301 (size-group size-group)
2304 (defbinding size-group-remove-widget () nil
2305 (size-group size-group)
2311 (defbinding %stock-item-copy () pointer
2314 (defbinding %stock-item-free () nil
2317 (defbinding stock-add (stock-item) nil
2318 (stock-item stock-item)
2321 (defbinding stock-list-ids () (gslist string))
2323 (defbinding %stock-lookup () boolean
2327 (defun stock-lookup (stock-id)
2328 (with-memory (stock-item (foreign-size (find-class 'stock-item)))
2329 (when (%stock-lookup stock-id stock-item)
2330 (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item)))))
2332 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
2334 (define-callback-marshal %stock-translate-callback string ((path string)))
2336 (defbinding (stock-set-translate-function "gtk_stock_set_translate_func")
2337 (domain function) nil
2339 (%stock-translate-callback callback)
2340 ((register-callback-function function) unsigned-int)
2341 (user-data-destroy-callback callback)))
2347 (defbinding tooltips-enable () nil
2348 (tooltips tooltips))
2350 (defbinding tooltips-disable () nil
2351 (tooltips tooltips))
2353 (defun (setf tooltips-enabled-p) (enable tooltips)
2355 (tooltips-enable tooltips)
2356 (tooltips-disable tooltips)))
2358 (defbinding tooltips-set-tip () nil
2362 (tip-private string))
2364 (defbinding tooltips-data-get () tooltips-data
2367 (defbinding tooltips-force-window () nil
2368 (tooltips tooltips))
2370 (defbinding tooltips-get-info-from-tip-window () boolean
2372 (tooltips tooltips :out)
2373 (current-widget widget :out))
2378 (defbinding rc-get-style () style
2381 (defbinding rc-get-style-by-paths (&key path class-path class) style
2382 (path (or null string))
2383 (class-path (or null string))
2386 (defbinding rc-parse () nil
2387 (filename pathname))
2389 (defbinding rc-parse-string () nil
2392 (defbinding %rc-reparse-all () boolean)
2394 (defbinding %rc-reparse-all-for-settings () boolean
2396 (force-load-p boolean))
2398 (defun rc-reparse-all (&optional setting force-load-p)
2400 (%rc-reparse-all-for-settings setting force-load-p)
2403 (defbinding rc-reset-styles () nil
2404 (settings settings))
2406 (defbinding rc-add-default-file () nil
2407 (filename pathname))
2409 (defbinding rc-get-default-files ()
2410 (copy-of (null-terminated-vector (copy-of string))))
2412 (defbinding rc-get-module-dir () string)
2414 (defbinding rc-get-im-module-path () string)
2416 (defbinding rc-get-im-module-file () string)
2418 (defbinding rc-get-theme-dir () string)
2423 (defbinding (settings-get "gtk_settings_get_for_screen")
2424 (&optional (screen (gdk:display-get-default-screen))) settings
2425 (screen gdk:screen))
2430 (defbinding socket-add-id () nil
2432 (id gdk:native-window))
2434 (defbinding %plug-new () pointer
2435 (id gdk:native-window))
2437 (defmethod allocate-foreign ((plug plug) &key id)
2438 (%plug-new (or id 0)))
2441 ;;;; New stuff in Gtk+ 2.10
2445 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.10.0")
2447 (define-callback-marshal %link-button-uri-callback nil (link-button (link string)))
2449 (defbinding link-button-set-uri-hook (function) pointer
2450 (%link-button-uri-callback callback)
2451 ((register-callback-function function) unsigned-int)
2452 (user-data-destroy-callback callback)))