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.75 2007-06-20 14:28:48 espen Exp $
30 (defbinding check-version () (copy-of string)
31 (required-major unsigned-int)
32 (required-minor unsigned-int)
33 (required-micro unsigned-int))
35 (defbinding query-version () nil
36 (major unsigned-int :out)
37 (minor unsigned-int :out)
38 (micro unsigned-int :out))
41 (multiple-value-bind (major minor micro)
44 (format nil "Gtk+ v~A.~A" major minor)
45 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
51 ;;;; Initalization and display handling
53 (defparameter *event-poll-interval* 10000) ; in microseconds
56 (defbinding (gtk-init "gtk_parse_args") () boolean
57 "Initializes the library without opening the display."
61 (defun clg-init (&optional display multi-threading-p)
62 "Initializes the system and starts event handling."
63 (unless (gdk:display-get-default)
64 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
66 #+sbcl(sb-int:set-floating-point-modes :traps nil)
67 #+cmu(ext:set-floating-point-modes :traps nil))
71 (error "Initialization of GTK+ failed."))
73 (if (not multi-threading-p)
74 (%init-async-event-handling display)
75 #+sb-thread(%init-multi-threaded-event-handling display)
76 #-sb-thread(error "Multi threading not supported on this platform")))
77 (gdk:ensure-display display t))
79 (defun clg-init-with-threading (&optional display)
84 ;; A very minimal implementation of CLISP's socket-status
85 (defun socket-status (socket seconds microseconds)
86 (sb-alien:with-alien ((read-fds (sb-alien:struct sb-unix:fd-set)))
87 (let ((fd (sb-sys:fd-stream-fd (car socket))))
88 (sb-unix:fd-zero read-fds)
89 (sb-unix:fd-set fd read-fds)
91 (let ((num-fds-changed
92 (sb-unix:unix-fast-select
93 (1+ fd) (sb-alien:addr read-fds) nil nil
94 seconds microseconds)))
95 (unless (or (not num-fds-changed) (zerop num-fds-changed))
96 (if (peek-char nil (car socket) nil)
100 (defun %init-async-event-handling (display)
101 (let ((style #?(or (featurep :cmu) (sbcl< 1 0 6)) :fd-handler
102 #?-(or (featurep :cmu) (sbcl< 1 0 6)) nil))
104 (find-package "SWANK")
105 (not (eq (symbol-value (find-symbol "*COMMUNICATION-STYLE*" "SWANK")) style)))
106 (error "When running clg in Slime, the communication style ~A must be used in combination with asynchronous event handling on this platform. See the README file and <http://common-lisp.net/project/slime/doc/html/slime_45.html> for more information." style)))
108 #?(or (featurep :cmu) (sbcl< 1 0 6))
110 (signal-connect (gdk:display-manager) 'display-opened
112 (let ((fd (gdk:display-connection-number display)))
114 (let ((handler (add-fd-handler
115 (gdk:display-connection-number display)
116 :input #'main-iterate-all)))
117 (signal-connect display 'closed
118 #'(lambda (is-error-p)
119 (declare (ignore is-error-p))
120 (remove-fd-handler handler))))))))
121 (setq *periodic-polling-function* #'main-iterate-all)
122 (setq *max-event-to-sec* 0)
123 (setq *max-event-to-usec* *event-poll-interval*))
125 #+(and clisp readline)
126 ;; Readline will call the event hook at most ten times per second
127 (setf readline:event-hook #'main-iterate-all)
129 #?-(or (featurep :cmu) (sbcl< 1 0 6))
130 ;; When running in Slime we need to hook into the Swank server
131 ;; to handle events asynchronously.
132 (if (find-package "SWANK")
133 (let ((read-from-emacs (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK")))
134 (stream (funcall (find-symbol "CONNECTION.SOCKET-IO" "SWANK") (symbol-value (find-symbol "*EMACS-CONNECTION*" "SWANK")))))
135 (setf (symbol-function (find-symbol "READ-FROM-EMACS" "SWANK"))
138 (case (socket-status (cons stream :input) 0 *event-poll-interval*)
139 ((:input :eof) (return (funcall read-from-emacs)))
140 (otherwise (main-iterate-all)))))))
141 #-(and clisp readline)
142 (warn "Asynchronous event handling not supported on this platform. An explicit main loop has to be started."))
144 (gdk:display-open display))
148 (defvar *main-thread* nil)
150 ;; Hopefully, when threading support is added to the Win32 port of
151 ;; SBCL in the future, this will work just out of the box.
153 (let ((done (sb-thread:make-waitqueue))
157 ;; In Win32 all GDK calls have to be made from the main loop
158 ;; thread, so we add a timeout function which will poll for code and
161 (defun funcall-in-main (function)
164 (eq sb-thread:*current-thread* *main-thread*))
166 (gdk:with-global-lock
167 (push function functions)
168 (sb-thread:condition-wait done gdk:*global-lock*)
171 ;; Will lock REPL on error, need to be fixed!
172 (defun %funcall-in-main-poll ()
177 do (push (funcall (pop functions)) results)
178 finally (sb-thread:condition-notify done n)))
181 (defmacro within-main-loop (&body body)
182 #-win32 `(gdk:with-global-lock ,@body)
183 #+win32 `(funcall-in-main #'(lambda () ,@body)))
185 (defun %init-multi-threaded-event-handling (display)
187 (find-package "SWANK")
188 (not (eq (symbol-value (find-symbol "*COMMUNICATION-STYLE*" "SWANK")) :spawn)))
189 (error "When running clg in Slime, the communication style :spawn must be used in combination with multi threaded event handling. See the README file and <http://common-lisp.net/project/slime/doc/html/slime_45.html> for more information."))
190 (let ((main-running (sb-thread:make-waitqueue)))
191 (gdk:with-global-lock
193 (sb-thread:make-thread
196 (gdk:with-global-lock
197 (gdk:display-open display)
198 #+win32(gdk:timeout-add-with-lock (/ *event-poll-interval* 1000)
199 #'%funcall-in-main-poll)
200 (sb-thread:condition-notify main-running)
202 :name "gtk event loop"))
203 (sb-thread:condition-wait main-running gdk:*global-lock*)))
205 ;; We need to hook into the Swank server to protect calls to GDK properly.
206 ;; This will *only* protect code entered directly in the REPL.
207 (when (find-package "SWANK")
208 (push #'(lambda (form)
209 (within-main-loop (eval form)))
210 swank::*slime-repl-eval-hooks*))))
213 (defmacro within-main-loop (&body body)
218 ;;; Generic functions
220 (defgeneric add-to-radio-group (item1 item2))
221 (defgeneric activate-radio-widget (item))
222 (defgeneric (setf tool-item-tip-text) (tip-text tool-item))
223 (defgeneric (setf tool-item-tip-private) (tip-private tool-item))
229 (defbinding grab-add () nil
232 (defbinding grab-get-current () widget)
234 (defbinding grab-remove () nil
237 (defbinding get-default-language () (copy-of pango:language))
242 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
244 (define-callback-marshal %about-dialog-activate-link-callback nil
245 (about-dialog (link string)))
247 (defbinding about-dialog-set-email-hook (function) nil
248 (%about-dialog-activate-link-callback callback)
249 ((register-callback-function function) unsigned-int)
250 (user-data-destroy-callback callback))
252 (defbinding about-dialog-set-url-hook (function) nil
253 (%about-dialog-activate-link-callback callback)
254 ((register-callback-function function) unsigned-int)
255 (user-data-destroy-callback callback)))
260 (defbinding %accel-group-connect () nil
261 (accel-group accel-group)
263 (modifiers gdk:modifier-type)
267 (defun accel-group-connect (group accelerator function &optional flags)
268 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
269 (let ((gclosure (make-callback-closure function)))
270 (%accel-group-connect group key modifiers flags gclosure)
273 (defbinding accel-group-connect-by-path (group path function) nil
276 ((make-callback-closure function) gclosure :in/return))
278 (defbinding %accel-group-disconnect (group gclosure) boolean
282 (defbinding %accel-group-disconnect-key () boolean
285 (modifiers gdk:modifier-type))
287 (defun accel-group-disconnect (group accelerator)
288 (etypecase accelerator
289 (gclosure (%accel-group-disconnect group accelerator))
291 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
292 (%accel-group-disconnect-key group key modifiers)))))
294 (defbinding %accel-group-query () (copy-of (vector (inlined accel-group-entry) n))
295 (accel-group accel-group)
297 (modifiers gdk:modifier-type)
300 (defun accel-group-query (accel-group accelerator)
301 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
302 (%accel-group-query accel-group key modifiers)))
304 (defbinding %accel-group-activate () boolean
305 (accel-group accel-group)
306 (acceleratable gobject)
308 (modifiers gdk:modifier-type))
310 (defun accel-group-activate (accel-group acceleratable accelerator)
311 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
312 (%accel-group-activate accel-group acceleratable key modifiers)))
314 (defbinding accel-group-lock () nil
315 (accel-group accel-group))
317 (defbinding accel-group-unlock () nil
318 (accel-group accel-group))
320 (defbinding accel-group-from-accel-closure () accel-group
323 (defbinding %accel-groups-activate () boolean
326 (modifiers gdk:modifier-type))
328 (defun accel-groups-activate (object accelerator)
329 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
330 (%accel-groups-activate object key modifiers)))
332 (defbinding accel-groups-from-object () (gslist accel-groups)
335 (defbinding accelerator-valid-p (key &optional modifiers) boolean
337 (modifiers gdk:modifier-type))
339 (defbinding %accelerator-parse () nil
341 (key unsigned-int :out)
342 (modifiers gdk:modifier-type :out))
344 (defgeneric parse-accelerator (accelerator))
346 (defmethod parse-accelerator ((accelerator string))
347 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
349 (error "Invalid accelerator: ~A" accelerator)
350 (values key modifiers))))
352 (defmethod parse-accelerator ((accelerator cons))
353 (destructuring-bind (key modifiers) accelerator
359 (gdk:keyval-from-name key)
360 (error "Invalid key name: ~A" key)))
361 (character (parse-accelerator key)))
364 (defmethod parse-accelerator ((key integer))
367 (defmethod parse-accelerator ((key character))
369 (gdk:keyval-from-name (string key))
370 (error "Invalid key name: ~A" key)))
373 (defbinding accelerator-name () string
375 (modifiers gdk:modifier-type))
377 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
378 (defbinding accelerator-get-label () string
380 (modifiers gdk:modifier-type))
382 (defbinding %accelerator-set-default-mod-mask () nil
383 (default-modifiers gdk:modifier-type))
385 (defun (setf accelerator-default-modifier-mask) (default-modifiers)
386 (%accelerator-set-default-mod-mask default-modifiers))
388 (defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
393 (defbinding accel-label-get-accel-width () unsigned-int
394 (accel-label accel-label))
396 (defbinding accel-label-refetch () boolean
397 (accel-label accel-label))
403 (defbinding %accel-map-add-entry () nil
406 (modifiers gdk:modifier-type))
408 (defun accel-map-add-entry (path accelerator)
409 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
410 (%accel-map-add-entry path key modifiers)))
412 (defbinding %accel-map-lookup-entry () boolean
414 ((make-instance 'accel-key) accel-key :in/return))
416 (defun accel-map-lookup-entry (path)
417 (multiple-value-bind (found-p accel-key) (%accel-map-lookup-entry path)
420 (slot-value accel-key 'key)
421 (slot-value accel-key 'modifiers)
422 (slot-value accel-key 'flags)))))
424 (defbinding %accel-map-change-entry () boolean
427 (modifiers gdk:modifier-type)
430 (defun accel-map-change-entry (path accelerator &optional replace)
431 (multiple-value-bind (key modifiers) (parse-accelerator accelerator)
432 (%accel-map-change-entry path key modifiers replace)))
434 (defbinding accel-map-load () nil
437 (defbinding accel-map-save () nil
440 (define-callback-marshal %accel-map-foreach-callback nil
441 ((accel-path string) (key unsigned-int)
442 (modifiers gdk:modifier-type) (changed boolean)) :callback-id :first)
444 (defbinding %accel-map-foreach (callback-id) nil
445 (callback-id unsigned-int)
446 (%accel-map-foreach-callback callback))
448 (defbinding %accel-map-foreach-unfiltered (callback-id) nil
449 (callback-id unsigned-int)
450 (%accel-map-foreach-callback callback))
452 (defun accel-map-foreach (function &optional (filter-p t))
453 (with-callback-function (id function)
455 (%accel-map-foreach id)
456 (%accel-map-foreach-unfiltered id))))
458 (defbinding accel-map-add-filter () nil
461 (defbinding accel-map-get () accel-map)
463 (defbinding accel-map-lock-path () nil
466 (defbinding accel-map-unlock-path () nil
473 (defbinding accessible-connect-widget-destroyed () nil
474 (accessible accessible))
479 (defmethod initialize-instance ((adjustment adjustment) &key value)
482 ;; we need to make sure that the value is set last, otherwise it
483 ;; may be outside current limits and ignored
485 (setf (slot-value adjustment 'value) value))))
488 (defbinding adjustment-changed () nil
489 (adjustment adjustment))
491 (defbinding adjustment-value-changed () nil
492 (adjustment adjustment))
494 (defbinding adjustment-clamp-page () nil
495 (adjustment adjustment)
497 (upper single-float))
502 (defbinding alignment-set () nil
503 (alognment alignment)
504 (x-align single-float)
505 (y-align single-float)
506 (x-scale single-float)
507 (y-scale single-float))
509 (defbinding alignment-get-padding () nil
510 (alognment alignment)
511 (top unsigned-int :out)
512 (bottom unsigned-int :out)
513 (left unsigned-int :out)
514 (right unsigned-int :out))
516 (defbinding alignment-set-padding () nil
517 (alognment alignment)
519 (bottom unsigned-int)
521 (right unsigned-int))
529 (defun (setf bin-child) (child bin)
530 (when-bind (current-child (bin-child bin))
531 (container-remove bin current-child))
532 (container-add bin child)
535 (defmethod compute-signal-function ((bin bin) signal function object args)
536 (declare (ignore signal))
537 (if (eq object :child)
538 #'(lambda (&rest emission-args)
539 (apply function (bin-child bin) (nconc (rest emission-args) args)))
545 (defbinding box-pack-start () nil
550 (padding unsigned-int))
552 (defbinding box-pack-end () nil
557 (padding unsigned-int))
559 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
561 (box-pack-end box child expand fill padding)
562 (box-pack-start box child expand fill padding)))
564 (defbinding box-reorder-child () nil
569 (defbinding box-query-child-packing () nil
572 (expand boolean :out)
574 (padding unsigned-int :out)
575 (pack-type pack-type :out))
577 (defbinding box-set-child-packing () nil
582 (padding unsigned-int)
583 (pack-type pack-type))
589 (defmethod initialize-instance ((button button) &rest initargs &key stock)
591 (apply #'call-next-method button
592 :label stock :use-stock t :use-underline t initargs)
596 (defbinding button-pressed () nil
599 (defbinding button-released () nil
602 (defbinding button-clicked () nil
605 (defbinding button-enter () nil
608 (defbinding button-leave () nil
615 (defbinding calendar-select-month () int
620 (defbinding calendar-select-day () nil
624 (defbinding calendar-mark-day () int
628 (defbinding calendar-unmark-day () int
632 (defbinding calendar-clear-marks () nil
635 (defbinding calendar-get-date () nil
637 (year unsigned-int :out)
638 (month unsigned-int :out)
639 (day unsigned-int :out))
641 (defbinding calendar-freeze () nil
644 (defbinding calendar-thaw () nil
650 (defbinding check-menu-item-toggled () nil
651 (check-menu-item check-menu-item))
656 (defbinding (color-selection-is-adjusting-p
657 "gtk_color_selection_is_adjusting") () boolean
658 (colorsel color-selection))
662 ;;; Color selection dialog -- no functions
668 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
669 &key model content active)
670 (remf initargs :active)
672 (apply #'call-next-method combo-box initargs)
674 (apply #'call-next-method combo-box
675 :model (make-instance 'list-store :column-types '(string))
677 (unless (typep combo-box 'combo-box-entry)
678 (let ((cell (make-instance 'cell-renderer-text)))
679 (cell-layout-pack combo-box cell :expand t)
680 (cell-layout-add-attribute combo-box cell :text 0)))))
682 (mapc #'(lambda (text)
683 (combo-box-append-text combo-box text))
686 (setf (combo-box-active combo-box) active)))
689 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
691 ;; (signal-emit combo-box 'changed)))
693 (defbinding combo-box-append-text () nil
694 (combo-box combo-box)
697 (defbinding combo-box-insert-text () nil
698 (combo-box combo-box)
702 (defbinding combo-box-prepend-text () nil
703 (combo-box combo-box)
706 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
707 (defbinding combo-box-get-active-text () string
708 (combo-box combo-box))
710 (defbinding combo-box-popup () nil
711 (combo-box combo-box))
713 (defbinding combo-box-popdown () nil
714 (combo-box combo-box))
720 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
723 (setf (combo-box-entry-text-column combo-box-entry) 0)))
728 (defmethod shared-initialize ((dialog dialog) names &rest initargs
730 (declare (ignore names button buttons))
733 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
736 (defun dialog-response-id (dialog response &optional create-p error-p)
737 "Returns a numeric response id"
738 (if (typep response 'response-type)
739 (response-type-to-int response)
740 (let ((responses (user-data dialog 'responses)))
742 ((and responses (position response responses :test #'equal)))
746 (vector-push-extend response responses)
747 (1- (length responses)))
750 (user-data dialog 'responses)
751 (make-array 1 :adjustable t :fill-pointer t
752 :initial-element response))
755 (error "Invalid response: ~A" response))))))
757 (defun dialog-find-response (dialog id)
758 "Finds a symbolic response given a numeric id"
760 (int-to-response-type id)
761 (aref (user-data dialog 'responses) id)))
764 (defmethod compute-signal-id ((dialog dialog) signal)
765 (if (dialog-response-id dialog signal)
766 (ensure-signal-id 'response dialog)
769 (defmethod compute-signal-function ((dialog dialog) signal function object args)
770 (declare (ignore function object args))
771 (let ((callback (call-next-method))
772 (id (dialog-response-id dialog signal)))
774 #'(lambda (dialog response)
775 (when (= response id)
776 (funcall callback dialog)))
779 (defbinding dialog-run () nil
782 (defbinding dialog-response (dialog response) nil
784 ((dialog-response-id dialog response nil t) int))
787 (defbinding %dialog-add-button () button
792 (defun dialog-add-button (dialog label &optional (response label)
793 &key default object after)
794 "Adds a button to the dialog."
795 (let* ((signal (if (functionp response)
798 (id (dialog-response-id dialog signal t))
799 (button (%dialog-add-button dialog label id)))
800 (when (functionp response)
801 (signal-connect dialog signal response :object object :after after))
803 (%dialog-set-default-response dialog id))
807 (defbinding %dialog-add-action-widget () nil
809 (action-widget widget)
812 (defun dialog-add-action-widget (dialog widget &optional (response widget)
813 &key default object after)
814 (let* ((signal (if (functionp response)
817 (id (dialog-response-id dialog signal t)))
818 (unless (widget-hidden-p widget)
819 (widget-show widget))
820 (%dialog-add-action-widget dialog widget id)
821 (when (functionp response)
822 (signal-connect dialog signal response :object object :after after))
824 (%dialog-set-default-response dialog id))
828 (defbinding %dialog-set-default-response () nil
832 (defun dialog-set-default-response (dialog response)
833 (%dialog-set-default-response
834 dialog (dialog-response-id dialog response nil t)))
836 (defbinding dialog-set-response-sensitive (dialog response sensitive) nil
838 ((dialog-response-id dialog response nil t) int)
841 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
842 (defbinding alternative-dialog-button-order-p (&optional screen) boolean
843 (screen (or null gdk:screen)))
845 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
846 (defbinding (dialog-set-alternative-button-order
847 "gtk_dialog_set_alternative_button_order_from_array")
848 (dialog new-order) nil
850 ((length new-order) int)
851 ((map 'vector #'(lambda (response)
852 (dialog-response-id dialog response nil t))
853 new-order) (vector int)))
856 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
858 (defbinding %dialog-get-response-for-widget () int
862 (defun dialog-get-response-for-widget (dialog widget)
863 (dialog-find-response dialog (dialog-get-response-for-widget dialog widget))))
866 (defmethod container-add ((dialog dialog) (child widget) &rest args)
867 (apply #'container-add (dialog-vbox dialog) child args))
870 (defmethod container-remove ((dialog dialog) (child widget))
871 (container-remove (dialog-vbox dialog) child))
873 (defmethod container-children ((dialog dialog))
874 (container-children (dialog-vbox dialog)))
876 (defmethod (setf container-children) (children (dialog dialog))
877 (setf (container-children (dialog-vbox dialog)) children))
882 (defun drawing-area-scroll (drawing-area dx dy)
883 (gdk:window-scroll (widget-window drawing-area) dx dy))
888 (defbinding entry-get-layout-offsets () nil
893 (defbinding entry-layout-index-to-text-index () int
897 (defbinding entry-text-index-to-layout-index () int
904 (define-callback-marshal %entry-completion-match-callback boolean
905 (entry-completion string tree-iter))
907 (defbinding entry-completion-set-match-func (completion function) nil
908 (completion entry-completion)
909 (%entry-completion-match-callback callback)
910 ((register-callback-function function) unsigned-int)
911 (user-data-destroy-callback callback))
913 (defbinding entry-completion-complete () nil
914 (completion entry-completion))
916 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
917 (defbinding entry-completion-insert-prefix () nil
918 (completion entry-completion))
920 (defbinding entry-completion-insert-action-text () nil
921 (completion entry-completion)
925 (defbinding entry-completion-insert-action-markup () nil
926 (completion entry-completion)
930 (defbinding entry-completion-delete-action () nil
931 (completion entry-completion)
937 (defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
938 &key filter filters shortcut-folder
939 shortcut-folders shortcut-folder-uti
940 shortcut-folder-uris)
941 (declare (ignore filter filters shortcut-folder shortcut-folders
942 shortcut-folder-uti shortcut-folder-uris))
945 (initial-add file-chooser #'file-chooser-add-filter
946 initargs :filer :filters)
947 (initial-add file-chooser #'file-chooser-add-shortcut-folder
948 initargs :shortcut-folder :shortcut-folders)
949 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
950 initargs :shortcut-folder-uri :shortcut-folders-uris)))
953 (defbinding file-chooser-select-filename () boolean
954 (file-chooser file-chooser)
957 (defbinding file-chooser-unselect-filename () nil
958 (file-chooser file-chooser)
961 (defbinding file-chooser-select-all () boolean
962 (file-chooser file-chooser))
964 (defbinding file-chooser-unselect-all () boolean
965 (file-chooser file-chooser))
967 (defbinding file-chooser-get-filenames () (gslist string)
968 (file-chooser file-chooser))
970 (defbinding file-chooser-select-uri () boolean
971 (file-chooser file-chooser)
974 (defbinding file-chooser-unselect-uri () nil
975 (file-chooser file-chooser)
978 (defbinding file-chooser-get-uris () (gslist string)
979 (file-chooser file-chooser))
981 (defbinding file-chooser-add-filter () nil
982 (file-chooser file-chooser)
983 (filter file-filter))
985 (defbinding file-chooser-remove-filter () nil
986 (file-chooser file-chooser)
987 (filter file-filter))
989 (defbinding file-chooser-list-filters () (gslist file-filter)
990 (file-chooser file-chooser))
992 (defbinding file-chooser-add-shortcut-folder () boolean
993 (file-chooser file-chooser)
997 (defbinding file-chooser-remove-shortcut-folder () nil
998 (file-chooser file-chooser)
1002 (defbinding file-chooser-list-shortcut-folders () (gslist string)
1003 (file-chooser file-chooser))
1005 (defbinding file-chooser-add-shortcut-folder-uri () boolean
1006 (file-chooser file-chooser)
1010 (defbinding file-chooser-remove-shortcut-folder-uri () nil
1011 (file-chooser file-chooser)
1015 (defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
1016 (file-chooser file-chooser))
1021 (defmethod initialize-instance ((file-filter file-filter) &rest initargs
1022 &key mime-type mime-types pattern patterns
1024 (declare (ignore mime-type mime-types pattern patterns))
1027 (when pixbuf-formats
1028 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1029 (warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
1030 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1031 (file-filter-add-pixbuf-formats file-filter))
1032 (initial-add file-filter #'file-filter-add-mime-type
1033 initargs :mime-type :mime-types)
1034 (initial-add file-filter #'file-filter-add-pattern
1035 initargs :pattern :patterns)))
1038 (defbinding file-filter-add-mime-type () nil
1039 (filter file-filter)
1042 (defbinding file-filter-add-pattern () nil
1043 (filter file-filter)
1046 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1047 (defbinding file-filter-add-pixbuf-formats () nil
1048 (filter file-filter))
1050 (define-callback-marshal %file-filter-callback boolean (file-filter-info))
1052 (defbinding file-filter-add-custom (filter needed function) nil
1053 (filter file-filter)
1054 (needed file-filter-flags)
1055 (%file-filter-callback callback)
1056 ((register-callback-function function) unsigned-int)
1057 (user-data-destroy-callback callback))
1059 (defbinding file-filter-get-needed () file-filter-flags
1060 (filter file-filter))
1062 (defbinding file-filter-filter () boolean
1063 (filter file-filter)
1064 (filter-info file-filter-info))
1070 (defbinding image-set-from-file () nil
1072 (filename pathname))
1074 (defmethod (setf image-pixmap) ((data vector) (image image))
1075 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
1076 (setf (image-pixmap image) pixmap)
1077 (setf (image-mask image) mask)))
1079 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
1081 ((typep pixmap 'vector)
1082 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
1083 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
1087 (image-set-from-file image file)))
1088 ((call-next-method))))
1090 (defun create-image-widget (source &optional mask)
1092 (gdk:pixbuf (make-instance 'image :pixbuf source))
1093 (string (make-instance 'image :stock source))
1094 (pathname (make-instance 'image :file source))
1095 ((or list vector) (make-instance 'image :pixmap source))
1096 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
1098 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1099 (defbinding image-clear () nil
1106 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
1107 (if (and image (not (typep image 'widget)))
1108 (apply #'call-next-method item :image (create-image-widget image) initargs)
1109 (call-next-method)))
1112 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
1113 (setf (slot-value item 'image) widget))
1115 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
1116 (setf (image-menu-item-image item) (create-image-widget image)))
1121 (defmethod shared-initialize ((label label) names &key pattern)
1122 (declare (ignore names))
1125 (setf (label-pattern label) pattern)))
1127 (defbinding label-get-layout-offsets () nil
1132 (defbinding label-select-region () nil
1137 (defbinding label-get-selection-bounds () boolean
1146 (defbinding %radio-button-get-group () pointer
1147 (radio-button radio-button))
1149 (defbinding %radio-button-set-group () nil
1150 (radio-button radio-button)
1153 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
1154 "Add BUTTON1 to the group which BUTTON2 belongs to."
1155 (%radio-button-set-group button1 (%radio-button-get-group button2)))
1157 (defun %add-activate-callback (widget signal function object after)
1159 (signal-connect widget signal
1161 (when (slot-value widget 'active)
1162 (funcall function object (slot-value widget 'value))))
1163 :object object :after after)
1164 (signal-connect widget signal
1166 (when (slot-value widget 'active)
1167 (funcall function (slot-value widget 'value))))
1170 (defmethod activate-radio-widget ((button radio-button))
1171 (signal-emit button 'clicked))
1173 (defgeneric add-activate-callback (action function &key object after))
1175 (defmethod add-activate-callback ((button radio-button) function &key object after)
1176 (%add-activate-callback button 'clicked function object after))
1178 (defmethod initialize-instance ((button radio-button) &key group)
1182 (add-to-radio-group button group))))
1187 (defbinding item-select () nil
1190 (defbinding item-deselect () nil
1193 (defbinding item-toggle () nil
1200 (defmethod initialize-instance ((item menu-item) &key label)
1204 (setf (menu-item-label item) label))))
1207 (defun (setf menu-item-label) (label menu-item)
1208 (make-instance 'accel-label
1209 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
1210 :use-underline (menu-item-use-underline-p menu-item)
1211 :visible t :parent menu-item)
1214 (defun menu-item-label (menu-item)
1215 (when (and (slot-boundp menu-item 'child)
1216 (typep (bin-child menu-item) 'label))
1217 (label-label (bin-child menu-item))))
1219 (defbinding menu-item-remove-submenu () nil
1220 (menu-item menu-item))
1222 (defbinding menu-item-set-accel-path () nil
1223 (menu-item menu-item)
1224 (accel-path string))
1226 (defbinding menu-item-select () nil
1227 (menu-item menu-item))
1229 (defbinding menu-item-deselect () nil
1230 (menu-item menu-item))
1232 (defbinding menu-item-activate () nil
1233 (menu-item menu-item))
1235 (defbinding menu-item-toggle-size-request () nil
1236 (menu-item menu-item)
1237 (requisition int :out))
1239 (defbinding menu-item-toggle-size-allocate () nil
1240 (menu-item menu-item)
1244 ;;; Menu tool button
1246 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1247 (defbinding menu-tool-button-set-arrow-tooltip () nil
1248 (menu-tool-button menu-tool-button)
1251 (tip-private string))
1256 (defmethod allocate-foreign ((dialog message-dialog) &key (message-type :info)
1257 (buttons :close) flags transient-parent)
1258 (%message-dialog-new transient-parent flags message-type buttons))
1261 (defmethod shared-initialize ((dialog message-dialog) names &key text
1262 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1264 (declare (ignore names))
1266 (message-dialog-set-markup dialog text))
1267 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1268 (when secondary-text
1269 (message-dialog-format-secondary-markup dialog secondary-text))
1273 (defbinding %message-dialog-new () pointer
1274 (parent (or null window))
1275 (flags dialog-flags)
1277 (buttons buttons-type)
1280 (defbinding message-dialog-set-markup () nil
1281 (message-dialog message-dialog)
1284 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1285 (defbinding message-dialog-format-secondary-text () nil
1286 (message-dialog message-dialog)
1289 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
1290 (defbinding message-dialog-format-secondary-markup () nil
1291 (message-dialog message-dialog)
1298 (defbinding %radio-menu-item-get-group () pointer
1299 (radio-menu-item radio-menu-item))
1301 (defbinding %radio-menu-item-set-group () nil
1302 (radio-menu-item radio-menu-item)
1305 (defmethod activate-radio-widget ((item radio-menu-item))
1306 (menu-item-activate item))
1308 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
1309 "Add ITEM1 to the group which ITEM2 belongs to."
1310 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1312 (defmethod add-activate-callback ((item radio-menu-item) function &key object after)
1313 (%add-activate-callback item 'activate function object after))
1315 (defmethod initialize-instance ((item radio-menu-item) &key group)
1319 (add-to-radio-group item group))))
1323 ;;; Radio tool button
1325 (defbinding %radio-tool-button-get-group () pointer
1326 (radio-tool-button radio-tool-button))
1328 (defbinding %radio-tool-button-set-group () nil
1329 (radio-tool-button radio-tool-button)
1332 (defmethod activate-radio-widget ((button radio-tool-button))
1333 (signal-emit button 'clicked))
1335 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
1336 "Add BUTTON1 to the group which BUTTON2 belongs to."
1337 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1338 (defmethod add-activate-callback ((button radio-tool-button) function &key object after)
1339 (%add-activate-callback button 'clicked function object after))
1341 (defmethod initialize-instance ((button radio-tool-button) &key group)
1345 (add-to-radio-group button group))))
1351 (defbinding toggle-button-toggled () nil
1352 (toggle-button toggle-button))
1357 (defmethod initialize-instance ((window window) &rest initargs
1358 &key display accel-group accel-groups)
1359 (declare (ignore accel-group accel-groups))
1362 (apply #'call-next-method
1363 window :screen (gdk:display-get-default-screen (gdk:ensure-display display)) initargs)
1365 (initial-add window #'window-add-accel-group
1366 initargs :accel-group :accel-groups)))
1368 #-debug-ref-counting
1369 (defmethod print-object ((window window) stream)
1371 (proxy-valid-p window)
1372 (slot-boundp window 'title)
1373 (not (zerop (length (window-title window)))))
1374 (print-unreadable-object (window stream :type t :identity nil)
1375 (format stream "~S at 0x~X"
1376 (window-title window) (pointer-address (foreign-location window))))
1377 (call-next-method)))
1379 (defbinding window-set-wmclass () nil
1381 (wmclass-name string)
1382 (wmclass-class string))
1384 (defbinding window-add-accel-group () nil
1386 (accel-group accel-group))
1388 (defbinding window-remove-accel-group () nil
1390 (accel-group accel-group))
1392 (defbinding window-activate-focus () int
1395 (defbinding window-activate-default () int
1398 (defbinding window-set-default-size (window width height) int
1401 ((or height -1) int))
1403 (defbinding %window-set-geometry-hints () nil
1405 (geometry gdk:geometry)
1406 (geometry-mask gdk:window-hints))
1408 (defun window-set-geometry-hints (window &key min-width min-height
1409 max-width max-height base-width base-height
1410 width-inc height-inc min-aspect max-aspect
1411 (gravity nil gravity-p) min-size max-size)
1412 (let ((geometry (make-instance 'gdk:geometry
1413 :min-width (or min-width -1)
1414 :min-height (or min-height -1)
1415 :max-width (or max-width -1)
1416 :max-height (or max-height -1)
1417 :base-width (or base-width 0)
1418 :base-height (or base-height 0)
1419 :width-inc (or width-inc 0)
1420 :height-inc (or height-inc 0)
1421 :min-aspect (or min-aspect 0)
1422 :max-aspect (or max-aspect 0)
1425 (when (or min-size min-width min-height)
1426 (push :min-size mask))
1427 (when (or max-size max-width max-height)
1428 (push :max-size mask))
1429 (when (or base-width base-height)
1430 (push :base-size mask))
1431 (when (or width-inc height-inc)
1432 (push :resize-inc mask))
1433 (when (or min-aspect max-aspect)
1434 (push :aspect mask))
1436 (push :win-gravity mask))
1437 (%window-set-geometry-hints window geometry mask)))
1439 (defbinding window-list-toplevels () (glist (copy-of window))
1440 "Returns a list of all existing toplevel windows.")
1442 (defbinding window-add-mnemonic (window key target) nil
1444 ((gdk:keyval-from-name key) unsigned-int)
1447 (defbinding window-remove-mnemonic (window key target) nil
1449 ((gdk:keyval-from-name key) unsigned-int)
1452 (defbinding window-mnemonic-activate (window key modifier) nil
1454 ((gdk:keyval-from-name key) unsigned-int)
1455 (modifier gdk:modifier-type))
1457 (defbinding window-activate-key () boolean
1459 (event gdk:key-event))
1461 (defbinding window-propagate-key-event () boolean
1463 (event gdk:key-event))
1465 #?-(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1466 (defbinding window-present () nil
1469 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
1471 (defbinding %window-present () nil
1474 (defbinding %window-present-with-time () nil
1476 (timespamp unsigned-int))
1478 (defun window-present (window &optional timestamp)
1480 (%window-present-with-time window timestamp)
1481 (%window-present window))))
1483 (defbinding window-iconify () nil
1486 (defbinding window-deiconify () nil
1489 (defbinding window-stick () nil
1492 (defbinding window-unstick () nil
1495 (defbinding window-maximize () nil
1498 (defbinding window-unmaximize () nil
1501 (defbinding window-fullscreen () nil
1504 (defbinding window-unfullscreen () nil
1507 (defbinding window-set-keep-above () nil
1511 (defbinding window-set-keep-below () nil
1515 (defbinding window-begin-resize-drag () nil
1517 (edge gdk:window-edge)
1519 (root-x int) (root-y int)
1520 (timestamp unsigned-int))
1522 (defbinding window-begin-move-drag () nil
1524 (edge gdk:window-edge)
1526 (root-x int) (root-y int)
1527 (timestamp unsigned-int))
1529 (defbinding window-set-frame-dimensions () nil
1531 (left int) (top int) (rigth int) (bottom int))
1533 (defbinding %window-get-default-size () nil
1538 (defun window-get-default-size (window)
1539 (multiple-value-bind (width height) (%window-get-default-size window)
1540 (values (unless (= width -1) width) (unless (= height -1) height))))
1542 (defbinding window-get-frame-dimensions () nil
1544 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1546 (defbinding %window-get-icon-list () (glist (copy-of gdk:pixbuf))
1549 (defbinding window-get-position () nil
1554 (defbinding window-get-size () nil
1559 (defbinding window-move () nil
1564 (defbinding window-parse-geometry () boolean
1568 (defbinding window-reshow-with-initial-size () nil
1571 (defbinding window-resize () nil
1576 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1577 () (glist gdk:pixbuf))
1579 (defun window-default-icon ()
1580 (first (window-default-icon-list)))
1582 (defbinding %window-set-default-icon-list () nil
1583 (icons (glist gdk:pixbuf)))
1585 (defun (setf window-default-icon-list) (icons)
1586 (%window-set-default-icon-list icons)
1589 (defbinding %window-set-default-icon () nil
1590 (icons (glist gdk:pixbuf)))
1592 (defgeneric (setf window-default-icon) (icon))
1594 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1595 (%window-set-default-icon icon)
1598 (defgeneric (setf window-group) (group window))
1600 (defmethod (setf window-group) ((group window-group) (window window))
1601 (window-group-add-window group window)
1604 (defbinding %window-set-default-icon-from-file () boolean
1608 (defmethod (setf window-default-icon) ((icon-file pathname))
1609 (%window-set-default-icon-from-file icon-file)
1612 (defbinding %window-set-icon-from-file () boolean
1617 (defmethod (setf window-icon) ((icon-file pathname) (window window))
1618 (%window-set-icon-from-file window icon-file)
1621 (defbinding window-set-auto-startup-notification () nil
1624 (defbinding decorated-window-init () nil
1627 (defbinding decorated-window-calculate-frame-size () nil
1630 (defbinding decorated-window-set-title () nil
1634 (defbinding decorated-window-move-resize-window () nil
1644 (defmethod initialize-instance ((window-group window-group) &rest initargs
1645 &key window windows)
1646 (declare (ignore window windows))
1649 (initial-add window-group #'window-group-add-window
1650 initargs :window :windows)))
1653 (defbinding window-group-add-window () nil
1654 (window-group window-group)
1657 (defbinding window-group-remove-window () nil
1658 (window-group window-group)
1664 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1665 (setf (scrolled-window-hscrollbar-policy window) policy)
1666 (setf (scrolled-window-vscrollbar-policy window) policy))
1668 (defbinding scrolled-window-add-with-viewport () nil
1669 (scrolled-window scrolled-window)
1672 (defmethod shared-initialize ((window scrolled-window) names &key policy)
1673 (declare (ignore names))
1675 (setf (slot-value window 'hscrollbar-policy) policy)
1676 (setf (slot-value window 'vscrollbar-policy) policy))
1682 (defbinding statusbar-get-context-id () unsigned-int
1683 (statusbar statusbar)
1684 (context-description string))
1686 (defbinding statusbar-push () unsigned-int
1687 (statusbar statusbar)
1688 (context-id unsigned-int)
1691 (defbinding statusbar-pop () nil
1692 (statusbar statusbar)
1693 (context-id unsigned-int))
1695 (defbinding statusbar-remove () nil
1696 (statusbar statusbar)
1697 (context-id unsigned-int)
1698 (message-id unsigned-int))
1704 (defbinding fixed-put () nil
1709 (defbinding fixed-move () nil
1718 (defun %ensure-notebook-position (notebook page)
1721 (widget (notebook-page-num notebook page t))))
1723 (defun %ensure-notebook-child (notebook position)
1726 (t (notebook-get-nth-page notebook position))))
1728 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1729 (notebook position child &optional tab-label menu-label) nil
1732 ((if (stringp tab-label)
1733 (make-instance 'label :label tab-label)
1734 tab-label) (or null widget))
1735 ((if (stringp menu-label)
1736 (make-instance 'label :label menu-label)
1737 menu-label) (or null widget))
1738 ((%ensure-notebook-position notebook position) position))
1740 (defun notebook-append (notebook child &optional tab-label menu-label)
1741 (notebook-insert notebook :last child tab-label menu-label))
1743 (defun notebook-prepend (notebook child &optional tab-label menu-label)
1744 (notebook-insert notebook :first child tab-label menu-label))
1746 (defbinding notebook-remove-page (notebook page) nil
1748 ((%ensure-notebook-position notebook page) position))
1750 (defbinding %notebook-page-num () int
1754 (defun notebook-page-num (notebook child &optional error-p)
1755 (let ((page-num (%notebook-page-num notebook child)))
1758 (error "~A is not a page in ~A" child notebook))
1761 (defbinding notebook-next-page () nil
1762 (notebook notebook))
1764 (defbinding notebook-prev-page () nil
1765 (notebook notebook))
1767 (defbinding notebook-reorder-child (notebook child position) nil
1770 ((%ensure-notebook-position notebook position) int))
1772 (defbinding notebook-popup-enable () nil
1773 (notebook notebook))
1775 (defbinding notebook-popup-disable () nil
1776 (notebook notebook))
1778 (defbinding notebook-get-nth-page () widget
1782 (defun %notebook-current-page (notebook)
1783 (when (slot-boundp notebook 'current-page-num)
1784 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
1786 (defun (setf notebook-current-page) (page notebook)
1787 (setf (notebook-current-page-num notebook) (notebook-page-num notebook page)))
1789 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1790 (notebook page) widget
1792 ((%ensure-notebook-child notebook page) widget))
1794 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1795 (notebook page) (copy-of string)
1797 ((%ensure-notebook-child notebook page) widget))
1799 (defbinding %notebook-set-tab-label () nil
1804 (defun (setf notebook-tab-label) (tab-label notebook page)
1805 (let ((widget (if (stringp tab-label)
1806 (make-instance 'label :label tab-label)
1808 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1812 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1813 (notebook page) widget
1815 ((%ensure-notebook-child notebook page) widget))
1817 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1818 (notebook page) (copy-of string)
1820 ((%ensure-notebook-child notebook page) widget))
1822 (defbinding %notebook-set-menu-label () nil
1825 (menu-label widget))
1827 (defun (setf notebook-menu-label) (menu-label notebook page)
1828 (let ((widget (if (stringp menu-label)
1829 (make-instance 'label :label menu-label)
1831 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1835 (defbinding notebook-query-tab-label-packing (notebook page) nil
1837 ((%ensure-notebook-child notebook page) widget)
1838 (expand boolean :out)
1840 (pack-type pack-type :out))
1842 (defbinding notebook-set-tab-label-packing
1843 (notebook page expand fill pack-type) nil
1845 ((%ensure-notebook-child notebook page) widget)
1848 (pack-type pack-type))
1854 (defbinding paned-pack1 () nil
1860 (defbinding paned-pack2 () nil
1869 (defbinding layout-put () nil
1875 (defbinding layout-move () nil
1881 (defbinding layout-set-size () nil
1883 (width unsigned-int)
1884 (height unsigned-int))
1886 (defbinding layout-get-size () nil
1888 (width unsigned-int :out)
1889 (height unsigned-int :out))
1894 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1895 (menu-shell menu-shell)
1896 (menu-item menu-item)
1902 (defun menu-shell-append (menu-shell menu-item)
1903 (menu-shell-insert menu-shell menu-item :last))
1905 (defun menu-shell-prepend (menu-shell menu-item)
1906 (menu-shell-insert menu-shell menu-item :fisrt))
1908 (defbinding menu-shell-deactivate () nil
1909 (menu-shell menu-shell))
1911 (defbinding menu-shell-select-item () nil
1912 (menu-shell menu-shell)
1913 (menu-item menu-item))
1915 (defbinding menu-shell-select-first () nil
1916 (menu-shell menu-shell)
1917 (search-sensitive boolean))
1919 (defbinding menu-shell-deselect () nil
1920 (menu-shell menu-shell))
1922 (defbinding menu-shell-activate-item () nil
1923 (menu-shell menu-shell)
1924 (menu-item menu-item)
1925 (fore-deactivate boolean))
1927 (defbinding menu-shell-cancel () nil
1928 (menu-shell menu-shell))
1933 (defun %menu-position (menu child)
1936 (keyword (case child
1939 (t (error "Invalid position keyword: ~A" child))))
1940 (widget (menu-child-position menu child))))
1943 (defbinding menu-reorder-child (menu menu-item position) nil
1945 (menu-item menu-item)
1946 ((%menu-position menu position) int))
1948 (defbinding menu-attach () nil
1950 (menu-item menu-item)
1951 (left-attach unsigned-int)
1952 (right-attach unsigned-int)
1953 (top-attach unsigned-int)
1954 (bottom-attach unsigned-int))
1956 (define-callback-marshal %menu-position-callback nil
1957 (menu (x int) (y int) (push-in boolean)))
1959 (defbinding %menu-popup () nil
1961 (parent-menu-shell (or null menu-shell))
1962 (parent-menu-item (or null menu-item))
1963 (callback (or null callback))
1964 (callback-id unsigned-int)
1965 (button unsigned-int)
1966 (activate-time (unsigned 32)))
1968 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1971 (with-callback-function (id callback)
1973 menu parent-menu-shell parent-menu-item
1974 %menu-position-callback id button activate-time))
1976 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1978 (defbinding menu-set-accel-path () nil
1980 (accel-path string))
1982 (defbinding menu-reposition () nil
1985 (defbinding menu-popdown () nil
1988 (defun menu-child-position (menu child)
1989 (position child (container-children menu)))
1991 (defun menu-active-num (menu)
1992 (menu-child-position menu (menu-active menu)))
1994 (defbinding %menu-set-active () nil
1996 (index unsigned-int))
1998 (defun (setf menu-active) (menu child)
1999 (%menu-set-active menu (%menu-position menu child))
2002 (define-callback %menu-detach-callback nil ((widget widget) (menu menu))
2003 (funcall (user-data menu 'detach-func) widget menu))
2005 (defbinding %menu-attach-to-widget (menu widget) nil
2008 (%menu-detach-callback callback))
2010 (defun menu-attach-to-widget (menu widget function)
2011 (setf (user-data menu 'detach-func) function)
2012 (%menu-attach-to-widget menu widget))
2014 (defbinding menu-detach () nil
2017 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
2018 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
2021 (defbinding menu-set-monitor () nil
2028 (defbinding table-resize () nil
2031 (columns unsigned-int))
2033 (defbinding table-attach (table child left right top bottom
2034 &key options x-options y-options
2035 (x-padding 0) (y-padding 0)) nil
2039 (right unsigned-int)
2041 (bottom unsigned-int)
2042 ((append (mklist options) (mklist x-options)) attach-options)
2043 ((append (mklist options) (mklist y-options)) attach-options)
2044 (x-padding unsigned-int)
2045 (y-padding unsigned-int))
2048 (defbinding %table-set-row-spacing () nil
2051 (spacing unsigned-int))
2053 (defbinding %table-set-row-spacings () nil
2055 (spacing unsigned-int))
2057 (defun (setf table-row-spacing) (spacing table &optional row)
2059 (%table-set-row-spacing table row spacing)
2060 (%table-set-row-spacings table spacing))
2063 (defbinding %table-get-row-spacing () unsigned-int
2067 (defbinding %table-get-default-row-spacing () unsigned-int
2070 (defun table-row-spacing (table &optional row)
2072 (%table-get-row-spacing table row)
2073 (%table-get-default-row-spacing table)))
2076 (defbinding %table-set-col-spacing () nil
2079 (spacing unsigned-int))
2081 (defbinding %table-set-col-spacings () nil
2083 (spacing unsigned-int))
2085 (defun (setf table-column-spacing) (spacing table &optional column)
2087 (%table-set-col-spacing table column spacing)
2088 (%table-set-col-spacings table spacing))
2091 (defun (setf table-col-spacing) (spacing table &optional col)
2092 (warn "TABLE-COL-SPACING is deprecatet, use TABLE-COLUMN-SPACING instead")
2093 (setf (table-column-spacing table col) spacing))
2095 (defbinding %table-get-col-spacing () unsigned-int
2099 (defbinding %table-get-default-col-spacing () unsigned-int
2102 (defun table-column-spacing (table &optional column)
2104 (%table-get-col-spacing table column)
2105 (%table-get-default-col-spacing table)))
2107 (defun table-col-spacing (table &optional col)
2108 (warn "TABLE-COL-SPACING is deprecatet, use TABLE-COLUMN-SPACING instead")
2109 (table-column-spacing table col))
2115 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
2117 (apply #'call-next-method toolbar
2118 :tooltips (make-instance 'tooltips) initargs)
2119 (call-next-method)))
2121 (defbinding %toolbar-insert () nil
2123 (tool-item tool-item)
2124 (position position))
2126 (defun toolbar-insert (toolbar tool-item &optional (position :end))
2127 (%toolbar-insert toolbar tool-item position)
2128 (%tool-item-update-tooltips tool-item))
2130 (defbinding toolbar-get-item-index () int
2134 (defbinding toolbar-get-nth-item () tool-item
2138 (defbinding toolbar-get-drop-index () int
2142 (defbinding toolbar-set-drop-highlight-item () nil
2144 (tool-item tool-item)
2150 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
2151 (if (and icon (not (typep icon 'widget)))
2152 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
2153 (call-next-method)))
2158 (defbinding tool-item-set-tooltip () nil
2159 (tool-item tool-item)
2162 (tip-private string))
2165 (defun %tool-item-update-tooltips (tool-item)
2167 (slot-boundp tool-item 'parent)
2169 (user-data-p tool-item 'tip-text)
2170 (user-data-p tool-item 'tip-private)))
2171 (tool-item-set-tooltip
2172 tool-item (toolbar-tooltips (widget-parent tool-item))
2173 (or (user-data tool-item 'tip-text) "")
2174 (or (user-data tool-item 'tip-private) ""))))
2176 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
2177 (setf (user-data tool-item 'tip-text) tip-text)
2178 (%tool-item-update-tooltips tool-item)
2181 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
2182 (setf (user-data tool-item 'tip-private) tip-private)
2183 (%tool-item-update-tooltips tool-item)
2186 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
2187 (declare (ignore args))
2190 (%tool-item-update-tooltips tool-item)))
2193 (defbinding tool-item-retrieve-proxy-menu-item () widget
2194 (tool-item tool-item))
2196 (defbinding (tool-item-proxy-menu-item
2197 "gtk_tool_item_get_proxy_menu_item") () menu-item
2198 (tool-item tool-item)
2199 (menu-item-id string))
2201 (defbinding %tool-item-set-proxy-menu-item () nil
2202 (tool-item tool-item)
2203 (menu-item-id string)
2204 (menu-item menu-item))
2206 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
2207 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
2210 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.6.0")
2211 (defbinding tool-item-rebuild-menu () nil
2212 (tool-item tool-item))
2217 (defbinding editable-select-region (editable &optional (start 0) end) nil
2222 (defbinding editable-get-selection-bounds (editable) nil
2227 (defbinding editable-insert-text (editable text &optional (position 0)) nil
2231 (position position :in/out))
2233 (defun editable-append-text (editable text)
2234 (editable-insert-text editable text nil))
2236 (defun editable-prepend-text (editable text)
2237 (editable-insert-text editable text 0))
2239 (defbinding editable-delete-text (editable &optional (start 0) end) nil
2244 (defbinding (editable-text "gtk_editable_get_chars")
2245 (editable &optional (start 0) end) string
2250 (defun (setf editable-text) (text editable)
2252 (editable-delete-text
2254 (editable-insert-text editable text))
2255 (editable-delete-text editable))
2258 (defbinding editable-cut-clipboard () nil
2259 (editable editable))
2261 (defbinding editable-copy-clipboard () nil
2262 (editable editable))
2264 (defbinding editable-paste-clipboard () nil
2265 (editable editable))
2267 (defbinding editable-delete-selection () nil
2268 (editable editable))
2274 (defbinding spin-button-configure () nil
2275 (spin-button spin-button)
2276 (adjustment adjustment)
2277 (climb-rate double-float)
2278 (digits unsigned-int))
2280 (defbinding spin-button-set-range () nil
2281 (spin-button spin-button)
2285 (defbinding spin-button-get-range () nil
2286 (spin-button spin-button)
2287 (min double-float :out)
2288 (max double-float :out))
2290 (defun spin-button-value-as-int (spin-button)
2291 (round (spin-button-value spin-button)))
2293 (defbinding %spin-button-spin () nil
2294 (spin-button spin-button)
2295 (direction spin-type)
2296 (increment double-float))
2298 (defun spin-button-spin (spin-button value)
2300 (real (%spin-button-spin spin-button :spin-user-defined value))
2301 (spin-type (%spin-button-spin spin-button value 0))))
2304 (defbinding spin-button-update () nil
2305 (spin-button spin-button))
2311 (defbinding ruler-set-range () nil
2313 (lower single-float)
2314 (upper single-float)
2315 (position single-float)
2316 (max-size single-float))
2318 (defbinding ruler-get-range () nil
2320 (lower single-float :out)
2321 (upper single-float :out)
2322 (position single-float :out)
2323 (max-size single-float :out))
2329 (defun range-lower (range)
2330 (adjustment-lower (range-adjustment range)))
2332 (defun range-upper (range)
2333 (adjustment-upper (range-adjustment range)))
2335 (defun (setf range-lower) (value range)
2336 (setf (adjustment-lower (range-adjustment range)) value))
2338 (defun (setf range-upper) (value range)
2339 (setf (adjustment-upper (range-adjustment range)) value))
2341 (defun range-page-increment (range)
2342 (adjustment-page-increment (range-adjustment range)))
2344 (defun range-step-increment (range)
2345 (adjustment-step-increment (range-adjustment range)))
2347 (defun (setf range-page-increment) (value range)
2348 (setf (adjustment-page-increment (range-adjustment range)) value))
2350 (defun (setf range-step-increment) (value range)
2351 (setf (adjustment-step-increment (range-adjustment range)) value))
2353 (defbinding range-set-range () nil
2355 (lower double-float)
2356 (upper double-float))
2358 (defbinding range-set-increments () nil
2361 (page double-float))
2366 (defbinding scale-get-layout-offsets () nil
2374 (defbinding progress-bar-pulse () nil
2375 (progress-bar progress-bar))
2380 (defmethod initialize-instance ((size-group size-group) &rest initargs
2381 &key widget widgets)
2382 (declare (ignore widget widgets))
2385 (initial-add size-group #'size-group-add-widget
2386 initargs :widget :widgets)))
2389 (defbinding size-group-add-widget () nil
2390 (size-group size-group)
2393 (defbinding size-group-remove-widget () nil
2394 (size-group size-group)
2400 (defbinding %stock-item-copy () pointer
2403 (defbinding %stock-item-free () nil
2406 (defbinding stock-add (stock-item) nil
2407 (stock-item stock-item)
2410 (defbinding stock-list-ids () (gslist string))
2412 (defbinding %stock-lookup () boolean
2416 (defun stock-lookup (stock-id)
2417 (with-memory (stock-item (foreign-size (find-class 'stock-item)))
2418 (when (%stock-lookup stock-id stock-item)
2419 (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item)))))
2421 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.8.0")
2423 (define-callback-marshal %stock-translate-callback string ((path string)))
2425 (defbinding (stock-set-translate-function "gtk_stock_set_translate_func")
2426 (domain function) nil
2428 (%stock-translate-callback callback)
2429 ((register-callback-function function) unsigned-int)
2430 (user-data-destroy-callback callback)))
2436 (defbinding tooltips-enable () nil
2437 (tooltips tooltips))
2439 (defbinding tooltips-disable () nil
2440 (tooltips tooltips))
2442 (defun (setf tooltips-enabled-p) (enable tooltips)
2444 (tooltips-enable tooltips)
2445 (tooltips-disable tooltips)))
2447 (defbinding tooltips-set-tip () nil
2451 (tip-private string))
2453 (defbinding tooltips-data-get () tooltips-data
2456 (defbinding tooltips-force-window () nil
2457 (tooltips tooltips))
2459 (defbinding tooltips-get-info-from-tip-window () boolean
2461 (tooltips tooltips :out)
2462 (current-widget widget :out))
2467 (defbinding rc-get-style () style
2470 (defbinding rc-get-style-by-paths (&key path class-path class) style
2471 (path (or null string))
2472 (class-path (or null string))
2475 (defbinding rc-parse () nil
2476 (filename pathname))
2478 (defbinding rc-parse-string () nil
2481 (defbinding %rc-reparse-all () boolean)
2483 (defbinding %rc-reparse-all-for-settings () boolean
2485 (force-load-p boolean))
2487 (defun rc-reparse-all (&optional setting force-load-p)
2489 (%rc-reparse-all-for-settings setting force-load-p)
2492 (defbinding rc-reset-styles () nil
2493 (settings settings))
2495 (defbinding rc-add-default-file () nil
2496 (filename pathname))
2498 (defbinding rc-get-default-files ()
2499 (copy-of (null-terminated-vector (copy-of string))))
2501 (defbinding rc-get-module-dir () string)
2503 (defbinding rc-get-im-module-path () string)
2505 (defbinding rc-get-im-module-file () string)
2507 (defbinding rc-get-theme-dir () string)
2512 (defbinding (settings-get "gtk_settings_get_for_screen")
2513 (&optional (screen (gdk:display-get-default-screen))) settings
2514 (screen gdk:screen))
2519 (defbinding socket-add-id () nil
2521 (id gdk:native-window))
2523 (defbinding %plug-new () pointer
2524 (id gdk:native-window))
2526 (defmethod allocate-foreign ((plug plug) &key id)
2527 (%plug-new (or id 0)))
2530 ;;;; New stuff in Gtk+ 2.10
2534 #?(pkg-exists-p "gtk+-2.0" :atleast-version "2.10.0")
2536 (define-callback-marshal %link-button-uri-callback nil (link-button (link string)))
2538 (defbinding link-button-set-uri-hook (function) pointer
2539 (%link-button-uri-callback callback)
2540 ((register-callback-function function) unsigned-int)
2541 (user-data-destroy-callback callback)))