chiark / gitweb /
New toolbar API
[clg] / gtk / gtk.lisp
... / ...
CommitLineData
1;; Common Lisp bindings for GTK+ v2.0
2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
3;;
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.
8;;
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.
13;;
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
17
18;; $Id: gtk.lisp,v 1.29 2005-01-06 21:05:46 espen Exp $
19
20
21(in-package "GTK")
22
23;;; Gtk version
24
25(defbinding check-version () (copy-of string)
26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
29
30(defbinding query-version () nil
31 (major unsigned-int :out)
32 (minor unsigned-int :out)
33 (micro unsigned-int :out))
34
35(defun gtk-version ()
36 (multiple-value-bind (major minor micro)
37 (query-version)
38 (if (zerop micro)
39 (format nil "Gtk+ v~A.~A" major minor)
40 (format nil "Gtk+ v~A.~A.~A" major minor micro))))
41
42(defbinding get-default-language () (copy-of pango:language))
43
44
45;;;; Initalization
46
47(defbinding (gtk-init "gtk_parse_args") () nil
48 "Initializes the library without opening the display."
49 (nil null)
50 (nil null))
51
52(defun clg-init (&optional display)
53 "Initializes the system and starts the event handling"
54 (unless (gdk:display-get-default)
55 (gdk:gdk-init)
56 (gtk-init)
57 (prog1
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))))
64
65
66;;; Acccel group
67
68
69
70;;; Acccel label
71
72(defbinding accel-label-refetch () boolean
73 (accel-label accel-label))
74
75
76;;; Accessible
77
78(defbinding accessible-connect-widget-destroyed () nil
79 (accessible accessible))
80
81
82;;; Adjustment
83
84(defmethod initialize-instance ((adjustment adjustment) &key value)
85 (prog1
86 (call-next-method)
87 ;; we need to make sure that the value is set last, otherwise it
88 ;; may be outside current limits and ignored
89 (when value
90 (setf (slot-value adjustment 'value) value))))
91
92
93(defbinding adjustment-changed () nil
94 (adjustment adjustment))
95
96(defbinding adjustment-value-changed () nil
97 (adjustment adjustment))
98
99(defbinding adjustment-clamp-page () nil
100 (adjustment adjustment)
101 (lower single-float)
102 (upper single-float))
103
104
105;;; Aspect frame
106
107
108;;; Bin
109
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)
114 child)
115
116(defmethod create-callback-function ((bin bin) function arg1)
117 (if (eq arg1 :child)
118 #'(lambda (&rest args)
119 (apply function (bin-child bin) (rest args)))
120 (call-next-method)))
121
122
123;;; Box
124
125(defbinding box-pack-start () nil
126 (box box)
127 (child widget)
128 (expand boolean)
129 (fill boolean)
130 (padding unsigned-int))
131
132(defbinding box-pack-end () nil
133 (box box)
134 (child widget)
135 (expand boolean)
136 (fill boolean)
137 (padding unsigned-int))
138
139(defun box-pack (box child &key end (expand t) (fill t) (padding 0))
140 (if end
141 (box-pack-end box child expand fill padding)
142 (box-pack-start box child expand fill padding)))
143
144(defbinding box-reorder-child () nil
145 (box box)
146 (child widget)
147 (position int))
148
149(defbinding box-query-child-packing () nil
150 (box box)
151 (child widget)
152 (expand boolean :out)
153 (fill boolean :out)
154 (padding unsigned-int :out)
155 (pack-type pack-type :out))
156
157(defbinding box-set-child-packing () nil
158 (box box)
159 (child widget)
160 (expand boolean)
161 (fill boolean)
162 (padding unsigned-int)
163 (pack-type pack-type))
164
165
166
167;;; Button
168
169(defmethod initialize-instance ((button button) &rest initargs &key stock)
170 (if stock
171 (apply #'call-next-method button :label stock :use-stock t initargs)
172 (call-next-method)))
173
174
175(defbinding button-pressed () nil
176 (button button))
177
178(defbinding button-released () nil
179 (button button))
180
181(defbinding button-clicked () nil
182 (button button))
183
184(defbinding button-enter () nil
185 (button button))
186
187(defbinding button-leave () nil
188 (button button))
189
190
191
192;;; Calendar
193
194(defbinding calendar-select-month () int
195 (calendar calendar)
196 (month unsigned-int)
197 (year unsigned-int))
198
199(defbinding calendar-select-day () nil
200 (calendar calendar)
201 (day unsigned-int))
202
203(defbinding calendar-mark-day () int
204 (calendar calendar)
205 (day unsigned-int))
206
207(defbinding calendar-unmark-day () int
208 (calendar calendar)
209 (day unsigned-int))
210
211(defbinding calendar-clear-marks () nil
212 (calendar calendar))
213
214(defbinding calendar-get-date () nil
215 (calendar calendar)
216 (year unsigned-int :out)
217 (month unsigned-int :out)
218 (day unsigned-int :out))
219
220(defbinding calendar-freeze () nil
221 (calendar calendar))
222
223(defbinding calendar-thaw () nil
224 (calendar calendar))
225
226
227;;; Check menu item
228
229(defbinding check-menu-item-toggled () nil
230 (check-menu-item check-menu-item))
231
232
233
234;;; Clipboard
235
236
237;;; Color selection
238
239(defbinding (color-selection-is-adjusting-p
240 "gtk_color_selection_is_adjusting") () boolean
241 (colorsel color-selection))
242
243
244
245;;; Color selection dialog -- no functions
246
247
248
249;;;; Combo Box
250
251(defmethod initialize-instance ((combo-box combo-box) &rest initargs
252 &key model content active)
253 (remf initargs :active)
254 (if model
255 (apply #'call-next-method combo-box initargs)
256 (progn
257 (apply #'call-next-method combo-box
258 :model (make-instance 'list-store :column-types '(string))
259 initargs)
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)))))
264 (when content
265 (mapc #'(lambda (text)
266 (combo-box-append-text combo-box text))
267 content))
268 (when active
269 (setf (combo-box-active combo-box) active)))
270
271
272;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
273;; (when active
274;; (signal-emit combo-box 'changed)))
275
276(defbinding combo-box-append-text () nil
277 (combo-box combo-box)
278 (text string))
279
280(defbinding combo-box-insert-text () nil
281 (combo-box combo-box)
282 (position int)
283 (text string))
284
285(defbinding combo-box-prepend-text () nil
286 (combo-box combo-box)
287 (text string))
288
289#+gtk2.6
290(defbinding combo-box-get-active-text () string
291 (combo-box combo-box))
292
293(defbinding combo-box-popup () nil
294 (combo-box combo-box))
295
296(defbinding combo-box-popdown () nil
297 (combo-box combo-box))
298
299
300
301;;;; Combo Box Entry
302
303(defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
304 (call-next-method)
305 (unless model
306 (setf (combo-box-entry-text-column combo-box-entry) 0)))
307
308
309;;;; Dialog
310
311(defmethod shared-initialize ((dialog dialog) names &rest initargs
312 &key button buttons)
313 (declare (ignore button buttons))
314 (prog1
315 (call-next-method)
316 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
317
318
319(defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
320 (or
321 (cadr (assoc id (rest (type-expand-1 'response-type))))
322 (let ((response-ids (object-data dialog 'response-id-key)))
323 (cond
324 ((and response-ids (position id response-ids :test #'equal)))
325 (create-p
326 (cond
327 (response-ids
328 (vector-push-extend id response-ids)
329 (1- (length response-ids)))
330 (t
331 (setf
332 (object-data dialog 'response-id-key)
333 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
334 0)))
335 (error-p
336 (error "Invalid response: ~A" id))))))
337
338(defun %dialog-find-response-id (dialog response-id-num)
339 (if (< response-id-num 0)
340 (car
341 (rassoc
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 )))
345
346
347(defmethod signal-connect ((dialog dialog) signal function &key object after)
348 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
349 (cond
350 (response-id-num
351 (call-next-method
352 dialog 'response
353 #'(lambda (dialog id)
354 (when (= id response-id-num)
355 (cond
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)))))
361
362
363(defbinding dialog-run () nil
364 (dialog dialog))
365
366(defbinding dialog-response (dialog response-id) nil
367 (dialog dialog)
368 ((%dialog-find-response-id-num dialog response-id nil t) int))
369
370
371(defbinding %dialog-add-button () button
372 (dialog dialog)
373 (text string)
374 (response-id-num int))
375
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)
380 label
381 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))
386 (when default
387 (%dialog-set-default-response dialog id-num))
388 button))
389
390
391(defbinding %dialog-add-action-widget () button
392 (dialog dialog)
393 (action-widget widget)
394 (response-id-num int))
395
396(defun dialog-add-action-widget (dialog widget &optional (response widget)
397 &key default object after)
398 (let* ((id (if (functionp response)
399 widget
400 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))
405 (when default
406 (%dialog-set-default-response dialog id-num))
407 widget))
408
409
410(defbinding %dialog-set-default-response () nil
411 (dialog dialog)
412 (response-id-num int))
413
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)))
417
418(defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
419 (dialog dialog)
420 ((%dialog-find-response-id-num dialog response-id nil t) int)
421 (sensitive boolean))
422
423#+gtk2.6
424(defbinding alternative-dialog-button-order-p(&optional screen)
425 (screen (or null screen)))
426
427#+gtk2.6
428(defbinding (dialog-set-alternative-button-order
429 "gtk_dialog_set_alternative_button_order_from_array")
430 (dialog new-order)
431 (dialog dialog)
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)))
436
437
438(defmethod container-add ((dialog dialog) (child widget) &rest args)
439 (apply #'container-add (dialog-vbox dialog) child args))
440
441(defmethod container-remove ((dialog dialog) (child widget))
442 (container-remove (dialog-vbox dialog) child))
443
444(defmethod container-children ((dialog dialog))
445 (container-children (dialog-vbox dialog)))
446
447(defmethod (setf container-children) (children (dialog dialog))
448 (setf (container-children (dialog-vbox dialog)) children))
449
450
451;;; Entry
452
453(defbinding entry-get-layout-offsets () nil
454 (entry entry)
455 (x int :out)
456 (y int :out))
457
458(defbinding entry-layout-index-to-text-index () int
459 (entry entry)
460 (layout-index int))
461
462(defbinding entry-text-index-to-layout-index () int
463 (entry entry)
464 (text-index int))
465
466
467;;; Entry Completion
468
469(def-callback-marshal %entry-completion-match-func
470 (boolean entry-completion string (copy-of tree-iter)))
471
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))
477
478(defbinding entry-completion-complete () nil
479 (completion entry-completion))
480
481#+gtk2.6
482(defbinding entry-completion-insert-prefix () nil
483 (completion entry-completion))
484
485(defbinding entry-completion-insert-action-text () nil
486 (completion entry-completion)
487 (index int)
488 (text string))
489
490(defbinding entry-completion-insert-action-markup () nil
491 (completion entry-completion)
492 (index int)
493 (markup string))
494
495(defbinding entry-completion-delete-action () nil
496 (completion entry-completion)
497 (index int))
498
499
500;;; Image
501
502(defbinding image-set-from-file () nil
503 (image image)
504 (filename pathname))
505
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)))
510
511(defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
512 (cond
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)))
516 (file
517 (prog1
518 (call-next-method)
519 (image-set-from-file image file)))
520 ((call-next-method))))
521
522(defun create-image-widget (source &optional mask)
523 (etypecase source
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))))
529
530
531;;; Image menu item
532
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)
536 (call-next-method)))
537
538
539(defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
540 (setf (slot-value item 'image) widget))
541
542(defmethod (setf image-menu-item-image) (image (item image-menu-item))
543 (setf (image-menu-item-image item) (create-image-widget image)))
544
545
546;;; Label
547
548(defbinding label-get-layout-offsets () nil
549 (label label)
550 (x int :out)
551 (y int :out))
552
553(defbinding label-select-region () nil
554 (label label)
555 (start int)
556 (end int))
557
558(defbinding label-get-selection-bounds () boolean
559 (label label)
560 (start int :out)
561 (end int :out))
562
563
564
565;;; Radio button
566
567(defbinding %radio-button-get-group () pointer
568 (radio-button radio-button))
569
570(defbinding %radio-button-set-group () nil
571 (radio-button radio-button)
572 (group pointer))
573
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)))
577
578(defmethod initialize-instance ((button radio-button) &key group)
579 (prog1
580 (call-next-method)
581 (when group
582 (add-to-radio-group button group))))
583
584
585;;; Item
586
587(defbinding item-select () nil
588 (item item))
589
590(defbinding item-deselect () nil
591 (item item))
592
593(defbinding item-toggle () nil
594 (item item))
595
596
597
598;;; Menu item
599
600(defmethod initialize-instance ((item menu-item) &key label)
601 (prog1
602 (call-next-method)
603 (when label
604 (setf (menu-item-label item) label))))
605
606
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)
612 label)
613
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))))
618
619(defbinding menu-item-remove-submenu () nil
620 (menu-item menu-item))
621
622(defbinding menu-item-set-accel-path () nil
623 (menu-item menu-item)
624 (accel-path string))
625
626(defbinding menu-item-select () nil
627 (menu-item menu-item))
628
629(defbinding menu-item-deselect () nil
630 (menu-item menu-item))
631
632(defbinding menu-item-activate () nil
633 (menu-item menu-item))
634
635(defbinding menu-item-toggle-size-request () nil
636 (menu-item menu-item)
637 (requisition int :out))
638
639(defbinding menu-item-toggle-size-allocate () nil
640 (menu-item menu-item)
641 (allocation int))
642
643
644;;; Menu tool button
645
646#+gtk2.6
647(defbinding menu-tool-button-set-arrow-tip () nil
648 (menu-tool-button menu-tool-button)
649 (tooltips tooltips)
650 (tip-text string)
651 (tip-private string))
652
653
654;;; Message dialog
655
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)
660 (setf
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))
665
666
667(defbinding %message-dialog-new () pointer
668 (parent (or null window))
669 (flags dialog-flags)
670 (type message-type)
671 (buttons buttons-type)
672 (message (or null string)))
673
674(defbinding %message-dialog-new-with-markup () pointer
675 (parent (or null window))
676 (flags dialog-flags)
677 (type message-type)
678 (buttons buttons-type)
679 (message string))
680
681(defbinding message-dialog-set-markup () nil
682 (message-dialog message-dialog)
683 (markup string))
684
685#+gtk2.6
686(defbinding message-dialog-format-secondary-text () nil
687 (message-dialog message-dialog)
688 (text string))
689
690#+gtk2.6
691(defbinding message-dialog-format-secondary-markup () nil
692 (message-dialog message-dialog)
693 (markup string))
694
695
696
697;;; Radio menu item
698
699(defbinding %radio-menu-item-get-group () pointer
700 (radio-menu-item radio-menu-item))
701
702(defbinding %radio-menu-item-set-group () nil
703 (radio-menu-item radio-menu-item)
704 (group pointer))
705
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)))
709
710(defmethod initialize-instance ((item radio-menu-item) &key group)
711 (prog1
712 (call-next-method)
713 (when group
714 (add-to-radio-group item group))))
715
716
717
718;;; Radio tool button
719
720(defbinding %radio-tool-button-get-group () pointer
721 (radio-tool-button radio-tool-button))
722
723(defbinding %radio-tool-button-set-group () nil
724 (radio-tool-button radio-tool-button)
725 (group pointer))
726
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)))
730
731(defmethod add-activate-callback ((widget widget) function &key object after)
732 (if object
733 (signal-connect widget 'clicked
734 #'(lambda (object)
735 (when (slot-value widget 'active)
736 (funcall function object (slot-value widget 'value))))
737 :object object :after after)
738 (signal-connect widget 'clicked
739 #'(lambda ()
740 (when (slot-value widget 'active)
741 (funcall function (slot-value widget 'value))))
742 :after after)))
743
744(defmethod initialize-instance ((button radio-tool-button) &key group)
745 (prog1
746 (call-next-method)
747 (when group
748 (add-to-radio-group button group))))
749
750
751
752;;; Toggle button
753
754(defbinding toggle-button-toggled () nil
755 (toggle-button toggle-button))
756
757
758;;; Window
759
760(defmethod initialize-instance ((window window) &rest initargs
761 &key accel-group accel-groups)
762 (declare (ignore accel-group accel-groups))
763 (prog1
764 (call-next-method)
765 (initial-add window #'window-add-accel-group
766 initargs :accel-group :accel-groups)))
767
768
769(defbinding window-set-wmclass () nil
770 (window window)
771 (wmclass-name string)
772 (wmclass-class string))
773
774(defbinding window-add-accel-group () nil
775 (window window)
776 (accel-group accel-group))
777
778(defbinding window-remove-accel-group () nil
779 (window window)
780 (accel-group accel-group))
781
782(defbinding window-activate-focus () int
783 (window window))
784
785(defbinding window-activate-default () int
786 (window window))
787
788(defbinding window-set-default-size (window width height) int
789 (window window)
790 ((or width -1) int)
791 ((or height -1) int))
792
793(defbinding %window-set-geometry-hints () nil
794 (window window)
795 (geometry gdk:geometry)
796 (geometry-mask gdk:window-hints))
797
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)
813 :gravity gravity))
814 (mask ()))
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)
824 (push :aspect mask))
825 (when gravity-p
826 (push :win-gravity mask))
827 (%window-set-geometry-hints window geometry mask)))
828
829(defbinding window-list-toplevels () (glist (copy-of window))
830 "Returns a list of all existing toplevel windows.")
831
832(defbinding window-add-mnemonic (window key target) nil
833 (window window)
834 ((gdk:keyval-from-name key) unsigned-int)
835 (target widget))
836
837(defbinding window-remove-mnemonic (window key target) nil
838 (window window)
839 ((gdk:keyval-from-name key) unsigned-int)
840 (target widget))
841
842(defbinding window-mnemonic-activate (window key modifier) nil
843 (window window)
844 ((gdk:keyval-from-name key) unsigned-int)
845 (modifier gdk:modifier-type))
846
847(defbinding window-activate-key () boolean
848 (window window)
849 (event gdk:key-event))
850
851(defbinding window-propagate-key-event () boolean
852 (window window)
853 (event gdk:key-event))
854
855(defbinding window-present () nil
856 (window window))
857
858(defbinding window-iconify () nil
859 (window window))
860
861(defbinding window-deiconify () nil
862 (window window))
863
864(defbinding window-stick () nil
865 (window window))
866
867(defbinding window-unstick () nil
868 (window window))
869
870(defbinding window-maximize () nil
871 (window window))
872
873(defbinding window-unmaximize () nil
874 (window window))
875
876(defbinding window-fullscreen () nil
877 (window window))
878
879(defbinding window-unfullscreen () nil
880 (window window))
881
882(defbinding window-set-keep-above () nil
883 (window window)
884 (setting boolean))
885
886(defbinding window-set-keep-below () nil
887 (window window)
888 (setting boolean))
889
890(defbinding window-begin-resize-drag () nil
891 (window window)
892 (edge gdk:window-edge)
893 (button int)
894 (root-x int) (root-y int)
895 (timestamp unsigned-int))
896
897(defbinding window-begin-move-drag () nil
898 (window window)
899 (edge gdk:window-edge)
900 (button int)
901 (root-x int) (root-y int)
902 (timestamp unsigned-int))
903
904(defbinding window-set-frame-dimensions () nil
905 (window window)
906 (left int) (top int) (rigth int) (bottom int))
907
908(defbinding %window-get-default-size () nil
909 (window window)
910 (width int :out)
911 (height int :out))
912
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))))
916
917(defbinding window-get-frame-dimensions () nil
918 (window window)
919 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
920
921(defbinding %window-get-icon-list () (glist gdk:pixbuf)
922 (window window))
923
924(defbinding window-get-position () nil
925 (window window)
926 (root-x int :out)
927 (root-y int :out))
928
929(defbinding window-get-size () nil
930 (window window)
931 (width int :out)
932 (height int :out))
933
934(defbinding window-move () nil
935 (window window)
936 (x int)
937 (y int))
938
939(defbinding window-parse-geometry () boolean
940 (window window)
941 (geometry string))
942
943(defbinding window-reshow-with-initial-size () nil
944 (window window))
945
946(defbinding window-resize () nil
947 (window window)
948 (width int)
949 (heigth int))
950
951(defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
952 () (glist gdk:pixbuf))
953
954(defun window-default-icon ()
955 (first (window-default-icon-list)))
956
957(defbinding %window-set-default-icon-list () nil
958 (icons (glist gdk:pixbuf)))
959
960(defun (setf window-default-icon-list) (icons)
961 (%window-set-default-icon-list icons)
962 icons)
963
964(defbinding %window-set-default-icon () nil
965 (icons (glist gdk:pixbuf)))
966
967(defmethod (setf window-default-icon) ((icon gdk:pixbuf))
968 (%window-set-default-icon icon)
969 icon)
970
971(defmethod (setf window-group) ((group window-group) (window window))
972 (window-group-add-window group window)
973 group)
974
975(defbinding %window-set-default-icon-from-file () boolean
976 (filename pathname)
977 (nil null))
978
979(defmethod (setf window-default-icon) ((icon-file pathname))
980 (%window-set-default-icon-from-file icon-file)
981 icon-file)
982
983(defbinding %window-set-icon-from-file () boolean
984 (window window)
985 (filename pathname)
986 (nil null))
987
988(defmethod (setf window-icon) ((icon-file pathname) (window window))
989 (%window-set-icon-from-file window icon-file)
990 icon-file)
991
992(defbinding window-set-auto-startup-notification () nil
993 (setting boolean))
994
995(defbinding decorated-window-init () nil
996 (window window))
997
998(defbinding decorated-window-calculate-frame-size () nil
999 (window window))
1000
1001(defbinding decorated-window-set-title () nil
1002 (window window)
1003 (title string))
1004
1005(defbinding decorated-window-move-resize-window () nil
1006 (window window)
1007 (x int)
1008 (y int)
1009 (width int)
1010 (heigth int))
1011
1012
1013;;; Window group
1014
1015(defmethod initialize-instance ((window-group window-group) &rest initargs
1016 &key window windows)
1017 (declare (ignore window windows))
1018 (prog1
1019 (call-next-method)
1020 (initial-add window-group #'window-group-add-window
1021 initargs :window :windows)))
1022
1023
1024(defbinding window-group-add-window () nil
1025 (window-group window-group)
1026 (window window))
1027
1028(defbinding window-group-remove-window () nil
1029 (window-group window-group)
1030 (window window))
1031
1032
1033;;; Scrolled window
1034
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))
1038
1039(defbinding scrolled-window-add-with-viewport () nil
1040 (scrolled-window scrolled-window)
1041 (child widget))
1042
1043(defmethod initialize-instance ((window scrolled-window) &rest initargs
1044 &key policy)
1045 (if policy
1046 (apply #'call-next-method window
1047 :vscrollbar-policy policy :hscrollbar-policy policy initargs)
1048 (call-next-method)))
1049
1050
1051;;; Statusbar
1052
1053(defbinding statusbar-get-context-id () unsigned-int
1054 (statusbar statusbar)
1055 (context-description string))
1056
1057(defbinding statusbar-push () unsigned-int
1058 (statusbar statusbar)
1059 (context-id unsigned-int)
1060 (text string))
1061
1062(defbinding statusbar-pop () nil
1063 (statusbar statusbar)
1064 (context-id unsigned-int))
1065
1066(defbinding statusbar-remove () nil
1067 (statusbar statusbar)
1068 (context-id unsigned-int)
1069 (message-id unsigned-int))
1070
1071
1072
1073;;; Fixed
1074
1075(defbinding fixed-put () nil
1076 (fixed fixed)
1077 (widget widget)
1078 (x int) (y int))
1079
1080(defbinding fixed-move () nil
1081 (fixed fixed)
1082 (widget widget)
1083 (x int) (y int))
1084
1085
1086
1087;;; Notebook
1088
1089(defun %notebook-position (notebook page)
1090 (etypecase page
1091 (int page)
1092 (keyword (case page
1093 (:first 0)
1094 (:last -1)
1095 (t (error "Invalid position keyword: ~A" page))))
1096 (widget (notebook-page-num notebook page t))))
1097
1098(defun %notebook-child (notebook position)
1099 (typecase position
1100 (widget position)
1101 (t (notebook-nth-page-child notebook position))))
1102
1103
1104(defbinding (notebook-insert "gtk_notebook_insert_page_menu")
1105 (notebook position child tab-label &optional menu-label) nil
1106 (notebook notebook)
1107 (child widget)
1108 ((if (stringp tab-label)
1109 (make-instance 'label :label tab-label)
1110 tab-label) widget)
1111 ((if (stringp menu-label)
1112 (make-instance 'label :label menu-label)
1113 menu-label) (or null widget))
1114 ((%notebook-position notebook position) int))
1115
1116(defun notebook-append (notebook child tab-label &optional menu-label)
1117 (notebook-insert notebook :last child tab-label menu-label))
1118
1119(defun notebook-prepend (notebook child tab-label &optional menu-label)
1120 (notebook-insert notebook :first child tab-label menu-label))
1121
1122(defbinding notebook-remove-page (notebook page) nil
1123 (notebook notebook)
1124 ((%notebook-position notebook page) int))
1125
1126(defbinding %notebook-page-num () int
1127 (notebook notebook)
1128 (child widget))
1129
1130(defun notebook-page-num (notebook child &optional error-p)
1131 (let ((page-num (%notebook-page-num notebook child)))
1132 (if (= page-num -1)
1133 (when error-p
1134 (error "~A is not a child of ~A" child notebook))
1135 page-num)))
1136
1137(defbinding notebook-next-page () nil
1138 (notebook notebook))
1139
1140(defbinding notebook-prev-page () nil
1141 (notebook notebook))
1142
1143(defbinding notebook-reorder-child (notebook child position) nil
1144 (notebook notebook)
1145 (child widget)
1146 ((%notebook-position notebook position) int))
1147
1148(defbinding notebook-popup-enable () nil
1149 (notebook notebook))
1150
1151(defbinding notebook-popup-disable () nil
1152 (notebook notebook))
1153
1154(defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
1155 (notebook page) widget
1156 (notebook notebook)
1157 ((case page
1158 (:first 0)
1159 (:last -1)
1160 (t page)) int))
1161
1162
1163(defbinding %notebook-get-current-page () int
1164 (notebook notebook))
1165
1166(defun notebook-current-page-num (notebook)
1167 (let ((num (%notebook-get-current-page notebook)))
1168 (when (>= num 0)
1169 num)))
1170
1171(defun notebook-current-page (notebook)
1172 (let ((page-num (notebook-current-page-num notebook)))
1173 (when page-num
1174 (notebook-nth-page-child notebook page-num))))
1175
1176(defbinding %notebook-set-current-page () nil
1177 (notebook notebook)
1178 (page-num int))
1179
1180(defun (setf notebook-current-page) (page notebook)
1181 (%notebook-set-current-page notebook (%notebook-position notebook page))
1182 page)
1183
1184
1185(defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1186 (notebook page) widget
1187 (notebook notebook)
1188 ((%notebook-child notebook page) widget))
1189
1190(defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
1191 (notebook page) (copy-of string)
1192 (notebook notebook)
1193 ((%notebook-child notebook page) widget))
1194
1195(defbinding %notebook-set-tab-label () nil
1196 (notebook notebook)
1197 (page widget)
1198 (tab-label widget))
1199
1200(defun (setf notebook-tab-label) (tab-label notebook page)
1201 (let ((widget (if (stringp tab-label)
1202 (make-instance 'label :label tab-label)
1203 tab-label)))
1204 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
1205 widget))
1206
1207
1208(defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1209 (notebook page) widget
1210 (notebook notebook)
1211 ((%notebook-child notebook page) widget))
1212
1213(defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
1214 (notebook page) (copy-of string)
1215 (notebook notebook)
1216 ((%notebook-child notebook page) widget))
1217
1218(defbinding %notebook-set-menu-label () nil
1219 (notebook notebook)
1220 (page widget)
1221 (menu-label widget))
1222
1223(defun (setf notebook-menu-label) (menu-label notebook page)
1224 (let ((widget (if (stringp menu-label)
1225 (make-instance 'label :label menu-label)
1226 menu-label)))
1227 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1228 widget))
1229
1230
1231(defbinding notebook-query-tab-label-packing (notebook page) nil
1232 (notebook notebook)
1233 ((%notebook-child notebook page) widget)
1234 (expand boolean :out)
1235 (fill boolean :out)
1236 (pack-type pack-type :out))
1237
1238(defbinding notebook-set-tab-label-packing
1239 (notebook page expand fill pack-type) nil
1240 (notebook notebook)
1241 ((%notebook-child notebook page) widget)
1242 (expand boolean)
1243 (fill boolean)
1244 (pack-type pack-type))
1245
1246
1247
1248;;; Paned
1249
1250(defbinding paned-pack1 () nil
1251 (paned paned)
1252 (child widget)
1253 (resize boolean)
1254 (shrink boolean))
1255
1256(defbinding paned-pack2 () nil
1257 (paned paned)
1258 (child widget)
1259 (resize boolean)
1260 (shrink boolean))
1261
1262
1263;;; Layout
1264
1265(defbinding layout-put () nil
1266 (layout layout)
1267 (widget widget)
1268 (x int)
1269 (y int))
1270
1271(defbinding layout-move () nil
1272 (layout layout)
1273 (widget widget)
1274 (x int)
1275 (y int))
1276
1277
1278
1279;;; Menu shell
1280
1281(defbinding menu-shell-insert (menu-shell menu-item position) nil
1282 (menu-shell menu-shell)
1283 (menu-item menu-item)
1284 ((case position
1285 (:first 0)
1286 (:last -1)
1287 (t position)) int))
1288
1289(defun menu-shell-append (menu-shell menu-item)
1290 (menu-shell-insert menu-shell menu-item :last))
1291
1292(defun menu-shell-prepend (menu-shell menu-item)
1293 (menu-shell-insert menu-shell menu-item :fisrt))
1294
1295(defbinding menu-shell-deactivate () nil
1296 (menu-shell menu-shell))
1297
1298(defbinding menu-shell-select-item () nil
1299 (menu-shell menu-shell)
1300 (menu-item menu-item))
1301
1302(defbinding menu-shell-select-first () nil
1303 (menu-shell menu-shell)
1304 (search-sensitive boolean))
1305
1306(defbinding menu-shell-deselect () nil
1307 (menu-shell menu-shell))
1308
1309(defbinding menu-shell-activate-item () nil
1310 (menu-shell menu-shell)
1311 (menu-item menu-item)
1312 (fore-deactivate boolean))
1313
1314(defbinding menu-shell-cancel () nil
1315 (menu-shell menu-shell))
1316
1317
1318;;; Menu
1319
1320(defun %menu-position (menu child)
1321 (etypecase child
1322 (int child)
1323 (keyword (case child
1324 (:first 0)
1325 (:last -1)
1326 (t (error "Invalid position keyword: ~A" child))))
1327 (widget (menu-child-position menu child))))
1328
1329
1330(defbinding menu-reorder-child (menu menu-item position) nil
1331 (menu menu)
1332 (menu-item menu-item)
1333 ((%menu-position menu position) int))
1334
1335(defbinding menu-attach () nil
1336 (menu menu)
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))
1342
1343(def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean)))
1344
1345(defbinding %menu-popup () nil
1346 (menu menu)
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)))
1353
1354(defun menu-popup (menu button activate-time &key callback parent-menu-shell
1355 parent-menu-item)
1356 (if callback
1357 (with-callback-function (id callback)
1358 (%menu-popup
1359 menu parent-menu-shell parent-menu-item
1360 (callback %menu-position-func) id button activate-time))
1361 (%menu-popup
1362 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1363
1364(defbinding menu-set-accel-path () nil
1365 (menu menu)
1366 (accel-path string))
1367
1368(defbinding menu-reposition () nil
1369 (menu menu))
1370
1371(defbinding menu-popdown () nil
1372 (menu menu))
1373
1374(defun menu-child-position (menu child)
1375 (position child (container-children menu)))
1376
1377(defun menu-active-num (menu)
1378 (menu-child-position menu (menu-active menu)))
1379
1380(defbinding %menu-set-active () nil
1381 (menu menu)
1382 (index unsigned-int))
1383
1384(defun (setf menu-active) (menu child)
1385 (%menu-set-active menu (%menu-position menu child))
1386 child)
1387
1388(defcallback %menu-detach-func (nil (widget widget) (menu menu))
1389 (funcall (object-data menu 'detach-func) widget menu))
1390
1391(defbinding %menu-attach-to-widget () nil
1392 (menu menu)
1393 (widget widget)
1394 ((callback %menu-detach-func) pointer))
1395
1396(defun menu-attach-to-widget (menu widget function)
1397 (setf (object-data menu 'detach-func) function)
1398 (%menu-attach-to-widget menu widget))
1399
1400(defbinding menu-detach () nil
1401 (menu menu))
1402
1403#+gtk2.6
1404(defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1405 (widget widget))
1406
1407(defbinding menu-set-monitor () nil
1408 (menu menu)
1409 (monitor-num int))
1410
1411
1412;;; Table
1413
1414(defbinding table-resize () nil
1415 (table table)
1416 (rows unsigned-int)
1417 (columns unsigned-int))
1418
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
1422 (table table)
1423 (child widget)
1424 (left unsigned-int)
1425 (right unsigned-int)
1426 (top 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))
1432
1433
1434(defbinding %table-set-row-spacing () nil
1435 (table table)
1436 (row unsigned-int)
1437 (spacing unsigned-int))
1438
1439(defbinding %table-set-row-spacings () nil
1440 (table table)
1441 (spacing unsigned-int))
1442
1443(defun (setf table-row-spacing) (spacing table &optional row)
1444 (if row
1445 (%table-set-row-spacing table row spacing)
1446 (%table-set-row-spacings table spacing))
1447 spacing)
1448
1449(defbinding %table-get-row-spacing () unsigned-int
1450 (table table)
1451 (row unsigned-int))
1452
1453(defbinding %table-get-default-row-spacing () unsigned-int
1454 (table table))
1455
1456(defun table-row-spacing (table &optional row)
1457 (if row
1458 (%table-get-row-spacing table row)
1459 (%table-get-default-row-spacing table)))
1460
1461
1462(defbinding %table-set-col-spacing () nil
1463 (table table)
1464 (col unsigned-int)
1465 (spacing unsigned-int))
1466
1467(defbinding %table-set-col-spacings () nil
1468 (table table)
1469 (spacing unsigned-int))
1470
1471(defun (setf table-col-spacing) (spacing table &optional col)
1472 (if col
1473 (%table-set-col-spacing table col spacing)
1474 (%table-set-col-spacings table spacing))
1475 spacing)
1476
1477(defbinding %table-get-col-spacing () unsigned-int
1478 (table table)
1479 (col unsigned-int))
1480
1481(defbinding %table-get-default-col-spacing () unsigned-int
1482 (table table))
1483
1484(defun table-col-spacing (table &optional col)
1485 (if col
1486 (%table-get-col-spacing table col)
1487 (%table-get-default-col-spacing table)))
1488
1489
1490
1491;;; Toolbar
1492
1493(defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1494 (if (eq tooltips t)
1495 (apply #'call-next-method toolbar
1496 :tooltips (make-instance 'tooltips) initargs)
1497 (call-next-method)))
1498
1499(defbinding %toolbar-insert () nil
1500 (toolbar toolbar)
1501 (tool-item tool-item)
1502 (position position))
1503
1504(defun toolbar-insert (toolbar tool-item &optional (position :end))
1505 (%toolbar-insert toolbar tool-item position)
1506 (%tool-item-update-tooltips tool-item))
1507
1508(defbinding toolbar-get-item-index () int
1509 (toolbar toolbar)
1510 (item tool-item))
1511
1512(defbinding toolbar-get-nth-item () tool-item
1513 (toolbar toolbar)
1514 (n int))
1515
1516(defbinding toolbar-get-drop-index () int
1517 (toolbar toolbar)
1518 (x int) (y int))
1519
1520(defbinding toolbar-set-drop-highlight-item () nil
1521 (toolbar toolbar)
1522 (tool-item tool-item)
1523 (index int))
1524
1525
1526;;; Tool button
1527
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)))
1532
1533
1534;;; Tool item
1535
1536(defbinding tool-item-set-tooltip () nil
1537 (tool-item tool-item)
1538 (tooltips tooltips)
1539 (tip-text string)
1540 (tip-private string))
1541
1542
1543(defun %tool-item-update-tooltips (tool-item)
1544 (when (and
1545 (slot-boundp tool-item 'parent)
1546 (or
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) ""))))
1553
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)
1557 tip-text)
1558
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)
1562 tip-private)
1563
1564(defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
1565 (declare (ignore args))
1566 (prog1
1567 (call-next-method)
1568 (%tool-item-update-tooltips tool-item)))
1569
1570
1571(defbinding tool-item-retrieve-proxy-menu-item () widget
1572 (tool-item tool-item))
1573
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))
1578
1579(defbinding %tool-item-set-proxy-menu-item () nil
1580 (tool-item tool-item)
1581 (menu-item-id string)
1582 (menu-item menu-item))
1583
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)
1586 menu-item)
1587
1588#+gtk2.6
1589(defbinding tool-item-rebuild-menu () nil
1590 (tool-item tool-item))
1591
1592
1593;;; Editable
1594
1595(defbinding editable-select-region (editable &optional (start 0) end) nil
1596 (editable editable)
1597 (start int)
1598 ((or end -1) int))
1599
1600(defbinding editable-get-selection-bounds (editable) nil
1601 (editable editable)
1602 (start int :out)
1603 (end int :out))
1604
1605(defbinding editable-insert-text (editable text &optional (position 0)) nil
1606 (editable editable)
1607 (text string)
1608 ((length text) int)
1609 (position position-type :in-out))
1610
1611(defun editable-append-text (editable text)
1612 (editable-insert-text editable text nil))
1613
1614(defun editable-prepend-text (editable text)
1615 (editable-insert-text editable text 0))
1616
1617(defbinding editable-delete-text (editable &optional (start 0) end) nil
1618 (editable editable)
1619 (start int)
1620 ((or end -1) int))
1621
1622(defbinding (editable-text "gtk_editable_get_chars")
1623 (editable &optional (start 0) end) string
1624 (editable editable)
1625 (start int)
1626 ((or end -1) int))
1627
1628(defun (setf editable-text) (text editable)
1629 (if text
1630 (editable-delete-text
1631 editable
1632 (editable-insert-text editable text))
1633 (editable-delete-text editable))
1634 text)
1635
1636(defbinding editable-cut-clipboard () nil
1637 (editable editable))
1638
1639(defbinding editable-copy-clipboard () nil
1640 (editable editable))
1641
1642(defbinding editable-paste-clipboard () nil
1643 (editable editable))
1644
1645(defbinding editable-delete-selection () nil
1646 (editable editable))
1647
1648
1649
1650;;; Spin button
1651
1652(defbinding spin-button-configure () nil
1653 (spin-button spin-button)
1654 (adjustment adjustment)
1655 (climb-rate double-float)
1656 (digits unsigned-int))
1657
1658(defbinding spin-button-set-range () nil
1659 (spin-button spin-button)
1660 (min double-float)
1661 (max double-float))
1662
1663(defbinding spin-button-get-range () nil
1664 (spin-button spin-button)
1665 (min double-float :out)
1666 (max double-float :out))
1667
1668(defun spin-button-value-as-int (spin-button)
1669 (round (spin-button-value spin-button)))
1670
1671(defbinding spin-button-spin () nil
1672 (spin-button spin-button)
1673 (direction spin-type)
1674 (increment single-float))
1675
1676(defbinding spin-button-update () nil
1677 (spin-button spin-button))
1678
1679
1680
1681; ;;; Ruler
1682
1683(defbinding ruler-set-range () nil
1684 (ruler ruler)
1685 (lower single-float)
1686 (upper single-float)
1687 (position single-float)
1688 (max-size single-float))
1689
1690(defbinding ruler-draw-ticks () nil
1691 (ruler ruler))
1692
1693(defbinding ruler-draw-pos () nil
1694 (ruler ruler))
1695
1696
1697
1698;;; Range
1699
1700(defun range-lower (range)
1701 (adjustment-lower (range-adjustment range)))
1702
1703(defun range-upper (range)
1704 (adjustment-upper (range-adjustment range)))
1705
1706(defun (setf range-lower) (value range)
1707 (setf (adjustment-lower (range-adjustment range)) value))
1708
1709(defun (setf range-upper) (value range)
1710 (setf (adjustment-upper (range-adjustment range)) value))
1711
1712(defun range-page-increment (range)
1713 (adjustment-page-increment (range-adjustment range)))
1714
1715(defun range-step-increment (range)
1716 (adjustment-step-increment (range-adjustment range)))
1717
1718(defun (setf range-page-increment) (value range)
1719 (setf (adjustment-page-increment (range-adjustment range)) value))
1720
1721(defun (setf range-step-increment) (value range)
1722 (setf (adjustment-step-increment (range-adjustment range)) value))
1723
1724(defbinding range-set-range () nil
1725 (range range)
1726 (lower double-float)
1727 (upper double-float))
1728
1729(defbinding range-set-increments () nil
1730 (range range)
1731 (step double-float)
1732 (page double-float))
1733
1734
1735;;; Scale
1736
1737; (defbinding scale-draw-value () nil
1738; (scale scale))
1739
1740
1741
1742;;; Progress bar
1743
1744(defbinding progress-bar-pulse () nil
1745 (progress-bar progress-bar))
1746
1747
1748;;; Size group
1749
1750(defmethod initialize-instance ((size-group size-group) &rest initargs
1751 &key widget widgets)
1752 (declare (ignore widget widgets))
1753 (prog1
1754 (call-next-method)
1755 (initial-add size-group #'size-group-add-widget
1756 initargs :widget :widgets)))
1757
1758
1759(defbinding size-group-add-widget () nil
1760 (size-group size-group)
1761 (widget widget))
1762
1763(defbinding size-group-remove-widget () nil
1764 (size-group size-group)
1765 (widget widget))
1766
1767
1768;;; Stock items
1769
1770(defbinding %stock-item-copy () pointer
1771 (location pointer))
1772
1773(defbinding %stock-item-free () nil
1774 (location pointer))
1775
1776(defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1777 (%stock-item-copy location))
1778
1779(defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1780 (%stock-item-free location))
1781
1782(defbinding stock-add (stock-item) nil
1783 (stock-item stock-item)
1784 (1 unsigned-int))
1785
1786(defbinding stock-list-ids () (gslist string))
1787
1788(defbinding %stock-lookup () boolean
1789 (stock-id string)
1790 (location pointer))
1791
1792(defun stock-lookup (stock-id)
1793 (let ((location
1794 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1795 (unwind-protect
1796 (when (%stock-lookup stock-id location)
1797 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1798 (deallocate-memory location))))
1799
1800
1801;;; Tooltips
1802
1803(defbinding tooltips-enable () nil
1804 (tooltips tooltips))
1805
1806(defbinding tooltips-disable () nil
1807 (tooltips tooltips))
1808
1809(defun (setf tooltips-enabled-p) (enable tooltips)
1810 (if enable
1811 (tooltips-enable tooltips)
1812 (tooltips-disable tooltips)))
1813
1814(defbinding tooltips-set-tip () nil
1815 (tooltips tooltips)
1816 (widget widget)
1817 (tip-text string)
1818 (tip-private string))
1819
1820(defbinding tooltips-data-get () tooltips-data
1821 (widget widget))
1822
1823(defbinding tooltips-force-window () nil
1824 (tooltips tooltips))
1825
1826(defbinding tooltips-get-info-from-tip-window () boolean
1827 (tip-window window)
1828 (tooltips tooltips :out)
1829 (current-widget widget :out))
1830
1831
1832;;; Rc
1833
1834(defbinding rc-add-default-file (filename) nil
1835 ((namestring (truename filename)) string))
1836
1837(defbinding rc-parse (filename) nil
1838 ((namestring (truename filename)) string))
1839
1840(defbinding rc-parse-string () nil
1841 (rc-string string))
1842
1843(defbinding rc-reparse-all () nil)
1844
1845(defbinding rc-get-style () style
1846 (widget widget))
1847
1848
1849
1850;;; Accelerator Groups
1851#|
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))
1856
1857(defbinding accel-groups-activate (object key modifiers) boolean
1858 (object object)
1859 ((gdk:keyval-from-name key) unsigned-int)
1860 (modifiers gdk:modifier-type))
1861
1862(defbinding accel-group-attach () nil
1863 (accel-group accel-group)
1864 (object object))
1865
1866(defbinding accel-group-detach () nil
1867 (accel-group accel-group)
1868 (object object))
1869
1870(defbinding accel-group-lock () nil
1871 (accel-group accel-group))
1872
1873(defbinding accel-group-unlock () nil
1874 (accel-group accel-group))
1875
1876
1877;;; Accelerator Groups Entries
1878
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))
1883
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))
1888
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))
1893
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)
1899 (flags accel-flags)
1900 (object object)
1901 ((name-to-string signal) string))
1902
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)
1907 (object object))
1908
1909
1910;;; Accelerator Signals
1911
1912(defbinding accel-group-handle-add
1913 (object signal-id accel-group key modifiers flags) nil
1914 (object object)
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))
1920
1921(defbinding accel-group-handle-remove
1922 (object accel-group key modifiers) nil
1923 (object object)
1924 (accel-group accel-group)
1925 ((gdk:keyval-from-name key) unsigned-int)
1926 (modifiers gdk:modifier-type))
1927|#