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.29 2005-01-06 21:05:46 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 (defbinding accessible-connect-widget-destroyed () nil
79 (accessible accessible))
84 (defmethod initialize-instance ((adjustment adjustment) &key value)
87 ;; we need to make sure that the value is set last, otherwise it
88 ;; may be outside current limits and ignored
90 (setf (slot-value adjustment 'value) value))))
93 (defbinding adjustment-changed () nil
94 (adjustment adjustment))
96 (defbinding adjustment-value-changed () nil
97 (adjustment adjustment))
99 (defbinding adjustment-clamp-page () nil
100 (adjustment adjustment)
102 (upper single-float))
110 (defun (setf bin-child) (child bin)
111 (when-bind (current-child (bin-child bin))
112 (container-remove bin current-child))
113 (container-add bin child)
116 (defmethod create-callback-function ((bin bin) function arg1)
118 #'(lambda (&rest args)
119 (apply function (bin-child bin) (rest args)))
125 (defbinding box-pack-start () nil
130 (padding unsigned-int))
132 (defbinding box-pack-end () nil
137 (padding unsigned-int))
139 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
141 (box-pack-end box child expand fill padding)
142 (box-pack-start box child expand fill padding)))
144 (defbinding box-reorder-child () nil
149 (defbinding box-query-child-packing () nil
152 (expand boolean :out)
154 (padding unsigned-int :out)
155 (pack-type pack-type :out))
157 (defbinding box-set-child-packing () nil
162 (padding unsigned-int)
163 (pack-type pack-type))
169 (defmethod initialize-instance ((button button) &rest initargs &key stock)
171 (apply #'call-next-method button :label stock :use-stock t initargs)
175 (defbinding button-pressed () nil
178 (defbinding button-released () nil
181 (defbinding button-clicked () nil
184 (defbinding button-enter () nil
187 (defbinding button-leave () nil
194 (defbinding calendar-select-month () int
199 (defbinding calendar-select-day () nil
203 (defbinding calendar-mark-day () int
207 (defbinding calendar-unmark-day () int
211 (defbinding calendar-clear-marks () nil
214 (defbinding calendar-get-date () nil
216 (year unsigned-int :out)
217 (month unsigned-int :out)
218 (day unsigned-int :out))
220 (defbinding calendar-freeze () nil
223 (defbinding calendar-thaw () nil
229 (defbinding check-menu-item-toggled () nil
230 (check-menu-item check-menu-item))
239 (defbinding (color-selection-is-adjusting-p
240 "gtk_color_selection_is_adjusting") () boolean
241 (colorsel color-selection))
245 ;;; Color selection dialog -- no functions
251 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
252 &key model content active)
253 (remf initargs :active)
255 (apply #'call-next-method combo-box initargs)
257 (apply #'call-next-method combo-box
258 :model (make-instance 'list-store :column-types '(string))
260 (unless (typep combo-box 'combo-box-entry)
261 (let ((cell (make-instance 'cell-renderer-text)))
262 (cell-layout-pack combo-box cell :expand t)
263 (cell-layout-add-attribute combo-box cell :text 0)))))
265 (mapc #'(lambda (text)
266 (combo-box-append-text combo-box text))
269 (setf (combo-box-active combo-box) active)))
272 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
274 ;; (signal-emit combo-box 'changed)))
276 (defbinding combo-box-append-text () nil
277 (combo-box combo-box)
280 (defbinding combo-box-insert-text () nil
281 (combo-box combo-box)
285 (defbinding combo-box-prepend-text () nil
286 (combo-box combo-box)
290 (defbinding combo-box-get-active-text () string
291 (combo-box combo-box))
293 (defbinding combo-box-popup () nil
294 (combo-box combo-box))
296 (defbinding combo-box-popdown () nil
297 (combo-box combo-box))
303 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
306 (setf (combo-box-entry-text-column combo-box-entry) 0)))
311 (defmethod shared-initialize ((dialog dialog) names &rest initargs
313 (declare (ignore button buttons))
316 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
319 (defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
321 (cadr (assoc id (rest (type-expand-1 'response-type))))
322 (let ((response-ids (object-data dialog 'response-id-key)))
324 ((and response-ids (position id response-ids :test #'equal)))
328 (vector-push-extend id response-ids)
329 (1- (length response-ids)))
332 (object-data dialog 'response-id-key)
333 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
336 (error "Invalid response: ~A" id))))))
338 (defun %dialog-find-response-id (dialog response-id-num)
339 (if (< response-id-num 0)
342 (list response-id-num)
343 (rest (type-expand-1 'response-type)) :test #'equal))
344 (aref (object-data dialog 'response-id-key) response-id-num )))
347 (defmethod signal-connect ((dialog dialog) signal function &key object after)
348 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
353 #'(lambda (dialog id)
354 (when (= id response-id-num)
356 ((eq object t) (funcall function dialog))
357 (object (funcall function object))
358 (t (funcall function)))))
359 :object t :after after))
360 ((call-next-method)))))
363 (defbinding dialog-run () nil
366 (defbinding dialog-response (dialog response-id) nil
368 ((%dialog-find-response-id-num dialog response-id nil t) int))
371 (defbinding %dialog-add-button () button
374 (response-id-num int))
376 (defun dialog-add-button (dialog label &optional (response label)
377 &key default object after)
378 "Adds a button to the dialog."
379 (let* ((id (if (functionp response)
382 (id-num (%dialog-find-response-id-num dialog id t))
383 (button (%dialog-add-button dialog label id-num)))
384 (when (functionp response)
385 (signal-connect dialog id response :object object :after after))
387 (%dialog-set-default-response dialog id-num))
391 (defbinding %dialog-add-action-widget () button
393 (action-widget widget)
394 (response-id-num int))
396 (defun dialog-add-action-widget (dialog widget &optional (response widget)
397 &key default object after)
398 (let* ((id (if (functionp response)
401 (id-num (%dialog-find-response-id-num dialog id t)))
402 (%dialog-add-action-widget dialog widget id-num)
403 (when (functionp response)
404 (signal-connect dialog id response :object object :after after))
406 (%dialog-set-default-response dialog id-num))
410 (defbinding %dialog-set-default-response () nil
412 (response-id-num int))
414 (defun dialog-set-default-response (dialog response-id)
415 (%dialog-set-default-response
416 dialog (%dialog-find-response-id-num dialog response-id nil t)))
418 (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
420 ((%dialog-find-response-id-num dialog response-id nil t) int)
424 (defbinding alternative-dialog-button-order-p(&optional screen)
425 (screen (or null screen)))
428 (defbinding (dialog-set-alternative-button-order
429 "gtk_dialog_set_alternative_button_order_from_array")
432 ((length new-order) int)
433 ((map 'vector #'(lambda (id)
434 (%dialog-find-response-id-num dialog id nil t))
435 new-order) (vector int)))
438 (defmethod container-add ((dialog dialog) (child widget) &rest args)
439 (apply #'container-add (dialog-vbox dialog) child args))
441 (defmethod container-remove ((dialog dialog) (child widget))
442 (container-remove (dialog-vbox dialog) child))
444 (defmethod container-children ((dialog dialog))
445 (container-children (dialog-vbox dialog)))
447 (defmethod (setf container-children) (children (dialog dialog))
448 (setf (container-children (dialog-vbox dialog)) children))
453 (defbinding entry-get-layout-offsets () nil
458 (defbinding entry-layout-index-to-text-index () int
462 (defbinding entry-text-index-to-layout-index () int
469 (def-callback-marshal %entry-completion-match-func
470 (boolean entry-completion string (copy-of tree-iter)))
472 (defbinding entry-completion-set-match-func (completion function) nil
473 (completion entry-completion)
474 ((callback %entry-completion-match-func) pointer)
475 ((register-callback-function function) unsigned-int)
476 ((callback %destroy-user-data) pointer))
478 (defbinding entry-completion-complete () nil
479 (completion entry-completion))
482 (defbinding entry-completion-insert-prefix () nil
483 (completion entry-completion))
485 (defbinding entry-completion-insert-action-text () nil
486 (completion entry-completion)
490 (defbinding entry-completion-insert-action-markup () nil
491 (completion entry-completion)
495 (defbinding entry-completion-delete-action () nil
496 (completion entry-completion)
502 (defbinding image-set-from-file () nil
506 (defmethod (setf image-pixmap) ((data vector) (image image))
507 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
508 (setf (image-pixmap image) pixmap)
509 (setf (image-mask image) mask)))
511 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
513 ((typep pixmap 'vector)
514 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
515 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
519 (image-set-from-file image file)))
520 ((call-next-method))))
522 (defun create-image-widget (source &optional mask)
524 (gdk:pixbuf (make-instance 'image :pixbuf source))
525 (string (make-instance 'image :stock source))
526 (pathname (make-instance 'image :file source))
527 ((or list vector) (make-instance 'image :pixmap source))
528 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
533 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
534 (if (and image (not (typep image 'widget)))
535 (apply #'call-next-method item :image (create-image-widget image) initargs)
539 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
540 (setf (slot-value item 'image) widget))
542 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
543 (setf (image-menu-item-image item) (create-image-widget image)))
548 (defbinding label-get-layout-offsets () nil
553 (defbinding label-select-region () nil
558 (defbinding label-get-selection-bounds () boolean
567 (defbinding %radio-button-get-group () pointer
568 (radio-button radio-button))
570 (defbinding %radio-button-set-group () nil
571 (radio-button radio-button)
574 (defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
575 "Add BUTTON1 to the group which BUTTON2 belongs to."
576 (%radio-button-set-group button1 (%radio-button-get-group button2)))
578 (defmethod initialize-instance ((button radio-button) &key group)
582 (add-to-radio-group button group))))
587 (defbinding item-select () nil
590 (defbinding item-deselect () nil
593 (defbinding item-toggle () nil
600 (defmethod initialize-instance ((item menu-item) &key label)
604 (setf (menu-item-label item) label))))
607 (defun (setf menu-item-label) (label menu-item)
608 (make-instance 'accel-label
609 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
610 :use-underline (menu-item-use-underline-p menu-item)
611 :visible t :parent menu-item)
614 (defun menu-item-label (menu-item)
615 (when (and (slot-boundp menu-item 'child)
616 (typep (bin-child menu-item) 'label))
617 (label-label (bin-child menu-item))))
619 (defbinding menu-item-remove-submenu () nil
620 (menu-item menu-item))
622 (defbinding menu-item-set-accel-path () nil
623 (menu-item menu-item)
626 (defbinding menu-item-select () nil
627 (menu-item menu-item))
629 (defbinding menu-item-deselect () nil
630 (menu-item menu-item))
632 (defbinding menu-item-activate () nil
633 (menu-item menu-item))
635 (defbinding menu-item-toggle-size-request () nil
636 (menu-item menu-item)
637 (requisition int :out))
639 (defbinding menu-item-toggle-size-allocate () nil
640 (menu-item menu-item)
647 (defbinding menu-tool-button-set-arrow-tip () nil
648 (menu-tool-button menu-tool-button)
651 (tip-private string))
656 (defmethod initialize-instance ((dialog message-dialog) &rest initargs
657 &key (type :info) (buttons :close) ; or :ok?
658 flags message parent)
659 (remf initargs :parent)
661 (slot-value dialog 'location)
662 (%message-dialog-new parent flags type buttons nil))
663 (message-dialog-set-markup dialog message)
664 (apply #'call-next-method dialog initargs))
667 (defbinding %message-dialog-new () pointer
668 (parent (or null window))
671 (buttons buttons-type)
672 (message (or null string)))
674 (defbinding %message-dialog-new-with-markup () pointer
675 (parent (or null window))
678 (buttons buttons-type)
681 (defbinding message-dialog-set-markup () nil
682 (message-dialog message-dialog)
686 (defbinding message-dialog-format-secondary-text () nil
687 (message-dialog message-dialog)
691 (defbinding message-dialog-format-secondary-markup () nil
692 (message-dialog message-dialog)
699 (defbinding %radio-menu-item-get-group () pointer
700 (radio-menu-item radio-menu-item))
702 (defbinding %radio-menu-item-set-group () nil
703 (radio-menu-item radio-menu-item)
706 (defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
707 "Add ITEM1 to the group which ITEM2 belongs to."
708 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
710 (defmethod initialize-instance ((item radio-menu-item) &key group)
714 (add-to-radio-group item group))))
718 ;;; Radio tool button
720 (defbinding %radio-tool-button-get-group () pointer
721 (radio-tool-button radio-tool-button))
723 (defbinding %radio-tool-button-set-group () nil
724 (radio-tool-button radio-tool-button)
727 (defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
728 "Add BUTTON1 to the group which BUTTON2 belongs to."
729 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
731 (defmethod add-activate-callback ((widget widget) function &key object after)
733 (signal-connect widget 'clicked
735 (when (slot-value widget 'active)
736 (funcall function object (slot-value widget 'value))))
737 :object object :after after)
738 (signal-connect widget 'clicked
740 (when (slot-value widget 'active)
741 (funcall function (slot-value widget 'value))))
744 (defmethod initialize-instance ((button radio-tool-button) &key group)
748 (add-to-radio-group button group))))
754 (defbinding toggle-button-toggled () nil
755 (toggle-button toggle-button))
760 (defmethod initialize-instance ((window window) &rest initargs
761 &key accel-group accel-groups)
762 (declare (ignore accel-group accel-groups))
765 (initial-add window #'window-add-accel-group
766 initargs :accel-group :accel-groups)))
769 (defbinding window-set-wmclass () nil
771 (wmclass-name string)
772 (wmclass-class string))
774 (defbinding window-add-accel-group () nil
776 (accel-group accel-group))
778 (defbinding window-remove-accel-group () nil
780 (accel-group accel-group))
782 (defbinding window-activate-focus () int
785 (defbinding window-activate-default () int
788 (defbinding window-set-default-size (window width height) int
791 ((or height -1) int))
793 (defbinding %window-set-geometry-hints () nil
795 (geometry gdk:geometry)
796 (geometry-mask gdk:window-hints))
798 (defun window-set-geometry-hints (window &key min-width min-height
799 max-width max-height base-width base-height
800 width-inc height-inc min-aspect max-aspect
801 (gravity nil gravity-p) min-size max-size)
802 (let ((geometry (make-instance 'gdk:geometry
803 :min-width (or min-width -1)
804 :min-height (or min-height -1)
805 :max-width (or max-width -1)
806 :max-height (or max-height -1)
807 :base-width (or base-width 0)
808 :base-height (or base-height 0)
809 :width-inc (or width-inc 0)
810 :height-inc (or height-inc 0)
811 :min-aspect (or min-aspect 0)
812 :max-aspect (or max-aspect 0)
815 (when (or min-size min-width min-height)
816 (push :min-size mask))
817 (when (or max-size max-width max-height)
818 (push :max-size mask))
819 (when (or base-width base-height)
820 (push :base-size mask))
821 (when (or width-inc height-inc)
822 (push :resize-inc mask))
823 (when (or min-aspect max-aspect)
826 (push :win-gravity mask))
827 (%window-set-geometry-hints window geometry mask)))
829 (defbinding window-list-toplevels () (glist (copy-of window))
830 "Returns a list of all existing toplevel windows.")
832 (defbinding window-add-mnemonic (window key target) nil
834 ((gdk:keyval-from-name key) unsigned-int)
837 (defbinding window-remove-mnemonic (window key target) nil
839 ((gdk:keyval-from-name key) unsigned-int)
842 (defbinding window-mnemonic-activate (window key modifier) nil
844 ((gdk:keyval-from-name key) unsigned-int)
845 (modifier gdk:modifier-type))
847 (defbinding window-activate-key () boolean
849 (event gdk:key-event))
851 (defbinding window-propagate-key-event () boolean
853 (event gdk:key-event))
855 (defbinding window-present () nil
858 (defbinding window-iconify () nil
861 (defbinding window-deiconify () nil
864 (defbinding window-stick () nil
867 (defbinding window-unstick () nil
870 (defbinding window-maximize () nil
873 (defbinding window-unmaximize () nil
876 (defbinding window-fullscreen () nil
879 (defbinding window-unfullscreen () nil
882 (defbinding window-set-keep-above () nil
886 (defbinding window-set-keep-below () nil
890 (defbinding window-begin-resize-drag () nil
892 (edge gdk:window-edge)
894 (root-x int) (root-y int)
895 (timestamp unsigned-int))
897 (defbinding window-begin-move-drag () nil
899 (edge gdk:window-edge)
901 (root-x int) (root-y int)
902 (timestamp unsigned-int))
904 (defbinding window-set-frame-dimensions () nil
906 (left int) (top int) (rigth int) (bottom int))
908 (defbinding %window-get-default-size () nil
913 (defun window-get-default-size (window)
914 (multiple-value-bind (width height) (%window-get-default-size window)
915 (values (unless (= width -1) width) (unless (= height -1) height))))
917 (defbinding window-get-frame-dimensions () nil
919 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
921 (defbinding %window-get-icon-list () (glist gdk:pixbuf)
924 (defbinding window-get-position () nil
929 (defbinding window-get-size () nil
934 (defbinding window-move () nil
939 (defbinding window-parse-geometry () boolean
943 (defbinding window-reshow-with-initial-size () nil
946 (defbinding window-resize () nil
951 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
952 () (glist gdk:pixbuf))
954 (defun window-default-icon ()
955 (first (window-default-icon-list)))
957 (defbinding %window-set-default-icon-list () nil
958 (icons (glist gdk:pixbuf)))
960 (defun (setf window-default-icon-list) (icons)
961 (%window-set-default-icon-list icons)
964 (defbinding %window-set-default-icon () nil
965 (icons (glist gdk:pixbuf)))
967 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
968 (%window-set-default-icon icon)
971 (defmethod (setf window-group) ((group window-group) (window window))
972 (window-group-add-window group window)
975 (defbinding %window-set-default-icon-from-file () boolean
979 (defmethod (setf window-default-icon) ((icon-file pathname))
980 (%window-set-default-icon-from-file icon-file)
983 (defbinding %window-set-icon-from-file () boolean
988 (defmethod (setf window-icon) ((icon-file pathname) (window window))
989 (%window-set-icon-from-file window icon-file)
992 (defbinding window-set-auto-startup-notification () nil
995 (defbinding decorated-window-init () nil
998 (defbinding decorated-window-calculate-frame-size () nil
1001 (defbinding decorated-window-set-title () nil
1005 (defbinding decorated-window-move-resize-window () nil
1015 (defmethod initialize-instance ((window-group window-group) &rest initargs
1016 &key window windows)
1017 (declare (ignore window windows))
1020 (initial-add window-group #'window-group-add-window
1021 initargs :window :windows)))
1024 (defbinding window-group-add-window () nil
1025 (window-group window-group)
1028 (defbinding window-group-remove-window () nil
1029 (window-group window-group)
1035 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1036 (setf (scrolled-window-hscrollbar-policy window) policy)
1037 (setf (scrolled-window-vscrollbar-policy window) policy))
1039 (defbinding scrolled-window-add-with-viewport () nil
1040 (scrolled-window scrolled-window)
1043 (defmethod initialize-instance ((window scrolled-window) &rest initargs
1046 (apply #'call-next-method window
1047 :vscrollbar-policy policy :hscrollbar-policy policy initargs)
1048 (call-next-method)))
1053 (defbinding statusbar-get-context-id () unsigned-int
1054 (statusbar statusbar)
1055 (context-description string))
1057 (defbinding statusbar-push () unsigned-int
1058 (statusbar statusbar)
1059 (context-id unsigned-int)
1062 (defbinding statusbar-pop () nil
1063 (statusbar statusbar)
1064 (context-id unsigned-int))
1066 (defbinding statusbar-remove () nil
1067 (statusbar statusbar)
1068 (context-id unsigned-int)
1069 (message-id unsigned-int))
1075 (defbinding fixed-put () nil
1080 (defbinding fixed-move () nil
1089 (defun %notebook-position (notebook page)
1095 (t (error "Invalid position keyword: ~A" page))))
1096 (widget (notebook-page-num notebook page t))))
1098 (defun %notebook-child (notebook position)
1101 (t (notebook-nth-page-child notebook position))))
1104 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1105 (notebook position child tab-label &optional menu-label) nil
1108 ((if (stringp tab-label)
1109 (make-instance 'label :label tab-label)
1111 ((if (stringp menu-label)
1112 (make-instance 'label :label menu-label)
1113 menu-label) (or null widget))
1114 ((%notebook-position notebook position) int))
1116 (defun notebook-append (notebook child tab-label &optional menu-label)
1117 (notebook-insert notebook :last child tab-label menu-label))
1119 (defun notebook-prepend (notebook child tab-label &optional menu-label)
1120 (notebook-insert notebook :first child tab-label menu-label))
1122 (defbinding notebook-remove-page (notebook page) nil
1124 ((%notebook-position notebook page) int))
1126 (defbinding %notebook-page-num () int
1130 (defun notebook-page-num (notebook child &optional error-p)
1131 (let ((page-num (%notebook-page-num notebook child)))
1134 (error "~A is not a child of ~A" child notebook))
1137 (defbinding notebook-next-page () nil
1138 (notebook notebook))
1140 (defbinding notebook-prev-page () nil
1141 (notebook notebook))
1143 (defbinding notebook-reorder-child (notebook child position) nil
1146 ((%notebook-position notebook position) int))
1148 (defbinding notebook-popup-enable () nil
1149 (notebook notebook))
1151 (defbinding notebook-popup-disable () nil
1152 (notebook notebook))
1154 (defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
1155 (notebook page) widget
1163 (defbinding %notebook-get-current-page () int
1164 (notebook notebook))
1166 (defun notebook-current-page-num (notebook)
1167 (let ((num (%notebook-get-current-page notebook)))
1171 (defun notebook-current-page (notebook)
1172 (let ((page-num (notebook-current-page-num notebook)))
1174 (notebook-nth-page-child notebook page-num))))
1176 (defbinding %notebook-set-current-page () nil
1180 (defun (setf notebook-current-page) (page notebook)
1181 (%notebook-set-current-page notebook (%notebook-position notebook page))
1185 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1186 (notebook page) widget
1188 ((%notebook-child notebook page) widget))
1190 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1191 (notebook page) (copy-of string)
1193 ((%notebook-child notebook page) widget))
1195 (defbinding %notebook-set-tab-label () nil
1200 (defun (setf notebook-tab-label) (tab-label notebook page)
1201 (let ((widget (if (stringp tab-label)
1202 (make-instance 'label :label tab-label)
1204 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
1208 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1209 (notebook page) widget
1211 ((%notebook-child notebook page) widget))
1213 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1214 (notebook page) (copy-of string)
1216 ((%notebook-child notebook page) widget))
1218 (defbinding %notebook-set-menu-label () nil
1221 (menu-label widget))
1223 (defun (setf notebook-menu-label) (menu-label notebook page)
1224 (let ((widget (if (stringp menu-label)
1225 (make-instance 'label :label menu-label)
1227 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1231 (defbinding notebook-query-tab-label-packing (notebook page) nil
1233 ((%notebook-child notebook page) widget)
1234 (expand boolean :out)
1236 (pack-type pack-type :out))
1238 (defbinding notebook-set-tab-label-packing
1239 (notebook page expand fill pack-type) nil
1241 ((%notebook-child notebook page) widget)
1244 (pack-type pack-type))
1250 (defbinding paned-pack1 () nil
1256 (defbinding paned-pack2 () nil
1265 (defbinding layout-put () nil
1271 (defbinding layout-move () nil
1281 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1282 (menu-shell menu-shell)
1283 (menu-item menu-item)
1289 (defun menu-shell-append (menu-shell menu-item)
1290 (menu-shell-insert menu-shell menu-item :last))
1292 (defun menu-shell-prepend (menu-shell menu-item)
1293 (menu-shell-insert menu-shell menu-item :fisrt))
1295 (defbinding menu-shell-deactivate () nil
1296 (menu-shell menu-shell))
1298 (defbinding menu-shell-select-item () nil
1299 (menu-shell menu-shell)
1300 (menu-item menu-item))
1302 (defbinding menu-shell-select-first () nil
1303 (menu-shell menu-shell)
1304 (search-sensitive boolean))
1306 (defbinding menu-shell-deselect () nil
1307 (menu-shell menu-shell))
1309 (defbinding menu-shell-activate-item () nil
1310 (menu-shell menu-shell)
1311 (menu-item menu-item)
1312 (fore-deactivate boolean))
1314 (defbinding menu-shell-cancel () nil
1315 (menu-shell menu-shell))
1320 (defun %menu-position (menu child)
1323 (keyword (case child
1326 (t (error "Invalid position keyword: ~A" child))))
1327 (widget (menu-child-position menu child))))
1330 (defbinding menu-reorder-child (menu menu-item position) nil
1332 (menu-item menu-item)
1333 ((%menu-position menu position) int))
1335 (defbinding menu-attach () nil
1337 (menu-item menu-item)
1338 (left-attach unsigned-int)
1339 (right-attach unsigned-int)
1340 (top-attach unsigned-int)
1341 (bottom-attach unsigned-int))
1343 (def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean)))
1345 (defbinding %menu-popup () nil
1347 (parent-menu-shell (or null menu-shell))
1348 (parent-menu-item (or null menu-item))
1349 (callback-func (or null pointer))
1350 (callback-id unsigned-int)
1351 (button unsigned-int)
1352 (activate-time (unsigned 32)))
1354 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1357 (with-callback-function (id callback)
1359 menu parent-menu-shell parent-menu-item
1360 (callback %menu-position-func) id button activate-time))
1362 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1364 (defbinding menu-set-accel-path () nil
1366 (accel-path string))
1368 (defbinding menu-reposition () nil
1371 (defbinding menu-popdown () nil
1374 (defun menu-child-position (menu child)
1375 (position child (container-children menu)))
1377 (defun menu-active-num (menu)
1378 (menu-child-position menu (menu-active menu)))
1380 (defbinding %menu-set-active () nil
1382 (index unsigned-int))
1384 (defun (setf menu-active) (menu child)
1385 (%menu-set-active menu (%menu-position menu child))
1388 (defcallback %menu-detach-func (nil (widget widget) (menu menu))
1389 (funcall (object-data menu 'detach-func) widget menu))
1391 (defbinding %menu-attach-to-widget () nil
1394 ((callback %menu-detach-func) pointer))
1396 (defun menu-attach-to-widget (menu widget function)
1397 (setf (object-data menu 'detach-func) function)
1398 (%menu-attach-to-widget menu widget))
1400 (defbinding menu-detach () nil
1404 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1407 (defbinding menu-set-monitor () nil
1414 (defbinding table-resize () nil
1417 (columns unsigned-int))
1419 (defbinding table-attach (table child left right top bottom
1420 &key options x-options y-options
1421 (x-padding 0) (y-padding 0)) nil
1425 (right unsigned-int)
1427 (bottom unsigned-int)
1428 ((append (mklist options) (mklist x-options)) attach-options)
1429 ((append (mklist options) (mklist y-options)) attach-options)
1430 (x-padding unsigned-int)
1431 (y-padding unsigned-int))
1434 (defbinding %table-set-row-spacing () nil
1437 (spacing unsigned-int))
1439 (defbinding %table-set-row-spacings () nil
1441 (spacing unsigned-int))
1443 (defun (setf table-row-spacing) (spacing table &optional row)
1445 (%table-set-row-spacing table row spacing)
1446 (%table-set-row-spacings table spacing))
1449 (defbinding %table-get-row-spacing () unsigned-int
1453 (defbinding %table-get-default-row-spacing () unsigned-int
1456 (defun table-row-spacing (table &optional row)
1458 (%table-get-row-spacing table row)
1459 (%table-get-default-row-spacing table)))
1462 (defbinding %table-set-col-spacing () nil
1465 (spacing unsigned-int))
1467 (defbinding %table-set-col-spacings () nil
1469 (spacing unsigned-int))
1471 (defun (setf table-col-spacing) (spacing table &optional col)
1473 (%table-set-col-spacing table col spacing)
1474 (%table-set-col-spacings table spacing))
1477 (defbinding %table-get-col-spacing () unsigned-int
1481 (defbinding %table-get-default-col-spacing () unsigned-int
1484 (defun table-col-spacing (table &optional col)
1486 (%table-get-col-spacing table col)
1487 (%table-get-default-col-spacing table)))
1493 (defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1495 (apply #'call-next-method toolbar
1496 :tooltips (make-instance 'tooltips) initargs)
1497 (call-next-method)))
1499 (defbinding %toolbar-insert () nil
1501 (tool-item tool-item)
1502 (position position))
1504 (defun toolbar-insert (toolbar tool-item &optional (position :end))
1505 (%toolbar-insert toolbar tool-item position)
1506 (%tool-item-update-tooltips tool-item))
1508 (defbinding toolbar-get-item-index () int
1512 (defbinding toolbar-get-nth-item () tool-item
1516 (defbinding toolbar-get-drop-index () int
1520 (defbinding toolbar-set-drop-highlight-item () nil
1522 (tool-item tool-item)
1528 (defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
1529 (if (and icon (not (typep icon 'widget)))
1530 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
1531 (call-next-method)))
1536 (defbinding tool-item-set-tooltip () nil
1537 (tool-item tool-item)
1540 (tip-private string))
1543 (defun %tool-item-update-tooltips (tool-item)
1545 (slot-boundp tool-item 'parent)
1547 (user-data-p tool-item 'tip-text)
1548 (user-data-p tool-item 'tip-private)))
1549 (tool-item-set-tooltip
1550 tool-item (toolbar-tooltips (widget-parent tool-item))
1551 (or (user-data tool-item 'tip-text) "")
1552 (or (user-data tool-item 'tip-private) ""))))
1554 (defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
1555 (setf (user-data tool-item 'tip-text) tip-text)
1556 (%tool-item-update-tooltips tool-item)
1559 (defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
1560 (setf (user-data tool-item 'tip-private) tip-private)
1561 (%tool-item-update-tooltips tool-item)
1564 (defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
1565 (declare (ignore args))
1568 (%tool-item-update-tooltips tool-item)))
1571 (defbinding tool-item-retrieve-proxy-menu-item () widget
1572 (tool-item tool-item))
1574 (defbinding (tool-item-proxy-menu-item
1575 "gtk_tool_item_get_proxy_menu_item") () menu-item
1576 (tool-item tool-item)
1577 (menu-item-id string))
1579 (defbinding %tool-item-set-proxy-menu-item () nil
1580 (tool-item tool-item)
1581 (menu-item-id string)
1582 (menu-item menu-item))
1584 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
1585 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
1589 (defbinding tool-item-rebuild-menu () nil
1590 (tool-item tool-item))
1595 (defbinding editable-select-region (editable &optional (start 0) end) nil
1600 (defbinding editable-get-selection-bounds (editable) nil
1605 (defbinding editable-insert-text (editable text &optional (position 0)) nil
1609 (position position-type :in-out))
1611 (defun editable-append-text (editable text)
1612 (editable-insert-text editable text nil))
1614 (defun editable-prepend-text (editable text)
1615 (editable-insert-text editable text 0))
1617 (defbinding editable-delete-text (editable &optional (start 0) end) nil
1622 (defbinding (editable-text "gtk_editable_get_chars")
1623 (editable &optional (start 0) end) string
1628 (defun (setf editable-text) (text editable)
1630 (editable-delete-text
1632 (editable-insert-text editable text))
1633 (editable-delete-text editable))
1636 (defbinding editable-cut-clipboard () nil
1637 (editable editable))
1639 (defbinding editable-copy-clipboard () nil
1640 (editable editable))
1642 (defbinding editable-paste-clipboard () nil
1643 (editable editable))
1645 (defbinding editable-delete-selection () nil
1646 (editable editable))
1652 (defbinding spin-button-configure () nil
1653 (spin-button spin-button)
1654 (adjustment adjustment)
1655 (climb-rate double-float)
1656 (digits unsigned-int))
1658 (defbinding spin-button-set-range () nil
1659 (spin-button spin-button)
1663 (defbinding spin-button-get-range () nil
1664 (spin-button spin-button)
1665 (min double-float :out)
1666 (max double-float :out))
1668 (defun spin-button-value-as-int (spin-button)
1669 (round (spin-button-value spin-button)))
1671 (defbinding spin-button-spin () nil
1672 (spin-button spin-button)
1673 (direction spin-type)
1674 (increment single-float))
1676 (defbinding spin-button-update () nil
1677 (spin-button spin-button))
1683 (defbinding ruler-set-range () nil
1685 (lower single-float)
1686 (upper single-float)
1687 (position single-float)
1688 (max-size single-float))
1690 (defbinding ruler-draw-ticks () nil
1693 (defbinding ruler-draw-pos () nil
1700 (defun range-lower (range)
1701 (adjustment-lower (range-adjustment range)))
1703 (defun range-upper (range)
1704 (adjustment-upper (range-adjustment range)))
1706 (defun (setf range-lower) (value range)
1707 (setf (adjustment-lower (range-adjustment range)) value))
1709 (defun (setf range-upper) (value range)
1710 (setf (adjustment-upper (range-adjustment range)) value))
1712 (defun range-page-increment (range)
1713 (adjustment-page-increment (range-adjustment range)))
1715 (defun range-step-increment (range)
1716 (adjustment-step-increment (range-adjustment range)))
1718 (defun (setf range-page-increment) (value range)
1719 (setf (adjustment-page-increment (range-adjustment range)) value))
1721 (defun (setf range-step-increment) (value range)
1722 (setf (adjustment-step-increment (range-adjustment range)) value))
1724 (defbinding range-set-range () nil
1726 (lower double-float)
1727 (upper double-float))
1729 (defbinding range-set-increments () nil
1732 (page double-float))
1737 ; (defbinding scale-draw-value () nil
1744 (defbinding progress-bar-pulse () nil
1745 (progress-bar progress-bar))
1750 (defmethod initialize-instance ((size-group size-group) &rest initargs
1751 &key widget widgets)
1752 (declare (ignore widget widgets))
1755 (initial-add size-group #'size-group-add-widget
1756 initargs :widget :widgets)))
1759 (defbinding size-group-add-widget () nil
1760 (size-group size-group)
1763 (defbinding size-group-remove-widget () nil
1764 (size-group size-group)
1770 (defbinding %stock-item-copy () pointer
1773 (defbinding %stock-item-free () nil
1776 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1777 (%stock-item-copy location))
1779 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1780 (%stock-item-free location))
1782 (defbinding stock-add (stock-item) nil
1783 (stock-item stock-item)
1786 (defbinding stock-list-ids () (gslist string))
1788 (defbinding %stock-lookup () boolean
1792 (defun stock-lookup (stock-id)
1794 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1796 (when (%stock-lookup stock-id location)
1797 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1798 (deallocate-memory location))))
1803 (defbinding tooltips-enable () nil
1804 (tooltips tooltips))
1806 (defbinding tooltips-disable () nil
1807 (tooltips tooltips))
1809 (defun (setf tooltips-enabled-p) (enable tooltips)
1811 (tooltips-enable tooltips)
1812 (tooltips-disable tooltips)))
1814 (defbinding tooltips-set-tip () nil
1818 (tip-private string))
1820 (defbinding tooltips-data-get () tooltips-data
1823 (defbinding tooltips-force-window () nil
1824 (tooltips tooltips))
1826 (defbinding tooltips-get-info-from-tip-window () boolean
1828 (tooltips tooltips :out)
1829 (current-widget widget :out))
1834 (defbinding rc-add-default-file (filename) nil
1835 ((namestring (truename filename)) string))
1837 (defbinding rc-parse (filename) nil
1838 ((namestring (truename filename)) string))
1840 (defbinding rc-parse-string () nil
1843 (defbinding rc-reparse-all () nil)
1845 (defbinding rc-get-style () style
1850 ;;; Accelerator Groups
1852 (defbinding accel-group-activate (accel-group key modifiers) boolean
1853 (accel-group accel-group)
1854 ((gdk:keyval-from-name key) unsigned-int)
1855 (modifiers gdk:modifier-type))
1857 (defbinding accel-groups-activate (object key modifiers) boolean
1859 ((gdk:keyval-from-name key) unsigned-int)
1860 (modifiers gdk:modifier-type))
1862 (defbinding accel-group-attach () nil
1863 (accel-group accel-group)
1866 (defbinding accel-group-detach () nil
1867 (accel-group accel-group)
1870 (defbinding accel-group-lock () nil
1871 (accel-group accel-group))
1873 (defbinding accel-group-unlock () nil
1874 (accel-group accel-group))
1877 ;;; Accelerator Groups Entries
1879 (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
1880 (accel-group accel-group)
1881 ((gdk:keyval-from-name key) unsigned-int)
1882 (modifiers gdk:modifier-type))
1884 (defbinding accel-group-lock-entry (accel-group key modifiers) nil
1885 (accel-group accel-group)
1886 ((gdk:keyval-from-name key) unsigned-int)
1887 (modifiers gdk:modifier-type))
1889 (defbinding accel-group-unlock-entry (accel-group key modifiers) nil
1890 (accel-group accel-group)
1891 ((gdk:keyval-from-name key) unsigned-int)
1892 (modifiers gdk:modifier-type))
1894 (defbinding accel-group-add
1895 (accel-group key modifiers flags object signal) nil
1896 (accel-group accel-group)
1897 ((gdk:keyval-from-name key) unsigned-int)
1898 (modifiers gdk:modifier-type)
1901 ((name-to-string signal) string))
1903 (defbinding accel-group-add (accel-group key modifiers object) nil
1904 (accel-group accel-group)
1905 ((gdk:keyval-from-name key) unsigned-int)
1906 (modifiers gdk:modifier-type)
1910 ;;; Accelerator Signals
1912 (defbinding accel-group-handle-add
1913 (object signal-id accel-group key modifiers flags) nil
1915 (signal-id unsigned-int)
1916 (accel-group accel-group)
1917 ((gdk:keyval-from-name key) unsigned-int)
1918 (modifiers gdk:modifier-type)
1919 (flags accel-flags))
1921 (defbinding accel-group-handle-remove
1922 (object accel-group key modifiers) nil
1924 (accel-group accel-group)
1925 ((gdk:keyval-from-name key) unsigned-int)
1926 (modifiers gdk:modifier-type))