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.28 2004-12-29 21:17:36 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)
123 (defbinding box-pack-start () nil
128 (padding unsigned-int))
130 (defbinding box-pack-end () nil
135 (padding unsigned-int))
137 (defun box-pack (box child &key end (expand t) (fill t) (padding 0))
139 (box-pack-end box child expand fill padding)
140 (box-pack-start box child expand fill padding)))
142 (defbinding box-reorder-child () nil
147 (defbinding box-query-child-packing () nil
150 (expand boolean :out)
152 (padding unsigned-int :out)
153 (pack-type pack-type :out))
155 (defbinding box-set-child-packing () nil
160 (padding unsigned-int)
161 (pack-type pack-type))
167 (defmethod initialize-instance ((button button) &rest initargs &key stock)
169 (apply #'call-next-method button :label stock :use-stock t initargs)
173 (defbinding button-pressed () nil
176 (defbinding button-released () nil
179 (defbinding button-clicked () nil
182 (defbinding button-enter () nil
185 (defbinding button-leave () nil
192 (defbinding calendar-select-month () int
197 (defbinding calendar-select-day () nil
201 (defbinding calendar-mark-day () int
205 (defbinding calendar-unmark-day () int
209 (defbinding calendar-clear-marks () nil
212 (defbinding calendar-get-date () nil
214 (year unsigned-int :out)
215 (month unsigned-int :out)
216 (day unsigned-int :out))
218 (defbinding calendar-freeze () nil
221 (defbinding calendar-thaw () nil
227 (defbinding check-menu-item-toggled () nil
228 (check-menu-item check-menu-item))
237 (defbinding (color-selection-is-adjusting-p
238 "gtk_color_selection_is_adjusting") () boolean
239 (colorsel color-selection))
243 ;;; Color selection dialog -- no functions
249 (defmethod initialize-instance ((combo-box combo-box) &rest initargs
250 &key model content active)
251 (remf initargs :active)
253 (apply #'call-next-method combo-box initargs)
255 (apply #'call-next-method combo-box
256 :model (make-instance 'list-store :column-types '(string))
258 (unless (typep combo-box 'combo-box-entry)
259 (let ((cell (make-instance 'cell-renderer-text)))
260 (cell-layout-pack combo-box cell :expand t)
261 (cell-layout-add-attribute combo-box cell :text 0)))))
263 (mapc #'(lambda (text)
264 (combo-box-append-text combo-box text))
267 (setf (combo-box-active combo-box) active)))
270 ;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
272 ;; (signal-emit combo-box 'changed)))
274 (defbinding combo-box-append-text () nil
275 (combo-box combo-box)
278 (defbinding combo-box-insert-text () nil
279 (combo-box combo-box)
283 (defbinding combo-box-prepend-text () nil
284 (combo-box combo-box)
288 (defbinding combo-box-get-active-text () string
289 (combo-box combo-box))
291 (defbinding combo-box-popup () nil
292 (combo-box combo-box))
294 (defbinding combo-box-popdown () nil
295 (combo-box combo-box))
301 (defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
304 (setf (combo-box-entry-text-column combo-box-entry) 0)))
309 (defmethod shared-initialize ((dialog dialog) names &rest initargs
311 (declare (ignore button buttons))
314 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
317 (defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
319 (cadr (assoc id (rest (type-expand-1 'response-type))))
320 (let ((response-ids (object-data dialog 'response-id-key)))
322 ((and response-ids (position id response-ids :test #'equal)))
326 (vector-push-extend id response-ids)
327 (1- (length response-ids)))
330 (object-data dialog 'response-id-key)
331 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
334 (error "Invalid response: ~A" id))))))
336 (defun %dialog-find-response-id (dialog response-id-num)
337 (if (< response-id-num 0)
340 (list response-id-num)
341 (rest (type-expand-1 'response-type)) :test #'equal))
342 (aref (object-data dialog 'response-id-key) response-id-num )))
345 (defmethod signal-connect ((dialog dialog) signal function &key object after)
346 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
351 #'(lambda (dialog id)
352 (when (= id response-id-num)
354 ((eq object t) (funcall function dialog))
355 (object (funcall function object))
356 (t (funcall function)))))
357 :object t :after after))
358 ((call-next-method)))))
361 (defbinding dialog-run () nil
364 (defbinding dialog-response (dialog response-id) nil
366 ((%dialog-find-response-id-num dialog response-id nil t) int))
369 (defbinding %dialog-add-button () button
372 (response-id-num int))
374 (defun dialog-add-button (dialog label &optional (response label)
375 &key default object after)
376 "Adds a button to the dialog."
377 (let* ((id (if (functionp response)
380 (id-num (%dialog-find-response-id-num dialog id t))
381 (button (%dialog-add-button dialog label id-num)))
382 (when (functionp response)
383 (signal-connect dialog id response :object object :after after))
385 (%dialog-set-default-response dialog id-num))
389 (defbinding %dialog-add-action-widget () button
391 (action-widget widget)
392 (response-id-num int))
394 (defun dialog-add-action-widget (dialog widget &optional (response widget)
395 &key default object after)
396 (let* ((id (if (functionp response)
399 (id-num (%dialog-find-response-id-num dialog id t)))
400 (%dialog-add-action-widget dialog widget id-num)
401 (when (functionp response)
402 (signal-connect dialog id response :object object :after after))
404 (%dialog-set-default-response dialog id-num))
408 (defbinding %dialog-set-default-response () nil
410 (response-id-num int))
412 (defun dialog-set-default-response (dialog response-id)
413 (%dialog-set-default-response
414 dialog (%dialog-find-response-id-num dialog response-id nil t)))
416 (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
418 ((%dialog-find-response-id-num dialog response-id nil t) int)
422 (defbinding alternative-dialog-button-order-p(&optional screen)
423 (screen (or null screen)))
426 (defbinding (dialog-set-alternative-button-order
427 "gtk_dialog_set_alternative_button_order_from_array")
430 ((length new-order) int)
431 ((map 'vector #'(lambda (id)
432 (%dialog-find-response-id-num dialog id nil t))
433 new-order) (vector int)))
436 (defmethod container-add ((dialog dialog) (child widget) &rest args)
437 (apply #'container-add (dialog-vbox dialog) child args))
439 (defmethod container-remove ((dialog dialog) (child widget))
440 (container-remove (dialog-vbox dialog) child))
442 (defmethod container-children ((dialog dialog))
443 (container-children (dialog-vbox dialog)))
445 (defmethod (setf container-children) (children (dialog dialog))
446 (setf (container-children (dialog-vbox dialog)) children))
451 (defbinding entry-get-layout-offsets () nil
456 (defbinding entry-layout-index-to-text-index () int
460 (defbinding entry-text-index-to-layout-index () int
467 (def-callback-marshal %entry-completion-match-func
468 (boolean entry-completion string (copy-of tree-iter)))
470 (defbinding entry-completion-set-match-func (completion function) nil
471 (completion entry-completion)
472 ((callback %entry-completion-match-func) pointer)
473 ((register-callback-function function) unsigned-int)
474 ((callback %destroy-user-data) pointer))
476 (defbinding entry-completion-complete () nil
477 (completion entry-completion))
480 (defbinding entry-completion-insert-prefix () nil
481 (completion entry-completion))
483 (defbinding entry-completion-insert-action-text () nil
484 (completion entry-completion)
488 (defbinding entry-completion-insert-action-markup () nil
489 (completion entry-completion)
493 (defbinding entry-completion-delete-action () nil
494 (completion entry-completion)
500 (defbinding image-set-from-file () nil
504 (defmethod (setf image-pixmap) ((data vector) (image image))
505 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
506 (setf (image-pixmap image) pixmap)
507 (setf (image-mask image) mask)))
509 (defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
511 ((typep pixmap 'vector)
512 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
513 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
517 (image-set-from-file image file)))
518 ((call-next-method))))
520 (defun create-image (source &optional mask)
522 (gdk:pixbuf (make-instance 'image :pixbuf source))
523 (string (make-instance 'image :stock source))
524 (pathname (make-instance 'image :file source))
525 ((or list vector) (make-instance 'image :pixmap source))
526 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
531 (defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
532 (if (and image (not (typep image 'widget)))
533 (apply #'call-next-method item :image (create-image image) initargs)
537 (defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
538 (setf (slot-value item 'image) widget))
540 (defmethod (setf image-menu-item-image) (image (item image-menu-item))
541 (setf (image-menu-item-image item) (create-image image)))
546 (defbinding label-get-layout-offsets () nil
551 (defbinding label-select-region () nil
556 (defbinding label-get-selection-bounds () boolean
565 (defbinding %radio-button-get-group () pointer
566 (radio-button radio-button))
568 (defbinding %radio-button-set-group () nil
569 (radio-button radio-button)
572 (defun radio-button-add-to-group (button1 button2)
573 "Add BUTTON1 to the group which BUTTON2 belongs to."
574 (%radio-button-set-group button1 (%radio-button-get-group button2)))
577 (defmethod initialize-instance ((button radio-button) &key group)
581 (radio-button-add-to-group button group))))
586 (defbinding item-select () nil
589 (defbinding item-deselect () nil
592 (defbinding item-toggle () nil
599 (defmethod initialize-instance ((item menu-item) &key label)
603 (setf (menu-item-label item) label))))
606 (defun (setf menu-item-label) (label menu-item)
607 (make-instance 'accel-label
608 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
609 :use-underline (menu-item-use-underline-p menu-item)
610 :visible t :parent menu-item)
613 (defun menu-item-label (menu-item)
614 (when (and (slot-boundp menu-item 'child)
615 (typep (bin-child menu-item) 'label))
616 (label-label (bin-child menu-item))))
618 (defbinding menu-item-remove-submenu () nil
619 (menu-item menu-item))
621 (defbinding menu-item-set-accel-path () nil
622 (menu-item menu-item)
625 (defbinding menu-item-select () nil
626 (menu-item menu-item))
628 (defbinding menu-item-deselect () nil
629 (menu-item menu-item))
631 (defbinding menu-item-activate () nil
632 (menu-item menu-item))
634 (defbinding menu-item-toggle-size-request () nil
635 (menu-item menu-item)
636 (requisition int :out))
638 (defbinding menu-item-toggle-size-allocate () nil
639 (menu-item menu-item)
646 (defbinding menu-tool-button-set-arrow-tip () nil
647 (menu-tool-button menu-tool-button)
650 (tip-private string))
655 (defmethod initialize-instance ((dialog message-dialog) &rest initargs
656 &key (type :info) (buttons :close) ; or :ok?
657 flags message parent)
658 (remf initargs :parent)
660 (slot-value dialog 'location)
661 (%message-dialog-new parent flags type buttons nil))
662 (message-dialog-set-markup dialog message)
663 (apply #'call-next-method dialog initargs))
666 (defbinding %message-dialog-new () pointer
667 (parent (or null window))
670 (buttons buttons-type)
671 (message (or null string)))
673 (defbinding %message-dialog-new-with-markup () pointer
674 (parent (or null window))
677 (buttons buttons-type)
680 (defbinding message-dialog-set-markup () nil
681 (message-dialog message-dialog)
685 (defbinding message-dialog-format-secondary-text () nil
686 (message-dialog message-dialog)
690 (defbinding message-dialog-format-secondary-markup () nil
691 (message-dialog message-dialog)
698 (defbinding %radio-menu-item-get-group () pointer
699 (radio-menu-item radio-menu-item))
701 (defbinding %radio-menu-item-set-group () nil
702 (radio-menu-item radio-menu-item)
705 (defun radio-menu-item-add-to-group (item1 item2)
706 "Add ITEM1 to the group which ITEM2 belongs to."
707 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
709 (defmethod initialize-instance ((item radio-menu-item) &key group)
713 (radio-menu-item-add-to-group item group))))
716 ;;; Radio tool button
718 (defbinding %radio-tool-button-get-group () pointer
719 (radio-tool-button radio-tool-button))
721 (defbinding %radio-tool-button-set-group () nil
722 (radio-tool-button radio-tool-button)
725 (defun radio-tool-button-add-to-group (button1 button2)
726 "Add BUTTON1 to the group which BUTTON2 belongs to."
727 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
730 (defmethod initialize-instance ((button radio-tool-button) &key group)
734 (radio-tool-button-add-to-group button group))))
739 (defbinding toggle-button-toggled () nil
740 (toggle-button toggle-button))
745 (defmethod initialize-instance ((window window) &rest initargs
746 &key accel-group accel-groups)
747 (declare (ignore accel-group accel-groups))
750 (initial-add window #'window-add-accel-group
751 initargs :accel-group :accel-groups)))
754 (defbinding window-set-wmclass () nil
756 (wmclass-name string)
757 (wmclass-class string))
759 (defbinding window-add-accel-group () nil
761 (accel-group accel-group))
763 (defbinding window-remove-accel-group () nil
765 (accel-group accel-group))
767 (defbinding window-activate-focus () int
770 (defbinding window-activate-default () int
773 (defbinding window-set-default-size (window width height) int
776 ((or height -1) int))
778 (defbinding %window-set-geometry-hints () nil
780 (geometry gdk:geometry)
781 (geometry-mask gdk:window-hints))
783 (defun window-set-geometry-hints (window &key min-width min-height
784 max-width max-height base-width base-height
785 width-inc height-inc min-aspect max-aspect
786 (gravity nil gravity-p) min-size max-size)
787 (let ((geometry (make-instance 'gdk:geometry
788 :min-width (or min-width -1)
789 :min-height (or min-height -1)
790 :max-width (or max-width -1)
791 :max-height (or max-height -1)
792 :base-width (or base-width 0)
793 :base-height (or base-height 0)
794 :width-inc (or width-inc 0)
795 :height-inc (or height-inc 0)
796 :min-aspect (or min-aspect 0)
797 :max-aspect (or max-aspect 0)
800 (when (or min-size min-width min-height)
801 (push :min-size mask))
802 (when (or max-size max-width max-height)
803 (push :max-size mask))
804 (when (or base-width base-height)
805 (push :base-size mask))
806 (when (or width-inc height-inc)
807 (push :resize-inc mask))
808 (when (or min-aspect max-aspect)
811 (push :win-gravity mask))
812 (%window-set-geometry-hints window geometry mask)))
814 (defbinding window-list-toplevels () (glist (copy-of window))
815 "Returns a list of all existing toplevel windows.")
817 (defbinding window-add-mnemonic (window key target) nil
819 ((gdk:keyval-from-name key) unsigned-int)
822 (defbinding window-remove-mnemonic (window key target) nil
824 ((gdk:keyval-from-name key) unsigned-int)
827 (defbinding window-mnemonic-activate (window key modifier) nil
829 ((gdk:keyval-from-name key) unsigned-int)
830 (modifier gdk:modifier-type))
832 (defbinding window-activate-key () boolean
834 (event gdk:key-event))
836 (defbinding window-propagate-key-event () boolean
838 (event gdk:key-event))
840 (defbinding window-present () nil
843 (defbinding window-iconify () nil
846 (defbinding window-deiconify () nil
849 (defbinding window-stick () nil
852 (defbinding window-unstick () nil
855 (defbinding window-maximize () nil
858 (defbinding window-unmaximize () nil
861 (defbinding window-fullscreen () nil
864 (defbinding window-unfullscreen () nil
867 (defbinding window-set-keep-above () nil
871 (defbinding window-set-keep-below () nil
875 (defbinding window-begin-resize-drag () nil
877 (edge gdk:window-edge)
879 (root-x int) (root-y int)
880 (timestamp unsigned-int))
882 (defbinding window-begin-move-drag () nil
884 (edge gdk:window-edge)
886 (root-x int) (root-y int)
887 (timestamp unsigned-int))
889 (defbinding window-set-frame-dimensions () nil
891 (left int) (top int) (rigth int) (bottom int))
893 (defbinding %window-get-default-size () nil
898 (defun window-get-default-size (window)
899 (multiple-value-bind (width height) (%window-get-default-size window)
900 (values (unless (= width -1) width) (unless (= height -1) height))))
902 (defbinding window-get-frame-dimensions () nil
904 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
906 (defbinding %window-get-icon-list () (glist gdk:pixbuf)
909 (defbinding window-get-position () nil
914 (defbinding window-get-size () nil
919 (defbinding window-move () nil
924 (defbinding window-parse-geometry () boolean
928 (defbinding window-reshow-with-initial-size () nil
931 (defbinding window-resize () nil
936 (defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
937 () (glist gdk:pixbuf))
939 (defun window-default-icon ()
940 (first (window-default-icon-list)))
942 (defbinding %window-set-default-icon-list () nil
943 (icons (glist gdk:pixbuf)))
945 (defun (setf window-default-icon-list) (icons)
946 (%window-set-default-icon-list icons)
949 (defbinding %window-set-default-icon () nil
950 (icons (glist gdk:pixbuf)))
952 (defmethod (setf window-default-icon) ((icon gdk:pixbuf))
953 (%window-set-default-icon icon)
956 (defmethod (setf window-group) ((group window-group) (window window))
957 (window-group-add-window group window)
960 (defbinding %window-set-default-icon-from-file () boolean
964 (defmethod (setf window-default-icon) ((icon-file pathname))
965 (%window-set-default-icon-from-file icon-file)
968 (defbinding %window-set-icon-from-file () boolean
973 (defmethod (setf window-icon) ((icon-file pathname) (window window))
974 (%window-set-icon-from-file window icon-file)
977 (defbinding window-set-auto-startup-notification () nil
980 (defbinding decorated-window-init () nil
983 (defbinding decorated-window-calculate-frame-size () nil
986 (defbinding decorated-window-set-title () nil
990 (defbinding decorated-window-move-resize-window () nil
1000 (defmethod initialize-instance ((window-group window-group) &rest initargs
1001 &key window windows)
1002 (declare (ignore window windows))
1005 (initial-add window-group #'window-group-add-window
1006 initargs :window :windows)))
1009 (defbinding window-group-add-window () nil
1010 (window-group window-group)
1013 (defbinding window-group-remove-window () nil
1014 (window-group window-group)
1020 (defun (setf scrolled-window-scrollbar-policy) (policy window)
1021 (setf (scrolled-window-hscrollbar-policy window) policy)
1022 (setf (scrolled-window-vscrollbar-policy window) policy))
1024 (defbinding scrolled-window-add-with-viewport () nil
1025 (scrolled-window scrolled-window)
1028 (defmethod initialize-instance ((window scrolled-window) &rest initargs
1031 (apply #'call-next-method window
1032 :vscrollbar-policy policy :hscrollbar-policy policy initargs)
1033 (call-next-method)))
1038 (defbinding statusbar-get-context-id () unsigned-int
1039 (statusbar statusbar)
1040 (context-description string))
1042 (defbinding statusbar-push () unsigned-int
1043 (statusbar statusbar)
1044 (context-id unsigned-int)
1047 (defbinding statusbar-pop () nil
1048 (statusbar statusbar)
1049 (context-id unsigned-int))
1051 (defbinding statusbar-remove () nil
1052 (statusbar statusbar)
1053 (context-id unsigned-int)
1054 (message-id unsigned-int))
1060 (defbinding fixed-put () nil
1065 (defbinding fixed-move () nil
1074 (defun %notebook-position (notebook page)
1080 (t (error "Invalid position keyword: ~A" page))))
1081 (widget (notebook-page-num notebook page t))))
1083 (defun %notebook-child (notebook position)
1086 (t (notebook-nth-page-child notebook position))))
1089 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1090 (notebook position child tab-label &optional menu-label) nil
1093 ((if (stringp tab-label)
1094 (make-instance 'label :label tab-label)
1096 ((if (stringp menu-label)
1097 (make-instance 'label :label menu-label)
1098 menu-label) (or null widget))
1099 ((%notebook-position notebook position) int))
1101 (defun notebook-append (notebook child tab-label &optional menu-label)
1102 (notebook-insert notebook :last child tab-label menu-label))
1104 (defun notebook-prepend (notebook child tab-label &optional menu-label)
1105 (notebook-insert notebook :first child tab-label menu-label))
1107 (defbinding notebook-remove-page (notebook page) nil
1109 ((%notebook-position notebook page) int))
1111 (defbinding %notebook-page-num () int
1115 (defun notebook-page-num (notebook child &optional error-p)
1116 (let ((page-num (%notebook-page-num notebook child)))
1119 (error "~A is not a child of ~A" child notebook))
1122 (defbinding notebook-next-page () nil
1123 (notebook notebook))
1125 (defbinding notebook-prev-page () nil
1126 (notebook notebook))
1128 (defbinding notebook-reorder-child (notebook child position) nil
1131 ((%notebook-position notebook position) int))
1133 (defbinding notebook-popup-enable () nil
1134 (notebook notebook))
1136 (defbinding notebook-popup-disable () nil
1137 (notebook notebook))
1139 (defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
1140 (notebook page) widget
1148 (defbinding %notebook-get-current-page () int
1149 (notebook notebook))
1151 (defun notebook-current-page-num (notebook)
1152 (let ((num (%notebook-get-current-page notebook)))
1156 (defun notebook-current-page (notebook)
1157 (let ((page-num (notebook-current-page-num notebook)))
1159 (notebook-nth-page-child notebook page-num))))
1161 (defbinding %notebook-set-current-page () nil
1165 (defun (setf notebook-current-page) (page notebook)
1166 (%notebook-set-current-page notebook (%notebook-position notebook page))
1170 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1171 (notebook page) widget
1173 ((%notebook-child notebook page) widget))
1175 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1176 (notebook page) (copy-of string)
1178 ((%notebook-child notebook page) widget))
1180 (defbinding %notebook-set-tab-label () nil
1185 (defun (setf notebook-tab-label) (tab-label notebook page)
1186 (let ((widget (if (stringp tab-label)
1187 (make-instance 'label :label tab-label)
1189 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
1193 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1194 (notebook page) widget
1196 ((%notebook-child notebook page) widget))
1198 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1199 (notebook page) (copy-of string)
1201 ((%notebook-child notebook page) widget))
1203 (defbinding %notebook-set-menu-label () nil
1206 (menu-label widget))
1208 (defun (setf notebook-menu-label) (menu-label notebook page)
1209 (let ((widget (if (stringp menu-label)
1210 (make-instance 'label :label menu-label)
1212 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1216 (defbinding notebook-query-tab-label-packing (notebook page) nil
1218 ((%notebook-child notebook page) widget)
1219 (expand boolean :out)
1221 (pack-type pack-type :out))
1223 (defbinding notebook-set-tab-label-packing
1224 (notebook page expand fill pack-type) nil
1226 ((%notebook-child notebook page) widget)
1229 (pack-type pack-type))
1235 (defbinding paned-pack1 () nil
1241 (defbinding paned-pack2 () nil
1250 (defbinding layout-put () nil
1256 (defbinding layout-move () nil
1266 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1267 (menu-shell menu-shell)
1268 (menu-item menu-item)
1274 (defun menu-shell-append (menu-shell menu-item)
1275 (menu-shell-insert menu-shell menu-item :last))
1277 (defun menu-shell-prepend (menu-shell menu-item)
1278 (menu-shell-insert menu-shell menu-item :fisrt))
1280 (defbinding menu-shell-deactivate () nil
1281 (menu-shell menu-shell))
1283 (defbinding menu-shell-select-item () nil
1284 (menu-shell menu-shell)
1285 (menu-item menu-item))
1287 (defbinding menu-shell-select-first () nil
1288 (menu-shell menu-shell)
1289 (search-sensitive boolean))
1291 (defbinding menu-shell-deselect () nil
1292 (menu-shell menu-shell))
1294 (defbinding menu-shell-activate-item () nil
1295 (menu-shell menu-shell)
1296 (menu-item menu-item)
1297 (fore-deactivate boolean))
1299 (defbinding menu-shell-cancel () nil
1300 (menu-shell menu-shell))
1305 (defun %menu-position (menu child)
1308 (keyword (case child
1311 (t (error "Invalid position keyword: ~A" child))))
1312 (widget (menu-child-position menu child))))
1315 (defbinding menu-reorder-child (menu menu-item position) nil
1317 (menu-item menu-item)
1318 ((%menu-position menu position) int))
1320 (defbinding menu-attach () nil
1322 (menu-item menu-item)
1323 (left-attach unsigned-int)
1324 (right-attach unsigned-int)
1325 (top-attach unsigned-int)
1326 (bottom-attach unsigned-int))
1328 (def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean)))
1330 (defbinding %menu-popup () nil
1332 (parent-menu-shell (or null menu-shell))
1333 (parent-menu-item (or null menu-item))
1334 (callback-func (or null pointer))
1335 (callback-id unsigned-int)
1336 (button unsigned-int)
1337 (activate-time (unsigned 32)))
1339 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1342 (with-callback-function (id callback)
1344 menu parent-menu-shell parent-menu-item
1345 (callback %menu-position-func) id button activate-time))
1347 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1349 (defbinding menu-set-accel-path () nil
1351 (accel-path string))
1353 (defbinding menu-reposition () nil
1356 (defbinding menu-popdown () nil
1359 (defun menu-child-position (menu child)
1360 (position child (container-children menu)))
1362 (defun menu-active-num (menu)
1363 (menu-child-position menu (menu-active menu)))
1365 (defbinding %menu-set-active () nil
1367 (index unsigned-int))
1369 (defun (setf menu-active) (menu child)
1370 (%menu-set-active menu (%menu-position menu child))
1373 (defcallback %menu-detach-func (nil (widget widget) (menu menu))
1374 (funcall (object-data menu 'detach-func) widget menu))
1376 (defbinding %menu-attach-to-widget () nil
1379 ((callback %menu-detach-func) pointer))
1381 (defun menu-attach-to-widget (menu widget function)
1382 (setf (object-data menu 'detach-func) function)
1383 (%menu-attach-to-widget menu widget))
1385 (defbinding menu-detach () nil
1389 (defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1392 (defbinding menu-set-monitor () nil
1399 (defbinding table-resize () nil
1402 (columns unsigned-int))
1404 (defbinding table-attach (table child left right top bottom
1405 &key options x-options y-options
1406 (x-padding 0) (y-padding 0)) nil
1410 (right unsigned-int)
1412 (bottom unsigned-int)
1413 ((append (mklist options) (mklist x-options)) attach-options)
1414 ((append (mklist options) (mklist y-options)) attach-options)
1415 (x-padding unsigned-int)
1416 (y-padding unsigned-int))
1419 (defbinding %table-set-row-spacing () nil
1422 (spacing unsigned-int))
1424 (defbinding %table-set-row-spacings () nil
1426 (spacing unsigned-int))
1428 (defun (setf table-row-spacing) (spacing table &optional row)
1430 (%table-set-row-spacing table row spacing)
1431 (%table-set-row-spacings table spacing))
1434 (defbinding %table-get-row-spacing () unsigned-int
1438 (defbinding %table-get-default-row-spacing () unsigned-int
1441 (defun table-row-spacing (table &optional row)
1443 (%table-get-row-spacing table row)
1444 (%table-get-default-row-spacing table)))
1447 (defbinding %table-set-col-spacing () nil
1450 (spacing unsigned-int))
1452 (defbinding %table-set-col-spacings () nil
1454 (spacing unsigned-int))
1456 (defun (setf table-col-spacing) (spacing table &optional col)
1458 (%table-set-col-spacing table col spacing)
1459 (%table-set-col-spacings table spacing))
1462 (defbinding %table-get-col-spacing () unsigned-int
1466 (defbinding %table-get-default-col-spacing () unsigned-int
1469 (defun table-col-spacing (table &optional col)
1471 (%table-get-col-spacing table col)
1472 (%table-get-default-col-spacing table)))
1478 (defbinding %toolbar-insert-element () widget
1480 (type toolbar-child-type)
1481 (widget (or null widget))
1483 (tooltip-text string)
1484 (tooltip-private-text string)
1485 (icon (or null widget))
1490 (defbinding %toolbar-insert-stock () widget
1493 (tooltip-text string)
1494 (tooltip-private-text string)
1499 (defun toolbar-insert (toolbar position element
1500 &key tooltip-text tooltip-private-text
1501 type icon group callback object)
1502 (let* ((numpos (case position
1510 (and (not type) (eq element :space)))
1511 (%toolbar-insert-element
1512 toolbar :space nil nil
1513 tooltip-text tooltip-private-text nil numpos))
1516 (and (not type) (typep element 'widget)))
1517 (%toolbar-insert-element
1518 toolbar :widget element nil
1519 tooltip-text tooltip-private-text nil numpos))
1524 (typep element 'string)
1525 (stock-lookup element)))
1526 (%toolbar-insert-stock
1527 toolbar element tooltip-text tooltip-private-text numpos))
1528 ((typep element 'string)
1529 (%toolbar-insert-element
1530 toolbar (or type :button) (when (eq type :radio-button) group)
1531 element tooltip-text tooltip-private-text
1535 (string (make-instance 'image :stock icon))
1536 (pathname (make-instance 'image :file icon))
1538 (make-instance 'image
1539 :pixmap icon ; :icon-size (toolbar-icon-size toolbar)
1542 ((error "Invalid element type: ~A" element)))))
1544 (signal-connect widget 'clicked callback :object object))
1547 (defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text
1548 type icon group callback object)
1550 toolbar :first element :type type :icon icon :group group
1551 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1552 :callback callback :object object))
1554 (defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text
1555 type icon group callback object)
1557 toolbar :last element :type type :icon icon :group group
1558 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1559 :callback callback :object object))
1562 (defun toolbar-insert-space (toolbar position)
1563 (toolbar-insert toolbar position :space))
1565 (defun toolbar-append-space (toolbar)
1566 (toolbar-append toolbar :space))
1568 (defun toolbar-prepend-space (toolbar)
1569 (toolbar-prepend toolbar :space))
1572 (defun toolbar-enable-tooltips (toolbar)
1573 (setf (toolbar-tooltips-p toolbar) t))
1575 (defun toolbar-disable-tooltips (toolbar)
1576 (setf (toolbar-tooltips-p toolbar) nil))
1579 (defbinding toolbar-remove-space () nil
1583 (defbinding toolbar-unset-icon-size () nil
1586 (defbinding toolbar-unset-style () nil
1592 (defbinding tool-item-retrieve-proxy-menu-item () widget
1593 (tool-item tool-item))
1595 (defbinding (tool-item-proxy-menu-item
1596 "gtk_tool_item_get_proxy_menu_item") () menu-item
1597 (tool-item tool-item)
1598 (menu-item-id string))
1600 (defbinding %tool-item-set-proxy-menu-item () nil
1601 (tool-item tool-item)
1602 (menu-item-id string)
1603 (menu-item menu-item))
1605 (defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
1606 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
1610 (defbinding tool-item-rebuild-menu () nil
1611 (tool-item tool-item))
1616 (defbinding editable-select-region (editable &optional (start 0) end) nil
1621 (defbinding editable-get-selection-bounds (editable) nil
1626 (defbinding editable-insert-text (editable text &optional (position 0)) nil
1630 (position editable-position :in-out))
1632 (defun editable-append-text (editable text)
1633 (editable-insert-text editable text nil))
1635 (defun editable-prepend-text (editable text)
1636 (editable-insert-text editable text 0))
1638 (defbinding editable-delete-text (editable &optional (start 0) end) nil
1643 (defbinding (editable-text "gtk_editable_get_chars")
1644 (editable &optional (start 0) end) string
1649 (defun (setf editable-text) (text editable)
1651 (editable-delete-text
1653 (editable-insert-text editable text))
1654 (editable-delete-text editable))
1657 (defbinding editable-cut-clipboard () nil
1658 (editable editable))
1660 (defbinding editable-copy-clipboard () nil
1661 (editable editable))
1663 (defbinding editable-paste-clipboard () nil
1664 (editable editable))
1666 (defbinding editable-delete-selection () nil
1667 (editable editable))
1673 (defbinding spin-button-configure () nil
1674 (spin-button spin-button)
1675 (adjustment adjustment)
1676 (climb-rate double-float)
1677 (digits unsigned-int))
1679 (defbinding spin-button-set-range () nil
1680 (spin-button spin-button)
1684 (defbinding spin-button-get-range () nil
1685 (spin-button spin-button)
1686 (min double-float :out)
1687 (max double-float :out))
1689 (defun spin-button-value-as-int (spin-button)
1690 (round (spin-button-value spin-button)))
1692 (defbinding spin-button-spin () nil
1693 (spin-button spin-button)
1694 (direction spin-type)
1695 (increment single-float))
1697 (defbinding spin-button-update () nil
1698 (spin-button spin-button))
1704 (defbinding ruler-set-range () nil
1706 (lower single-float)
1707 (upper single-float)
1708 (position single-float)
1709 (max-size single-float))
1711 (defbinding ruler-draw-ticks () nil
1714 (defbinding ruler-draw-pos () nil
1721 (defun range-lower (range)
1722 (adjustment-lower (range-adjustment range)))
1724 (defun range-upper (range)
1725 (adjustment-upper (range-adjustment range)))
1727 (defun (setf range-lower) (value range)
1728 (setf (adjustment-lower (range-adjustment range)) value))
1730 (defun (setf range-upper) (value range)
1731 (setf (adjustment-upper (range-adjustment range)) value))
1733 (defun range-page-increment (range)
1734 (adjustment-page-increment (range-adjustment range)))
1736 (defun range-step-increment (range)
1737 (adjustment-step-increment (range-adjustment range)))
1739 (defun (setf range-page-increment) (value range)
1740 (setf (adjustment-page-increment (range-adjustment range)) value))
1742 (defun (setf range-step-increment) (value range)
1743 (setf (adjustment-step-increment (range-adjustment range)) value))
1745 (defbinding range-set-range () nil
1747 (lower double-float)
1748 (upper double-float))
1750 (defbinding range-set-increments () nil
1753 (page double-float))
1758 ; (defbinding scale-draw-value () nil
1765 (defbinding progress-bar-pulse () nil
1766 (progress-bar progress-bar))
1771 (defmethod initialize-instance ((size-group size-group) &rest initargs
1772 &key widget widgets)
1773 (declare (ignore widget widgets))
1776 (initial-add size-group #'size-group-add-widget
1777 initargs :widget :widgets)))
1780 (defbinding size-group-add-widget () nil
1781 (size-group size-group)
1784 (defbinding size-group-remove-widget () nil
1785 (size-group size-group)
1791 (defbinding %stock-item-copy () pointer
1794 (defbinding %stock-item-free () nil
1797 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1798 (%stock-item-copy location))
1800 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1801 (%stock-item-free location))
1803 (defbinding stock-add (stock-item) nil
1804 (stock-item stock-item)
1807 (defbinding stock-list-ids () (gslist string))
1809 (defbinding %stock-lookup () boolean
1813 (defun stock-lookup (stock-id)
1815 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1817 (when (%stock-lookup stock-id location)
1818 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1819 (deallocate-memory location))))
1824 (defbinding tooltips-enable () nil
1825 (tooltips tooltips))
1827 (defbinding tooltips-disable () nil
1828 (tooltips tooltips))
1830 (defun (setf tooltips-enabled-p) (enable tooltips)
1832 (tooltips-enable tooltips)
1833 (tooltips-disable tooltips)))
1835 (defbinding tooltips-set-tip () nil
1839 (tip-private string))
1841 (defbinding tooltips-data-get () tooltips-data
1844 (defbinding tooltips-force-window () nil
1845 (tooltips tooltips))
1847 (defbinding tooltips-get-info-from-tip-window () boolean
1849 (tooltips tooltips :out)
1850 (current-widget widget :out))
1855 (defbinding rc-add-default-file (filename) nil
1856 ((namestring (truename filename)) string))
1858 (defbinding rc-parse (filename) nil
1859 ((namestring (truename filename)) string))
1861 (defbinding rc-parse-string () nil
1864 (defbinding rc-reparse-all () nil)
1866 (defbinding rc-get-style () style
1871 ;;; Accelerator Groups
1873 (defbinding accel-group-activate (accel-group key modifiers) boolean
1874 (accel-group accel-group)
1875 ((gdk:keyval-from-name key) unsigned-int)
1876 (modifiers gdk:modifier-type))
1878 (defbinding accel-groups-activate (object key modifiers) boolean
1880 ((gdk:keyval-from-name key) unsigned-int)
1881 (modifiers gdk:modifier-type))
1883 (defbinding accel-group-attach () nil
1884 (accel-group accel-group)
1887 (defbinding accel-group-detach () nil
1888 (accel-group accel-group)
1891 (defbinding accel-group-lock () nil
1892 (accel-group accel-group))
1894 (defbinding accel-group-unlock () nil
1895 (accel-group accel-group))
1898 ;;; Accelerator Groups Entries
1900 (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
1901 (accel-group accel-group)
1902 ((gdk:keyval-from-name key) unsigned-int)
1903 (modifiers gdk:modifier-type))
1905 (defbinding accel-group-lock-entry (accel-group key modifiers) nil
1906 (accel-group accel-group)
1907 ((gdk:keyval-from-name key) unsigned-int)
1908 (modifiers gdk:modifier-type))
1910 (defbinding accel-group-unlock-entry (accel-group key modifiers) nil
1911 (accel-group accel-group)
1912 ((gdk:keyval-from-name key) unsigned-int)
1913 (modifiers gdk:modifier-type))
1915 (defbinding accel-group-add
1916 (accel-group key modifiers flags object signal) nil
1917 (accel-group accel-group)
1918 ((gdk:keyval-from-name key) unsigned-int)
1919 (modifiers gdk:modifier-type)
1922 ((name-to-string signal) string))
1924 (defbinding accel-group-add (accel-group key modifiers object) nil
1925 (accel-group accel-group)
1926 ((gdk:keyval-from-name key) unsigned-int)
1927 (modifiers gdk:modifier-type)
1931 ;;; Accelerator Signals
1933 (defbinding accel-group-handle-add
1934 (object signal-id accel-group key modifiers flags) nil
1936 (signal-id unsigned-int)
1937 (accel-group accel-group)
1938 ((gdk:keyval-from-name key) unsigned-int)
1939 (modifiers gdk:modifier-type)
1940 (flags accel-flags))
1942 (defbinding accel-group-handle-remove
1943 (object accel-group key modifiers) nil
1945 (accel-group accel-group)
1946 ((gdk:keyval-from-name key) unsigned-int)
1947 (modifiers gdk:modifier-type))