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.62 2006/04/26 12:33:52 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))))
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 the 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)
70 (error "Initialization of GTK+ failed."))
72 (gdk:display-open display)
75 (add-fd-handler (gdk:display-connection-number) :input #'main-iterate-all)
76 (setq *periodic-polling-function* #'main-iterate-all)
77 (setq *max-event-to-sec* 0)
78 (setq *max-event-to-usec* *event-poll-interval*))
79 #+(and clisp readline)
80 ;; Readline will call the event hook at most ten times per second
81 (setf readline:event-hook #'main-iterate-all)
83 ;; When running in Slime we need to hook into the Swank server
84 ;; to handle events asynchronously
85 (if (find-symbol "WAIT-UNTIL-READABLE" "SWANK")
86 (setf (symbol-function 'swank::wait-until-readable)
89 (case (socket:socket-status (cons stream :input) 0 *event-poll-interval*)
91 (:eof (read-char stream))
92 (otherwise (main-iterate-all))))))
93 #-readline(warn "Not running in Slime and Readline support is missing, so the Gtk main loop has to be invoked explicit.")))))
96 (defun clg-init-with-threading (&optional display)
97 "Initializes the system and starts the event handling"
98 (unless (gdk:display-get-default)
100 (gdk:threads-set-lock-functions)
102 (error "Initialization of GTK+ failed."))
103 (sb-thread:make-thread
105 (gdk:display-open display)
106 (gdk:with-global-lock (main)))
107 :name "gtk event loop")))
110 (defun clg-init-with-threading (&optional display)
111 "Initializes the system and starts the event handling"
112 (unless (gdk:display-get-default)
114 (gdk:threads-set-lock-functions)
116 (error "Initialization of GTK+ failed."))
117 (sb-thread:make-thread
119 (gdk:display-open display)
120 (gdk:with-global-lock (main)))
121 :name "gtk event loop")))
124 ;;; Generic functions
126 (defgeneric add-to-radio-group (item1 item2))
127 (defgeneric activate-radio-widget (item))
128 (defgeneric (setf tool-item-tip-text) (tip-text tool-item))
129 (defgeneric (setf tool-item-tip-private) (tip-private tool-item))
135 (defbinding grab-add () nil
138 (defbinding grab-get-current () widget)
140 (defbinding grab-remove () nil
143 (defbinding get-default-language () (copy-of pango:language))
148 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
150 (define-callback-marshal %about-dialog-activate-link-callback nil
151 (about-dialog (link string)))
153 (defbinding about-dialog-set-email-hook (function) nil
154 (%about-dialog-activate-link-callback callback)
155 ((register-callback-function function) unsigned-int)
156 (user-data-destroy-callback callback))
158 (defbinding about-dialog-set-url-hook (function) nil
159 (%about-dialog-activate-link-callback callback)
160 ((register-callback-function function) unsigned-int)
161 (user-data-destroy-callback callback)))
166 (defbinding %accel-group-connect () nil
167 (accel-group accel-group)
169 (modifiers gdk:modifier-type)
173 (defun accel-group-connect (group accelerator function &optional flags)
174 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
175 (let ((gclosure (make-callback-closure function)))
176 (%accel-group-connect group key modifiers flags gclosure)
179 (defbinding accel-group-connect-by-path (group path function) nil
182 ((make-callback-closure function) gclosure :in/return))
184 (defbinding %accel-group-disconnect (group gclosure) boolean
188 (defbinding %accel-group-disconnect-key () boolean
191 (modifiers gdk:modifier-type))
193 (defun accel-group-disconnect (group accelerator)
194 (etypecase accelerator
195 (gclosure (%accel-group-disconnect group accelerator))
197 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
198 (%accel-group-disconnect-key group key modifiers)))))
200 (defbinding %accel-group-query () (copy-of (vector (inlined accel-group-entry) n))
201 (accel-group accel-group)
203 (modifiers gdk:modifier-type)
206 (defun accel-group-query (accel-group accelerator)
207 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
208 (%accel-group-query accel-group key modifiers)))
210 (defbinding %accel-group-activate () boolean
211 (accel-group accel-group)
212 (acceleratable gobject)
214 (modifiers gdk:modifier-type))
216 (defun accel-group-activate (accel-group acceleratable accelerator)
217 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
218 (%accel-group-activate accel-group acceleratable key modifiers)))
220 (defbinding accel-group-lock () nil
221 (accel-group accel-group))
223 (defbinding accel-group-unlock () nil
224 (accel-group accel-group))
226 (defbinding accel-group-from-accel-closure () accel-group
229 (defbinding %accel-groups-activate () boolean
232 (modifiers gdk:modifier-type))
234 (defun accel-groups-activate (object accelerator)
235 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
236 (%accel-groups-activate object key modifiers)))
238 (defbinding accel-groups-from-object () (gslist accel-groups)
241 (defbinding accelerator-valid-p (key &optional modifiers) boolean
243 (modifiers gdk:modifier-type))
245 (defbinding %accelerator-parse () nil
247 (key unsigned-int :out)
248 (modifiers gdk:modifier-type :out))
250 (defgeneric parse-accelerator (accelerator))
252 (defmethod parse-accelerator ((accelerator string))
253 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
255 (error "Invalid accelerator: ~A" accelerator)
256 (values key modifiers))))
258 (defmethod parse-accelerator ((accelerator cons))
259 (destructuring-bind (key modifiers) accelerator
265 (gdk:keyval-from-name key)
266 (error "Invalid key name: ~A" key)))
267 (character (parse-accelerator key)))
270 (defmethod parse-accelerator ((key integer))
273 (defmethod parse-accelerator ((key character))
275 (gdk:keyval-from-name (string key))
276 (error "Invalid key name: ~A" key)))
279 (defbinding accelerator-name () string
281 (modifiers gdk:modifier-type))
283 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
284 (defbinding accelerator-get-label () string
286 (modifiers gdk:modifier-type))
288 (defbinding %accelerator-set-default-mod-mask () nil
289 (default-modifiers gdk:modifier-type))
291 (defun (setf accelerator-default-modifier-mask) (default-modifiers)
292 (%accelerator-set-default-mod-mask default-modifiers))
294 (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
299 (defbinding accel-label-get-accel-width () unsigned-int
300 (accel-label accel-label))
302 (defbinding accel-label-refetch () boolean
303 (accel-label accel-label))
309 (defbinding %accel-map-add-entry () nil
312 (modifiers gdk:modifier-type))
314 (defun accel-map-add-entry (path accelerator)
315 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
316 (%accel-map-add-entry path key modifiers)))
318 (defbinding %accel-map-lookup-entry () boolean
320 ((make-instance 'accel-key) accel-key :in/return))
322 (defun accel-map-lookup-entry (path)
323 (multiple-value-bind (found-p accel-key) (%accel-map-lookup-entry path)
326 (slot-value accel-key 'key)
327 (slot-value accel-key 'modifiers)
328 (slot-value accel-key 'flags)))))
330 (defbinding %accel-map-change-entry () boolean
333 (modifiers gdk:modifier-type)
336 (defun accel-map-change-entry (path accelerator &optional replace)
337 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
338 (%accel-map-change-entry path key modifiers replace)))
340 (defbinding accel-map-load () nil
343 (defbinding accel-map-save () nil
346 (define-callback-marshal %accel-map-foreach-callback nil
347 ((accel-path string) (key unsigned-int)
348 (modifiers gdk:modifier-type) (changed boolean)) :callback-id :first)
350 (defbinding %accel-map-foreach (callback-id) nil
351 (callback-id unsigned-int)
352 (%accel-map-foreach-callback callback))
354 (defbinding %accel-map-foreach-unfiltered (callback-id) nil
355 (callback-id unsigned-int)
356 (%accel-map-foreach-callback callback))
358 (defun accel-map-foreach (function &optional (filter-p t))
359 (with-callback-function (id function)
361 (%accel-map-foreach id)
362 (%accel-map-foreach-unfiltered id))))
364 (defbinding accel-map-add-filter () nil
367 (defbinding accel-map-get () accel-map)
369 (defbinding accel-map-lock-path () nil
372 (defbinding accel-map-unlock-path () nil
379 (defbinding accessible-connect-widget-destroyed () nil
380 (accessible accessible))
385 (defmethod initialize-instance ((adjustment adjustment) &key value)
388 ;; we need to make sure that the value is set last, otherwise it
389 ;; may be outside current limits and ignored
391 (setf (slot-value adjustment 'value) value))))
394 (defbinding adjustment-changed () nil
395 (adjustment adjustment))
397 (defbinding adjustment-value-changed () nil
398 (adjustment adjustment))
400 (defbinding adjustment-clamp-page () nil
401 (adjustment adjustment)
403 (upper single-float))
408 (defbinding alignment-set () nil
409 (alognment alignment)
410 (x-align single-float)
411 (y-align single-float)
412 (x-scale single-float)
413 (y-scale single-float))
415 (defbinding alignment-get-padding () nil
416 (alognment alignment)
417 (top unsigned-int :out)
418 (bottom unsigned-int :out)
419 (left unsigned-int :out)
420 (right unsigned-int :out))
422 (defbinding alignment-set-padding () nil
423 (alognment alignment)
425 (bottom unsigned-int)
427 (right unsigned-int))
435 (defun (setf bin-child) (child bin)
436 (when-bind (current-child (bin-child bin))
437 (container-remove bin current-child))
438 (container-add bin child)
441 (defmethod compute-signal-function ((bin bin) signal function object)
442 (declare (ignore signal))
443 (if (eq object :child)
444 #'(lambda (&rest args)
445 (apply function (bin-child bin) (rest args)))
451 (defbinding box-pack-start () nil
456 (padding unsigned-int))
458 (defbinding box-pack-end () nil
463 (padding unsigned-int))
465 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
467 (box-pack-end box child expand fill padding)
468 (box-pack-start box child expand fill padding)))
470 (defbinding box-reorder-child () nil
475 (defbinding box-query-child-packing () nil
478 (expand boolean :out)
480 (padding unsigned-int :out)
481 (pack-type pack-type :out))
483 (defbinding box-set-child-packing () nil
488 (padding unsigned-int)
489 (pack-type pack-type))
495 (defmethod initialize-instance ((button button) &rest initargs &key stock)
497 (apply #'call-next-method button
498 :label stock :use-stock t :use-underline t initargs)
502 (defbinding button-pressed () nil
505 (defbinding button-released () nil
508 (defbinding button-clicked () nil
511 (defbinding button-enter () nil
514 (defbinding button-leave () nil
521 (defbinding calendar-select-month () int
526 (defbinding calendar-select-day () nil
530 (defbinding calendar-mark-day () int
534 (defbinding calendar-unmark-day () int
538 (defbinding calendar-clear-marks () nil
541 (defbinding calendar-get-date () nil
543 (year unsigned-int :out)
544 (month unsigned-int :out)
545 (day unsigned-int :out))
547 (defbinding calendar-freeze () nil
550 (defbinding calendar-thaw () nil
556 (defbinding check-menu-item-toggled () nil
557 (check-menu-item check-menu-item))
562 (defbinding (color-selection-is-adjusting-p
563 "gtk_color_selection_is_adjusting") () boolean
564 (colorsel color-selection))
568 ;;; Color selection dialog -- no functions
574 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
575 &key model content active)
576 (remf initargs :active)
578 (apply #'call-next-method combo-box initargs)
580 (apply #'call-next-method combo-box
581 :model (make-instance 'list-store :column-types '(string))
583 (unless (typep combo-box 'combo-box-entry)
584 (let ((cell (make-instance 'cell-renderer-text)))
585 (cell-layout-pack combo-box cell :expand t)
586 (cell-layout-add-attribute combo-box cell :text 0)))))
588 (mapc #'(lambda (text)
589 (combo-box-append-text combo-box text))
592 (setf (combo-box-active combo-box) active)))
595 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
597 ;; (signal-emit combo-box 'changed)))
599 (defbinding combo-box-append-text () nil
600 (combo-box combo-box)
603 (defbinding combo-box-insert-text () nil
604 (combo-box combo-box)
608 (defbinding combo-box-prepend-text () nil
609 (combo-box combo-box)
612 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
613 (defbinding combo-box-get-active-text () string
614 (combo-box combo-box))
616 (defbinding combo-box-popup () nil
617 (combo-box combo-box))
619 (defbinding combo-box-popdown () nil
620 (combo-box combo-box))
626 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
629 (setf (combo-box-entry-text-column combo-box-entry) 0)))
634 (defmethod shared-initialize ((dialog dialog) names &rest initargs
636 (declare (ignore names button buttons))
639 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
642 (defun dialog-response-id (dialog response &optional create-p error-p)
643 "Returns a numeric response id"
644 (if (typep response 'response-type)
645 (response-type-to-int response)
646 (let ((responses (user-data dialog 'responses)))
648 ((and responses (position response responses :test #'equal)))
652 (vector-push-extend response responses)
653 (1- (length responses)))
656 (user-data dialog 'responses)
657 (make-array 1 :adjustable t :fill-pointer t
658 :initial-element response))
661 (error "Invalid response: ~A" response))))))
663 (defun dialog-find-response (dialog id)
664 "Finds a symbolic response given a numeric id"
666 (int-to-response-type id)
667 (aref (user-data dialog 'responses) id)))
670 (defmethod compute-signal-id ((dialog dialog) signal)
671 (if (dialog-response-id dialog signal)
672 (ensure-signal-id 'response dialog)
675 (defmethod compute-signal-function ((dialog dialog) signal function object)
676 (declare (ignore function object))
677 (let ((callback (call-next-method))
678 (id (dialog-response-id dialog signal)))
680 #'(lambda (dialog response)
681 (when (= response id)
682 (funcall callback dialog)))
685 (defbinding dialog-run () nil
688 (defbinding dialog-response (dialog response) nil
690 ((dialog-response-id dialog response nil t) int))
693 (defbinding %dialog-add-button () button
698 (defun dialog-add-button (dialog label &optional (response label)
699 &key default object after)
700 "Adds a button to the dialog."
701 (let* ((signal (if (functionp response)
704 (id (dialog-response-id dialog signal t))
705 (button (%dialog-add-button dialog label id)))
706 (when (functionp response)
707 (signal-connect dialog signal response :object object :after after))
709 (%dialog-set-default-response dialog id))
713 (defbinding %dialog-add-action-widget () nil
715 (action-widget widget)
718 (defun dialog-add-action-widget (dialog widget &optional (response widget)
719 &key default object after)
720 (let* ((signal (if (functionp response)
723 (id (dialog-response-id dialog signal t)))
724 (unless (widget-hidden-p widget)
725 (widget-show widget))
726 (%dialog-add-action-widget dialog widget id)
727 (when (functionp response)
728 (signal-connect dialog signal response :object object :after after))
730 (%dialog-set-default-response dialog id))
734 (defbinding %dialog-set-default-response () nil
738 (defun dialog-set-default-response (dialog response)
739 (%dialog-set-default-response
740 dialog (dialog-response-id dialog response nil t)))
742 (defbinding dialog-set-response-sensitive (dialog response sensitive) nil
744 ((dialog-response-id dialog response nil t) int)
747 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
748 (defbinding alternative-dialog-button-order-p (&optional screen) boolean
749 (screen (or null gdk:screen)))
751 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
752 (defbinding (dialog-set-alternative-button-order
753 "gtk_dialog_set_alternative_button_order_from_array")
754 (dialog new-order) nil
756 ((length new-order) int)
757 ((map 'vector #'(lambda (response)
758 (dialog-response-id dialog response nil t))
759 new-order) (vector int)))
762 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
764 (defbinding %dialog-get-response-for-widget () int
768 (defun dialog-get-response-for-widget (dialog widget)
769 (dialog-find-response dialog (dialog-get-response-for-widget dialog widget))))
772 (defmethod container-add ((dialog dialog) (child widget) &rest args)
773 (apply #'container-add (dialog-vbox dialog) child args))
776 (defmethod container-remove ((dialog dialog) (child widget))
777 (container-remove (dialog-vbox dialog) child))
779 (defmethod container-children ((dialog dialog))
780 (container-children (dialog-vbox dialog)))
782 (defmethod (setf container-children) (children (dialog dialog))
783 (setf (container-children (dialog-vbox dialog)) children))
788 (defbinding entry-get-layout-offsets () nil
793 (defbinding entry-layout-index-to-text-index () int
797 (defbinding entry-text-index-to-layout-index () int
804 (define-callback-marshal %entry-completion-match-callback boolean
805 (entry-completion string tree-iter))
807 (defbinding entry-completion-set-match-func (completion function) nil
808 (completion entry-completion)
809 (%entry-completion-match-callback callback)
810 ((register-callback-function function) unsigned-int)
811 (user-data-destroy-callback callback))
813 (defbinding entry-completion-complete () nil
814 (completion entry-completion))
816 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
817 (defbinding entry-completion-insert-prefix () nil
818 (completion entry-completion))
820 (defbinding entry-completion-insert-action-text () nil
821 (completion entry-completion)
825 (defbinding entry-completion-insert-action-markup () nil
826 (completion entry-completion)
830 (defbinding entry-completion-delete-action () nil
831 (completion entry-completion)
837 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
838 &key filter filters shortcut-folder
839 shortcut-folders shortcut-folder-uti
840 shortcut-folder-uris)
841 (declare (ignore filter filters shortcut-folder shortcut-folders
842 shortcut-folder-uti shortcut-folder-uris))
845 (initial-add file-chooser #'file-chooser-add-filter
846 initargs :filer :filters)
847 (initial-add file-chooser #'file-chooser-add-shortcut-folder
848 initargs :shortcut-folder :shortcut-folders)
849 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
850 initargs :shortcut-folder-uri :shortcut-folders-uris)))
853 (defbinding file-chooser-select-filename () boolean
854 (file-chooser file-chooser)
857 (defbinding file-chooser-unselect-filename () nil
858 (file-chooser file-chooser)
861 (defbinding file-chooser-select-all () boolean
862 (file-chooser file-chooser))
864 (defbinding file-chooser-unselect-all () boolean
865 (file-chooser file-chooser))
867 (defbinding file-chooser-get-filenames () (gslist string)
868 (file-chooser file-chooser))
870 (defbinding file-chooser-select-uri () boolean
871 (file-chooser file-chooser)
874 (defbinding file-chooser-unselect-uri () nil
875 (file-chooser file-chooser)
878 (defbinding file-chooser-get-uris () (gslist string)
879 (file-chooser file-chooser))
881 (defbinding file-chooser-add-filter () nil
882 (file-chooser file-chooser)
883 (filter file-filter))
885 (defbinding file-chooser-remove-filter () nil
886 (file-chooser file-chooser)
887 (filter file-filter))
889 (defbinding file-chooser-list-filters () (gslist file-filter)
890 (file-chooser file-chooser))
892 (defbinding file-chooser-add-shortcut-folder () boolean
893 (file-chooser file-chooser)
897 (defbinding file-chooser-remove-shortcut-folder () nil
898 (file-chooser file-chooser)
902 (defbinding file-chooser-list-shortcut-folders () (gslist string)
903 (file-chooser file-chooser))
905 (defbinding file-chooser-add-shortcut-folder-uri () boolean
906 (file-chooser file-chooser)
910 (defbinding file-chooser-remove-shortcut-folder-uri () nil
911 (file-chooser file-chooser)
915 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
916 (file-chooser file-chooser))
921 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
922 &key mime-type mime-types pattern patterns
924 (declare (ignore mime-type mime-types pattern patterns))
928 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
929 (warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
930 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
931 (file-filter-add-pixbuf-formats file-filter))
932 (initial-add file-filter #'file-filter-add-mime-type
933 initargs :mime-type :mime-types)
934 (initial-add file-filter #'file-filter-add-pattern
935 initargs :pattern :patterns)))
938 (defbinding file-filter-add-mime-type () nil
942 (defbinding file-filter-add-pattern () nil
946 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
947 (defbinding file-filter-add-pixbuf-formats () nil
948 (filter file-filter))
950 (define-callback-marshal %file-filter-callback boolean (file-filter-info))
952 (defbinding file-filter-add-custom (filter needed function) nil
954 (needed file-filter-flags)
955 (%file-filter-callback callback)
956 ((register-callback-function function) unsigned-int)
957 (user-data-destroy-callback callback))
959 (defbinding file-filter-get-needed () file-filter-flags
960 (filter file-filter))
962 (defbinding file-filter-filter () boolean
964 (filter-info file-filter-info))
970 (defbinding image-set-from-file () nil
974 (defmethod (setf image-pixmap) ((data vector) (image image))
975 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
976 (setf (image-pixmap image) pixmap)
977 (setf (image-mask image) mask)))
979 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
981 ((typep pixmap 'vector)
982 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
983 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
987 (image-set-from-file image file)))
988 ((call-next-method))))
990 (defun create-image-widget (source &optional mask)
992 (gdk:pixbuf (make-instance 'image :pixbuf source))
993 (string (make-instance 'image :stock source))
994 (pathname (make-instance 'image :file source))
995 ((or list vector) (make-instance 'image :pixmap source))
996 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
998 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
999 (defbinding image-clear () nil
1006 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
1007 (if (and image (not (typep image 'widget)))
1008 (apply #'call-next-method item :image (create-image-widget image) initargs)
1009 (call-next-method)))
1012 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
1013 (setf (slot-value item 'image) widget))
1015 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
1016 (setf (image-menu-item-image item) (create-image-widget image)))
1021 (defmethod shared-initialize ((label label) names &key pattern)
1022 (declare (ignore names))
1025 (setf (label-pattern label) pattern)))
1027 (defbinding label-get-layout-offsets () nil
1032 (defbinding label-select-region () nil
1037 (defbinding label-get-selection-bounds () boolean
1046 (defbinding %radio-button-get-group () pointer
1047 (radio-button radio-button))
1049 (defbinding %radio-button-set-group () nil
1050 (radio-button radio-button)
1053 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
1054 "Add BUTTON1 to the group which BUTTON2 belongs to."
1055 (%radio-button-set-group button1 (%radio-button-get-group button2)))
1057 (defun %add-activate-callback (widget signal function object after)
1059 (signal-connect widget signal
1061 (when (slot-value widget 'active)
1062 (funcall function object (slot-value widget 'value))))
1063 :object object :after after)
1064 (signal-connect widget signal
1066 (when (slot-value widget 'active)
1067 (funcall function (slot-value widget 'value))))
1070 (defmethod activate-radio-widget ((button radio-button))
1071 (signal-emit button 'clicked))
1073 (defmethod add-activate-callback ((button radio-button) function &key object after)
1074 (%add-activate-callback button 'clicked function object after))
1076 (defmethod initialize-instance ((button radio-button) &key group)
1080 (add-to-radio-group button group))))
1085 (defbinding item-select () nil
1088 (defbinding item-deselect () nil
1091 (defbinding item-toggle () nil
1098 (defmethod initialize-instance ((item menu-item) &key label)
1102 (setf (menu-item-label item) label))))
1105 (defun (setf menu-item-label) (label menu-item)
1106 (make-instance 'accel-label
1107 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
1108 :use-underline (menu-item-use-underline-p menu-item)
1109 :visible t :parent menu-item)
1112 (defun menu-item-label (menu-item)
1113 (when (and (slot-boundp menu-item 'child)
1114 (typep (bin-child menu-item) 'label))
1115 (label-label (bin-child menu-item))))
1117 (defbinding menu-item-remove-submenu () nil
1118 (menu-item menu-item))
1120 (defbinding menu-item-set-accel-path () nil
1121 (menu-item menu-item)
1122 (accel-path string))
1124 (defbinding menu-item-select () nil
1125 (menu-item menu-item))
1127 (defbinding menu-item-deselect () nil
1128 (menu-item menu-item))
1130 (defbinding menu-item-activate () nil
1131 (menu-item menu-item))
1133 (defbinding menu-item-toggle-size-request () nil
1134 (menu-item menu-item)
1135 (requisition int :out))
1137 (defbinding menu-item-toggle-size-allocate () nil
1138 (menu-item menu-item)
1142 ;;; Menu tool button
1144 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1145 (defbinding menu-tool-button-set-arrow-tooltip () nil
1146 (menu-tool-button menu-tool-button)
1149 (tip-private string))
1154 (defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
1155 (buttons :close) flags transient-parent)
1156 (%message-dialog-new transient-parent flags message-type buttons))
1159 (defmethod shared-initialize ((dialog message-dialog) names &key text
1160 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1162 (declare (ignore names))
1164 (message-dialog-set-markup dialog text))
1165 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1166 (when secondary-text
1167 (message-dialog-format-secondary-markup dialog secondary-text))
1171 (defbinding %message-dialog-new () pointer
1172 (parent (or null window))
1173 (flags dialog-flags)
1175 (buttons buttons-type)
1178 (defbinding message-dialog-set-markup () nil
1179 (message-dialog message-dialog)
1182 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1183 (defbinding message-dialog-format-secondary-text () nil
1184 (message-dialog message-dialog)
1187 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1188 (defbinding message-dialog-format-secondary-markup () nil
1189 (message-dialog message-dialog)
1196 (defbinding %radio-menu-item-get-group () pointer
1197 (radio-menu-item radio-menu-item))
1199 (defbinding %radio-menu-item-set-group () nil
1200 (radio-menu-item radio-menu-item)
1203 (defmethod activate-radio-widget ((item radio-menu-item))
1204 (menu-item-activate item))
1206 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
1207 "Add ITEM1 to the group which ITEM2 belongs to."
1208 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1210 (defmethod add-activate-callback ((item radio-menu-item) function &key object after)
1211 (%add-activate-callback item 'activate function object after))
1213 (defmethod initialize-instance ((item radio-menu-item) &key group)
1217 (add-to-radio-group item group))))
1221 ;;; Radio tool button
1223 (defbinding %radio-tool-button-get-group () pointer
1224 (radio-tool-button radio-tool-button))
1226 (defbinding %radio-tool-button-set-group () nil
1227 (radio-tool-button radio-tool-button)
1230 (defmethod activate-radio-widget ((button radio-tool-button))
1231 (signal-emit button 'clicked))
1233 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
1234 "Add BUTTON1 to the group which BUTTON2 belongs to."
1235 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1236 (defmethod add-activate-callback ((button radio-tool-button) function &key object after)
1237 (%add-activate-callback button 'clicked function object after))
1239 (defmethod initialize-instance ((button radio-tool-button) &key group)
1243 (add-to-radio-group button group))))
1249 (defbinding toggle-button-toggled () nil
1250 (toggle-button toggle-button))
1255 (defmethod initialize-instance ((window window) &rest initargs
1256 &key accel-group accel-groups)
1257 (declare (ignore accel-group accel-groups))
1260 (initial-add window #'window-add-accel-group
1261 initargs :accel-group :accel-groups)))
1263 #-debug-ref-counting
1264 (defmethod print-object ((window window) stream)
1266 (proxy-valid-p window)
1267 (slot-boundp window 'title)
1268 (not (zerop (length (window-title window)))))
1269 (print-unreadable-object (window stream :type t :identity nil)
1270 (format stream "~S at 0x~X"
1271 (window-title window) (pointer-address (foreign-location window))))
1272 (call-next-method)))
1274 (defbinding window-set-wmclass () nil
1276 (wmclass-name string)
1277 (wmclass-class string))
1279 (defbinding window-add-accel-group () nil
1281 (accel-group accel-group))
1283 (defbinding window-remove-accel-group () nil
1285 (accel-group accel-group))
1287 (defbinding window-activate-focus () int
1290 (defbinding window-activate-default () int
1293 (defbinding window-set-default-size (window width height) int
1296 ((or height -1) int))
1298 (defbinding %window-set-geometry-hints () nil
1300 (geometry gdk:geometry)
1301 (geometry-mask gdk:window-hints))
1303 (defun window-set-geometry-hints (window &key min-width min-height
1304 max-width max-height base-width base-height
1305 width-inc height-inc min-aspect max-aspect
1306 (gravity nil gravity-p) min-size max-size)
1307 (let ((geometry (make-instance 'gdk:geometry
1308 :min-width (or min-width -1)
1309 :min-height (or min-height -1)
1310 :max-width (or max-width -1)
1311 :max-height (or max-height -1)
1312 :base-width (or base-width 0)
1313 :base-height (or base-height 0)
1314 :width-inc (or width-inc 0)
1315 :height-inc (or height-inc 0)
1316 :min-aspect (or min-aspect 0)
1317 :max-aspect (or max-aspect 0)
1320 (when (or min-size min-width min-height)
1321 (push :min-size mask))
1322 (when (or max-size max-width max-height)
1323 (push :max-size mask))
1324 (when (or base-width base-height)
1325 (push :base-size mask))
1326 (when (or width-inc height-inc)
1327 (push :resize-inc mask))
1328 (when (or min-aspect max-aspect)
1329 (push :aspect mask))
1331 (push :win-gravity mask))
1332 (%window-set-geometry-hints window geometry mask)))
1334 (defbinding window-list-toplevels () (glist (copy-of window))
1335 "Returns a list of all existing toplevel windows.")
1337 (defbinding window-add-mnemonic (window key target) nil
1339 ((gdk:keyval-from-name key) unsigned-int)
1342 (defbinding window-remove-mnemonic (window key target) nil
1344 ((gdk:keyval-from-name key) unsigned-int)
1347 (defbinding window-mnemonic-activate (window key modifier) nil
1349 ((gdk:keyval-from-name key) unsigned-int)
1350 (modifier gdk:modifier-type))
1352 (defbinding window-activate-key () boolean
1354 (event gdk:key-event))
1356 (defbinding window-propagate-key-event () boolean
1358 (event gdk:key-event))
1360 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1361 (defbinding window-present () nil
1364 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1366 (defbinding %window-present () nil
1369 (defbinding %window-present-with-time () nil
1371 (timespamp unsigned-int))
1373 (defun window-present (window &optional timestamp)
1375 (%window-present-with-time window timestamp)
1376 (%window-present window))))
1378 (defbinding window-iconify () nil
1381 (defbinding window-deiconify () nil
1384 (defbinding window-stick () nil
1387 (defbinding window-unstick () nil
1390 (defbinding window-maximize () nil
1393 (defbinding window-unmaximize () nil
1396 (defbinding window-fullscreen () nil
1399 (defbinding window-unfullscreen () nil
1402 (defbinding window-set-keep-above () nil
1406 (defbinding window-set-keep-below () nil
1410 (defbinding window-begin-resize-drag () nil
1412 (edge gdk:window-edge)
1414 (root-x int) (root-y int)
1415 (timestamp unsigned-int))
1417 (defbinding window-begin-move-drag () nil
1419 (edge gdk:window-edge)
1421 (root-x int) (root-y int)
1422 (timestamp unsigned-int))
1424 (defbinding window-set-frame-dimensions () nil
1426 (left int) (top int) (rigth int) (bottom int))
1428 (defbinding %window-get-default-size () nil
1433 (defun window-get-default-size (window)
1434 (multiple-value-bind (width height) (%window-get-default-size window)
1435 (values (unless (= width -1) width) (unless (= height -1) height))))
1437 (defbinding window-get-frame-dimensions () nil
1439 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1441 (defbinding %window-get-icon-list () (glist (copy-of gdk:pixbuf))
1444 (defbinding window-get-position () nil
1449 (defbinding window-get-size () nil
1454 (defbinding window-move () nil
1459 (defbinding window-parse-geometry () boolean
1463 (defbinding window-reshow-with-initial-size () nil
1466 (defbinding window-resize () nil
1471 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1472 () (glist gdk:pixbuf))
1474 (defun window-default-icon ()
1475 (first (window-default-icon-list)))
1477 (defbinding %window-set-default-icon-list () nil
1478 (icons (glist gdk:pixbuf)))
1480 (defun (setf window-default-icon-list) (icons)
1481 (%window-set-default-icon-list icons)
1484 (defbinding %window-set-default-icon () nil
1485 (icons (glist gdk:pixbuf)))
1487 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1488 (%window-set-default-icon icon)
1491 (defmethod (setf window-group) ((group window-group) (window window))
1492 (window-group-add-window group window)
1495 (defbinding %window-set-default-icon-from-file () boolean
1499 (defmethod (setf window-default-icon) ((icon-file pathname))
1500 (%window-set-default-icon-from-file icon-file)
1503 (defbinding %window-set-icon-from-file () boolean
1508 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1509 (%window-set-icon-from-file window icon-file)
1512 (defbinding window-set-auto-startup-notification () nil
1515 (defbinding decorated-window-init () nil
1518 (defbinding decorated-window-calculate-frame-size () nil
1521 (defbinding decorated-window-set-title () nil
1525 (defbinding decorated-window-move-resize-window () nil
1535 (defmethod initialize-instance ((window-group window-group) &rest initargs
1536 &key window windows)
1537 (declare (ignore window windows))
1540 (initial-add window-group #'window-group-add-window
1541 initargs :window :windows)))
1544 (defbinding window-group-add-window () nil
1545 (window-group window-group)
1548 (defbinding window-group-remove-window () nil
1549 (window-group window-group)
1555 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1556 (setf (scrolled-window-hscrollbar-policy window) policy)
1557 (setf (scrolled-window-vscrollbar-policy window) policy))
1559 (defbinding scrolled-window-add-with-viewport () nil
1560 (scrolled-window scrolled-window)
1563 (defmethod shared-initialize ((window scrolled-window) names &key policy)
1564 (declare (ignore names))
1566 (setf (slot-value window 'hscrollbar-policy) policy)
1567 (setf (slot-value window 'vscrollbar-policy) policy))
1573 (defbinding statusbar-get-context-id () unsigned-int
1574 (statusbar statusbar)
1575 (context-description string))
1577 (defbinding statusbar-push () unsigned-int
1578 (statusbar statusbar)
1579 (context-id unsigned-int)
1582 (defbinding statusbar-pop () nil
1583 (statusbar statusbar)
1584 (context-id unsigned-int))
1586 (defbinding statusbar-remove () nil
1587 (statusbar statusbar)
1588 (context-id unsigned-int)
1589 (message-id unsigned-int))
1595 (defbinding fixed-put () nil
1600 (defbinding fixed-move () nil
1609 (defun %ensure-notebook-position (notebook page)
1612 (widget (notebook-page-num notebook page t))))
1614 (defun %ensure-notebook-child (notebook position)
1617 (t (notebook-get-nth-page notebook position))))
1619 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1620 (notebook position child &optional tab-label menu-label) nil
1623 ((if (stringp tab-label)
1624 (make-instance 'label :label tab-label)
1625 tab-label) (or null widget))
1626 ((if (stringp menu-label)
1627 (make-instance 'label :label menu-label)
1628 menu-label) (or null widget))
1629 ((%ensure-notebook-position notebook position) position))
1631 (defun notebook-append (notebook child &optional tab-label menu-label)
1632 (notebook-insert notebook :last child tab-label menu-label))
1634 (defun notebook-prepend (notebook child &optional tab-label menu-label)
1635 (notebook-insert notebook :first child tab-label menu-label))
1637 (defbinding notebook-remove-page (notebook page) nil
1639 ((%ensure-notebook-position notebook page) position))
1641 (defbinding %notebook-page-num () int
1645 (defun notebook-page-num (notebook child &optional error-p)
1646 (let ((page-num (%notebook-page-num notebook child)))
1649 (error "~A is not a page in ~A" child notebook))
1652 (defbinding notebook-next-page () nil
1653 (notebook notebook))
1655 (defbinding notebook-prev-page () nil
1656 (notebook notebook))
1658 (defbinding notebook-reorder-child (notebook child position) nil
1661 ((%ensure-notebook-position notebook position) int))
1663 (defbinding notebook-popup-enable () nil
1664 (notebook notebook))
1666 (defbinding notebook-popup-disable () nil
1667 (notebook notebook))
1669 (defbinding notebook-get-nth-page () widget
1673 (defun %notebook-current-page (notebook)
1674 (when (slot-boundp notebook 'current-page-num)
1675 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1677 (defun (setf notebook-current-page) (page notebook)
1678 (setf (notebook-current-page-num notebook) (notebook-page-num notebook page)))
1680 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1681 (notebook page) widget
1683 ((%ensure-notebook-child notebook page) widget))
1685 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1686 (notebook page) (copy-of string)
1688 ((%ensure-notebook-child notebook page) widget))
1690 (defbinding %notebook-set-tab-label () nil
1695 (defun (setf notebook-tab-label) (tab-label notebook page)
1696 (let ((widget (if (stringp tab-label)
1697 (make-instance 'label :label tab-label)
1699 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1703 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1704 (notebook page) widget
1706 ((%ensure-notebook-child notebook page) widget))
1708 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1709 (notebook page) (copy-of string)
1711 ((%ensure-notebook-child notebook page) widget))
1713 (defbinding %notebook-set-menu-label () nil
1716 (menu-label widget))
1718 (defun (setf notebook-menu-label) (menu-label notebook page)
1719 (let ((widget (if (stringp menu-label)
1720 (make-instance 'label :label menu-label)
1722 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1726 (defbinding notebook-query-tab-label-packing (notebook page) nil
1728 ((%ensure-notebook-child notebook page) widget)
1729 (expand boolean :out)
1731 (pack-type pack-type :out))
1733 (defbinding notebook-set-tab-label-packing
1734 (notebook page expand fill pack-type) nil
1736 ((%ensure-notebook-child notebook page) widget)
1739 (pack-type pack-type))
1745 (defbinding paned-pack1 () nil
1751 (defbinding paned-pack2 () nil
1760 (defbinding layout-put () nil
1766 (defbinding layout-move () nil
1772 (defbinding layout-set-size () nil
1774 (width unsigned-int)
1775 (height unsigned-int))
1777 (defbinding layout-get-size () nil
1779 (width unsigned-int :out)
1780 (height unsigned-int :out))
1785 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1786 (menu-shell menu-shell)
1787 (menu-item menu-item)
1793 (defun menu-shell-append (menu-shell menu-item)
1794 (menu-shell-insert menu-shell menu-item :last))
1796 (defun menu-shell-prepend (menu-shell menu-item)
1797 (menu-shell-insert menu-shell menu-item :fisrt))
1799 (defbinding menu-shell-deactivate () nil
1800 (menu-shell menu-shell))
1802 (defbinding menu-shell-select-item () nil
1803 (menu-shell menu-shell)
1804 (menu-item menu-item))
1806 (defbinding menu-shell-select-first () nil
1807 (menu-shell menu-shell)
1808 (search-sensitive boolean))
1810 (defbinding menu-shell-deselect () nil
1811 (menu-shell menu-shell))
1813 (defbinding menu-shell-activate-item () nil
1814 (menu-shell menu-shell)
1815 (menu-item menu-item)
1816 (fore-deactivate boolean))
1818 (defbinding menu-shell-cancel () nil
1819 (menu-shell menu-shell))
1824 (defun %menu-position (menu child)
1827 (keyword (case child
1830 (t (error "Invalid position keyword: ~A" child))))
1831 (widget (menu-child-position menu child))))
1834 (defbinding menu-reorder-child (menu menu-item position) nil
1836 (menu-item menu-item)
1837 ((%menu-position menu position) int))
1839 (defbinding menu-attach () nil
1841 (menu-item menu-item)
1842 (left-attach unsigned-int)
1843 (right-attach unsigned-int)
1844 (top-attach unsigned-int)
1845 (bottom-attach unsigned-int))
1847 (define-callback-marshal %menu-position-callback nil
1848 (menu (x int) (y int) (push-in boolean)))
1850 (defbinding %menu-popup () nil
1852 (parent-menu-shell (or null menu-shell))
1853 (parent-menu-item (or null menu-item))
1854 (callback (or null callback))
1855 (callback-id unsigned-int)
1856 (button unsigned-int)
1857 (activate-time (unsigned 32)))
1859 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1862 (with-callback-function (id callback)
1864 menu parent-menu-shell parent-menu-item
1865 %menu-position-callback id button activate-time))
1867 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1869 (defbinding menu-set-accel-path () nil
1871 (accel-path string))
1873 (defbinding menu-reposition () nil
1876 (defbinding menu-popdown () nil
1879 (defun menu-child-position (menu child)
1880 (position child (container-children menu)))
1882 (defun menu-active-num (menu)
1883 (menu-child-position menu (menu-active menu)))
1885 (defbinding %menu-set-active () nil
1887 (index unsigned-int))
1889 (defun (setf menu-active) (menu child)
1890 (%menu-set-active menu (%menu-position menu child))
1893 (define-callback %menu-detach-callback nil ((widget widget) (menu menu))
1894 (funcall (user-data menu 'detach-func) widget menu))
1896 (defbinding %menu-attach-to-widget (menu widget) nil
1899 (%menu-detach-callback callback))
1901 (defun menu-attach-to-widget (menu widget function)
1902 (setf (user-data menu 'detach-func) function)
1903 (%menu-attach-to-widget menu widget))
1905 (defbinding menu-detach () nil
1908 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1909 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1912 (defbinding menu-set-monitor () nil
1919 (defbinding table-resize () nil
1922 (columns unsigned-int))
1924 (defbinding table-attach (table child left right top bottom
1925 &key options x-options y-options
1926 (x-padding 0) (y-padding 0)) nil
1930 (right unsigned-int)
1932 (bottom unsigned-int)
1933 ((append (mklist options) (mklist x-options)) attach-options)
1934 ((append (mklist options) (mklist y-options)) attach-options)
1935 (x-padding unsigned-int)
1936 (y-padding unsigned-int))
1939 (defbinding %table-set-row-spacing () nil
1942 (spacing unsigned-int))
1944 (defbinding %table-set-row-spacings () nil
1946 (spacing unsigned-int))
1948 (defun (setf table-row-spacing) (spacing table &optional row)
1950 (%table-set-row-spacing table row spacing)
1951 (%table-set-row-spacings table spacing))
1954 (defbinding %table-get-row-spacing () unsigned-int
1958 (defbinding %table-get-default-row-spacing () unsigned-int
1961 (defun table-row-spacing (table &optional row)
1963 (%table-get-row-spacing table row)
1964 (%table-get-default-row-spacing table)))
1967 (defbinding %table-set-col-spacing () nil
1970 (spacing unsigned-int))
1972 (defbinding %table-set-col-spacings () nil
1974 (spacing unsigned-int))
1976 (defun (setf table-col-spacing) (spacing table &optional col)
1978 (%table-set-col-spacing table col spacing)
1979 (%table-set-col-spacings table spacing))
1982 (defbinding %table-get-col-spacing () unsigned-int
1986 (defbinding %table-get-default-col-spacing () unsigned-int
1989 (defun table-col-spacing (table &optional col)
1991 (%table-get-col-spacing table col)
1992 (%table-get-default-col-spacing table)))
1998 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
2000 (apply #'call-next-method toolbar
2001 :tooltips (make-instance 'tooltips) initargs)
2002 (call-next-method)))
2004 (defbinding %toolbar-insert () nil
2006 (tool-item tool-item)
2007 (position position))
2009 (defun toolbar-insert (toolbar tool-item &optional (position :end))
2010 (%toolbar-insert toolbar tool-item position)
2011 (%tool-item-update-tooltips tool-item))
2013 (defbinding toolbar-get-item-index () int
2017 (defbinding toolbar-get-nth-item () tool-item
2021 (defbinding toolbar-get-drop-index () int
2025 (defbinding toolbar-set-drop-highlight-item () nil
2027 (tool-item tool-item)
2033 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
2034 (if (and icon (not (typep icon 'widget)))
2035 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
2036 (call-next-method)))
2041 (defbinding tool-item-set-tooltip () nil
2042 (tool-item tool-item)
2045 (tip-private string))
2048 (defun %tool-item-update-tooltips (tool-item)
2050 (slot-boundp tool-item 'parent)
2052 (user-data-p tool-item 'tip-text)
2053 (user-data-p tool-item 'tip-private)))
2054 (tool-item-set-tooltip
2055 tool-item (toolbar-tooltips (widget-parent tool-item))
2056 (or (user-data tool-item 'tip-text) "")
2057 (or (user-data tool-item 'tip-private) ""))))
2059 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
2060 (setf (user-data tool-item 'tip-text) tip-text)
2061 (%tool-item-update-tooltips tool-item)
2064 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
2065 (setf (user-data tool-item 'tip-private) tip-private)
2066 (%tool-item-update-tooltips tool-item)
2069 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
2070 (declare (ignore args))
2073 (%tool-item-update-tooltips tool-item)))
2076 (defbinding tool-item-retrieve-proxy-menu-item () widget
2077 (tool-item tool-item))
2079 (defbinding (tool-item-proxy-menu-item
2080 "gtk_tool_item_get_proxy_menu_item") () menu-item
2081 (tool-item tool-item)
2082 (menu-item-id string))
2084 (defbinding %tool-item-set-proxy-menu-item () nil
2085 (tool-item tool-item)
2086 (menu-item-id string)
2087 (menu-item menu-item))
2089 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
2090 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
2093 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
2094 (defbinding tool-item-rebuild-menu () nil
2095 (tool-item tool-item))
2100 (defbinding editable-select-region (editable &optional (start 0) end) nil
2105 (defbinding editable-get-selection-bounds (editable) nil
2110 (defbinding editable-insert-text (editable text &optional (position 0)) nil
2114 (position position :in/out))
2116 (defun editable-append-text (editable text)
2117 (editable-insert-text editable text nil))
2119 (defun editable-prepend-text (editable text)
2120 (editable-insert-text editable text 0))
2122 (defbinding editable-delete-text (editable &optional (start 0) end) nil
2127 (defbinding (editable-text "gtk_editable_get_chars")
2128 (editable &optional (start 0) end) string
2133 (defun (setf editable-text) (text editable)
2135 (editable-delete-text
2137 (editable-insert-text editable text))
2138 (editable-delete-text editable))
2141 (defbinding editable-cut-clipboard () nil
2142 (editable editable))
2144 (defbinding editable-copy-clipboard () nil
2145 (editable editable))
2147 (defbinding editable-paste-clipboard () nil
2148 (editable editable))
2150 (defbinding editable-delete-selection () nil
2151 (editable editable))
2157 (defbinding spin-button-configure () nil
2158 (spin-button spin-button)
2159 (adjustment adjustment)
2160 (climb-rate double-float)
2161 (digits unsigned-int))
2163 (defbinding spin-button-set-range () nil
2164 (spin-button spin-button)
2168 (defbinding spin-button-get-range () nil
2169 (spin-button spin-button)
2170 (min double-float :out)
2171 (max double-float :out))
2173 (defun spin-button-value-as-int (spin-button)
2174 (round (spin-button-value spin-button)))
2176 (defbinding %spin-button-spin () nil
2177 (spin-button spin-button)
2178 (direction spin-type)
2179 (increment double-float))
2181 (defun spin-button-spin (spin-button value)
2183 (real (%spin-button-spin spin-button :spin-user-defined value))
2184 (spin-type (%spin-button-spin spin-button value 0))))
2187 (defbinding spin-button-update () nil
2188 (spin-button spin-button))
2194 (defbinding ruler-set-range () nil
2196 (lower single-float)
2197 (upper single-float)
2198 (position single-float)
2199 (max-size single-float))
2201 (defbinding ruler-get-range () nil
2203 (lower single-float :out)
2204 (upper single-float :out)
2205 (position single-float :out)
2206 (max-size single-float :out))
2212 (defun range-lower (range)
2213 (adjustment-lower (range-adjustment range)))
2215 (defun range-upper (range)
2216 (adjustment-upper (range-adjustment range)))
2218 (defun (setf range-lower) (value range)
2219 (setf (adjustment-lower (range-adjustment range)) value))
2221 (defun (setf range-upper) (value range)
2222 (setf (adjustment-upper (range-adjustment range)) value))
2224 (defun range-page-increment (range)
2225 (adjustment-page-increment (range-adjustment range)))
2227 (defun range-step-increment (range)
2228 (adjustment-step-increment (range-adjustment range)))
2230 (defun (setf range-page-increment) (value range)
2231 (setf (adjustment-page-increment (range-adjustment range)) value))
2233 (defun (setf range-step-increment) (value range)
2234 (setf (adjustment-step-increment (range-adjustment range)) value))
2236 (defbinding range-set-range () nil
2238 (lower double-float)
2239 (upper double-float))
2241 (defbinding range-set-increments () nil
2244 (page double-float))
2249 (defbinding scale-get-layout-offsets () nil
2257 (defbinding progress-bar-pulse () nil
2258 (progress-bar progress-bar))
2263 (defmethod initialize-instance ((size-group size-group) &rest initargs
2264 &key widget widgets)
2265 (declare (ignore widget widgets))
2268 (initial-add size-group #'size-group-add-widget
2269 initargs :widget :widgets)))
2272 (defbinding size-group-add-widget () nil
2273 (size-group size-group)
2276 (defbinding size-group-remove-widget () nil
2277 (size-group size-group)
2283 (defbinding %stock-item-copy () pointer
2286 (defbinding %stock-item-free () nil
2289 (defbinding stock-add (stock-item) nil
2290 (stock-item stock-item)
2293 (defbinding stock-list-ids () (gslist string))
2295 (defbinding %stock-lookup () boolean
2299 (defun stock-lookup (stock-id)
2300 (with-memory (stock-item (foreign-size (find-class 'stock-item)))
2301 (when (%stock-lookup stock-id stock-item)
2302 (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item)))))
2304 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
2306 (define-callback-marshal %stock-translate-callback string ((path string)))
2308 (defbinding (stock-set-translate-function "gtk_stock_set_translate_func")
2309 (domain function) nil
2311 (%stock-translate-callback callback)
2312 ((register-callback-function function) unsigned-int)
2313 (user-data-destroy-callback callback)))
2319 (defbinding tooltips-enable () nil
2320 (tooltips tooltips))
2322 (defbinding tooltips-disable () nil
2323 (tooltips tooltips))
2325 (defun (setf tooltips-enabled-p) (enable tooltips)
2327 (tooltips-enable tooltips)
2328 (tooltips-disable tooltips)))
2330 (defbinding tooltips-set-tip () nil
2334 (tip-private string))
2336 (defbinding tooltips-data-get () tooltips-data
2339 (defbinding tooltips-force-window () nil
2340 (tooltips tooltips))
2342 (defbinding tooltips-get-info-from-tip-window () boolean
2344 (tooltips tooltips :out)
2345 (current-widget widget :out))
2350 (defbinding rc-get-style () style
2353 (defbinding rc-get-style-by-paths (&key path class-path class) style
2354 (path (or null string))
2355 (class-path (or null string))
2358 (defbinding rc-parse () nil
2359 (filename pathname))
2361 (defbinding rc-parse-string () nil
2364 (defbinding %rc-reparse-all () boolean)
2366 (defbinding %rc-reparse-all-for-settings () boolean
2368 (force-load-p boolean))
2370 (defun rc-reparse-all (&optional setting force-load-p)
2372 (%rc-reparse-all-for-settings setting force-load-p)
2375 (defbinding rc-reset-styles () nil
2376 (settings settings))
2378 (defbinding rc-add-default-file () nil
2379 (filename pathname))
2381 (defbinding rc-get-default-files ()
2382 (copy-of (null-terminated-vector (copy-of string))))
2384 (defbinding rc-get-module-dir () string)
2386 (defbinding rc-get-im-module-path () string)
2388 (defbinding rc-get-im-module-file () string)
2390 (defbinding rc-get-theme-dir () string)
2395 (defbinding (settings-get "gtk_settings_get_for_screen")
2396 (&optional (screen (gdk:display-get-default-screen))) settings
2397 (screen gdk:screen))
2402 (defbinding socket-add-id () nil
2404 (id gdk:native-window))
2406 (defbinding %plug-new () pointer
2407 (id gdk:native-window))
2409 (defmethod allocate-foreign ((plug plug) &key id)
2410 (%plug-new (or id 0)))