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.23 2004-12-20 20:00:07 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 (defvar %*response-id-key* (gensym))
334 (defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
336 (cadr (assoc id (rest (type-expand-1 'response-type))))
337 (let ((response-ids (object-data dialog %*response-id-key*)))
339 ((and response-ids (position id response-ids :test #'equal)))
343 (vector-push-extend id response-ids)
344 (1- (length response-ids)))
347 (object-data dialog %*response-id-key*)
348 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
351 (error "Invalid response: ~A" id))))))
353 (defun %dialog-find-response-id (dialog response-id-num)
354 (if (< response-id-num 0)
357 (list response-id-num)
358 (rest (type-expand-1 'response-type)) :test #'equal))
359 (aref (object-data dialog %*response-id-key*) response-id-num )))
362 (defmethod signal-connect ((dialog dialog) signal function &key object after)
363 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
368 #'(lambda (dialog id)
369 (when (= id response-id-num)
371 ((eq object t) (funcall function dialog))
372 (object (funcall function object))
373 (t (funcall function)))))
374 :object t :after after))
375 ((call-next-method)))))
378 (defbinding dialog-run () nil
381 (defbinding dialog-response (dialog response-id) nil
383 ((%dialog-find-response-id-num dialog response-id nil t) int))
386 (defbinding %dialog-add-button () button
389 (response-id-num int))
391 (defun dialog-add-button (dialog label &optional (response label)
392 &key default object after)
393 "Adds a button to the dialog. If no response is given, then label
395 (let* ((id (if (functionp response)
398 (id-num (%dialog-find-response-id-num dialog id t))
399 (button (%dialog-add-button dialog label id-num)))
400 (when (functionp response)
401 (signal-connect dialog id response :object object :after after))
403 (%dialog-set-default-response dialog id-num))
407 (defbinding %dialog-add-action-widget () button
409 (action-widget widget)
410 (response-id-num int))
412 (defun dialog-add-action-widget (dialog widget &optional (response widget)
413 &key default object after)
414 (let* ((id (if (functionp response)
417 (id-num (%dialog-find-response-id-num dialog id t)))
418 (%dialog-add-action-widget dialog widget id-num)
419 (when (functionp response)
420 (signal-connect dialog id response :object object :after after))
422 (%dialog-set-default-response dialog id-num))
426 (defbinding %dialog-set-default-response () nil
428 (response-id-num int))
430 (defun dialog-set-default-response (dialog response-id)
431 (%dialog-set-default-response
432 dialog (%dialog-find-response-id-num dialog response-id nil t)))
434 (defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
436 ((%dialog-find-response-id-num dialog response-id nil t) int)
440 ;; Addition dialog functions
442 (defmethod container-add ((dialog dialog) (child widget) &rest args)
443 (apply #'container-add (dialog-vbox dialog) child args))
445 (defmethod container-remove ((dialog dialog) (child widget))
446 (container-remove (dialog-vbox dialog) child))
448 (defmethod container-children ((dialog dialog))
449 (container-children (dialog-vbox dialog)))
451 (defmethod (setf container-children) (children (dialog dialog))
452 (setf (container-children (dialog-vbox dialog)) children))
458 (defbinding drawing-area-get-size () nil
459 (drawing-area drawing-area)
466 (defbinding entry-get-layout () pango:layout
469 (defbinding entry-get-layout-offsets () nil
477 (defbinding image-set-from-file () nil
481 (defbinding image-set-from-pixmap () nil
486 (defbinding image-set-from-stock () nil
489 (icon-size icon-size))
491 (defun image-set-from-pixmap-data (image pixmap-data)
492 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap-data)
493 (image-set-from-pixmap image pixmap mask)))
495 (defun image-set-from-source (image source)
497 (pathname (image-set-from-file image source))
498 (string (if (stock-lookup source)
499 (setf (image-stock image) source)
500 (image-set-from-file image source)))
501 (vector (image-set-from-pixmap-data image source))))
504 (defmethod shared-initialize ((image image) names &rest initargs
505 &key file pixmap source)
509 (remf initargs :pixmap)
510 (apply #'call-next-method image names initargs))
513 (file (image-set-from-file image file))
514 ((vectorp pixmap) (image-set-from-pixmap-data image pixmap))
515 (source (image-set-from-source image source)))))
520 (defbinding label-get-layout-offsets () nil
525 (defbinding label-select-region () nil
530 (defbinding label-get-text () string
533 (defbinding label-get-layout () pango:layout
536 (defbinding label-get-selection-bounds () boolean
545 (defbinding %radio-button-get-group () pointer
546 (radio-button radio-button))
548 (defbinding %radio-button-set-group () nil
549 (radio-button radio-button)
552 (defun radio-button-add-to-group (button1 button2)
553 "Add BUTTON1 to the group which BUTTON2 belongs to."
554 (%radio-button-set-group button1 (%radio-button-get-group button2)))
557 (defmethod initialize-instance ((button radio-button)
558 &rest initargs &key group-with)
559 (declare (ignore initargs))
562 (radio-button-add-to-group button group-with)))
567 (defbinding item-select () nil
570 (defbinding item-deselect () nil
573 (defbinding item-toggle () nil
580 (defun (setf menu-item-label) (label menu-item)
581 (make-instance 'accel-label
582 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
583 :visible t :parent menu-item)
586 (defun menu-item-label (menu-item)
587 (with-slots (child) menu-item
588 (when (typep child 'label)
589 (label-label child))))
591 (defbinding %menu-item-set-submenu () nil
592 (menu-item menu-item)
595 (defbinding %menu-item-remove-submenu () nil
596 (menu-item menu-item))
598 (defun (setf menu-item-submenu) (submenu menu-item)
600 (%menu-item-remove-submenu menu-item)
601 (%menu-item-set-submenu menu-item submenu))
604 (defbinding menu-item-set-accel-path () nil
605 (menu-item menu-item)
608 (defbinding menu-item-select () nil
609 (menu-item menu-item))
611 (defbinding menu-item-deselect () nil
612 (menu-item menu-item))
614 (defbinding menu-item-activate () nil
615 (menu-item menu-item))
617 (defbinding menu-item-toggle-size-request () nil
618 (menu-item menu-item)
619 (requisition int :out))
621 (defbinding menu-item-toggle-size-allocate () nil
622 (menu-item menu-item)
629 (defbinding %radio-menu-item-get-group () pointer
630 (radio-menu-item radio-menu-item))
632 (defbinding %radio-menu-item-set-group () nil
633 (radio-menu-item radio-menu-item)
636 (defun radio-menu-item-add-to-group (item1 item2)
637 "Add ITEM1 to the group which ITEM2 belongs to."
638 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
640 (defmethod initialize-instance ((item radio-menu-item)
641 &rest initargs &key group-with)
642 (declare (ignore initargs))
646 (radio-menu-item-add-to-group item group-with))))
652 (defbinding toggle-button-toggled () nil
653 (toggle-button toggle-button))
659 (defmethod initialize-instance ((window window) &rest initargs
660 &key accel-group accel-groups)
661 (declare (ignore accel-group accel-groups))
664 (initial-add window #'window-add-accel-group
665 initargs :accel-group :accel-groups)))
668 (defbinding window-set-wmclass () nil
670 (wmclass-name string)
671 (wmclass-class string))
673 (defbinding window-add-accel-group () nil
675 (accel-group accel-group))
677 (defbinding window-remove-accel-group () nil
679 (accel-group accel-group))
681 (defbinding window-activate-focus () int
684 (defbinding window-activate-default () int
687 (defbinding window-set-default-size (window width height) int
690 ((or height -1) int))
692 ;(defbinding window-set-geometry-hints)
694 (defbinding window-list-toplevels () (glist (copy-of window))
695 "Returns a list of all existing toplevel windows.")
697 (defbinding window-add-mnemonic (window key target) nil
699 ((gdk:keyval-from-name key) unsigned-int)
702 (defbinding window-remove-mnemonic (window key target) nil
704 ((gdk:keyval-from-name key) unsigned-int)
707 (defbinding window-mnemonic-activate (window key modifier) nil
709 ((gdk:keyval-from-name key) unsigned-int)
710 (modifier gdk:modifier-type))
712 (defbinding window-present () nil
715 (defbinding window-iconify () nil
718 (defbinding window-deiconify () nil
721 (defbinding window-stick () nil
724 (defbinding window-unstick () nil
727 (defbinding window-maximize () nil
730 (defbinding window-unmaximize () nil
733 (defbinding window-begin-resize-drag () nil
735 (edge gdk:window-edge)
737 (root-x int) (root-y int)
738 (timestamp unsigned-int))
740 (defbinding window-begin-move-drag () nil
742 (edge gdk:window-edge)
744 (root-x int) (root-y int)
745 (timestamp unsigned-int))
747 (defbinding window-set-frame-dimensions () nil
749 (left int) (top int) (rigth int) (bottom int))
751 (defbinding (window-default-icons "gtk_window_get_default_icon_list")
752 () (glist gdk:pixbuf))
754 (defbinding %window-get-default-size () nil
759 (defun window-get-default-size (window)
760 (multiple-value-bind (width height) (%window-get-default-size window)
761 (values (unless (= width -1) width) (unless (= height -1) height))))
763 (defbinding window-get-frame-dimensions () nil
765 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
767 (defbinding %window-get-icon-list () (glist gdk:pixbuf)
770 (defmethod window-icon ((window window))
771 (let ((icon-list (%window-get-icon-list window)))
772 (if (endp (rest icon-list))
776 (defbinding window-get-position () nil
781 (defbinding window-get-size () nil
786 (defbinding window-move () nil
791 (defbinding window-parse-geometry () boolean
795 (defbinding window-reshow-with-initial-size () nil
798 (defbinding window-resize () nil
803 (defbinding %window-set-icon-list () nil
805 (icon-list (glist gdk:pixbuf)))
807 (defmethod (setf window-icon) (icon (window window))
808 (%window-set-icon-list window (mklist icon)))
820 (defun (setf scrolled-window-scrollbar-policy) (policy window)
821 (setf (scrolled-window-hscrollbar-policy window) policy)
822 (setf (scrolled-window-vscrollbar-policy window) policy))
824 (defbinding scrolled-window-add-with-viewport () nil
825 (scrolled-window scrolled-window)
836 (defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
838 (statusbar statusbar)
839 (context-description string))
841 (defbinding statusbar-push () unsigned-int
842 (statusbar statusbar)
843 (context-id unsigned-int)
846 (defbinding statusbar-pop () nil
847 (statusbar statusbar)
848 (context-id unsigned-int))
850 (defbinding statusbar-remove () nil
851 (statusbar statusbar)
852 (context-id unsigned-int)
853 (message-id unsigned-int))
859 (defbinding fixed-put () nil
864 (defbinding fixed-move () nil
873 (defun %notebook-position (notebook page)
879 (t (error "Invalid position keyword: ~A" page))))
880 (widget (notebook-page-num notebook page t))))
882 (defun %notebook-child (notebook position)
885 (t (notebook-nth-page-child notebook position))))
888 (defbinding (notebook-insert "gtk_notebook_insert_page_menu")
889 (notebook position child tab-label &optional menu-label) nil
892 ((if (stringp tab-label)
893 (make-instance 'label :label tab-label)
895 ((if (stringp menu-label)
896 (make-instance 'label :label menu-label)
897 menu-label) (or null widget))
898 ((%notebook-position notebook position) int))
900 (defun notebook-append (notebook child tab-label &optional menu-label)
901 (notebook-insert notebook :last child tab-label menu-label))
903 (defun notebook-prepend (notebook child tab-label &optional menu-label)
904 (notebook-insert notebook :first child tab-label menu-label))
906 (defbinding notebook-remove-page (notebook page) nil
908 ((%notebook-position notebook page) int))
910 (defbinding %notebook-page-num () int
914 (defun notebook-page-num (notebook child &optional error-p)
915 (let ((page-num (%notebook-page-num notebook child)))
918 (error "~A is not a child of ~A" child notebook))
921 (defbinding notebook-next-page () nil
924 (defbinding notebook-prev-page () nil
927 (defbinding notebook-reorder-child (notebook child position) nil
930 ((%notebook-position notebook position) int))
932 (defbinding notebook-popup-enable () nil
935 (defbinding notebook-popup-disable () nil
938 (defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
939 (notebook page) widget
947 (defbinding %notebook-get-current-page () int
950 (defun notebook-current-page-num (notebook)
951 (let ((num (%notebook-get-current-page notebook)))
955 (defun notebook-current-page (notebook)
956 (let ((page-num (notebook-current-page-num notebook)))
958 (notebook-nth-page-child notebook page-num))))
960 (defbinding %notebook-set-current-page () nil
964 (defun (setf notebook-current-page) (page notebook)
965 (%notebook-set-current-page notebook (%notebook-position notebook page))
969 (defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
970 (notebook page) widget
972 ((%notebook-child notebook page) widget))
974 (defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
975 (notebook page) (copy-of string)
977 ((%notebook-child notebook page) widget))
979 (defbinding %notebook-set-tab-label () nil
984 (defun (setf notebook-tab-label) (tab-label notebook page)
985 (let ((widget (if (stringp tab-label)
986 (make-instance 'label :label tab-label)
988 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
992 (defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
993 (notebook page) widget
995 ((%notebook-child notebook page) widget))
997 (defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
998 (notebook page) (copy-of string)
1000 ((%notebook-child notebook page) widget))
1002 (defbinding %notebook-set-menu-label () nil
1005 (menu-label widget))
1007 (defun (setf notebook-menu-label) (menu-label notebook page)
1008 (let ((widget (if (stringp menu-label)
1009 (make-instance 'label :label menu-label)
1011 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1015 (defbinding notebook-query-tab-label-packing (notebook page) nil
1017 ((%notebook-child notebook page) widget)
1018 (expand boolean :out)
1020 (pack-type pack-type :out))
1022 (defbinding notebook-set-tab-label-packing
1023 (notebook page expand fill pack-type) nil
1025 ((%notebook-child notebook page) widget)
1028 (pack-type pack-type))
1034 (defbinding paned-pack1 () nil
1040 (defbinding paned-pack2 () nil
1049 (defbinding layout-put () nil
1055 (defbinding layout-move () nil
1065 (defbinding menu-shell-insert (menu-shell menu-item position) nil
1066 (menu-shell menu-shell)
1067 (menu-item menu-item)
1073 (defun menu-shell-append (menu-shell menu-item)
1074 (menu-shell-insert menu-shell menu-item :last))
1076 (defun menu-shell-prepend (menu-shell menu-item)
1077 (menu-shell-insert menu-shell menu-item :fisrt))
1079 (defbinding menu-shell-deactivate () nil
1080 (menu-shell menu-shell))
1082 (defbinding menu-shell-select-item () nil
1083 (menu-shell menu-shell)
1084 (menu-item menu-item))
1086 (defbinding menu-shell-deselect () nil
1087 (menu-shell menu-shell))
1089 (defbinding menu-shell-activate-item () nil
1090 (menu-shell menu-shell)
1091 (menu-item menu-item)
1092 (fore-deactivate boolean))
1098 (defun %menu-position (menu child)
1101 (keyword (case child
1104 (t (error "Invalid position keyword: ~A" child))))
1105 (widget (menu-child-position menu child))))
1108 (defbinding menu-reorder-child (menu menu-item position) nil
1110 (menu-item menu-item)
1111 ((%menu-position menu position) int))
1113 (def-callback-marshal %menu-popup-callback (nil (x int) (y int) (push-in boolean)))
1115 (defbinding %menu-popup () nil
1117 (parent-menu-shell (or null menu-shell))
1118 (parent-menu-item (or null menu-item))
1119 (callback-func (or null pointer))
1120 (callback-id unsigned-int)
1121 (button unsigned-int)
1122 (activate-time (unsigned 32)))
1124 (defun menu-popup (menu button activate-time &key callback parent-menu-shell
1127 (with-callback-function (id callback)
1129 menu parent-menu-shell parent-menu-item
1130 (callback %menu-popup-callback) id button activate-time))
1132 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1134 (defbinding menu-set-accel-path () nil
1136 (accel-path string))
1138 (defbinding menu-reposition () nil
1141 (defbinding menu-popdown () nil
1144 (defun menu-child-position (menu child)
1145 (position child (container-children menu)))
1147 (defun menu-active-num (menu)
1148 (menu-child-position menu (menu-active menu)))
1150 (defbinding %menu-set-active () nil
1152 (index unsigned-int))
1154 (defun (setf menu-active) (menu child)
1155 (%menu-set-active menu (%menu-position menu child))
1162 (defbinding table-resize () nil
1165 (columns unsigned-int))
1167 (defbinding table-attach (table child left right top bottom
1168 &key options x-options y-options
1169 (x-padding 0) (y-padding 0)) nil
1173 (right unsigned-int)
1175 (bottom unsigned-int)
1176 ((append (mklist options) (mklist x-options)) attach-options)
1177 ((append (mklist options) (mklist y-options)) attach-options)
1178 (x-padding unsigned-int)
1179 (y-padding unsigned-int))
1182 (defbinding %table-set-row-spacing () nil
1185 (spacing unsigned-int))
1187 (defbinding %table-set-row-spacings () nil
1189 (spacing unsigned-int))
1191 (defun (setf table-row-spacing) (spacing table &optional row)
1193 (%table-set-row-spacing table row spacing)
1194 (%table-set-row-spacings table spacing))
1197 (defbinding %table-get-row-spacing () unsigned-int
1201 (defbinding %table-get-default-row-spacing () unsigned-int
1204 (defun table-row-spacing (table &optional row)
1206 (%table-get-row-spacing table row)
1207 (%table-get-default-row-spacing table)))
1210 (defbinding %table-set-col-spacing () nil
1213 (spacing unsigned-int))
1215 (defbinding %table-set-col-spacings () nil
1217 (spacing unsigned-int))
1219 (defun (setf table-col-spacing) (spacing table &optional col)
1221 (%table-set-col-spacing table col spacing)
1222 (%table-set-col-spacings table spacing))
1225 (defbinding %table-get-col-spacing () unsigned-int
1229 (defbinding %table-get-default-col-spacing () unsigned-int
1232 (defun table-col-spacing (table &optional col)
1234 (%table-get-col-spacing table col)
1235 (%table-get-default-col-spacing table)))
1241 (defbinding %toolbar-insert-element () widget
1243 (type toolbar-child-type)
1244 (widget (or null widget))
1246 (tooltip-text string)
1247 (tooltip-private-text string)
1248 (icon (or null widget))
1253 (defbinding %toolbar-insert-stock () widget
1256 (tooltip-text string)
1257 (tooltip-private-text string)
1262 (defun toolbar-insert (toolbar position element
1263 &key tooltip-text tooltip-private-text
1264 type icon group callback object)
1265 (let* ((numpos (case position
1273 (and (not type) (eq element :space)))
1274 (%toolbar-insert-element
1275 toolbar :space nil nil
1276 tooltip-text tooltip-private-text nil numpos))
1279 (and (not type) (typep element 'widget)))
1280 (%toolbar-insert-element
1281 toolbar :widget element nil
1282 tooltip-text tooltip-private-text nil numpos))
1287 (typep element 'string)
1288 (stock-lookup element)))
1289 (%toolbar-insert-stock
1290 toolbar element tooltip-text tooltip-private-text numpos))
1291 ((typep element 'string)
1292 (%toolbar-insert-element
1293 toolbar (or type :button) (when (eq type :radio-button) group)
1294 element tooltip-text tooltip-private-text
1298 ((or pathname string vector)
1299 (make-instance 'image
1300 :source icon ; :icon-size (toolbar-icon-size toolbar)
1303 ((error "Invalid element type: ~A" element)))))
1305 (signal-connect widget 'clicked callback :object object))
1308 (defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text
1309 type icon group callback object)
1311 toolbar :first element :type type :icon icon :group group
1312 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1313 :callback callback :object object))
1315 (defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text
1316 type icon group callback object)
1318 toolbar :last element :type type :icon icon :group group
1319 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
1320 :callback callback :object object))
1323 (defun toolbar-insert-space (toolbar position)
1324 (toolbar-insert toolbar position :space))
1326 (defun toolbar-append-space (toolbar)
1327 (toolbar-append toolbar :space))
1329 (defun toolbar-prepend-space (toolbar)
1330 (toolbar-prepend toolbar :space))
1333 (defun toolbar-enable-tooltips (toolbar)
1334 (setf (toolbar-tooltips-p toolbar) t))
1336 (defun toolbar-disable-tooltips (toolbar)
1337 (setf (toolbar-tooltips-p toolbar) nil))
1340 (defbinding toolbar-remove-space () nil
1344 (defbinding toolbar-unset-icon-size () nil
1347 (defbinding toolbar-unset-style () nil
1353 (defbinding editable-select-region (editable &optional (start 0) end) nil
1358 (defbinding editable-get-selection-bounds (editable) nil
1363 (defbinding editable-insert-text
1364 (editable text &optional (position 0)) nil
1368 ((or position -1) int :in-out))
1370 (defun editable-append-text (editable text)
1371 (editable-insert-text editable text nil))
1373 (defun editable-prepend-text (editable text)
1374 (editable-insert-text editable text 0))
1376 (defbinding editable-delete-text (editable &optional (start 0) end) nil
1381 (defbinding (editable-text "gtk_editable_get_chars")
1382 (editable &optional (start 0) end) string
1387 (defun (setf editable-text) (text editable)
1389 (editable-delete-text
1391 (editable-insert-text editable text))
1392 (editable-delete-text editable))
1395 (defbinding editable-cut-clipboard () nil
1396 (editable editable))
1398 (defbinding editable-copy-clipboard () nil
1399 (editable editable))
1401 (defbinding editable-paste-clipboard () nil
1402 (editable editable))
1404 (defbinding editable-delete-selection () nil
1405 (editable editable))
1411 (defun spin-button-value-as-int (spin-button)
1412 (round (spin-button-value spin-button)))
1414 (defbinding spin-button-spin () nil
1415 (spin-button spin-button)
1416 (direction spin-type)
1417 (increment single-float))
1419 (defbinding spin-button-update () nil
1420 (spin-button spin-button))
1426 (defbinding ruler-set-range () nil
1428 (lower single-float)
1429 (upper single-float)
1430 (position single-float)
1431 (max-size single-float))
1433 (defbinding ruler-draw-ticks () nil
1436 (defbinding ruler-draw-pos () nil
1443 (defun range-lower (range)
1444 (adjustment-lower (range-adjustment range)))
1446 (defun range-upper (range)
1447 (adjustment-upper (range-adjustment range)))
1449 (defun (setf range-lower) (value range)
1450 (setf (adjustment-lower (range-adjustment range)) value))
1452 (defun (setf range-upper) (value range)
1453 (setf (adjustment-upper (range-adjustment range)) value))
1455 (defun range-page-increment (range)
1456 (adjustment-page-increment (range-adjustment range)))
1458 (defun range-step-increment (range)
1459 (adjustment-step-increment (range-adjustment range)))
1461 (defun (setf range-page-increment) (value range)
1462 (setf (adjustment-page-increment (range-adjustment range)) value))
1464 (defun (setf range-step-increment) (value range)
1465 (setf (adjustment-step-increment (range-adjustment range)) value))
1467 (defbinding range-set-range () nil
1469 (lower double-float)
1470 (upper double-float))
1472 (defbinding range-set-increments () nil
1475 (page double-float))
1480 ; (defbinding scale-draw-value () nil
1487 (defbinding progress-bar-pulse () nil
1488 (progress-bar progress-bar))
1493 (defmethod initialize-instance ((size-group size-group) &rest initargs
1494 &key widget widgets)
1495 (declare (ignore widget widgets))
1498 (initial-add size-group #'size-group-add-widget
1499 initargs :widget :widgets)))
1502 (defbinding size-group-add-widget () nil
1503 (size-group size-group)
1506 (defbinding size-group-remove-widget () nil
1507 (size-group size-group)
1513 (defbinding %stock-item-copy () pointer
1516 (defbinding %stock-item-free () nil
1519 (defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1520 (%stock-item-copy location))
1522 (defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1523 (%stock-item-free location))
1525 (defbinding stock-add (stock-item) nil
1526 (stock-item stock-item)
1529 (defbinding stock-list-ids () (gslist string))
1531 (defbinding %stock-lookup () boolean
1535 (defun stock-lookup (stock-id)
1537 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1539 (when (%stock-lookup stock-id location)
1540 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1541 (deallocate-memory location))))
1546 (defbinding tooltips-enable () nil
1547 (tooltips tooltips))
1549 (defbinding tooltips-disable () nil
1550 (tooltips tooltips))
1552 (defun (setf tooltips-enabled-p) (enable tooltips)
1554 (tooltips-enable tooltips)
1555 (tooltips-disable tooltips)))
1557 (defbinding tooltips-set-tip () nil
1561 (tip-private string))
1563 (defbinding tooltips-force-window () nil
1564 (tooltips tooltips))
1570 (defbinding rc-add-default-file (filename) nil
1571 ((namestring (truename filename)) string))
1573 (defbinding rc-parse (filename) nil
1574 ((namestring (truename filename)) string))
1576 (defbinding rc-parse-string () nil
1579 (defbinding rc-reparse-all () nil)
1581 (defbinding rc-get-style () style
1586 ;;; Accelerator Groups
1588 (defbinding accel-group-activate (accel-group key modifiers) boolean
1589 (accel-group accel-group)
1590 ((gdk:keyval-from-name key) unsigned-int)
1591 (modifiers gdk:modifier-type))
1593 (defbinding accel-groups-activate (object key modifiers) boolean
1595 ((gdk:keyval-from-name key) unsigned-int)
1596 (modifiers gdk:modifier-type))
1598 (defbinding accel-group-attach () nil
1599 (accel-group accel-group)
1602 (defbinding accel-group-detach () nil
1603 (accel-group accel-group)
1606 (defbinding accel-group-lock () nil
1607 (accel-group accel-group))
1609 (defbinding accel-group-unlock () nil
1610 (accel-group accel-group))
1613 ;;; Accelerator Groups Entries
1615 (defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
1616 (accel-group accel-group)
1617 ((gdk:keyval-from-name key) unsigned-int)
1618 (modifiers gdk:modifier-type))
1620 (defbinding accel-group-lock-entry (accel-group key modifiers) nil
1621 (accel-group accel-group)
1622 ((gdk:keyval-from-name key) unsigned-int)
1623 (modifiers gdk:modifier-type))
1625 (defbinding accel-group-unlock-entry (accel-group key modifiers) nil
1626 (accel-group accel-group)
1627 ((gdk:keyval-from-name key) unsigned-int)
1628 (modifiers gdk:modifier-type))
1630 (defbinding accel-group-add
1631 (accel-group key modifiers flags object signal) nil
1632 (accel-group accel-group)
1633 ((gdk:keyval-from-name key) unsigned-int)
1634 (modifiers gdk:modifier-type)
1637 ((name-to-string signal) string))
1639 (defbinding accel-group-add (accel-group key modifiers object) nil
1640 (accel-group accel-group)
1641 ((gdk:keyval-from-name key) unsigned-int)
1642 (modifiers gdk:modifier-type)
1646 ;;; Accelerator Signals
1648 (defbinding accel-group-handle-add
1649 (object signal-id accel-group key modifiers flags) nil
1651 (signal-id unsigned-int)
1652 (accel-group accel-group)
1653 ((gdk:keyval-from-name key) unsigned-int)
1654 (modifiers gdk:modifier-type)
1655 (flags accel-flags))
1657 (defbinding accel-group-handle-remove
1658 (object accel-group key modifiers) nil
1660 (accel-group accel-group)
1661 ((gdk:keyval-from-name key) unsigned-int)
1662 (modifiers gdk:modifier-type))