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.63 2006/04/26 13:00:28 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 ;;; Generic functions
112 (defgeneric add-to-radio-group (item1 item2))
113 (defgeneric activate-radio-widget (item))
114 (defgeneric (setf tool-item-tip-text) (tip-text tool-item))
115 (defgeneric (setf tool-item-tip-private) (tip-private tool-item))
121 (defbinding grab-add () nil
124 (defbinding grab-get-current () widget)
126 (defbinding grab-remove () nil
129 (defbinding get-default-language () (copy-of pango:language))
134 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
136 (define-callback-marshal %about-dialog-activate-link-callback nil
137 (about-dialog (link string)))
139 (defbinding about-dialog-set-email-hook (function) nil
140 (%about-dialog-activate-link-callback callback)
141 ((register-callback-function function) unsigned-int)
142 (user-data-destroy-callback callback))
144 (defbinding about-dialog-set-url-hook (function) nil
145 (%about-dialog-activate-link-callback callback)
146 ((register-callback-function function) unsigned-int)
147 (user-data-destroy-callback callback)))
152 (defbinding %accel-group-connect () nil
153 (accel-group accel-group)
155 (modifiers gdk:modifier-type)
159 (defun accel-group-connect (group accelerator function &optional flags)
160 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
161 (let ((gclosure (make-callback-closure function)))
162 (%accel-group-connect group key modifiers flags gclosure)
165 (defbinding accel-group-connect-by-path (group path function) nil
168 ((make-callback-closure function) gclosure :in/return))
170 (defbinding %accel-group-disconnect (group gclosure) boolean
174 (defbinding %accel-group-disconnect-key () boolean
177 (modifiers gdk:modifier-type))
179 (defun accel-group-disconnect (group accelerator)
180 (etypecase accelerator
181 (gclosure (%accel-group-disconnect group accelerator))
183 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
184 (%accel-group-disconnect-key group key modifiers)))))
186 (defbinding %accel-group-query () (copy-of (vector (inlined accel-group-entry) n))
187 (accel-group accel-group)
189 (modifiers gdk:modifier-type)
192 (defun accel-group-query (accel-group accelerator)
193 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
194 (%accel-group-query accel-group key modifiers)))
196 (defbinding %accel-group-activate () boolean
197 (accel-group accel-group)
198 (acceleratable gobject)
200 (modifiers gdk:modifier-type))
202 (defun accel-group-activate (accel-group acceleratable accelerator)
203 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
204 (%accel-group-activate accel-group acceleratable key modifiers)))
206 (defbinding accel-group-lock () nil
207 (accel-group accel-group))
209 (defbinding accel-group-unlock () nil
210 (accel-group accel-group))
212 (defbinding accel-group-from-accel-closure () accel-group
215 (defbinding %accel-groups-activate () boolean
218 (modifiers gdk:modifier-type))
220 (defun accel-groups-activate (object accelerator)
221 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
222 (%accel-groups-activate object key modifiers)))
224 (defbinding accel-groups-from-object () (gslist accel-groups)
227 (defbinding accelerator-valid-p (key &optional modifiers) boolean
229 (modifiers gdk:modifier-type))
231 (defbinding %accelerator-parse () nil
233 (key unsigned-int :out)
234 (modifiers gdk:modifier-type :out))
236 (defgeneric parse-accelerator (accelerator))
238 (defmethod parse-accelerator ((accelerator string))
239 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
241 (error "Invalid accelerator: ~A" accelerator)
242 (values key modifiers))))
244 (defmethod parse-accelerator ((accelerator cons))
245 (destructuring-bind (key modifiers) accelerator
251 (gdk:keyval-from-name key)
252 (error "Invalid key name: ~A" key)))
253 (character (parse-accelerator key)))
256 (defmethod parse-accelerator ((key integer))
259 (defmethod parse-accelerator ((key character))
261 (gdk:keyval-from-name (string key))
262 (error "Invalid key name: ~A" key)))
265 (defbinding accelerator-name () string
267 (modifiers gdk:modifier-type))
269 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
270 (defbinding accelerator-get-label () string
272 (modifiers gdk:modifier-type))
274 (defbinding %accelerator-set-default-mod-mask () nil
275 (default-modifiers gdk:modifier-type))
277 (defun (setf accelerator-default-modifier-mask) (default-modifiers)
278 (%accelerator-set-default-mod-mask default-modifiers))
280 (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
285 (defbinding accel-label-get-accel-width () unsigned-int
286 (accel-label accel-label))
288 (defbinding accel-label-refetch () boolean
289 (accel-label accel-label))
295 (defbinding %accel-map-add-entry () nil
298 (modifiers gdk:modifier-type))
300 (defun accel-map-add-entry (path accelerator)
301 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
302 (%accel-map-add-entry path key modifiers)))
304 (defbinding %accel-map-lookup-entry () boolean
306 ((make-instance 'accel-key) accel-key :in/return))
308 (defun accel-map-lookup-entry (path)
309 (multiple-value-bind (found-p accel-key) (%accel-map-lookup-entry path)
312 (slot-value accel-key 'key)
313 (slot-value accel-key 'modifiers)
314 (slot-value accel-key 'flags)))))
316 (defbinding %accel-map-change-entry () boolean
319 (modifiers gdk:modifier-type)
322 (defun accel-map-change-entry (path accelerator &optional replace)
323 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
324 (%accel-map-change-entry path key modifiers replace)))
326 (defbinding accel-map-load () nil
329 (defbinding accel-map-save () nil
332 (define-callback-marshal %accel-map-foreach-callback nil
333 ((accel-path string) (key unsigned-int)
334 (modifiers gdk:modifier-type) (changed boolean)) :callback-id :first)
336 (defbinding %accel-map-foreach (callback-id) nil
337 (callback-id unsigned-int)
338 (%accel-map-foreach-callback callback))
340 (defbinding %accel-map-foreach-unfiltered (callback-id) nil
341 (callback-id unsigned-int)
342 (%accel-map-foreach-callback callback))
344 (defun accel-map-foreach (function &optional (filter-p t))
345 (with-callback-function (id function)
347 (%accel-map-foreach id)
348 (%accel-map-foreach-unfiltered id))))
350 (defbinding accel-map-add-filter () nil
353 (defbinding accel-map-get () accel-map)
355 (defbinding accel-map-lock-path () nil
358 (defbinding accel-map-unlock-path () nil
365 (defbinding accessible-connect-widget-destroyed () nil
366 (accessible accessible))
371 (defmethod initialize-instance ((adjustment adjustment) &key value)
374 ;; we need to make sure that the value is set last, otherwise it
375 ;; may be outside current limits and ignored
377 (setf (slot-value adjustment 'value) value))))
380 (defbinding adjustment-changed () nil
381 (adjustment adjustment))
383 (defbinding adjustment-value-changed () nil
384 (adjustment adjustment))
386 (defbinding adjustment-clamp-page () nil
387 (adjustment adjustment)
389 (upper single-float))
394 (defbinding alignment-set () nil
395 (alognment alignment)
396 (x-align single-float)
397 (y-align single-float)
398 (x-scale single-float)
399 (y-scale single-float))
401 (defbinding alignment-get-padding () nil
402 (alognment alignment)
403 (top unsigned-int :out)
404 (bottom unsigned-int :out)
405 (left unsigned-int :out)
406 (right unsigned-int :out))
408 (defbinding alignment-set-padding () nil
409 (alognment alignment)
411 (bottom unsigned-int)
413 (right unsigned-int))
421 (defun (setf bin-child) (child bin)
422 (when-bind (current-child (bin-child bin))
423 (container-remove bin current-child))
424 (container-add bin child)
427 (defmethod compute-signal-function ((bin bin) signal function object)
428 (declare (ignore signal))
429 (if (eq object :child)
430 #'(lambda (&rest args)
431 (apply function (bin-child bin) (rest args)))
437 (defbinding box-pack-start () nil
442 (padding unsigned-int))
444 (defbinding box-pack-end () nil
449 (padding unsigned-int))
451 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
453 (box-pack-end box child expand fill padding)
454 (box-pack-start box child expand fill padding)))
456 (defbinding box-reorder-child () nil
461 (defbinding box-query-child-packing () nil
464 (expand boolean :out)
466 (padding unsigned-int :out)
467 (pack-type pack-type :out))
469 (defbinding box-set-child-packing () nil
474 (padding unsigned-int)
475 (pack-type pack-type))
481 (defmethod initialize-instance ((button button) &rest initargs &key stock)
483 (apply #'call-next-method button
484 :label stock :use-stock t :use-underline t initargs)
488 (defbinding button-pressed () nil
491 (defbinding button-released () nil
494 (defbinding button-clicked () nil
497 (defbinding button-enter () nil
500 (defbinding button-leave () nil
507 (defbinding calendar-select-month () int
512 (defbinding calendar-select-day () nil
516 (defbinding calendar-mark-day () int
520 (defbinding calendar-unmark-day () int
524 (defbinding calendar-clear-marks () nil
527 (defbinding calendar-get-date () nil
529 (year unsigned-int :out)
530 (month unsigned-int :out)
531 (day unsigned-int :out))
533 (defbinding calendar-freeze () nil
536 (defbinding calendar-thaw () nil
542 (defbinding check-menu-item-toggled () nil
543 (check-menu-item check-menu-item))
548 (defbinding (color-selection-is-adjusting-p
549 "gtk_color_selection_is_adjusting") () boolean
550 (colorsel color-selection))
554 ;;; Color selection dialog -- no functions
560 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
561 &key model content active)
562 (remf initargs :active)
564 (apply #'call-next-method combo-box initargs)
566 (apply #'call-next-method combo-box
567 :model (make-instance 'list-store :column-types '(string))
569 (unless (typep combo-box 'combo-box-entry)
570 (let ((cell (make-instance 'cell-renderer-text)))
571 (cell-layout-pack combo-box cell :expand t)
572 (cell-layout-add-attribute combo-box cell :text 0)))))
574 (mapc #'(lambda (text)
575 (combo-box-append-text combo-box text))
578 (setf (combo-box-active combo-box) active)))
581 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
583 ;; (signal-emit combo-box 'changed)))
585 (defbinding combo-box-append-text () nil
586 (combo-box combo-box)
589 (defbinding combo-box-insert-text () nil
590 (combo-box combo-box)
594 (defbinding combo-box-prepend-text () nil
595 (combo-box combo-box)
598 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
599 (defbinding combo-box-get-active-text () string
600 (combo-box combo-box))
602 (defbinding combo-box-popup () nil
603 (combo-box combo-box))
605 (defbinding combo-box-popdown () nil
606 (combo-box combo-box))
612 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
615 (setf (combo-box-entry-text-column combo-box-entry) 0)))
620 (defmethod shared-initialize ((dialog dialog) names &rest initargs
622 (declare (ignore names button buttons))
625 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
628 (defun dialog-response-id (dialog response &optional create-p error-p)
629 "Returns a numeric response id"
630 (if (typep response 'response-type)
631 (response-type-to-int response)
632 (let ((responses (user-data dialog 'responses)))
634 ((and responses (position response responses :test #'equal)))
638 (vector-push-extend response responses)
639 (1- (length responses)))
642 (user-data dialog 'responses)
643 (make-array 1 :adjustable t :fill-pointer t
644 :initial-element response))
647 (error "Invalid response: ~A" response))))))
649 (defun dialog-find-response (dialog id)
650 "Finds a symbolic response given a numeric id"
652 (int-to-response-type id)
653 (aref (user-data dialog 'responses) id)))
656 (defmethod compute-signal-id ((dialog dialog) signal)
657 (if (dialog-response-id dialog signal)
658 (ensure-signal-id 'response dialog)
661 (defmethod compute-signal-function ((dialog dialog) signal function object)
662 (declare (ignore function object))
663 (let ((callback (call-next-method))
664 (id (dialog-response-id dialog signal)))
666 #'(lambda (dialog response)
667 (when (= response id)
668 (funcall callback dialog)))
671 (defbinding dialog-run () nil
674 (defbinding dialog-response (dialog response) nil
676 ((dialog-response-id dialog response nil t) int))
679 (defbinding %dialog-add-button () button
684 (defun dialog-add-button (dialog label &optional (response label)
685 &key default object after)
686 "Adds a button to the dialog."
687 (let* ((signal (if (functionp response)
690 (id (dialog-response-id dialog signal t))
691 (button (%dialog-add-button dialog label id)))
692 (when (functionp response)
693 (signal-connect dialog signal response :object object :after after))
695 (%dialog-set-default-response dialog id))
699 (defbinding %dialog-add-action-widget () nil
701 (action-widget widget)
704 (defun dialog-add-action-widget (dialog widget &optional (response widget)
705 &key default object after)
706 (let* ((signal (if (functionp response)
709 (id (dialog-response-id dialog signal t)))
710 (unless (widget-hidden-p widget)
711 (widget-show widget))
712 (%dialog-add-action-widget dialog widget id)
713 (when (functionp response)
714 (signal-connect dialog signal response :object object :after after))
716 (%dialog-set-default-response dialog id))
720 (defbinding %dialog-set-default-response () nil
724 (defun dialog-set-default-response (dialog response)
725 (%dialog-set-default-response
726 dialog (dialog-response-id dialog response nil t)))
728 (defbinding dialog-set-response-sensitive (dialog response sensitive) nil
730 ((dialog-response-id dialog response nil t) int)
733 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
734 (defbinding alternative-dialog-button-order-p (&optional screen) boolean
735 (screen (or null gdk:screen)))
737 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
738 (defbinding (dialog-set-alternative-button-order
739 "gtk_dialog_set_alternative_button_order_from_array")
740 (dialog new-order) nil
742 ((length new-order) int)
743 ((map 'vector #'(lambda (response)
744 (dialog-response-id dialog response nil t))
745 new-order) (vector int)))
748 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
750 (defbinding %dialog-get-response-for-widget () int
754 (defun dialog-get-response-for-widget (dialog widget)
755 (dialog-find-response dialog (dialog-get-response-for-widget dialog widget))))
758 (defmethod container-add ((dialog dialog) (child widget) &rest args)
759 (apply #'container-add (dialog-vbox dialog) child args))
762 (defmethod container-remove ((dialog dialog) (child widget))
763 (container-remove (dialog-vbox dialog) child))
765 (defmethod container-children ((dialog dialog))
766 (container-children (dialog-vbox dialog)))
768 (defmethod (setf container-children) (children (dialog dialog))
769 (setf (container-children (dialog-vbox dialog)) children))
774 (defbinding entry-get-layout-offsets () nil
779 (defbinding entry-layout-index-to-text-index () int
783 (defbinding entry-text-index-to-layout-index () int
790 (define-callback-marshal %entry-completion-match-callback boolean
791 (entry-completion string tree-iter))
793 (defbinding entry-completion-set-match-func (completion function) nil
794 (completion entry-completion)
795 (%entry-completion-match-callback callback)
796 ((register-callback-function function) unsigned-int)
797 (user-data-destroy-callback callback))
799 (defbinding entry-completion-complete () nil
800 (completion entry-completion))
802 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
803 (defbinding entry-completion-insert-prefix () nil
804 (completion entry-completion))
806 (defbinding entry-completion-insert-action-text () nil
807 (completion entry-completion)
811 (defbinding entry-completion-insert-action-markup () nil
812 (completion entry-completion)
816 (defbinding entry-completion-delete-action () nil
817 (completion entry-completion)
823 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
824 &key filter filters shortcut-folder
825 shortcut-folders shortcut-folder-uti
826 shortcut-folder-uris)
827 (declare (ignore filter filters shortcut-folder shortcut-folders
828 shortcut-folder-uti shortcut-folder-uris))
831 (initial-add file-chooser #'file-chooser-add-filter
832 initargs :filer :filters)
833 (initial-add file-chooser #'file-chooser-add-shortcut-folder
834 initargs :shortcut-folder :shortcut-folders)
835 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
836 initargs :shortcut-folder-uri :shortcut-folders-uris)))
839 (defbinding file-chooser-select-filename () boolean
840 (file-chooser file-chooser)
843 (defbinding file-chooser-unselect-filename () nil
844 (file-chooser file-chooser)
847 (defbinding file-chooser-select-all () boolean
848 (file-chooser file-chooser))
850 (defbinding file-chooser-unselect-all () boolean
851 (file-chooser file-chooser))
853 (defbinding file-chooser-get-filenames () (gslist string)
854 (file-chooser file-chooser))
856 (defbinding file-chooser-select-uri () boolean
857 (file-chooser file-chooser)
860 (defbinding file-chooser-unselect-uri () nil
861 (file-chooser file-chooser)
864 (defbinding file-chooser-get-uris () (gslist string)
865 (file-chooser file-chooser))
867 (defbinding file-chooser-add-filter () nil
868 (file-chooser file-chooser)
869 (filter file-filter))
871 (defbinding file-chooser-remove-filter () nil
872 (file-chooser file-chooser)
873 (filter file-filter))
875 (defbinding file-chooser-list-filters () (gslist file-filter)
876 (file-chooser file-chooser))
878 (defbinding file-chooser-add-shortcut-folder () boolean
879 (file-chooser file-chooser)
883 (defbinding file-chooser-remove-shortcut-folder () nil
884 (file-chooser file-chooser)
888 (defbinding file-chooser-list-shortcut-folders () (gslist string)
889 (file-chooser file-chooser))
891 (defbinding file-chooser-add-shortcut-folder-uri () boolean
892 (file-chooser file-chooser)
896 (defbinding file-chooser-remove-shortcut-folder-uri () nil
897 (file-chooser file-chooser)
901 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
902 (file-chooser file-chooser))
907 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
908 &key mime-type mime-types pattern patterns
910 (declare (ignore mime-type mime-types pattern patterns))
914 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
915 (warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
916 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
917 (file-filter-add-pixbuf-formats file-filter))
918 (initial-add file-filter #'file-filter-add-mime-type
919 initargs :mime-type :mime-types)
920 (initial-add file-filter #'file-filter-add-pattern
921 initargs :pattern :patterns)))
924 (defbinding file-filter-add-mime-type () nil
928 (defbinding file-filter-add-pattern () nil
932 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
933 (defbinding file-filter-add-pixbuf-formats () nil
934 (filter file-filter))
936 (define-callback-marshal %file-filter-callback boolean (file-filter-info))
938 (defbinding file-filter-add-custom (filter needed function) nil
940 (needed file-filter-flags)
941 (%file-filter-callback callback)
942 ((register-callback-function function) unsigned-int)
943 (user-data-destroy-callback callback))
945 (defbinding file-filter-get-needed () file-filter-flags
946 (filter file-filter))
948 (defbinding file-filter-filter () boolean
950 (filter-info file-filter-info))
956 (defbinding image-set-from-file () nil
960 (defmethod (setf image-pixmap) ((data vector) (image image))
961 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
962 (setf (image-pixmap image) pixmap)
963 (setf (image-mask image) mask)))
965 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
967 ((typep pixmap 'vector)
968 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
969 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
973 (image-set-from-file image file)))
974 ((call-next-method))))
976 (defun create-image-widget (source &optional mask)
978 (gdk:pixbuf (make-instance 'image :pixbuf source))
979 (string (make-instance 'image :stock source))
980 (pathname (make-instance 'image :file source))
981 ((or list vector) (make-instance 'image :pixmap source))
982 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
984 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
985 (defbinding image-clear () nil
992 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
993 (if (and image (not (typep image 'widget)))
994 (apply #'call-next-method item :image (create-image-widget image) initargs)
998 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
999 (setf (slot-value item 'image) widget))
1001 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
1002 (setf (image-menu-item-image item) (create-image-widget image)))
1007 (defmethod shared-initialize ((label label) names &key pattern)
1008 (declare (ignore names))
1011 (setf (label-pattern label) pattern)))
1013 (defbinding label-get-layout-offsets () nil
1018 (defbinding label-select-region () nil
1023 (defbinding label-get-selection-bounds () boolean
1032 (defbinding %radio-button-get-group () pointer
1033 (radio-button radio-button))
1035 (defbinding %radio-button-set-group () nil
1036 (radio-button radio-button)
1039 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
1040 "Add BUTTON1 to the group which BUTTON2 belongs to."
1041 (%radio-button-set-group button1 (%radio-button-get-group button2)))
1043 (defun %add-activate-callback (widget signal function object after)
1045 (signal-connect widget signal
1047 (when (slot-value widget 'active)
1048 (funcall function object (slot-value widget 'value))))
1049 :object object :after after)
1050 (signal-connect widget signal
1052 (when (slot-value widget 'active)
1053 (funcall function (slot-value widget 'value))))
1056 (defmethod activate-radio-widget ((button radio-button))
1057 (signal-emit button 'clicked))
1059 (defmethod add-activate-callback ((button radio-button) function &key object after)
1060 (%add-activate-callback button 'clicked function object after))
1062 (defmethod initialize-instance ((button radio-button) &key group)
1066 (add-to-radio-group button group))))
1071 (defbinding item-select () nil
1074 (defbinding item-deselect () nil
1077 (defbinding item-toggle () nil
1084 (defmethod initialize-instance ((item menu-item) &key label)
1088 (setf (menu-item-label item) label))))
1091 (defun (setf menu-item-label) (label menu-item)
1092 (make-instance 'accel-label
1093 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
1094 :use-underline (menu-item-use-underline-p menu-item)
1095 :visible t :parent menu-item)
1098 (defun menu-item-label (menu-item)
1099 (when (and (slot-boundp menu-item 'child)
1100 (typep (bin-child menu-item) 'label))
1101 (label-label (bin-child menu-item))))
1103 (defbinding menu-item-remove-submenu () nil
1104 (menu-item menu-item))
1106 (defbinding menu-item-set-accel-path () nil
1107 (menu-item menu-item)
1108 (accel-path string))
1110 (defbinding menu-item-select () nil
1111 (menu-item menu-item))
1113 (defbinding menu-item-deselect () nil
1114 (menu-item menu-item))
1116 (defbinding menu-item-activate () nil
1117 (menu-item menu-item))
1119 (defbinding menu-item-toggle-size-request () nil
1120 (menu-item menu-item)
1121 (requisition int :out))
1123 (defbinding menu-item-toggle-size-allocate () nil
1124 (menu-item menu-item)
1128 ;;; Menu tool button
1130 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1131 (defbinding menu-tool-button-set-arrow-tooltip () nil
1132 (menu-tool-button menu-tool-button)
1135 (tip-private string))
1140 (defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
1141 (buttons :close) flags transient-parent)
1142 (%message-dialog-new transient-parent flags message-type buttons))
1145 (defmethod shared-initialize ((dialog message-dialog) names &key text
1146 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1148 (declare (ignore names))
1150 (message-dialog-set-markup dialog text))
1151 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1152 (when secondary-text
1153 (message-dialog-format-secondary-markup dialog secondary-text))
1157 (defbinding %message-dialog-new () pointer
1158 (parent (or null window))
1159 (flags dialog-flags)
1161 (buttons buttons-type)
1164 (defbinding message-dialog-set-markup () nil
1165 (message-dialog message-dialog)
1168 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1169 (defbinding message-dialog-format-secondary-text () nil
1170 (message-dialog message-dialog)
1173 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1174 (defbinding message-dialog-format-secondary-markup () nil
1175 (message-dialog message-dialog)
1182 (defbinding %radio-menu-item-get-group () pointer
1183 (radio-menu-item radio-menu-item))
1185 (defbinding %radio-menu-item-set-group () nil
1186 (radio-menu-item radio-menu-item)
1189 (defmethod activate-radio-widget ((item radio-menu-item))
1190 (menu-item-activate item))
1192 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
1193 "Add ITEM1 to the group which ITEM2 belongs to."
1194 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1196 (defmethod add-activate-callback ((item radio-menu-item) function &key object after)
1197 (%add-activate-callback item 'activate function object after))
1199 (defmethod initialize-instance ((item radio-menu-item) &key group)
1203 (add-to-radio-group item group))))
1207 ;;; Radio tool button
1209 (defbinding %radio-tool-button-get-group () pointer
1210 (radio-tool-button radio-tool-button))
1212 (defbinding %radio-tool-button-set-group () nil
1213 (radio-tool-button radio-tool-button)
1216 (defmethod activate-radio-widget ((button radio-tool-button))
1217 (signal-emit button 'clicked))
1219 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
1220 "Add BUTTON1 to the group which BUTTON2 belongs to."
1221 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1222 (defmethod add-activate-callback ((button radio-tool-button) function &key object after)
1223 (%add-activate-callback button 'clicked function object after))
1225 (defmethod initialize-instance ((button radio-tool-button) &key group)
1229 (add-to-radio-group button group))))
1235 (defbinding toggle-button-toggled () nil
1236 (toggle-button toggle-button))
1241 (defmethod initialize-instance ((window window) &rest initargs
1242 &key accel-group accel-groups)
1243 (declare (ignore accel-group accel-groups))
1246 (initial-add window #'window-add-accel-group
1247 initargs :accel-group :accel-groups)))
1249 #-debug-ref-counting
1250 (defmethod print-object ((window window) stream)
1252 (proxy-valid-p window)
1253 (slot-boundp window 'title)
1254 (not (zerop (length (window-title window)))))
1255 (print-unreadable-object (window stream :type t :identity nil)
1256 (format stream "~S at 0x~X"
1257 (window-title window) (pointer-address (foreign-location window))))
1258 (call-next-method)))
1260 (defbinding window-set-wmclass () nil
1262 (wmclass-name string)
1263 (wmclass-class string))
1265 (defbinding window-add-accel-group () nil
1267 (accel-group accel-group))
1269 (defbinding window-remove-accel-group () nil
1271 (accel-group accel-group))
1273 (defbinding window-activate-focus () int
1276 (defbinding window-activate-default () int
1279 (defbinding window-set-default-size (window width height) int
1282 ((or height -1) int))
1284 (defbinding %window-set-geometry-hints () nil
1286 (geometry gdk:geometry)
1287 (geometry-mask gdk:window-hints))
1289 (defun window-set-geometry-hints (window &key min-width min-height
1290 max-width max-height base-width base-height
1291 width-inc height-inc min-aspect max-aspect
1292 (gravity nil gravity-p) min-size max-size)
1293 (let ((geometry (make-instance 'gdk:geometry
1294 :min-width (or min-width -1)
1295 :min-height (or min-height -1)
1296 :max-width (or max-width -1)
1297 :max-height (or max-height -1)
1298 :base-width (or base-width 0)
1299 :base-height (or base-height 0)
1300 :width-inc (or width-inc 0)
1301 :height-inc (or height-inc 0)
1302 :min-aspect (or min-aspect 0)
1303 :max-aspect (or max-aspect 0)
1306 (when (or min-size min-width min-height)
1307 (push :min-size mask))
1308 (when (or max-size max-width max-height)
1309 (push :max-size mask))
1310 (when (or base-width base-height)
1311 (push :base-size mask))
1312 (when (or width-inc height-inc)
1313 (push :resize-inc mask))
1314 (when (or min-aspect max-aspect)
1315 (push :aspect mask))
1317 (push :win-gravity mask))
1318 (%window-set-geometry-hints window geometry mask)))
1320 (defbinding window-list-toplevels () (glist (copy-of window))
1321 "Returns a list of all existing toplevel windows.")
1323 (defbinding window-add-mnemonic (window key target) nil
1325 ((gdk:keyval-from-name key) unsigned-int)
1328 (defbinding window-remove-mnemonic (window key target) nil
1330 ((gdk:keyval-from-name key) unsigned-int)
1333 (defbinding window-mnemonic-activate (window key modifier) nil
1335 ((gdk:keyval-from-name key) unsigned-int)
1336 (modifier gdk:modifier-type))
1338 (defbinding window-activate-key () boolean
1340 (event gdk:key-event))
1342 (defbinding window-propagate-key-event () boolean
1344 (event gdk:key-event))
1346 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1347 (defbinding window-present () nil
1350 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1352 (defbinding %window-present () nil
1355 (defbinding %window-present-with-time () nil
1357 (timespamp unsigned-int))
1359 (defun window-present (window &optional timestamp)
1361 (%window-present-with-time window timestamp)
1362 (%window-present window))))
1364 (defbinding window-iconify () nil
1367 (defbinding window-deiconify () nil
1370 (defbinding window-stick () nil
1373 (defbinding window-unstick () nil
1376 (defbinding window-maximize () nil
1379 (defbinding window-unmaximize () nil
1382 (defbinding window-fullscreen () nil
1385 (defbinding window-unfullscreen () nil
1388 (defbinding window-set-keep-above () nil
1392 (defbinding window-set-keep-below () nil
1396 (defbinding window-begin-resize-drag () nil
1398 (edge gdk:window-edge)
1400 (root-x int) (root-y int)
1401 (timestamp unsigned-int))
1403 (defbinding window-begin-move-drag () nil
1405 (edge gdk:window-edge)
1407 (root-x int) (root-y int)
1408 (timestamp unsigned-int))
1410 (defbinding window-set-frame-dimensions () nil
1412 (left int) (top int) (rigth int) (bottom int))
1414 (defbinding %window-get-default-size () nil
1419 (defun window-get-default-size (window)
1420 (multiple-value-bind (width height) (%window-get-default-size window)
1421 (values (unless (= width -1) width) (unless (= height -1) height))))
1423 (defbinding window-get-frame-dimensions () nil
1425 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1427 (defbinding %window-get-icon-list () (glist (copy-of gdk:pixbuf))
1430 (defbinding window-get-position () nil
1435 (defbinding window-get-size () nil
1440 (defbinding window-move () nil
1445 (defbinding window-parse-geometry () boolean
1449 (defbinding window-reshow-with-initial-size () nil
1452 (defbinding window-resize () nil
1457 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1458 () (glist gdk:pixbuf))
1460 (defun window-default-icon ()
1461 (first (window-default-icon-list)))
1463 (defbinding %window-set-default-icon-list () nil
1464 (icons (glist gdk:pixbuf)))
1466 (defun (setf window-default-icon-list) (icons)
1467 (%window-set-default-icon-list icons)
1470 (defbinding %window-set-default-icon () nil
1471 (icons (glist gdk:pixbuf)))
1473 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1474 (%window-set-default-icon icon)
1477 (defmethod (setf window-group) ((group window-group) (window window))
1478 (window-group-add-window group window)
1481 (defbinding %window-set-default-icon-from-file () boolean
1485 (defmethod (setf window-default-icon) ((icon-file pathname))
1486 (%window-set-default-icon-from-file icon-file)
1489 (defbinding %window-set-icon-from-file () boolean
1494 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1495 (%window-set-icon-from-file window icon-file)
1498 (defbinding window-set-auto-startup-notification () nil
1501 (defbinding decorated-window-init () nil
1504 (defbinding decorated-window-calculate-frame-size () nil
1507 (defbinding decorated-window-set-title () nil
1511 (defbinding decorated-window-move-resize-window () nil
1521 (defmethod initialize-instance ((window-group window-group) &rest initargs
1522 &key window windows)
1523 (declare (ignore window windows))
1526 (initial-add window-group #'window-group-add-window
1527 initargs :window :windows)))
1530 (defbinding window-group-add-window () nil
1531 (window-group window-group)
1534 (defbinding window-group-remove-window () nil
1535 (window-group window-group)
1541 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1542 (setf (scrolled-window-hscrollbar-policy window) policy)
1543 (setf (scrolled-window-vscrollbar-policy window) policy))
1545 (defbinding scrolled-window-add-with-viewport () nil
1546 (scrolled-window scrolled-window)
1549 (defmethod shared-initialize ((window scrolled-window) names &key policy)
1550 (declare (ignore names))
1552 (setf (slot-value window 'hscrollbar-policy) policy)
1553 (setf (slot-value window 'vscrollbar-policy) policy))
1559 (defbinding statusbar-get-context-id () unsigned-int
1560 (statusbar statusbar)
1561 (context-description string))
1563 (defbinding statusbar-push () unsigned-int
1564 (statusbar statusbar)
1565 (context-id unsigned-int)
1568 (defbinding statusbar-pop () nil
1569 (statusbar statusbar)
1570 (context-id unsigned-int))
1572 (defbinding statusbar-remove () nil
1573 (statusbar statusbar)
1574 (context-id unsigned-int)
1575 (message-id unsigned-int))
1581 (defbinding fixed-put () nil
1586 (defbinding fixed-move () nil
1595 (defun %ensure-notebook-position (notebook page)
1598 (widget (notebook-page-num notebook page t))))
1600 (defun %ensure-notebook-child (notebook position)
1603 (t (notebook-get-nth-page notebook position))))
1605 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1606 (notebook position child &optional tab-label menu-label) nil
1609 ((if (stringp tab-label)
1610 (make-instance 'label :label tab-label)
1611 tab-label) (or null widget))
1612 ((if (stringp menu-label)
1613 (make-instance 'label :label menu-label)
1614 menu-label) (or null widget))
1615 ((%ensure-notebook-position notebook position) position))
1617 (defun notebook-append (notebook child &optional tab-label menu-label)
1618 (notebook-insert notebook :last child tab-label menu-label))
1620 (defun notebook-prepend (notebook child &optional tab-label menu-label)
1621 (notebook-insert notebook :first child tab-label menu-label))
1623 (defbinding notebook-remove-page (notebook page) nil
1625 ((%ensure-notebook-position notebook page) position))
1627 (defbinding %notebook-page-num () int
1631 (defun notebook-page-num (notebook child &optional error-p)
1632 (let ((page-num (%notebook-page-num notebook child)))
1635 (error "~A is not a page in ~A" child notebook))
1638 (defbinding notebook-next-page () nil
1639 (notebook notebook))
1641 (defbinding notebook-prev-page () nil
1642 (notebook notebook))
1644 (defbinding notebook-reorder-child (notebook child position) nil
1647 ((%ensure-notebook-position notebook position) int))
1649 (defbinding notebook-popup-enable () nil
1650 (notebook notebook))
1652 (defbinding notebook-popup-disable () nil
1653 (notebook notebook))
1655 (defbinding notebook-get-nth-page () widget
1659 (defun %notebook-current-page (notebook)
1660 (when (slot-boundp notebook 'current-page-num)
1661 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1663 (defun (setf notebook-current-page) (page notebook)
1664 (setf (notebook-current-page-num notebook) (notebook-page-num notebook page)))
1666 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1667 (notebook page) widget
1669 ((%ensure-notebook-child notebook page) widget))
1671 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1672 (notebook page) (copy-of string)
1674 ((%ensure-notebook-child notebook page) widget))
1676 (defbinding %notebook-set-tab-label () nil
1681 (defun (setf notebook-tab-label) (tab-label notebook page)
1682 (let ((widget (if (stringp tab-label)
1683 (make-instance 'label :label tab-label)
1685 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1689 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1690 (notebook page) widget
1692 ((%ensure-notebook-child notebook page) widget))
1694 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1695 (notebook page) (copy-of string)
1697 ((%ensure-notebook-child notebook page) widget))
1699 (defbinding %notebook-set-menu-label () nil
1702 (menu-label widget))
1704 (defun (setf notebook-menu-label) (menu-label notebook page)
1705 (let ((widget (if (stringp menu-label)
1706 (make-instance 'label :label menu-label)
1708 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1712 (defbinding notebook-query-tab-label-packing (notebook page) nil
1714 ((%ensure-notebook-child notebook page) widget)
1715 (expand boolean :out)
1717 (pack-type pack-type :out))
1719 (defbinding notebook-set-tab-label-packing
1720 (notebook page expand fill pack-type) nil
1722 ((%ensure-notebook-child notebook page) widget)
1725 (pack-type pack-type))
1731 (defbinding paned-pack1 () nil
1737 (defbinding paned-pack2 () nil
1746 (defbinding layout-put () nil
1752 (defbinding layout-move () nil
1758 (defbinding layout-set-size () nil
1760 (width unsigned-int)
1761 (height unsigned-int))
1763 (defbinding layout-get-size () nil
1765 (width unsigned-int :out)
1766 (height unsigned-int :out))
1771 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1772 (menu-shell menu-shell)
1773 (menu-item menu-item)
1779 (defun menu-shell-append (menu-shell menu-item)
1780 (menu-shell-insert menu-shell menu-item :last))
1782 (defun menu-shell-prepend (menu-shell menu-item)
1783 (menu-shell-insert menu-shell menu-item :fisrt))
1785 (defbinding menu-shell-deactivate () nil
1786 (menu-shell menu-shell))
1788 (defbinding menu-shell-select-item () nil
1789 (menu-shell menu-shell)
1790 (menu-item menu-item))
1792 (defbinding menu-shell-select-first () nil
1793 (menu-shell menu-shell)
1794 (search-sensitive boolean))
1796 (defbinding menu-shell-deselect () nil
1797 (menu-shell menu-shell))
1799 (defbinding menu-shell-activate-item () nil
1800 (menu-shell menu-shell)
1801 (menu-item menu-item)
1802 (fore-deactivate boolean))
1804 (defbinding menu-shell-cancel () nil
1805 (menu-shell menu-shell))
1810 (defun %menu-position (menu child)
1813 (keyword (case child
1816 (t (error "Invalid position keyword: ~A" child))))
1817 (widget (menu-child-position menu child))))
1820 (defbinding menu-reorder-child (menu menu-item position) nil
1822 (menu-item menu-item)
1823 ((%menu-position menu position) int))
1825 (defbinding menu-attach () nil
1827 (menu-item menu-item)
1828 (left-attach unsigned-int)
1829 (right-attach unsigned-int)
1830 (top-attach unsigned-int)
1831 (bottom-attach unsigned-int))
1833 (define-callback-marshal %menu-position-callback nil
1834 (menu (x int) (y int) (push-in boolean)))
1836 (defbinding %menu-popup () nil
1838 (parent-menu-shell (or null menu-shell))
1839 (parent-menu-item (or null menu-item))
1840 (callback (or null callback))
1841 (callback-id unsigned-int)
1842 (button unsigned-int)
1843 (activate-time (unsigned 32)))
1845 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1848 (with-callback-function (id callback)
1850 menu parent-menu-shell parent-menu-item
1851 %menu-position-callback id button activate-time))
1853 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1855 (defbinding menu-set-accel-path () nil
1857 (accel-path string))
1859 (defbinding menu-reposition () nil
1862 (defbinding menu-popdown () nil
1865 (defun menu-child-position (menu child)
1866 (position child (container-children menu)))
1868 (defun menu-active-num (menu)
1869 (menu-child-position menu (menu-active menu)))
1871 (defbinding %menu-set-active () nil
1873 (index unsigned-int))
1875 (defun (setf menu-active) (menu child)
1876 (%menu-set-active menu (%menu-position menu child))
1879 (define-callback %menu-detach-callback nil ((widget widget) (menu menu))
1880 (funcall (user-data menu 'detach-func) widget menu))
1882 (defbinding %menu-attach-to-widget (menu widget) nil
1885 (%menu-detach-callback callback))
1887 (defun menu-attach-to-widget (menu widget function)
1888 (setf (user-data menu 'detach-func) function)
1889 (%menu-attach-to-widget menu widget))
1891 (defbinding menu-detach () nil
1894 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1895 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1898 (defbinding menu-set-monitor () nil
1905 (defbinding table-resize () nil
1908 (columns unsigned-int))
1910 (defbinding table-attach (table child left right top bottom
1911 &key options x-options y-options
1912 (x-padding 0) (y-padding 0)) nil
1916 (right unsigned-int)
1918 (bottom unsigned-int)
1919 ((append (mklist options) (mklist x-options)) attach-options)
1920 ((append (mklist options) (mklist y-options)) attach-options)
1921 (x-padding unsigned-int)
1922 (y-padding unsigned-int))
1925 (defbinding %table-set-row-spacing () nil
1928 (spacing unsigned-int))
1930 (defbinding %table-set-row-spacings () nil
1932 (spacing unsigned-int))
1934 (defun (setf table-row-spacing) (spacing table &optional row)
1936 (%table-set-row-spacing table row spacing)
1937 (%table-set-row-spacings table spacing))
1940 (defbinding %table-get-row-spacing () unsigned-int
1944 (defbinding %table-get-default-row-spacing () unsigned-int
1947 (defun table-row-spacing (table &optional row)
1949 (%table-get-row-spacing table row)
1950 (%table-get-default-row-spacing table)))
1953 (defbinding %table-set-col-spacing () nil
1956 (spacing unsigned-int))
1958 (defbinding %table-set-col-spacings () nil
1960 (spacing unsigned-int))
1962 (defun (setf table-col-spacing) (spacing table &optional col)
1964 (%table-set-col-spacing table col spacing)
1965 (%table-set-col-spacings table spacing))
1968 (defbinding %table-get-col-spacing () unsigned-int
1972 (defbinding %table-get-default-col-spacing () unsigned-int
1975 (defun table-col-spacing (table &optional col)
1977 (%table-get-col-spacing table col)
1978 (%table-get-default-col-spacing table)))
1984 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1986 (apply #'call-next-method toolbar
1987 :tooltips (make-instance 'tooltips) initargs)
1988 (call-next-method)))
1990 (defbinding %toolbar-insert () nil
1992 (tool-item tool-item)
1993 (position position))
1995 (defun toolbar-insert (toolbar tool-item &optional (position :end))
1996 (%toolbar-insert toolbar tool-item position)
1997 (%tool-item-update-tooltips tool-item))
1999 (defbinding toolbar-get-item-index () int
2003 (defbinding toolbar-get-nth-item () tool-item
2007 (defbinding toolbar-get-drop-index () int
2011 (defbinding toolbar-set-drop-highlight-item () nil
2013 (tool-item tool-item)
2019 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
2020 (if (and icon (not (typep icon 'widget)))
2021 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
2022 (call-next-method)))
2027 (defbinding tool-item-set-tooltip () nil
2028 (tool-item tool-item)
2031 (tip-private string))
2034 (defun %tool-item-update-tooltips (tool-item)
2036 (slot-boundp tool-item 'parent)
2038 (user-data-p tool-item 'tip-text)
2039 (user-data-p tool-item 'tip-private)))
2040 (tool-item-set-tooltip
2041 tool-item (toolbar-tooltips (widget-parent tool-item))
2042 (or (user-data tool-item 'tip-text) "")
2043 (or (user-data tool-item 'tip-private) ""))))
2045 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
2046 (setf (user-data tool-item 'tip-text) tip-text)
2047 (%tool-item-update-tooltips tool-item)
2050 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
2051 (setf (user-data tool-item 'tip-private) tip-private)
2052 (%tool-item-update-tooltips tool-item)
2055 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
2056 (declare (ignore args))
2059 (%tool-item-update-tooltips tool-item)))
2062 (defbinding tool-item-retrieve-proxy-menu-item () widget
2063 (tool-item tool-item))
2065 (defbinding (tool-item-proxy-menu-item
2066 "gtk_tool_item_get_proxy_menu_item") () menu-item
2067 (tool-item tool-item)
2068 (menu-item-id string))
2070 (defbinding %tool-item-set-proxy-menu-item () nil
2071 (tool-item tool-item)
2072 (menu-item-id string)
2073 (menu-item menu-item))
2075 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
2076 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
2079 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
2080 (defbinding tool-item-rebuild-menu () nil
2081 (tool-item tool-item))
2086 (defbinding editable-select-region (editable &optional (start 0) end) nil
2091 (defbinding editable-get-selection-bounds (editable) nil
2096 (defbinding editable-insert-text (editable text &optional (position 0)) nil
2100 (position position :in/out))
2102 (defun editable-append-text (editable text)
2103 (editable-insert-text editable text nil))
2105 (defun editable-prepend-text (editable text)
2106 (editable-insert-text editable text 0))
2108 (defbinding editable-delete-text (editable &optional (start 0) end) nil
2113 (defbinding (editable-text "gtk_editable_get_chars")
2114 (editable &optional (start 0) end) string
2119 (defun (setf editable-text) (text editable)
2121 (editable-delete-text
2123 (editable-insert-text editable text))
2124 (editable-delete-text editable))
2127 (defbinding editable-cut-clipboard () nil
2128 (editable editable))
2130 (defbinding editable-copy-clipboard () nil
2131 (editable editable))
2133 (defbinding editable-paste-clipboard () nil
2134 (editable editable))
2136 (defbinding editable-delete-selection () nil
2137 (editable editable))
2143 (defbinding spin-button-configure () nil
2144 (spin-button spin-button)
2145 (adjustment adjustment)
2146 (climb-rate double-float)
2147 (digits unsigned-int))
2149 (defbinding spin-button-set-range () nil
2150 (spin-button spin-button)
2154 (defbinding spin-button-get-range () nil
2155 (spin-button spin-button)
2156 (min double-float :out)
2157 (max double-float :out))
2159 (defun spin-button-value-as-int (spin-button)
2160 (round (spin-button-value spin-button)))
2162 (defbinding %spin-button-spin () nil
2163 (spin-button spin-button)
2164 (direction spin-type)
2165 (increment double-float))
2167 (defun spin-button-spin (spin-button value)
2169 (real (%spin-button-spin spin-button :spin-user-defined value))
2170 (spin-type (%spin-button-spin spin-button value 0))))
2173 (defbinding spin-button-update () nil
2174 (spin-button spin-button))
2180 (defbinding ruler-set-range () nil
2182 (lower single-float)
2183 (upper single-float)
2184 (position single-float)
2185 (max-size single-float))
2187 (defbinding ruler-get-range () nil
2189 (lower single-float :out)
2190 (upper single-float :out)
2191 (position single-float :out)
2192 (max-size single-float :out))
2198 (defun range-lower (range)
2199 (adjustment-lower (range-adjustment range)))
2201 (defun range-upper (range)
2202 (adjustment-upper (range-adjustment range)))
2204 (defun (setf range-lower) (value range)
2205 (setf (adjustment-lower (range-adjustment range)) value))
2207 (defun (setf range-upper) (value range)
2208 (setf (adjustment-upper (range-adjustment range)) value))
2210 (defun range-page-increment (range)
2211 (adjustment-page-increment (range-adjustment range)))
2213 (defun range-step-increment (range)
2214 (adjustment-step-increment (range-adjustment range)))
2216 (defun (setf range-page-increment) (value range)
2217 (setf (adjustment-page-increment (range-adjustment range)) value))
2219 (defun (setf range-step-increment) (value range)
2220 (setf (adjustment-step-increment (range-adjustment range)) value))
2222 (defbinding range-set-range () nil
2224 (lower double-float)
2225 (upper double-float))
2227 (defbinding range-set-increments () nil
2230 (page double-float))
2235 (defbinding scale-get-layout-offsets () nil
2243 (defbinding progress-bar-pulse () nil
2244 (progress-bar progress-bar))
2249 (defmethod initialize-instance ((size-group size-group) &rest initargs
2250 &key widget widgets)
2251 (declare (ignore widget widgets))
2254 (initial-add size-group #'size-group-add-widget
2255 initargs :widget :widgets)))
2258 (defbinding size-group-add-widget () nil
2259 (size-group size-group)
2262 (defbinding size-group-remove-widget () nil
2263 (size-group size-group)
2269 (defbinding %stock-item-copy () pointer
2272 (defbinding %stock-item-free () nil
2275 (defbinding stock-add (stock-item) nil
2276 (stock-item stock-item)
2279 (defbinding stock-list-ids () (gslist string))
2281 (defbinding %stock-lookup () boolean
2285 (defun stock-lookup (stock-id)
2286 (with-memory (stock-item (foreign-size (find-class 'stock-item)))
2287 (when (%stock-lookup stock-id stock-item)
2288 (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item)))))
2290 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
2292 (define-callback-marshal %stock-translate-callback string ((path string)))
2294 (defbinding (stock-set-translate-function "gtk_stock_set_translate_func")
2295 (domain function) nil
2297 (%stock-translate-callback callback)
2298 ((register-callback-function function) unsigned-int)
2299 (user-data-destroy-callback callback)))
2305 (defbinding tooltips-enable () nil
2306 (tooltips tooltips))
2308 (defbinding tooltips-disable () nil
2309 (tooltips tooltips))
2311 (defun (setf tooltips-enabled-p) (enable tooltips)
2313 (tooltips-enable tooltips)
2314 (tooltips-disable tooltips)))
2316 (defbinding tooltips-set-tip () nil
2320 (tip-private string))
2322 (defbinding tooltips-data-get () tooltips-data
2325 (defbinding tooltips-force-window () nil
2326 (tooltips tooltips))
2328 (defbinding tooltips-get-info-from-tip-window () boolean
2330 (tooltips tooltips :out)
2331 (current-widget widget :out))
2336 (defbinding rc-get-style () style
2339 (defbinding rc-get-style-by-paths (&key path class-path class) style
2340 (path (or null string))
2341 (class-path (or null string))
2344 (defbinding rc-parse () nil
2345 (filename pathname))
2347 (defbinding rc-parse-string () nil
2350 (defbinding %rc-reparse-all () boolean)
2352 (defbinding %rc-reparse-all-for-settings () boolean
2354 (force-load-p boolean))
2356 (defun rc-reparse-all (&optional setting force-load-p)
2358 (%rc-reparse-all-for-settings setting force-load-p)
2361 (defbinding rc-reset-styles () nil
2362 (settings settings))
2364 (defbinding rc-add-default-file () nil
2365 (filename pathname))
2367 (defbinding rc-get-default-files ()
2368 (copy-of (null-terminated-vector (copy-of string))))
2370 (defbinding rc-get-module-dir () string)
2372 (defbinding rc-get-im-module-path () string)
2374 (defbinding rc-get-im-module-file () string)
2376 (defbinding rc-get-theme-dir () string)
2381 (defbinding (settings-get "gtk_settings_get_for_screen")
2382 (&optional (screen (gdk:display-get-default-screen))) settings
2383 (screen gdk:screen))
2388 (defbinding socket-add-id () nil
2390 (id gdk:native-window))
2392 (defbinding %plug-new () pointer
2393 (id gdk:native-window))
2395 (defmethod allocate-foreign ((plug plug) &key id)
2396 (%plug-new (or id 0)))