1 ;; Common Lisp bindings for GTK+ v2.x
2 ;; Copyright 1999-2005 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.59 2006-02-28 16:29:45 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 (defun clg-init (&optional display)
59 "Initializes the system and starts the event handling"
61 (find-package "SWANK")
62 (eq (symbol-value (find-symbol "*COMMUNICATION-STYLE*" "SWANK")) :spawn))
63 (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."))
65 (unless (gdk:display-get-default)
68 (error "Initialization of GTK+ failed."))
70 (gdk:display-open display)
71 (add-fd-handler (gdk:display-connection-number) :input #'main-iterate-all)
72 (setq *periodic-polling-function* #'main-iterate-all)
73 (setq *max-event-to-sec* 0)
74 (setq *max-event-to-usec* 1000))))
78 (defgeneric add-to-radio-group (item1 item2))
79 (defgeneric activate-radio-widget (item))
80 (defgeneric (setf tool-item-tip-text) (tip-text tool-item))
81 (defgeneric (setf tool-item-tip-private) (tip-private tool-item))
87 (defbinding grab-add () nil
90 (defbinding grab-get-current () widget)
92 (defbinding grab-remove () nil
95 (defbinding get-default-language () (copy-of pango:language))
102 (define-callback-marshal %about-dialog-activate-link-callback nil
103 (about-dialog (link string)))
105 (defbinding about-dialog-set-email-hook (function) nil
106 (%about-dialog-activate-link-callback callback)
107 ((register-callback-function function) unsigned-int)
108 (user-data-destroy-callback callback))
110 (defbinding about-dialog-set-url-hook (function) nil
111 (%about-dialog-activate-link-callback callback)
112 ((register-callback-function function) unsigned-int)
113 (user-data-destroy-callback callback)))
118 (defbinding %accel-group-connect () nil
119 (accel-group accel-group)
121 (modifiers gdk:modifier-type)
125 (defun accel-group-connect (group accelerator function &optional flags)
126 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
127 (let ((gclosure (make-callback-closure function)))
128 (%accel-group-connect group key modifiers flags gclosure)
131 (defbinding accel-group-connect-by-path (group path function) nil
134 ((make-callback-closure function) gclosure :return))
136 (defbinding %accel-group-disconnect (group gclosure) boolean
140 (defbinding %accel-group-disconnect-key () boolean
143 (modifiers gdk:modifier-type))
145 (defun accel-group-disconnect (group accelerator)
146 (etypecase accelerator
147 (gclosure (%accel-group-disconnect group accelerator))
149 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
150 (%accel-group-disconnect-key group key modifiers)))))
152 (defbinding %accel-group-query () (copy-of (vector (inlined accel-group-entry) n))
153 (accel-group accel-group)
155 (modifiers gdk:modifier-type)
158 (defun accel-group-query (accel-group accelerator)
159 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
160 (%accel-group-query accel-group key modifiers)))
162 (defbinding %accel-group-activate () boolean
163 (accel-group accel-group)
164 (acceleratable gobject)
166 (modifiers gdk:modifier-type))
168 (defun accel-group-activate (accel-group acceleratable accelerator)
169 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
170 (%accel-group-activate accel-group acceleratable key modifiers)))
172 (defbinding accel-group-lock () nil
173 (accel-group accel-group))
175 (defbinding accel-group-unlock () nil
176 (accel-group accel-group))
178 (defbinding accel-group-from-accel-closure () accel-group
181 (defbinding %accel-groups-activate () boolean
184 (modifiers gdk:modifier-type))
186 (defun accel-groups-activate (object accelerator)
187 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
188 (%accel-groups-activate object key modifiers)))
190 (defbinding accel-groups-from-object () (gslist accel-groups)
193 (defbinding accelerator-valid-p (key &optional modifiers) boolean
195 (modifiers gdk:modifier-type))
197 (defbinding %accelerator-parse () nil
199 (key unsigned-int :out)
200 (modifiers gdk:modifier-type :out))
202 (defgeneric parse-accelerator (accelerator))
204 (defmethod parse-accelerator ((accelerator string))
205 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
207 (error "Invalid accelerator: ~A" accelerator)
208 (values key modifiers))))
210 (defmethod parse-accelerator ((accelerator cons))
211 (destructuring-bind (key modifiers) accelerator
217 (gdk:keyval-from-name key)
218 (error "Invalid key name: ~A" key)))
219 (character (parse-accelerator key)))
222 (defmethod parse-accelerator ((key integer))
225 (defmethod parse-accelerator ((key character))
227 (gdk:keyval-from-name (string key))
228 (error "Invalid key name: ~A" key)))
231 (defbinding accelerator-name () string
233 (modifiers gdk:modifier-type))
236 (defbinding accelerator-get-label () string
238 (modifiers gdk:modifier-type))
240 (defbinding %accelerator-set-default-mod-mask () nil
241 (default-modifiers gdk:modifier-type))
243 (defun (setf accelerator-default-modifier-mask) (default-modifiers)
244 (%accelerator-set-default-mod-mask default-modifiers))
246 (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
251 (defbinding accel-label-get-accel-width () unsigned-int
252 (accel-label accel-label))
254 (defbinding accel-label-refetch () boolean
255 (accel-label accel-label))
261 (defbinding (accel-map-init "_gtk_accel_map_init") () nil)
263 (defbinding %accel-map-add-entry () nil
266 (modifiers gdk:modifier-type))
268 (defun accel-map-add-entry (path accelerator)
269 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
270 (%accel-map-add-entry path key modifiers)))
272 (defbinding %accel-map-lookup-entry () boolean
274 ((make-instance 'accel-key) accel-key :return))
276 (defun accel-map-lookup-entry (path)
277 (multiple-value-bind (found-p accel-key) (%accel-map-lookup-entry path)
280 (slot-value accel-key 'key)
281 (slot-value accel-key 'modifiers)
282 (slot-value accel-key 'flags)))))
284 (defbinding %accel-map-change-entry () boolean
287 (modifiers gdk:modifier-type)
290 (defun accel-map-change-entry (path accelerator &optional replace)
291 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
292 (%accel-map-change-entry path key modifiers replace)))
294 (defbinding accel-map-load () nil
297 (defbinding accel-map-save () nil
300 (define-callback-marshal %accel-map-foreach-callback nil
301 ((accel-path string) (key unsigned-int)
302 (modifiers gdk:modifier-type) (changed boolean)) :callback-id :first)
304 (defbinding %accel-map-foreach (callback-id) nil
305 (callback-id unsigned-int)
306 (%accel-map-foreach-callback callback))
308 (defbinding %accel-map-foreach-unfiltered (callback-id) nil
309 (callback-id unsigned-int)
310 (%accel-map-foreach-callback callback))
312 (defun accel-map-foreach (function &optional (filter-p t))
313 (with-callback-function (id function)
315 (%accel-map-foreach id)
316 (%accel-map-foreach-unfiltered id))))
318 (defbinding accel-map-add-filter () nil
321 (defbinding accel-map-get () accel-map)
323 (defbinding accel-map-lock-path () nil
326 (defbinding accel-map-unlock-path () nil
333 (defbinding accessible-connect-widget-destroyed () nil
334 (accessible accessible))
339 (defmethod initialize-instance ((adjustment adjustment) &key value)
342 ;; we need to make sure that the value is set last, otherwise it
343 ;; may be outside current limits and ignored
345 (setf (slot-value adjustment 'value) value))))
348 (defbinding adjustment-changed () nil
349 (adjustment adjustment))
351 (defbinding adjustment-value-changed () nil
352 (adjustment adjustment))
354 (defbinding adjustment-clamp-page () nil
355 (adjustment adjustment)
357 (upper single-float))
362 (defbinding alignment-set () nil
363 (alognment alignment)
364 (x-align single-float)
365 (y-align single-float)
366 (x-scale single-float)
367 (y-scale single-float))
369 (defbinding alignment-get-padding () nil
370 (alognment alignment)
371 (top unsigned-int :out)
372 (bottom unsigned-int :out)
373 (left unsigned-int :out)
374 (right unsigned-int :out))
376 (defbinding alignment-set-padding () nil
377 (alognment alignment)
379 (bottom unsigned-int)
381 (right unsigned-int))
389 (defun (setf bin-child) (child bin)
390 (when-bind (current-child (bin-child bin))
391 (container-remove bin current-child))
392 (container-add bin child)
395 (defmethod compute-signal-function ((bin bin) signal function object)
396 (declare (ignore signal))
397 (if (eq object :child)
398 #'(lambda (&rest args)
399 (apply function (bin-child bin) (rest args)))
405 (defbinding box-pack-start () nil
410 (padding unsigned-int))
412 (defbinding box-pack-end () nil
417 (padding unsigned-int))
419 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
421 (box-pack-end box child expand fill padding)
422 (box-pack-start box child expand fill padding)))
424 (defbinding box-reorder-child () nil
429 (defbinding box-query-child-packing () nil
432 (expand boolean :out)
434 (padding unsigned-int :out)
435 (pack-type pack-type :out))
437 (defbinding box-set-child-packing () nil
442 (padding unsigned-int)
443 (pack-type pack-type))
449 (defmethod initialize-instance ((button button) &rest initargs &key stock)
451 (apply #'call-next-method button :label stock :use-stock t initargs)
455 (defbinding button-pressed () nil
458 (defbinding button-released () nil
461 (defbinding button-clicked () nil
464 (defbinding button-enter () nil
467 (defbinding button-leave () nil
474 (defbinding calendar-select-month () int
479 (defbinding calendar-select-day () nil
483 (defbinding calendar-mark-day () int
487 (defbinding calendar-unmark-day () int
491 (defbinding calendar-clear-marks () nil
494 (defbinding calendar-get-date () nil
496 (year unsigned-int :out)
497 (month unsigned-int :out)
498 (day unsigned-int :out))
500 (defbinding calendar-freeze () nil
503 (defbinding calendar-thaw () nil
509 (defbinding check-menu-item-toggled () nil
510 (check-menu-item check-menu-item))
515 (defbinding (color-selection-is-adjusting-p
516 "gtk_color_selection_is_adjusting") () boolean
517 (colorsel color-selection))
521 ;;; Color selection dialog -- no functions
527 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
528 &key model content active)
529 (remf initargs :active)
531 (apply #'call-next-method combo-box initargs)
533 (apply #'call-next-method combo-box
534 :model (make-instance 'list-store :column-types '(string))
536 (unless (typep combo-box 'combo-box-entry)
537 (let ((cell (make-instance 'cell-renderer-text)))
538 (cell-layout-pack combo-box cell :expand t)
539 (cell-layout-add-attribute combo-box cell :text 0)))))
541 (mapc #'(lambda (text)
542 (combo-box-append-text combo-box text))
545 (setf (combo-box-active combo-box) active)))
548 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
550 ;; (signal-emit combo-box 'changed)))
552 (defbinding combo-box-append-text () nil
553 (combo-box combo-box)
556 (defbinding combo-box-insert-text () nil
557 (combo-box combo-box)
561 (defbinding combo-box-prepend-text () nil
562 (combo-box combo-box)
566 (defbinding combo-box-get-active-text () string
567 (combo-box combo-box))
569 (defbinding combo-box-popup () nil
570 (combo-box combo-box))
572 (defbinding combo-box-popdown () nil
573 (combo-box combo-box))
579 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
582 (setf (combo-box-entry-text-column combo-box-entry) 0)))
587 (defmethod shared-initialize ((dialog dialog) names &rest initargs
589 (declare (ignore button buttons))
592 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
595 (defun dialog-response-id (dialog response &optional create-p error-p)
596 "Returns a numeric response id"
597 (if (typep response 'response-type)
598 (response-type-to-int response)
599 (let ((responses (object-data dialog 'responses)))
601 ((and responses (position response responses :test #'equal)))
605 (vector-push-extend response responses)
606 (1- (length responses)))
609 (object-data dialog 'responses)
610 (make-array 1 :adjustable t :fill-pointer t
611 :initial-element response))
614 (error "Invalid response: ~A" response))))))
616 (defun dialog-find-response (dialog id)
617 "Finds a symbolic response given a numeric id"
619 (int-to-response-type id)
620 (aref (object-data dialog 'responses) id)))
623 (defmethod compute-signal-id ((dialog dialog) signal)
624 (if (dialog-response-id dialog signal)
625 (ensure-signal-id 'response dialog)
628 (defmethod compute-signal-function ((dialog dialog) signal function object)
629 (declare (ignore function object))
630 (let ((callback (call-next-method))
631 (id (dialog-response-id dialog signal)))
633 #'(lambda (dialog response)
634 (when (= response id)
635 (funcall callback dialog)))
638 (defbinding dialog-run () nil
641 (defbinding dialog-response (dialog response) nil
643 ((dialog-response-id dialog response nil t) int))
646 (defbinding %dialog-add-button () button
651 (defun dialog-add-button (dialog label &optional (response label)
652 &key default object after)
653 "Adds a button to the dialog."
654 (let* ((signal (if (functionp response)
657 (id (dialog-response-id dialog signal t))
658 (button (%dialog-add-button dialog label id)))
659 (when (functionp response)
660 (signal-connect dialog signal response :object object :after after))
662 (%dialog-set-default-response dialog id))
666 (defbinding %dialog-add-action-widget () nil
668 (action-widget widget)
671 (defun dialog-add-action-widget (dialog widget &optional (response widget)
672 &key default object after)
673 (let* ((signal (if (functionp response)
676 (id (dialog-response-id dialog signal t)))
677 (unless (widget-hidden-p widget)
678 (widget-show widget))
679 (%dialog-add-action-widget dialog widget id)
680 (when (functionp response)
681 (signal-connect dialog signal response :object object :after after))
683 (%dialog-set-default-response dialog id))
687 (defbinding %dialog-set-default-response () nil
691 (defun dialog-set-default-response (dialog response)
692 (%dialog-set-default-response
693 dialog (dialog-response-id dialog response nil t)))
695 (defbinding dialog-set-response-sensitive (dialog response sensitive) nil
697 ((dialog-response-id dialog response nil t) int)
701 (defbinding alternative-dialog-button-order-p (&optional screen) boolean
702 (screen (or null gdk:screen)))
705 (defbinding (dialog-set-alternative-button-order
706 "gtk_dialog_set_alternative_button_order_from_array")
707 (dialog new-order) nil
709 ((length new-order) int)
710 ((map 'vector #'(lambda (response)
711 (dialog-response-id dialog response nil t))
712 new-order) (vector int)))
717 (defbinding %dialog-get-response-for-widget () int
721 (defun dialog-get-response-for-widget (dialog widget)
722 (dialog-find-response dialog (dialog-get-response-for-widget dialog widget))))
725 (defmethod container-add ((dialog dialog) (child widget) &rest args)
726 (apply #'container-add (dialog-vbox dialog) child args))
729 (defmethod container-remove ((dialog dialog) (child widget))
730 (container-remove (dialog-vbox dialog) child))
732 (defmethod container-children ((dialog dialog))
733 (container-children (dialog-vbox dialog)))
735 (defmethod (setf container-children) (children (dialog dialog))
736 (setf (container-children (dialog-vbox dialog)) children))
741 (defbinding entry-get-layout-offsets () nil
746 (defbinding entry-layout-index-to-text-index () int
750 (defbinding entry-text-index-to-layout-index () int
757 (define-callback-marshal %entry-completion-match-callback boolean
758 (entry-completion string tree-iter))
760 (defbinding entry-completion-set-match-func (completion function) nil
761 (completion entry-completion)
762 (%entry-completion-match-callback callback)
763 ((register-callback-function function) unsigned-int)
764 (user-data-destroy-callback callback))
766 (defbinding entry-completion-complete () nil
767 (completion entry-completion))
770 (defbinding entry-completion-insert-prefix () nil
771 (completion entry-completion))
773 (defbinding entry-completion-insert-action-text () nil
774 (completion entry-completion)
778 (defbinding entry-completion-insert-action-markup () nil
779 (completion entry-completion)
783 (defbinding entry-completion-delete-action () nil
784 (completion entry-completion)
790 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
791 &key filter filters shortcut-folder
792 shortcut-folders shortcut-folder-uti
793 shortcut-folder-uris)
794 (declare (ignore filter filters shortcut-folder shortcut-folders
795 shortcut-folder-uti shortcut-folder-uris))
798 (initial-add file-chooser #'file-chooser-add-filter
799 initargs :filer :filters)
800 (initial-add file-chooser #'file-chooser-add-shortcut-folder
801 initargs :shortcut-folder :shortcut-folders)
802 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
803 initargs :shortcut-folder-uri :shortcut-folders-uris)))
806 (defbinding file-chooser-select-filename () boolean
807 (file-chooser file-chooser)
810 (defbinding file-chooser-unselect-filename () nil
811 (file-chooser file-chooser)
814 (defbinding file-chooser-select-all () boolean
815 (file-chooser file-chooser))
817 (defbinding file-chooser-unselect-all () boolean
818 (file-chooser file-chooser))
820 (defbinding file-chooser-get-filenames () (gslist string)
821 (file-chooser file-chooser))
823 (defbinding file-chooser-select-uri () boolean
824 (file-chooser file-chooser)
827 (defbinding file-chooser-unselect-uri () nil
828 (file-chooser file-chooser)
831 (defbinding file-chooser-get-uris () (gslist string)
832 (file-chooser file-chooser))
834 (defbinding file-chooser-add-filter () nil
835 (file-chooser file-chooser)
836 (filter file-filter))
838 (defbinding file-chooser-remove-filter () nil
839 (file-chooser file-chooser)
840 (filter file-filter))
842 (defbinding file-chooser-list-filters () (gslist file-filter)
843 (file-chooser file-chooser))
845 (defbinding file-chooser-add-shortcut-folder () boolean
846 (file-chooser file-chooser)
850 (defbinding file-chooser-remove-shortcut-folder () nil
851 (file-chooser file-chooser)
855 (defbinding file-chooser-list-shortcut-folders () (gslist string)
856 (file-chooser file-chooser))
858 (defbinding file-chooser-add-shortcut-folder-uri () boolean
859 (file-chooser file-chooser)
863 (defbinding file-chooser-remove-shortcut-folder-uri () nil
864 (file-chooser file-chooser)
868 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
869 (file-chooser file-chooser))
874 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
875 &key mime-type mime-types pattern patterns
877 (declare (ignore mime-type mime-types pattern patterns))
881 #-gtk2.6(warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
882 #+gtk2.6(file-filter-add-pixbuf-formats file-filter))
883 (initial-add file-filter #'file-filter-add-mime-type
884 initargs :mime-type :mime-types)
885 (initial-add file-filter #'file-filter-add-pattern
886 initargs :pattern :patterns)))
889 (defbinding file-filter-add-mime-type () nil
893 (defbinding file-filter-add-pattern () nil
898 (defbinding file-filter-add-pixbuf-formats () nil
899 (filter file-filter))
901 (define-callback-marshal %file-filter-callback boolean (file-filter-info))
903 (defbinding file-filter-add-custom (filter needed function) nil
905 (needed file-filter-flags)
906 (%file-filter-callback callback)
907 ((register-callback-function function) unsigned-int)
908 (user-data-destroy-callback callback))
910 (defbinding file-filter-get-needed () file-filter-flags
911 (filter file-filter))
913 (defbinding file-filter-filter () boolean
915 (filter-info file-filter-info))
921 (defbinding image-set-from-file () nil
925 (defmethod (setf image-pixmap) ((data vector) (image image))
926 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
927 (setf (image-pixmap image) pixmap)
928 (setf (image-mask image) mask)))
930 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
932 ((typep pixmap 'vector)
933 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
934 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
938 (image-set-from-file image file)))
939 ((call-next-method))))
941 (defun create-image-widget (source &optional mask)
943 (gdk:pixbuf (make-instance 'image :pixbuf source))
944 (string (make-instance 'image :stock source))
945 (pathname (make-instance 'image :file source))
946 ((or list vector) (make-instance 'image :pixmap source))
947 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
950 (defbinding image-clear () nil
957 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
958 (if (and image (not (typep image 'widget)))
959 (apply #'call-next-method item :image (create-image-widget image) initargs)
963 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
964 (setf (slot-value item 'image) widget))
966 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
967 (setf (image-menu-item-image item) (create-image-widget image)))
972 (defmethod shared-initialize ((label label) names &key pattern)
973 (declare (ignore names))
976 (setf (label-pattern label) pattern)))
978 (defbinding label-get-layout-offsets () nil
983 (defbinding label-select-region () nil
988 (defbinding label-get-selection-bounds () boolean
997 (defbinding %radio-button-get-group () pointer
998 (radio-button radio-button))
1000 (defbinding %radio-button-set-group () nil
1001 (radio-button radio-button)
1004 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
1005 "Add BUTTON1 to the group which BUTTON2 belongs to."
1006 (%radio-button-set-group button1 (%radio-button-get-group button2)))
1008 (defun %add-activate-callback (widget signal function object after)
1010 (signal-connect widget signal
1012 (when (slot-value widget 'active)
1013 (funcall function object (slot-value widget 'value))))
1014 :object object :after after)
1015 (signal-connect widget signal
1017 (when (slot-value widget 'active)
1018 (funcall function (slot-value widget 'value))))
1021 (defmethod activate-radio-widget ((button radio-button))
1022 (signal-emit button 'clicked))
1024 (defmethod add-activate-callback ((button radio-button) function &key object after)
1025 (%add-activate-callback button 'clicked function object after))
1027 (defmethod initialize-instance ((button radio-button) &key group)
1031 (add-to-radio-group button group))))
1036 (defbinding item-select () nil
1039 (defbinding item-deselect () nil
1042 (defbinding item-toggle () nil
1049 (defmethod initialize-instance ((item menu-item) &key label)
1053 (setf (menu-item-label item) label))))
1056 (defun (setf menu-item-label) (label menu-item)
1057 (make-instance 'accel-label
1058 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
1059 :use-underline (menu-item-use-underline-p menu-item)
1060 :visible t :parent menu-item)
1063 (defun menu-item-label (menu-item)
1064 (when (and (slot-boundp menu-item 'child)
1065 (typep (bin-child menu-item) 'label))
1066 (label-label (bin-child menu-item))))
1068 (defbinding menu-item-remove-submenu () nil
1069 (menu-item menu-item))
1071 (defbinding menu-item-set-accel-path () nil
1072 (menu-item menu-item)
1073 (accel-path string))
1075 (defbinding menu-item-select () nil
1076 (menu-item menu-item))
1078 (defbinding menu-item-deselect () nil
1079 (menu-item menu-item))
1081 (defbinding menu-item-activate () nil
1082 (menu-item menu-item))
1084 (defbinding menu-item-toggle-size-request () nil
1085 (menu-item menu-item)
1086 (requisition int :out))
1088 (defbinding menu-item-toggle-size-allocate () nil
1089 (menu-item menu-item)
1093 ;;; Menu tool button
1096 (defbinding menu-tool-button-set-arrow-tooltip () nil
1097 (menu-tool-button menu-tool-button)
1100 (tip-private string))
1105 (defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
1106 (buttons :close) flags transient-parent)
1107 (%message-dialog-new transient-parent flags message-type buttons))
1110 (defmethod shared-initialize ((dialog message-dialog) names
1111 &key text #+gtk 2.6 secondary-text)
1112 (declare (ignore names))
1114 (message-dialog-set-markup dialog text))
1116 (when secondary-text
1117 (message-dialog-format-secondary-markup dialog secondary-text))
1121 (defbinding %message-dialog-new () pointer
1122 (parent (or null window))
1123 (flags dialog-flags)
1125 (buttons buttons-type)
1128 (defbinding message-dialog-set-markup () nil
1129 (message-dialog message-dialog)
1133 (defbinding message-dialog-format-secondary-text () nil
1134 (message-dialog message-dialog)
1138 (defbinding message-dialog-format-secondary-markup () nil
1139 (message-dialog message-dialog)
1146 (defbinding %radio-menu-item-get-group () pointer
1147 (radio-menu-item radio-menu-item))
1149 (defbinding %radio-menu-item-set-group () nil
1150 (radio-menu-item radio-menu-item)
1153 (defmethod activate-radio-widget ((item radio-menu-item))
1154 (menu-item-activate item))
1156 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
1157 "Add ITEM1 to the group which ITEM2 belongs to."
1158 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1160 (defmethod add-activate-callback ((item radio-menu-item) function &key object after)
1161 (%add-activate-callback item 'activate function object after))
1163 (defmethod initialize-instance ((item radio-menu-item) &key group)
1167 (add-to-radio-group item group))))
1171 ;;; Radio tool button
1173 (defbinding %radio-tool-button-get-group () pointer
1174 (radio-tool-button radio-tool-button))
1176 (defbinding %radio-tool-button-set-group () nil
1177 (radio-tool-button radio-tool-button)
1180 (defmethod activate-radio-widget ((button radio-tool-button))
1181 (signal-emit button 'clicked))
1183 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
1184 "Add BUTTON1 to the group which BUTTON2 belongs to."
1185 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1186 (defmethod add-activate-callback ((button radio-tool-button) function &key object after)
1187 (%add-activate-callback button 'clicked function object after))
1189 (defmethod initialize-instance ((button radio-tool-button) &key group)
1193 (add-to-radio-group button group))))
1199 (defbinding toggle-button-toggled () nil
1200 (toggle-button toggle-button))
1205 (defmethod initialize-instance ((window window) &rest initargs
1206 &key accel-group accel-groups)
1207 (declare (ignore accel-group accel-groups))
1210 (initial-add window #'window-add-accel-group
1211 initargs :accel-group :accel-groups)))
1213 #-debug-ref-counting
1214 (defmethod print-object ((window window) stream)
1216 (proxy-valid-p window)
1217 (slot-boundp window 'title)
1218 (not (zerop (length (window-title window)))))
1219 (print-unreadable-object (window stream :type t :identity nil)
1220 (format stream "~S at 0x~X"
1221 (window-title window) (sap-int (foreign-location window))))
1222 (call-next-method)))
1224 (defbinding window-set-wmclass () nil
1226 (wmclass-name string)
1227 (wmclass-class string))
1229 (defbinding window-add-accel-group () nil
1231 (accel-group accel-group))
1233 (defbinding window-remove-accel-group () nil
1235 (accel-group accel-group))
1237 (defbinding window-activate-focus () int
1240 (defbinding window-activate-default () int
1243 (defbinding window-set-default-size (window width height) int
1246 ((or height -1) int))
1248 (defbinding %window-set-geometry-hints () nil
1250 (geometry gdk:geometry)
1251 (geometry-mask gdk:window-hints))
1253 (defun window-set-geometry-hints (window &key min-width min-height
1254 max-width max-height base-width base-height
1255 width-inc height-inc min-aspect max-aspect
1256 (gravity nil gravity-p) min-size max-size)
1257 (let ((geometry (make-instance 'gdk:geometry
1258 :min-width (or min-width -1)
1259 :min-height (or min-height -1)
1260 :max-width (or max-width -1)
1261 :max-height (or max-height -1)
1262 :base-width (or base-width 0)
1263 :base-height (or base-height 0)
1264 :width-inc (or width-inc 0)
1265 :height-inc (or height-inc 0)
1266 :min-aspect (or min-aspect 0)
1267 :max-aspect (or max-aspect 0)
1270 (when (or min-size min-width min-height)
1271 (push :min-size mask))
1272 (when (or max-size max-width max-height)
1273 (push :max-size mask))
1274 (when (or base-width base-height)
1275 (push :base-size mask))
1276 (when (or width-inc height-inc)
1277 (push :resize-inc mask))
1278 (when (or min-aspect max-aspect)
1279 (push :aspect mask))
1281 (push :win-gravity mask))
1282 (%window-set-geometry-hints window geometry mask)))
1284 (defbinding window-list-toplevels () (glist (copy-of window))
1285 "Returns a list of all existing toplevel windows.")
1287 (defbinding window-add-mnemonic (window key target) nil
1289 ((gdk:keyval-from-name key) unsigned-int)
1292 (defbinding window-remove-mnemonic (window key target) nil
1294 ((gdk:keyval-from-name key) unsigned-int)
1297 (defbinding window-mnemonic-activate (window key modifier) nil
1299 ((gdk:keyval-from-name key) unsigned-int)
1300 (modifier gdk:modifier-type))
1302 (defbinding window-activate-key () boolean
1304 (event gdk:key-event))
1306 (defbinding window-propagate-key-event () boolean
1308 (event gdk:key-event))
1311 (defbinding window-present () nil
1316 (defbinding %window-present () nil
1319 (defbinding %window-present-with-time () nil
1321 (timespamp unsigned-int))
1323 (defun window-present (window &optional timestamp)
1325 (%window-present-with-time window timestamp)
1326 (%window-present window))))
1328 (defbinding window-iconify () nil
1331 (defbinding window-deiconify () nil
1334 (defbinding window-stick () nil
1337 (defbinding window-unstick () nil
1340 (defbinding window-maximize () nil
1343 (defbinding window-unmaximize () nil
1346 (defbinding window-fullscreen () nil
1349 (defbinding window-unfullscreen () nil
1352 (defbinding window-set-keep-above () nil
1356 (defbinding window-set-keep-below () nil
1360 (defbinding window-begin-resize-drag () nil
1362 (edge gdk:window-edge)
1364 (root-x int) (root-y int)
1365 (timestamp unsigned-int))
1367 (defbinding window-begin-move-drag () nil
1369 (edge gdk:window-edge)
1371 (root-x int) (root-y int)
1372 (timestamp unsigned-int))
1374 (defbinding window-set-frame-dimensions () nil
1376 (left int) (top int) (rigth int) (bottom int))
1378 (defbinding %window-get-default-size () nil
1383 (defun window-get-default-size (window)
1384 (multiple-value-bind (width height) (%window-get-default-size window)
1385 (values (unless (= width -1) width) (unless (= height -1) height))))
1387 (defbinding window-get-frame-dimensions () nil
1389 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1391 (defbinding %window-get-icon-list () (glist (copy-of gdk:pixbuf))
1394 (defbinding window-get-position () nil
1399 (defbinding window-get-size () nil
1404 (defbinding window-move () nil
1409 (defbinding window-parse-geometry () boolean
1413 (defbinding window-reshow-with-initial-size () nil
1416 (defbinding window-resize () nil
1421 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1422 () (glist gdk:pixbuf))
1424 (defun window-default-icon ()
1425 (first (window-default-icon-list)))
1427 (defbinding %window-set-default-icon-list () nil
1428 (icons (glist gdk:pixbuf)))
1430 (defun (setf window-default-icon-list) (icons)
1431 (%window-set-default-icon-list icons)
1434 (defbinding %window-set-default-icon () nil
1435 (icons (glist gdk:pixbuf)))
1437 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1438 (%window-set-default-icon icon)
1441 (defmethod (setf window-group) ((group window-group) (window window))
1442 (window-group-add-window group window)
1445 (defbinding %window-set-default-icon-from-file () boolean
1449 (defmethod (setf window-default-icon) ((icon-file pathname))
1450 (%window-set-default-icon-from-file icon-file)
1453 (defbinding %window-set-icon-from-file () boolean
1458 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1459 (%window-set-icon-from-file window icon-file)
1462 (defbinding window-set-auto-startup-notification () nil
1465 (defbinding decorated-window-init () nil
1468 (defbinding decorated-window-calculate-frame-size () nil
1471 (defbinding decorated-window-set-title () nil
1475 (defbinding decorated-window-move-resize-window () nil
1485 (defmethod initialize-instance ((window-group window-group) &rest initargs
1486 &key window windows)
1487 (declare (ignore window windows))
1490 (initial-add window-group #'window-group-add-window
1491 initargs :window :windows)))
1494 (defbinding window-group-add-window () nil
1495 (window-group window-group)
1498 (defbinding window-group-remove-window () nil
1499 (window-group window-group)
1505 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1506 (setf (scrolled-window-hscrollbar-policy window) policy)
1507 (setf (scrolled-window-vscrollbar-policy window) policy))
1509 (defbinding scrolled-window-add-with-viewport () nil
1510 (scrolled-window scrolled-window)
1513 (defmethod shared-initialize ((window scrolled-window) names &key policy)
1514 (declare (ignore names))
1516 (setf (slot-value window 'hscrollbar-policy) policy)
1517 (setf (slot-value window 'vscrollbar-policy) policy))
1523 (defbinding statusbar-get-context-id () unsigned-int
1524 (statusbar statusbar)
1525 (context-description string))
1527 (defbinding statusbar-push () unsigned-int
1528 (statusbar statusbar)
1529 (context-id unsigned-int)
1532 (defbinding statusbar-pop () nil
1533 (statusbar statusbar)
1534 (context-id unsigned-int))
1536 (defbinding statusbar-remove () nil
1537 (statusbar statusbar)
1538 (context-id unsigned-int)
1539 (message-id unsigned-int))
1545 (defbinding fixed-put () nil
1550 (defbinding fixed-move () nil
1559 (defun %ensure-notebook-position (notebook page)
1562 (widget (notebook-page-num notebook page t))))
1564 (defun %ensure-notebook-child (notebook position)
1567 (t (notebook-get-nth-page notebook position))))
1569 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1570 (notebook position child tab-label &optional menu-label) nil
1573 ((if (stringp tab-label)
1574 (make-instance 'label :label tab-label)
1576 ((if (stringp menu-label)
1577 (make-instance 'label :label menu-label)
1578 menu-label) (or null widget))
1579 ((%ensure-notebook-position notebook position) position))
1581 (defun notebook-append (notebook child tab-label &optional menu-label)
1582 (notebook-insert notebook :last child tab-label menu-label))
1584 (defun notebook-prepend (notebook child tab-label &optional menu-label)
1585 (notebook-insert notebook :first child tab-label menu-label))
1587 (defbinding notebook-remove-page (notebook page) nil
1589 ((%ensure-notebook-position notebook page) position))
1591 (defbinding %notebook-page-num () int
1595 (defun notebook-page-num (notebook child &optional error-p)
1596 (let ((page-num (%notebook-page-num notebook child)))
1599 (error "~A is not a page in ~A" child notebook))
1602 (defbinding notebook-next-page () nil
1603 (notebook notebook))
1605 (defbinding notebook-prev-page () nil
1606 (notebook notebook))
1608 (defbinding notebook-reorder-child (notebook child position) nil
1611 ((%ensure-notebook-position notebook position) int))
1613 (defbinding notebook-popup-enable () nil
1614 (notebook notebook))
1616 (defbinding notebook-popup-disable () nil
1617 (notebook notebook))
1619 (defbinding notebook-get-nth-page () widget
1623 (defun %notebook-current-page (notebook)
1624 (when (slot-boundp notebook 'current-page-num)
1625 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1627 (defun (setf notebook-current-page) (page notebook)
1628 (setf (notebook-current-page notebook) (notebook-page-num notebook page)))
1630 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1631 (notebook page) widget
1633 ((%ensure-notebook-child notebook page) widget))
1635 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1636 (notebook page) (copy-of string)
1638 ((%ensure-notebook-child notebook page) widget))
1640 (defbinding %notebook-set-tab-label () nil
1645 (defun (setf notebook-tab-label) (tab-label notebook page)
1646 (let ((widget (if (stringp tab-label)
1647 (make-instance 'label :label tab-label)
1649 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1653 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1654 (notebook page) widget
1656 ((%ensure-notebook-child notebook page) widget))
1658 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1659 (notebook page) (copy-of string)
1661 ((%ensure-notebook-child notebook page) widget))
1663 (defbinding %notebook-set-menu-label () nil
1666 (menu-label widget))
1668 (defun (setf notebook-menu-label) (menu-label notebook page)
1669 (let ((widget (if (stringp menu-label)
1670 (make-instance 'label :label menu-label)
1672 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1676 (defbinding notebook-query-tab-label-packing (notebook page) nil
1678 ((%ensure-notebook-child notebook page) widget)
1679 (expand boolean :out)
1681 (pack-type pack-type :out))
1683 (defbinding notebook-set-tab-label-packing
1684 (notebook page expand fill pack-type) nil
1686 ((%ensure-notebook-child notebook page) widget)
1689 (pack-type pack-type))
1695 (defbinding paned-pack1 () nil
1701 (defbinding paned-pack2 () nil
1710 (defbinding layout-put () nil
1716 (defbinding layout-move () nil
1722 (defbinding layout-set-size () nil
1724 (width unsigned-int)
1725 (height unsigned-int))
1727 (defbinding layout-get-size () nil
1729 (width unsigned-int :out)
1730 (height unsigned-int :out))
1735 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1736 (menu-shell menu-shell)
1737 (menu-item menu-item)
1743 (defun menu-shell-append (menu-shell menu-item)
1744 (menu-shell-insert menu-shell menu-item :last))
1746 (defun menu-shell-prepend (menu-shell menu-item)
1747 (menu-shell-insert menu-shell menu-item :fisrt))
1749 (defbinding menu-shell-deactivate () nil
1750 (menu-shell menu-shell))
1752 (defbinding menu-shell-select-item () nil
1753 (menu-shell menu-shell)
1754 (menu-item menu-item))
1756 (defbinding menu-shell-select-first () nil
1757 (menu-shell menu-shell)
1758 (search-sensitive boolean))
1760 (defbinding menu-shell-deselect () nil
1761 (menu-shell menu-shell))
1763 (defbinding menu-shell-activate-item () nil
1764 (menu-shell menu-shell)
1765 (menu-item menu-item)
1766 (fore-deactivate boolean))
1768 (defbinding menu-shell-cancel () nil
1769 (menu-shell menu-shell))
1774 (defun %menu-position (menu child)
1777 (keyword (case child
1780 (t (error "Invalid position keyword: ~A" child))))
1781 (widget (menu-child-position menu child))))
1784 (defbinding menu-reorder-child (menu menu-item position) nil
1786 (menu-item menu-item)
1787 ((%menu-position menu position) int))
1789 (defbinding menu-attach () nil
1791 (menu-item menu-item)
1792 (left-attach unsigned-int)
1793 (right-attach unsigned-int)
1794 (top-attach unsigned-int)
1795 (bottom-attach unsigned-int))
1797 (define-callback-marshal %menu-position-callback nil
1798 (menu (x int) (y int) (push-in boolean)))
1800 (defbinding %menu-popup () nil
1802 (parent-menu-shell (or null menu-shell))
1803 (parent-menu-item (or null menu-item))
1804 (callback (or null callback))
1805 (callback-id unsigned-int)
1806 (button unsigned-int)
1807 (activate-time (unsigned 32)))
1809 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1812 (with-callback-function (id callback)
1814 menu parent-menu-shell parent-menu-item
1815 %menu-position-callback id button activate-time))
1817 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1819 (defbinding menu-set-accel-path () nil
1821 (accel-path string))
1823 (defbinding menu-reposition () nil
1826 (defbinding menu-popdown () nil
1829 (defun menu-child-position (menu child)
1830 (position child (container-children menu)))
1832 (defun menu-active-num (menu)
1833 (menu-child-position menu (menu-active menu)))
1835 (defbinding %menu-set-active () nil
1837 (index unsigned-int))
1839 (defun (setf menu-active) (menu child)
1840 (%menu-set-active menu (%menu-position menu child))
1843 (define-callback %menu-detach-callback nil ((widget widget) (menu menu))
1844 (funcall (object-data menu 'detach-func) widget menu))
1846 (defbinding %menu-attach-to-widget (menu widget) nil
1849 (%menu-detach-callback callback))
1851 (defun menu-attach-to-widget (menu widget function)
1852 (setf (object-data menu 'detach-func) function)
1853 (%menu-attach-to-widget menu widget))
1855 (defbinding menu-detach () nil
1859 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1862 (defbinding menu-set-monitor () nil
1869 (defbinding table-resize () nil
1872 (columns unsigned-int))
1874 (defbinding table-attach (table child left right top bottom
1875 &key options x-options y-options
1876 (x-padding 0) (y-padding 0)) nil
1880 (right unsigned-int)
1882 (bottom unsigned-int)
1883 ((append (mklist options) (mklist x-options)) attach-options)
1884 ((append (mklist options) (mklist y-options)) attach-options)
1885 (x-padding unsigned-int)
1886 (y-padding unsigned-int))
1889 (defbinding %table-set-row-spacing () nil
1892 (spacing unsigned-int))
1894 (defbinding %table-set-row-spacings () nil
1896 (spacing unsigned-int))
1898 (defun (setf table-row-spacing) (spacing table &optional row)
1900 (%table-set-row-spacing table row spacing)
1901 (%table-set-row-spacings table spacing))
1904 (defbinding %table-get-row-spacing () unsigned-int
1908 (defbinding %table-get-default-row-spacing () unsigned-int
1911 (defun table-row-spacing (table &optional row)
1913 (%table-get-row-spacing table row)
1914 (%table-get-default-row-spacing table)))
1917 (defbinding %table-set-col-spacing () nil
1920 (spacing unsigned-int))
1922 (defbinding %table-set-col-spacings () nil
1924 (spacing unsigned-int))
1926 (defun (setf table-col-spacing) (spacing table &optional col)
1928 (%table-set-col-spacing table col spacing)
1929 (%table-set-col-spacings table spacing))
1932 (defbinding %table-get-col-spacing () unsigned-int
1936 (defbinding %table-get-default-col-spacing () unsigned-int
1939 (defun table-col-spacing (table &optional col)
1941 (%table-get-col-spacing table col)
1942 (%table-get-default-col-spacing table)))
1948 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1950 (apply #'call-next-method toolbar
1951 :tooltips (make-instance 'tooltips) initargs)
1952 (call-next-method)))
1954 (defbinding %toolbar-insert () nil
1956 (tool-item tool-item)
1957 (position position))
1959 (defun toolbar-insert (toolbar tool-item &optional (position :end))
1960 (%toolbar-insert toolbar tool-item position)
1961 (%tool-item-update-tooltips tool-item))
1963 (defbinding toolbar-get-item-index () int
1967 (defbinding toolbar-get-nth-item () tool-item
1971 (defbinding toolbar-get-drop-index () int
1975 (defbinding toolbar-set-drop-highlight-item () nil
1977 (tool-item tool-item)
1983 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
1984 (if (and icon (not (typep icon 'widget)))
1985 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
1986 (call-next-method)))
1991 (defbinding tool-item-set-tooltip () nil
1992 (tool-item tool-item)
1995 (tip-private string))
1998 (defun %tool-item-update-tooltips (tool-item)
2000 (slot-boundp tool-item 'parent)
2002 (user-data-p tool-item 'tip-text)
2003 (user-data-p tool-item 'tip-private)))
2004 (tool-item-set-tooltip
2005 tool-item (toolbar-tooltips (widget-parent tool-item))
2006 (or (user-data tool-item 'tip-text) "")
2007 (or (user-data tool-item 'tip-private) ""))))
2009 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
2010 (setf (user-data tool-item 'tip-text) tip-text)
2011 (%tool-item-update-tooltips tool-item)
2014 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
2015 (setf (user-data tool-item 'tip-private) tip-private)
2016 (%tool-item-update-tooltips tool-item)
2019 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
2020 (declare (ignore args))
2023 (%tool-item-update-tooltips tool-item)))
2026 (defbinding tool-item-retrieve-proxy-menu-item () widget
2027 (tool-item tool-item))
2029 (defbinding (tool-item-proxy-menu-item
2030 "gtk_tool_item_get_proxy_menu_item") () menu-item
2031 (tool-item tool-item)
2032 (menu-item-id string))
2034 (defbinding %tool-item-set-proxy-menu-item () nil
2035 (tool-item tool-item)
2036 (menu-item-id string)
2037 (menu-item menu-item))
2039 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
2040 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
2044 (defbinding tool-item-rebuild-menu () nil
2045 (tool-item tool-item))
2050 (defbinding editable-select-region (editable &optional (start 0) end) nil
2055 (defbinding editable-get-selection-bounds (editable) nil
2060 (defbinding editable-insert-text (editable text &optional (position 0)) nil
2064 (position position :in-out))
2066 (defun editable-append-text (editable text)
2067 (editable-insert-text editable text nil))
2069 (defun editable-prepend-text (editable text)
2070 (editable-insert-text editable text 0))
2072 (defbinding editable-delete-text (editable &optional (start 0) end) nil
2077 (defbinding (editable-text "gtk_editable_get_chars")
2078 (editable &optional (start 0) end) string
2083 (defun (setf editable-text) (text editable)
2085 (editable-delete-text
2087 (editable-insert-text editable text))
2088 (editable-delete-text editable))
2091 (defbinding editable-cut-clipboard () nil
2092 (editable editable))
2094 (defbinding editable-copy-clipboard () nil
2095 (editable editable))
2097 (defbinding editable-paste-clipboard () nil
2098 (editable editable))
2100 (defbinding editable-delete-selection () nil
2101 (editable editable))
2107 (defbinding spin-button-configure () nil
2108 (spin-button spin-button)
2109 (adjustment adjustment)
2110 (climb-rate double-float)
2111 (digits unsigned-int))
2113 (defbinding spin-button-set-range () nil
2114 (spin-button spin-button)
2118 (defbinding spin-button-get-range () nil
2119 (spin-button spin-button)
2120 (min double-float :out)
2121 (max double-float :out))
2123 (defun spin-button-value-as-int (spin-button)
2124 (round (spin-button-value spin-button)))
2126 (defbinding %spin-button-spin () nil
2127 (spin-button spin-button)
2128 (direction spin-type)
2129 (increment double-float))
2131 (defun spin-button-spin (spin-button value)
2133 (real (%spin-button-spin spin-button :spin-user-defined value))
2134 (spin-type (%spin-button-spin spin-button value 0))))
2137 (defbinding spin-button-update () nil
2138 (spin-button spin-button))
2144 (defbinding ruler-set-range () nil
2146 (lower single-float)
2147 (upper single-float)
2148 (position single-float)
2149 (max-size single-float))
2151 (defbinding ruler-get-range () nil
2153 (lower single-float :out)
2154 (upper single-float :out)
2155 (position single-float :out)
2156 (max-size single-float :out))
2162 (defun range-lower (range)
2163 (adjustment-lower (range-adjustment range)))
2165 (defun range-upper (range)
2166 (adjustment-upper (range-adjustment range)))
2168 (defun (setf range-lower) (value range)
2169 (setf (adjustment-lower (range-adjustment range)) value))
2171 (defun (setf range-upper) (value range)
2172 (setf (adjustment-upper (range-adjustment range)) value))
2174 (defun range-page-increment (range)
2175 (adjustment-page-increment (range-adjustment range)))
2177 (defun range-step-increment (range)
2178 (adjustment-step-increment (range-adjustment range)))
2180 (defun (setf range-page-increment) (value range)
2181 (setf (adjustment-page-increment (range-adjustment range)) value))
2183 (defun (setf range-step-increment) (value range)
2184 (setf (adjustment-step-increment (range-adjustment range)) value))
2186 (defbinding range-set-range () nil
2188 (lower double-float)
2189 (upper double-float))
2191 (defbinding range-set-increments () nil
2194 (page double-float))
2199 (defbinding scale-get-layout-offsets () nil
2207 (defbinding progress-bar-pulse () nil
2208 (progress-bar progress-bar))
2213 (defmethod initialize-instance ((size-group size-group) &rest initargs
2214 &key widget widgets)
2215 (declare (ignore widget widgets))
2218 (initial-add size-group #'size-group-add-widget
2219 initargs :widget :widgets)))
2222 (defbinding size-group-add-widget () nil
2223 (size-group size-group)
2226 (defbinding size-group-remove-widget () nil
2227 (size-group size-group)
2233 (defbinding %stock-item-copy () pointer
2236 (defbinding %stock-item-free () nil
2239 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
2240 (%stock-item-copy location))
2242 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
2243 (%stock-item-free location))
2245 (defbinding stock-add (stock-item) nil
2246 (stock-item stock-item)
2249 (defbinding stock-list-ids () (gslist string))
2251 (defbinding %stock-lookup () boolean
2255 (defun stock-lookup (stock-id)
2256 (with-allocated-memory (stock-item (foreign-size (find-class 'stock-item)))
2257 (when (%stock-lookup stock-id stock-item)
2258 (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item)))))
2262 (define-callback-marshal %stock-translate-callback string ((path string)))
2264 (defbinding (stock-set-translate-function "gtk_stock_set_translate_func")
2265 (domain function) nil
2267 (%stock-translate-callback callback)
2268 ((register-callback-function function) unsigned-int)
2269 (user-data-destroy-callback callback)))
2275 (defbinding tooltips-enable () nil
2276 (tooltips tooltips))
2278 (defbinding tooltips-disable () nil
2279 (tooltips tooltips))
2281 (defun (setf tooltips-enabled-p) (enable tooltips)
2283 (tooltips-enable tooltips)
2284 (tooltips-disable tooltips)))
2286 (defbinding tooltips-set-tip () nil
2290 (tip-private string))
2292 (defbinding tooltips-data-get () tooltips-data
2295 (defbinding tooltips-force-window () nil
2296 (tooltips tooltips))
2298 (defbinding tooltips-get-info-from-tip-window () boolean
2300 (tooltips tooltips :out)
2301 (current-widget widget :out))
2306 (defbinding rc-get-style () style
2309 (defbinding rc-get-style-by-paths (&key path class-path class) style
2310 (path (or null string))
2311 (class-path (or null string))
2314 (defbinding rc-parse () nil
2315 (filename pathname))
2317 (defbinding rc-parse-string () nil
2320 (defbinding %rc-reparse-all () boolean)
2322 (defbinding %rc-reparse-all-for-settings () boolean
2324 (force-load-p boolean))
2326 (defun rc-reparse-all (&optional setting force-load-p)
2328 (%rc-reparse-all-for-settings setting force-load-p)
2331 (defbinding rc-reset-styles () nil
2332 (settings settings))
2334 (defbinding rc-add-default-file () nil
2335 (filename pathname))
2337 (defbinding rc-get-default-files ()
2338 (copy-of (null-terminated-vector (copy-of string))))
2340 (defbinding rc-get-module-dir () string)
2342 (defbinding rc-get-im-module-path () string)
2344 (defbinding rc-get-im-module-file () string)
2346 (defbinding rc-get-theme-dir () string)
2351 (defbinding (settings-get "gtk_settings_get_for_screen")
2352 (&optional (screen (gdk:display-get-default-screen))) settings
2353 (screen gdk:screen))
2358 (defbinding socket-add-id () nil
2360 (id gdk:native-window))
2362 (defbinding %plug-new () pointer
2363 (id gdk:native-window))
2365 (defmethod allocate-foreign ((plug plug) &key id)
2366 (%plug-new (or id 0)))