1 ;; Common Lisp bindings for GTK+ v2.0
2 ;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
4 ;; This library is free software; you can redistribute it and/or
5 ;; modify it under the terms of the GNU Lesser General Public
6 ;; License as published by the Free Software Foundation; either
7 ;; version 2 of the License, or (at your option) any later version.
9 ;; This library is distributed in the hope that it will be useful,
10 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ;; Lesser General Public License for more details.
14 ;; You should have received a copy of the GNU Lesser General Public
15 ;; License along with this library; if not, write to the Free Software
16 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ;; $Id: gtk.lisp,v 1.27 2004-12-26 11:51:21 espen Exp $
25 (defbinding check-version () (copy-of string)
26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
30 (defbinding query-version () nil
31 (major unsigned-int :out)
32 (minor unsigned-int :out)
33 (micro unsigned-int :out))
36 (multiple-value-bind (major minor micro)
39 (format nil "Gtk+ v~A.~A" major minor)
40 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
42 (defbinding get-default-language () (copy-of pango:language))
47 (defbinding (gtk-init "gtk_parse_args") () nil
48 "Initializes the library without opening the display."
52 (defun clg-init (&optional display)
53 "Initializes the system and starts the event handling"
54 (unless (gdk:display-get-default)
58 (gdk:display-open display)
59 (system:add-fd-handler
60 (gdk:display-connection-number) :input #'main-iterate-all)
61 (setq lisp::*periodic-polling-function* #'main-iterate-all)
62 (setq lisp::*max-event-to-sec* 0)
63 (setq lisp::*max-event-to-usec* 1000))))
72 (defbinding accel-label-refetch () boolean
73 (accel-label accel-label))
78 (defmethod shared-initialize ((adjustment adjustment) names &key value)
81 ;; we need to make sure that the value is set last, otherwise it
82 ;; may be outside current limits
84 (setf (slot-value adjustment 'value) value))))
87 (defbinding adjustment-changed () nil
88 (adjustment adjustment))
90 (defbinding adjustment-value-changed () nil
91 (adjustment adjustment))
93 (defbinding adjustment-clamp-page () nil
94 (adjustment adjustment)
99 ;;; Arrow -- no functions
108 (defun (setf bin-child) (child bin)
109 (when-bind (current-child (bin-child bin))
110 (container-remove bin current-child))
111 (container-add bin child)
121 (defbinding box-pack-start () nil
126 (padding unsigned-int))
128 (defbinding box-pack-end () nil
133 (padding unsigned-int))
135 (defun box-pack (box child &key end expand fill (padding 0))
137 (box-pack-end box child expand fill padding)
138 (box-pack-start box child expand fill padding)))
140 (defbinding box-reorder-child () nil
145 (defbinding box-query-child-packing () nil
148 (expand boolean :out)
150 (padding unsigned-int :out)
151 (pack-type pack-type :out))
153 (defbinding box-set-child-packing () nil
158 (padding unsigned-int)
159 (pack-type pack-type))
165 (defbinding button-pressed () nil
168 (defbinding button-released () nil
171 (defbinding button-clicked () nil
174 (defbinding button-enter () nil
177 (defbinding button-leave () nil
184 (defbinding calendar-select-month () int
189 (defbinding calendar-select-day () nil
193 (defbinding calendar-mark-day () int
197 (defbinding calendar-unmark-day () int
201 (defbinding calendar-clear-marks () nil
204 (defbinding calendar-display-options () nil
206 (options calendar-display-options))
208 (defbinding (calendar-date "gtk_calendar_get_date") () nil
210 (year unsigned-int :out)
211 (month unsigned-int :out)
212 (day unsigned-int :out))
214 (defbinding calendar-freeze () nil
217 (defbinding calendar-thaw () nil
230 ;;; Cell renderer pixbuf -- no functions
234 ;;; Cell renderer text
238 ;;; Cell renderer toggle -- no functions
242 ;;; Check button -- no functions
248 (defbinding check-menu-item-toggled () nil
249 (check-menu-item check-menu-item))
258 (defbinding (color-selection-is-adjusting-p
259 "gtk_color_selection_is_adjusting") () boolean
260 (colorsel color-selection))
264 ;;; Color selection dialog -- no functions
270 (defmethod shared-initialize ((combo-box combo-box) names &key model content)
273 (combo-box-model combo-box)
274 (make-instance 'list-store :column-types '(string)))
275 (unless (typep combo-box 'combo-box-entry)
276 (let ((cell (make-instance 'cell-renderer-text)))
277 (cell-layout-pack combo-box cell :expand t)
278 (cell-layout-add-attribute combo-box cell :text 0)))
280 (map 'nil #'(lambda (text)
281 (combo-box-append-text combo-box text))
285 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
287 ;; (signal-emit combo-box 'changed)))
289 (defbinding combo-box-append-text () nil
290 (combo-box combo-box)
293 (defbinding combo-box-insert-text () nil
294 (combo-box combo-box)
298 (defbinding combo-box-prepend-text () nil
299 (combo-box combo-box)
303 (defbinding combo-box-get-active-text () string
304 (combo-box combo-box))
306 (defbinding combo-box-popup () nil
307 (combo-box combo-box))
309 (defbinding combo-box-popdown () nil
310 (combo-box combo-box))
316 (defmethod shared-initialize ((combo-box-entry combo-box-entry) names &key model)
319 (setf (combo-box-entry-text-column combo-box-entry) 0)))
324 (defmethod shared-initialize ((dialog dialog) names &rest initargs
326 (declare (ignore button buttons))
329 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
332 (defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
334 (cadr (assoc id (rest (type-expand-1 'response-type))))
335 (let ((response-ids (object-data dialog 'response-id-key)))
337 ((and response-ids (position id response-ids :test #'equal)))
341 (vector-push-extend id response-ids)
342 (1- (length response-ids)))
345 (object-data dialog 'response-id-key)
346 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
349 (error "Invalid response: ~A" id))))))
351 (defun %dialog-find-response-id (dialog response-id-num)
352 (if (< response-id-num 0)
355 (list response-id-num)
356 (rest (type-expand-1 'response-type)) :test #'equal))
357 (aref (object-data dialog 'response-id-key) response-id-num )))
360 (defmethod signal-connect ((dialog dialog) signal function &key object after)
361 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
366 #'(lambda (dialog id)
367 (when (= id response-id-num)
369 ((eq object t) (funcall function dialog))
370 (object (funcall function object))
371 (t (funcall function)))))
372 :object t :after after))
373 ((call-next-method)))))
376 (defbinding dialog-run () nil
379 (defbinding dialog-response (dialog response-id) nil
381 ((%dialog-find-response-id-num dialog response-id nil t) int))
384 (defbinding %dialog-add-button () button
387 (response-id-num int))
389 (defun dialog-add-button (dialog label &optional (response label)
390 &key default object after)
391 "Adds a button to the dialog."
392 (let* ((id (if (functionp response)
395 (id-num (%dialog-find-response-id-num dialog id t))
396 (button (%dialog-add-button dialog label id-num)))
397 (when (functionp response)
398 (signal-connect dialog id response :object object :after after))
400 (%dialog-set-default-response dialog id-num))
404 (defbinding %dialog-add-action-widget () button
406 (action-widget widget)
407 (response-id-num int))
409 (defun dialog-add-action-widget (dialog widget &optional (response widget)
410 &key default object after)
411 (let* ((id (if (functionp response)
414 (id-num (%dialog-find-response-id-num dialog id t)))
415 (%dialog-add-action-widget dialog widget id-num)
416 (when (functionp response)
417 (signal-connect dialog id response :object object :after after))
419 (%dialog-set-default-response dialog id-num))
423 (defbinding %dialog-set-default-response () nil
425 (response-id-num int))
427 (defun dialog-set-default-response (dialog response-id)
428 (%dialog-set-default-response
429 dialog (%dialog-find-response-id-num dialog response-id nil t)))
431 (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
433 ((%dialog-find-response-id-num dialog response-id nil t) int)
437 (defbinding alternative-dialog-button-order-p(&optional screen)
438 (screen (or null screen)))
441 (defbinding (dialog-set-alternative-button-order
442 "gtk_dialog_set_alternative_button_order_from_array")
445 ((length new-order) int)
446 ((map 'vector #'(lambda (id)
447 (%dialog-find-response-id-num dialog id nil t))
448 new-order) (vector int)))
451 (defmethod container-add ((dialog dialog) (child widget) &rest args)
452 (apply #'container-add (dialog-vbox dialog) child args))
454 (defmethod container-remove ((dialog dialog) (child widget))
455 (container-remove (dialog-vbox dialog) child))
457 (defmethod container-children ((dialog dialog))
458 (container-children (dialog-vbox dialog)))
460 (defmethod (setf container-children) (children (dialog dialog))
461 (setf (container-children (dialog-vbox dialog)) children))
467 (defbinding drawing-area-get-size () nil
468 (drawing-area drawing-area)
475 (defbinding entry-get-layout () pango:layout
478 (defbinding entry-get-layout-offsets () nil
486 (def-callback-marshal %entry-completion-match-func
487 (boolean entry-completion string (copy-of tree-iter)))
489 (defbinding entry-completion-set-match-func (completion function) nil
490 (completion entry-completion)
491 ((callback %entry-completion-match-func) pointer)
492 ((register-callback-function function) unsigned-int)
493 ((callback %destroy-user-data) pointer))
495 (defbinding entry-completion-complete () nil
496 (completion entry-completion))
499 (defbinding entry-completion-insert-prefix () nil
500 (completion entry-completion))
502 (defbinding entry-completion-insert-action-text () nil
503 (completion entry-completion)
507 (defbinding entry-completion-insert-action-markup () nil
508 (completion entry-completion)
512 (defbinding entry-completion-delete-action () nil
513 (completion entry-completion)
519 (defbinding image-set-from-file () nil
523 (defbinding image-set-from-pixmap () nil
528 (defbinding image-set-from-stock () nil
531 (icon-size icon-size))
533 (defun image-set-from-pixmap-data (image pixmap-data)
534 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap-data)
535 (image-set-from-pixmap image pixmap mask)))
537 (defun image-set-from-source (image source)
539 (pathname (image-set-from-file image source))
540 (string (if (stock-lookup source)
541 (setf (image-stock image) source)
542 (image-set-from-file image source)))
543 (vector (image-set-from-pixmap-data image source))))
546 (defmethod shared-initialize ((image image) names &rest initargs
547 &key file pixmap source)
551 (remf initargs :pixmap)
552 (apply #'call-next-method image names initargs))
555 (file (image-set-from-file image file))
556 ((vectorp pixmap) (image-set-from-pixmap-data image pixmap))
557 (source (image-set-from-source image source)))))
562 (defbinding label-get-layout-offsets () nil
567 (defbinding label-select-region () nil
572 (defbinding label-get-text () string
575 (defbinding label-get-layout () pango:layout
578 (defbinding label-get-selection-bounds () boolean
587 (defbinding %radio-button-get-group () pointer
588 (radio-button radio-button))
590 (defbinding %radio-button-set-group () nil
591 (radio-button radio-button)
594 (defun radio-button-add-to-group (button1 button2)
595 "Add BUTTON1 to the group which BUTTON2 belongs to."
596 (%radio-button-set-group button1 (%radio-button-get-group button2)))
599 (defmethod initialize-instance ((button radio-button)
600 &rest initargs &key group-with)
601 (declare (ignore initargs))
604 (radio-button-add-to-group button group-with)))
609 (defbinding item-select () nil
612 (defbinding item-deselect () nil
615 (defbinding item-toggle () nil
622 (defun (setf menu-item-label) (label menu-item)
623 (make-instance 'accel-label
624 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
625 :visible t :parent menu-item)
628 (defun menu-item-label (menu-item)
629 (with-slots (child) menu-item
630 (when (typep child 'label)
631 (label-label child))))
633 (defbinding %menu-item-set-submenu () nil
634 (menu-item menu-item)
637 (defbinding %menu-item-remove-submenu () nil
638 (menu-item menu-item))
640 (defun (setf menu-item-submenu) (submenu menu-item)
642 (%menu-item-remove-submenu menu-item)
643 (%menu-item-set-submenu menu-item submenu))
646 (defbinding menu-item-set-accel-path () nil
647 (menu-item menu-item)
650 (defbinding menu-item-select () nil
651 (menu-item menu-item))
653 (defbinding menu-item-deselect () nil
654 (menu-item menu-item))
656 (defbinding menu-item-activate () nil
657 (menu-item menu-item))
659 (defbinding menu-item-toggle-size-request () nil
660 (menu-item menu-item)
661 (requisition int :out))
663 (defbinding menu-item-toggle-size-allocate () nil
664 (menu-item menu-item)
670 (defmethod initialize-instance ((dialog message-dialog) &rest initargs
671 &key (type :info) (buttons :close) ; or :ok?
672 flags message parent)
673 (remf initargs :parent)
675 (slot-value dialog 'location)
676 (%message-dialog-new parent flags type buttons nil))
677 (message-dialog-set-markup dialog message)
678 (apply #'call-next-method dialog initargs))
681 (defbinding %message-dialog-new () pointer
682 (parent (or null window))
685 (buttons buttons-type)
686 (message (or null string)))
688 (defbinding %message-dialog-new-with-markup () pointer
689 (parent (or null window))
692 (buttons buttons-type)
695 (defbinding message-dialog-set-markup () nil
696 (message-dialog message-dialog)
700 (defbinding message-dialog-format-secondary-text () nil
701 (message-dialog message-dialog)
705 (defbinding message-dialog-format-secondary-markup () nil
706 (message-dialog message-dialog)
713 (defbinding %radio-menu-item-get-group () pointer
714 (radio-menu-item radio-menu-item))
716 (defbinding %radio-menu-item-set-group () nil
717 (radio-menu-item radio-menu-item)
720 (defun radio-menu-item-add-to-group (item1 item2)
721 "Add ITEM1 to the group which ITEM2 belongs to."
722 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
724 (defmethod initialize-instance ((item radio-menu-item)
725 &rest initargs &key group-with)
726 (declare (ignore initargs))
730 (radio-menu-item-add-to-group item group-with))))
736 (defbinding toggle-button-toggled () nil
737 (toggle-button toggle-button))
743 (defmethod initialize-instance ((window window) &rest initargs
744 &key accel-group accel-groups)
745 (declare (ignore accel-group accel-groups))
748 (initial-add window #'window-add-accel-group
749 initargs :accel-group :accel-groups)))
752 (defbinding window-set-wmclass () nil
754 (wmclass-name string)
755 (wmclass-class string))
757 (defbinding window-add-accel-group () nil
759 (accel-group accel-group))
761 (defbinding window-remove-accel-group () nil
763 (accel-group accel-group))
765 (defbinding window-activate-focus () int
768 (defbinding window-activate-default () int
771 (defbinding window-set-default-size (window width height) int
774 ((or height -1) int))
776 (defbinding %window-set-geometry-hints () nil
778 (geometry gdk:geometry)
779 (geometry-mask gdk:window-hints))
781 (defun window-set-geometry-hints (window &key min-width min-height
782 max-width max-height base-width base-height
783 width-inc height-inc min-aspect max-aspect
784 (gravity nil gravity-p) min-size max-size)
785 (let ((geometry (make-instance 'gdk:geometry
786 :min-width (or min-width -1)
787 :min-height (or min-height -1)
788 :max-width (or max-width -1)
789 :max-height (or max-height -1)
790 :base-width (or base-width 0)
791 :base-height (or base-height 0)
792 :width-inc (or width-inc 0)
793 :height-inc (or height-inc 0)
794 :min-aspect (or min-aspect 0)
795 :max-aspect (or max-aspect 0)
798 (when (or min-size min-width min-height)
799 (push :min-size mask))
800 (when (or max-size max-width max-height)
801 (push :max-size mask))
802 (when (or base-width base-height)
803 (push :base-size mask))
804 (when (or width-inc height-inc)
805 (push :resize-inc mask))
806 (when (or min-aspect max-aspect)
809 (push :win-gravity mask))
810 (%window-set-geometry-hints window geometry mask)))
812 (defbinding window-list-toplevels () (glist (copy-of window))
813 "Returns a list of all existing toplevel windows.")
815 (defbinding window-add-mnemonic (window key target) nil
817 ((gdk:keyval-from-name key) unsigned-int)
820 (defbinding window-remove-mnemonic (window key target) nil
822 ((gdk:keyval-from-name key) unsigned-int)
825 (defbinding window-mnemonic-activate (window key modifier) nil
827 ((gdk:keyval-from-name key) unsigned-int)
828 (modifier gdk:modifier-type))
830 (defbinding window-activate-key () boolean
832 (event gdk:key-event))
834 (defbinding window-propagate-key-event () boolean
836 (event gdk:key-event))
838 (defbinding window-present () nil
841 (defbinding window-iconify () nil
844 (defbinding window-deiconify () nil
847 (defbinding window-stick () nil
850 (defbinding window-unstick () nil
853 (defbinding window-maximize () nil
856 (defbinding window-unmaximize () nil
859 (defbinding window-fullscreen () nil
862 (defbinding window-unfullscreen () nil
865 (defbinding window-set-keep-above () nil
869 (defbinding window-set-keep-below () nil
873 (defbinding window-begin-resize-drag () nil
875 (edge gdk:window-edge)
877 (root-x int) (root-y int)
878 (timestamp unsigned-int))
880 (defbinding window-begin-move-drag () nil
882 (edge gdk:window-edge)
884 (root-x int) (root-y int)
885 (timestamp unsigned-int))
887 (defbinding window-set-frame-dimensions () nil
889 (left int) (top int) (rigth int) (bottom int))
891 (defbinding %window-get-default-size () nil
896 (defun window-get-default-size (window)
897 (multiple-value-bind (width height) (%window-get-default-size window)
898 (values (unless (= width -1) width) (unless (= height -1) height))))
900 (defbinding window-get-frame-dimensions () nil
902 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
904 (defbinding %window-get-icon-list () (glist gdk:pixbuf)
907 (defbinding window-get-position () nil
912 (defbinding window-get-size () nil
917 (defbinding window-move () nil
922 (defbinding window-parse-geometry () boolean
926 (defbinding window-reshow-with-initial-size () nil
929 (defbinding window-resize () nil
934 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
935 () (glist gdk:pixbuf))
937 (defun window-default-icon ()
938 (first (window-default-icon-list)))
940 (defbinding %window-set-default-icon-list () nil
941 (icons (glist gdk:pixbuf)))
943 (defun (setf window-default-icon-list) (icons)
944 (%window-set-default-icon-list icons)
947 (defbinding %window-set-default-icon () nil
948 (icons (glist gdk:pixbuf)))
950 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
951 (%window-set-default-icon icon)
954 (defmethod (setf window-group) ((group window-group) (window window))
955 (window-group-add-window group window)
958 (defbinding %window-set-default-icon-from-file () boolean
962 (defmethod (setf window-default-icon) ((icon-file pathname))
963 (%window-set-default-icon-from-file icon-file)
966 (defbinding %window-set-icon-from-file () boolean
971 (defmethod (setf window-icon) ((icon-file pathname) (window window))
972 (%window-set-icon-from-file window icon-file)
975 (defbinding window-set-auto-startup-notification () nil
978 (defbinding decorated-window-init () nil
981 (defbinding decorated-window-calculate-frame-size () nil
984 (defbinding decorated-window-set-title () nil
988 (defbinding decorated-window-move-resize-window () nil
998 (defmethod initialize-instance ((window-group window-group) &rest initargs
1000 (declare (ignore window windows))
1003 (initial-add window-group #'window-group-add-window
1004 initargs :window :windows)))
1007 (defbinding window-group-add-window () nil
1008 (window-group window-group)
1011 (defbinding window-group-remove-window () nil
1012 (window-group window-group)
1018 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1019 (setf (scrolled-window-hscrollbar-policy window) policy)
1020 (setf (scrolled-window-vscrollbar-policy window) policy))
1022 (defbinding scrolled-window-add-with-viewport () nil
1023 (scrolled-window scrolled-window)
1034 (defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
1036 (statusbar statusbar)
1037 (context-description string))
1039 (defbinding statusbar-push () unsigned-int
1040 (statusbar statusbar)
1041 (context-id unsigned-int)
1044 (defbinding statusbar-pop () nil
1045 (statusbar statusbar)
1046 (context-id unsigned-int))
1048 (defbinding statusbar-remove () nil
1049 (statusbar statusbar)
1050 (context-id unsigned-int)
1051 (message-id unsigned-int))
1057 (defbinding fixed-put () nil
1062 (defbinding fixed-move () nil
1071 (defun %notebook-position (notebook page)
1077 (t (error "Invalid position keyword: ~A" page))))
1078 (widget (notebook-page-num notebook page t))))
1080 (defun %notebook-child (notebook position)
1083 (t (notebook-nth-page-child notebook position))))
1086 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1087 (notebook position child tab-label &optional menu-label) nil
1090 ((if (stringp tab-label)
1091 (make-instance 'label :label tab-label)
1093 ((if (stringp menu-label)
1094 (make-instance 'label :label menu-label)
1095 menu-label) (or null widget))
1096 ((%notebook-position notebook position) int))
1098 (defun notebook-append (notebook child tab-label &optional menu-label)
1099 (notebook-insert notebook :last child tab-label menu-label))
1101 (defun notebook-prepend (notebook child tab-label &optional menu-label)
1102 (notebook-insert notebook :first child tab-label menu-label))
1104 (defbinding notebook-remove-page (notebook page) nil
1106 ((%notebook-position notebook page) int))
1108 (defbinding %notebook-page-num () int
1112 (defun notebook-page-num (notebook child &optional error-p)
1113 (let ((page-num (%notebook-page-num notebook child)))
1116 (error "~A is not a child of ~A" child notebook))
1119 (defbinding notebook-next-page () nil
1120 (notebook notebook))
1122 (defbinding notebook-prev-page () nil
1123 (notebook notebook))
1125 (defbinding notebook-reorder-child (notebook child position) nil
1128 ((%notebook-position notebook position) int))
1130 (defbinding notebook-popup-enable () nil
1131 (notebook notebook))
1133 (defbinding notebook-popup-disable () nil
1134 (notebook notebook))
1136 (defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
1137 (notebook page) widget
1145 (defbinding %notebook-get-current-page () int
1146 (notebook notebook))
1148 (defun notebook-current-page-num (notebook)
1149 (let ((num (%notebook-get-current-page notebook)))
1153 (defun notebook-current-page (notebook)
1154 (let ((page-num (notebook-current-page-num notebook)))
1156 (notebook-nth-page-child notebook page-num))))
1158 (defbinding %notebook-set-current-page () nil
1162 (defun (setf notebook-current-page) (page notebook)
1163 (%notebook-set-current-page notebook (%notebook-position notebook page))
1167 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1168 (notebook page) widget
1170 ((%notebook-child notebook page) widget))
1172 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1173 (notebook page) (copy-of string)
1175 ((%notebook-child notebook page) widget))
1177 (defbinding %notebook-set-tab-label () nil
1182 (defun (setf notebook-tab-label) (tab-label notebook page)
1183 (let ((widget (if (stringp tab-label)
1184 (make-instance 'label :label tab-label)
1186 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
1190 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1191 (notebook page) widget
1193 ((%notebook-child notebook page) widget))
1195 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1196 (notebook page) (copy-of string)
1198 ((%notebook-child notebook page) widget))
1200 (defbinding %notebook-set-menu-label () nil
1203 (menu-label widget))
1205 (defun (setf notebook-menu-label) (menu-label notebook page)
1206 (let ((widget (if (stringp menu-label)
1207 (make-instance 'label :label menu-label)
1209 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1213 (defbinding notebook-query-tab-label-packing (notebook page) nil
1215 ((%notebook-child notebook page) widget)
1216 (expand boolean :out)
1218 (pack-type pack-type :out))
1220 (defbinding notebook-set-tab-label-packing
1221 (notebook page expand fill pack-type) nil
1223 ((%notebook-child notebook page) widget)
1226 (pack-type pack-type))
1232 (defbinding paned-pack1 () nil
1238 (defbinding paned-pack2 () nil
1247 (defbinding layout-put () nil
1253 (defbinding layout-move () nil
1263 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1264 (menu-shell menu-shell)
1265 (menu-item menu-item)
1271 (defun menu-shell-append (menu-shell menu-item)
1272 (menu-shell-insert menu-shell menu-item :last))
1274 (defun menu-shell-prepend (menu-shell menu-item)
1275 (menu-shell-insert menu-shell menu-item :fisrt))
1277 (defbinding menu-shell-deactivate () nil
1278 (menu-shell menu-shell))
1280 (defbinding menu-shell-select-item () nil
1281 (menu-shell menu-shell)
1282 (menu-item menu-item))
1284 (defbinding menu-shell-deselect () nil
1285 (menu-shell menu-shell))
1287 (defbinding menu-shell-activate-item () nil
1288 (menu-shell menu-shell)
1289 (menu-item menu-item)
1290 (fore-deactivate boolean))
1296 (defun %menu-position (menu child)
1299 (keyword (case child
1302 (t (error "Invalid position keyword: ~A" child))))
1303 (widget (menu-child-position menu child))))
1306 (defbinding menu-reorder-child (menu menu-item position) nil
1308 (menu-item menu-item)
1309 ((%menu-position menu position) int))
1311 (def-callback-marshal %menu-popup-callback (nil (x int) (y int) (push-in boolean)))
1313 (defbinding %menu-popup () nil
1315 (parent-menu-shell (or null menu-shell))
1316 (parent-menu-item (or null menu-item))
1317 (callback-func (or null pointer))
1318 (callback-id unsigned-int)
1319 (button unsigned-int)
1320 (activate-time (unsigned 32)))
1322 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1325 (with-callback-function (id callback)
1327 menu parent-menu-shell parent-menu-item
1328 (callback %menu-popup-callback) id button activate-time))
1330 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1332 (defbinding menu-set-accel-path () nil
1334 (accel-path string))
1336 (defbinding menu-reposition () nil
1339 (defbinding menu-popdown () nil
1342 (defun menu-child-position (menu child)
1343 (position child (container-children menu)))
1345 (defun menu-active-num (menu)
1346 (menu-child-position menu (menu-active menu)))
1348 (defbinding %menu-set-active () nil
1350 (index unsigned-int))
1352 (defun (setf menu-active) (menu child)
1353 (%menu-set-active menu (%menu-position menu child))
1360 (defbinding table-resize () nil
1363 (columns unsigned-int))
1365 (defbinding table-attach (table child left right top bottom
1366 &key options x-options y-options
1367 (x-padding 0) (y-padding 0)) nil
1371 (right unsigned-int)
1373 (bottom unsigned-int)
1374 ((append (mklist options) (mklist x-options)) attach-options)
1375 ((append (mklist options) (mklist y-options)) attach-options)
1376 (x-padding unsigned-int)
1377 (y-padding unsigned-int))
1380 (defbinding %table-set-row-spacing () nil
1383 (spacing unsigned-int))
1385 (defbinding %table-set-row-spacings () nil
1387 (spacing unsigned-int))
1389 (defun (setf table-row-spacing) (spacing table &optional row)
1391 (%table-set-row-spacing table row spacing)
1392 (%table-set-row-spacings table spacing))
1395 (defbinding %table-get-row-spacing () unsigned-int
1399 (defbinding %table-get-default-row-spacing () unsigned-int
1402 (defun table-row-spacing (table &optional row)
1404 (%table-get-row-spacing table row)
1405 (%table-get-default-row-spacing table)))
1408 (defbinding %table-set-col-spacing () nil
1411 (spacing unsigned-int))
1413 (defbinding %table-set-col-spacings () nil
1415 (spacing unsigned-int))
1417 (defun (setf table-col-spacing) (spacing table &optional col)
1419 (%table-set-col-spacing table col spacing)
1420 (%table-set-col-spacings table spacing))
1423 (defbinding %table-get-col-spacing () unsigned-int
1427 (defbinding %table-get-default-col-spacing () unsigned-int
1430 (defun table-col-spacing (table &optional col)
1432 (%table-get-col-spacing table col)
1433 (%table-get-default-col-spacing table)))
1439 (defbinding %toolbar-insert-element () widget
1441 (type toolbar-child-type)
1442 (widget (or null widget))
1444 (tooltip-text string)
1445 (tooltip-private-text string)
1446 (icon (or null widget))
1451 (defbinding %toolbar-insert-stock () widget
1454 (tooltip-text string)
1455 (tooltip-private-text string)
1460 (defun toolbar-insert (toolbar position element
1461 &key tooltip-text tooltip-private-text
1462 type icon group callback object)
1463 (let* ((numpos (case position
1471 (and (not type) (eq element :space)))
1472 (%toolbar-insert-element
1473 toolbar :space nil nil
1474 tooltip-text tooltip-private-text nil numpos))
1477 (and (not type) (typep element 'widget)))
1478 (%toolbar-insert-element
1479 toolbar :widget element nil
1480 tooltip-text tooltip-private-text nil numpos))
1485 (typep element 'string)
1486 (stock-lookup element)))
1487 (%toolbar-insert-stock
1488 toolbar element tooltip-text tooltip-private-text numpos))
1489 ((typep element 'string)
1490 (%toolbar-insert-element
1491 toolbar (or type :button) (when (eq type :radio-button) group)
1492 element tooltip-text tooltip-private-text
1496 ((or pathname string vector)
1497 (make-instance 'image
1498 :source icon ; :icon-size (toolbar-icon-size toolbar)
1501 ((error "Invalid element type: ~A" element)))))
1503 (signal-connect widget 'clicked callback :object object))
1506 (defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text
1507 type icon group callback object)
1509 toolbar :first element :type type :icon icon :group group
1510 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1511 :callback callback :object object))
1513 (defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text
1514 type icon group callback object)
1516 toolbar :last element :type type :icon icon :group group
1517 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1518 :callback callback :object object))
1521 (defun toolbar-insert-space (toolbar position)
1522 (toolbar-insert toolbar position :space))
1524 (defun toolbar-append-space (toolbar)
1525 (toolbar-append toolbar :space))
1527 (defun toolbar-prepend-space (toolbar)
1528 (toolbar-prepend toolbar :space))
1531 (defun toolbar-enable-tooltips (toolbar)
1532 (setf (toolbar-tooltips-p toolbar) t))
1534 (defun toolbar-disable-tooltips (toolbar)
1535 (setf (toolbar-tooltips-p toolbar) nil))
1538 (defbinding toolbar-remove-space () nil
1542 (defbinding toolbar-unset-icon-size () nil
1545 (defbinding toolbar-unset-style () nil
1551 (defbinding editable-select-region (editable &optional (start 0) end) nil
1556 (defbinding editable-get-selection-bounds (editable) nil
1561 (defbinding editable-insert-text
1562 (editable text &optional (position 0)) nil
1566 ((or position -1) int :in-out))
1568 (defun editable-append-text (editable text)
1569 (editable-insert-text editable text nil))
1571 (defun editable-prepend-text (editable text)
1572 (editable-insert-text editable text 0))
1574 (defbinding editable-delete-text (editable &optional (start 0) end) nil
1579 (defbinding (editable-text "gtk_editable_get_chars")
1580 (editable &optional (start 0) end) string
1585 (defun (setf editable-text) (text editable)
1587 (editable-delete-text
1589 (editable-insert-text editable text))
1590 (editable-delete-text editable))
1593 (defbinding editable-cut-clipboard () nil
1594 (editable editable))
1596 (defbinding editable-copy-clipboard () nil
1597 (editable editable))
1599 (defbinding editable-paste-clipboard () nil
1600 (editable editable))
1602 (defbinding editable-delete-selection () nil
1603 (editable editable))
1609 (defun spin-button-value-as-int (spin-button)
1610 (round (spin-button-value spin-button)))
1612 (defbinding spin-button-spin () nil
1613 (spin-button spin-button)
1614 (direction spin-type)
1615 (increment single-float))
1617 (defbinding spin-button-update () nil
1618 (spin-button spin-button))
1624 (defbinding ruler-set-range () nil
1626 (lower single-float)
1627 (upper single-float)
1628 (position single-float)
1629 (max-size single-float))
1631 (defbinding ruler-draw-ticks () nil
1634 (defbinding ruler-draw-pos () nil
1641 (defun range-lower (range)
1642 (adjustment-lower (range-adjustment range)))
1644 (defun range-upper (range)
1645 (adjustment-upper (range-adjustment range)))
1647 (defun (setf range-lower) (value range)
1648 (setf (adjustment-lower (range-adjustment range)) value))
1650 (defun (setf range-upper) (value range)
1651 (setf (adjustment-upper (range-adjustment range)) value))
1653 (defun range-page-increment (range)
1654 (adjustment-page-increment (range-adjustment range)))
1656 (defun range-step-increment (range)
1657 (adjustment-step-increment (range-adjustment range)))
1659 (defun (setf range-page-increment) (value range)
1660 (setf (adjustment-page-increment (range-adjustment range)) value))
1662 (defun (setf range-step-increment) (value range)
1663 (setf (adjustment-step-increment (range-adjustment range)) value))
1665 (defbinding range-set-range () nil
1667 (lower double-float)
1668 (upper double-float))
1670 (defbinding range-set-increments () nil
1673 (page double-float))
1678 ; (defbinding scale-draw-value () nil
1685 (defbinding progress-bar-pulse () nil
1686 (progress-bar progress-bar))
1691 (defmethod initialize-instance ((size-group size-group) &rest initargs
1692 &key widget widgets)
1693 (declare (ignore widget widgets))
1696 (initial-add size-group #'size-group-add-widget
1697 initargs :widget :widgets)))
1700 (defbinding size-group-add-widget () nil
1701 (size-group size-group)
1704 (defbinding size-group-remove-widget () nil
1705 (size-group size-group)
1711 (defbinding %stock-item-copy () pointer
1714 (defbinding %stock-item-free () nil
1717 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1718 (%stock-item-copy location))
1720 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1721 (%stock-item-free location))
1723 (defbinding stock-add (stock-item) nil
1724 (stock-item stock-item)
1727 (defbinding stock-list-ids () (gslist string))
1729 (defbinding %stock-lookup () boolean
1733 (defun stock-lookup (stock-id)
1735 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1737 (when (%stock-lookup stock-id location)
1738 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1739 (deallocate-memory location))))
1744 (defbinding tooltips-enable () nil
1745 (tooltips tooltips))
1747 (defbinding tooltips-disable () nil
1748 (tooltips tooltips))
1750 (defun (setf tooltips-enabled-p) (enable tooltips)
1752 (tooltips-enable tooltips)
1753 (tooltips-disable tooltips)))
1755 (defbinding tooltips-set-tip () nil
1759 (tip-private string))
1761 (defbinding tooltips-force-window () nil
1762 (tooltips tooltips))
1768 (defbinding rc-add-default-file (filename) nil
1769 ((namestring (truename filename)) string))
1771 (defbinding rc-parse (filename) nil
1772 ((namestring (truename filename)) string))
1774 (defbinding rc-parse-string () nil
1777 (defbinding rc-reparse-all () nil)
1779 (defbinding rc-get-style () style
1784 ;;; Accelerator Groups
1786 (defbinding accel-group-activate (accel-group key modifiers) boolean
1787 (accel-group accel-group)
1788 ((gdk:keyval-from-name key) unsigned-int)
1789 (modifiers gdk:modifier-type))
1791 (defbinding accel-groups-activate (object key modifiers) boolean
1793 ((gdk:keyval-from-name key) unsigned-int)
1794 (modifiers gdk:modifier-type))
1796 (defbinding accel-group-attach () nil
1797 (accel-group accel-group)
1800 (defbinding accel-group-detach () nil
1801 (accel-group accel-group)
1804 (defbinding accel-group-lock () nil
1805 (accel-group accel-group))
1807 (defbinding accel-group-unlock () nil
1808 (accel-group accel-group))
1811 ;;; Accelerator Groups Entries
1813 (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
1814 (accel-group accel-group)
1815 ((gdk:keyval-from-name key) unsigned-int)
1816 (modifiers gdk:modifier-type))
1818 (defbinding accel-group-lock-entry (accel-group key modifiers) nil
1819 (accel-group accel-group)
1820 ((gdk:keyval-from-name key) unsigned-int)
1821 (modifiers gdk:modifier-type))
1823 (defbinding accel-group-unlock-entry (accel-group key modifiers) nil
1824 (accel-group accel-group)
1825 ((gdk:keyval-from-name key) unsigned-int)
1826 (modifiers gdk:modifier-type))
1828 (defbinding accel-group-add
1829 (accel-group key modifiers flags object signal) nil
1830 (accel-group accel-group)
1831 ((gdk:keyval-from-name key) unsigned-int)
1832 (modifiers gdk:modifier-type)
1835 ((name-to-string signal) string))
1837 (defbinding accel-group-add (accel-group key modifiers object) nil
1838 (accel-group accel-group)
1839 ((gdk:keyval-from-name key) unsigned-int)
1840 (modifiers gdk:modifier-type)
1844 ;;; Accelerator Signals
1846 (defbinding accel-group-handle-add
1847 (object signal-id accel-group key modifiers flags) nil
1849 (signal-id unsigned-int)
1850 (accel-group accel-group)
1851 ((gdk:keyval-from-name key) unsigned-int)
1852 (modifiers gdk:modifier-type)
1853 (flags accel-flags))
1855 (defbinding accel-group-handle-remove
1856 (object accel-group key modifiers) nil
1858 (accel-group accel-group)
1859 ((gdk:keyval-from-name key) unsigned-int)
1860 (modifiers gdk:modifier-type))