Bug fix
[clg] / gtk / gtk.lisp
CommitLineData
0d07716f 1;; Common Lisp bindings for GTK+ v2.0
a60bd055 2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
0d07716f 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
99821988 18;; $Id: gtk.lisp,v 1.20 2004/12/04 00:34:49 espen Exp $
0d07716f 19
20
21(in-package "GTK")
22
23;;; Gtk version
24
84967144 25(defbinding check-version () (copy-of string)
0d07716f 26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
29
a60bd055 30(defbinding query-version () nil
0d07716f 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
84967144 42(defbinding get-default-language () (copy-of pango:language))
0d07716f 43
44
6baf860c 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
d404b3af 66;;; Acccel group
0d07716f 67
68
eb4f580c 69
0d07716f 70;;; Acccel label
71
a60bd055 72(defbinding accel-label-refetch () boolean
0d07716f 73 (accel-label accel-label))
74
75
d404b3af 76;;; Adjustment
0d07716f 77
eb4f580c 78(defmethod shared-initialize ((adjustment adjustment) names &key value)
79 (prog1
80 (call-next-method)
81 ;; we need to make sure that the value is set last, otherwise it
82 ;; may be outside current limits
83 (when value
84 (setf (slot-value adjustment 'value) value))))
85
86
d404b3af 87(defbinding adjustment-changed () nil
88 (adjustment adjustment))
89
90(defbinding adjustment-value-changed () nil
91 (adjustment adjustment))
92
93(defbinding adjustment-clamp-page () nil
94 (adjustment adjustment)
95 (lower single-float)
96 (upper single-float))
0d07716f 97
d404b3af 98
d404b3af 99;;; Arrow -- no functions
100
101
102
103;;; Aspect frame
104
105
106;;; Bin
0d07716f 107
108(defun (setf bin-child) (child bin)
d404b3af 109 (when-bind (current-child (bin-child bin))
110 (container-remove bin current-child))
0d07716f 111 (container-add bin child)
112 child)
113
30481825 114
d404b3af 115;;; Binding
116
117
118
119;;; Box
120
121(defbinding box-pack-start () nil
122 (box box)
123 (child widget)
124 (expand boolean)
125 (fill boolean)
126 (padding unsigned-int))
127
128(defbinding box-pack-end () nil
129 (box box)
130 (child widget)
131 (expand boolean)
132 (fill boolean)
133 (padding unsigned-int))
134
4886872c 135(defun box-pack (box child &key end expand fill (padding 0))
136 (if end
378b3c5f 137 (box-pack-end box child expand fill padding)
138 (box-pack-start box child expand fill padding)))
d404b3af 139
140(defbinding box-reorder-child () nil
141 (box box)
142 (child widget)
143 (position int))
144
145(defbinding box-query-child-packing () nil
146 (box box)
147 (child widget)
148 (expand boolean :out)
149 (fill boolean :out)
150 (padding unsigned-int :out)
151 (pack-type pack-type :out))
152
153(defbinding box-set-child-packing () nil
154 (box box)
155 (child widget)
156 (expand boolean)
157 (fill boolean)
158 (padding unsigned-int)
159 (pack-type pack-type))
160
161
162
0d07716f 163;;; Button
164
a60bd055 165(defbinding button-pressed () nil
0d07716f 166 (button button))
167
d404b3af 168(defbinding button-released () nil
169 (button button))
170
171(defbinding button-clicked () nil
172 (button button))
173
174(defbinding button-enter () nil
175 (button button))
176
177(defbinding button-leave () nil
178 (button button))
179
180
181
182;;; Calendar
183
184(defbinding calendar-select-month () int
185 (calendar calendar)
186 (month unsigned-int)
187 (year unsigned-int))
188
189(defbinding calendar-select-day () nil
190 (calendar calendar)
191 (day unsigned-int))
192
193(defbinding calendar-mark-day () int
194 (calendar calendar)
195 (day unsigned-int))
196
197(defbinding calendar-unmark-day () int
198 (calendar calendar)
199 (day unsigned-int))
200
201(defbinding calendar-clear-marks () nil
202 (calendar calendar))
203
204(defbinding calendar-display-options () nil
205 (calendar calendar)
206 (options calendar-display-options))
207
208(defbinding (calendar-date "gtk_calendar_get_date") () nil
209 (calendar calendar)
210 (year unsigned-int :out)
211 (month unsigned-int :out)
212 (day unsigned-int :out))
213
214(defbinding calendar-freeze () nil
215 (calendar calendar))
216
217(defbinding calendar-thaw () nil
218 (calendar calendar))
219
220
221
222;;; Cell editable
223
224
225
226;;; Cell renderer
227
228
229
230;;; Cell renderer pixbuf -- no functions
231
232
233
234;;; Cell renderer text
235
236
237
238;;; Cell renderer toggle -- no functions
239
240
241
242;;; Check button -- no functions
243
244
245
246;;; Check menu item
247
248(defbinding check-menu-item-toggled () nil
249 (check-menu-item check-menu-item))
250
251
252
253;;; Clipboard
254
255
256;;; Color selection
257
258(defbinding (color-selection-is-adjusting-p
259 "gtk_color_selection_is_adjusting") () boolean
260 (colorsel color-selection))
261
262
263
264;;; Color selection dialog -- no functions
265
266
267
4886872c 268;;;; Combo Box
d404b3af 269
4886872c 270(defmethod shared-initialize ((combo-box combo-box) names &key model content)
271 (unless model
272 (setf
273 (combo-box-model combo-box)
84967144 274 (make-instance 'list-store :column-types '(string)))
4886872c 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)))
279 (when content
280 (map 'nil #'(lambda (text)
281 (combo-box-append-text combo-box text))
282 content)))
283 (call-next-method))
284
285;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
286;; (when active
287;; (signal-emit combo-box 'changed)))
288
289(defbinding combo-box-append-text () nil
290 (combo-box combo-box)
291 (text string))
292
293(defbinding combo-box-insert-text () nil
294 (combo-box combo-box)
295 (position int)
296 (text string))
297
298(defbinding combo-box-prepend-text () nil
299 (combo-box combo-box)
300 (text string))
301
302#+gtk2.6
303(defbinding combo-box-get-active-text () string
304 (combo-box combo-box))
d404b3af 305
4886872c 306(defbinding combo-box-popup () nil
307 (combo-box combo-box))
d404b3af 308
4886872c 309(defbinding combo-box-popdown () nil
310 (combo-box combo-box))
311
312
313
314;;;; Combo Box Entry
315
316(defmethod shared-initialize ((combo-box-entry combo-box-entry) names &key model)
317 (call-next-method)
318 (unless model
319 (setf (combo-box-entry-text-column combo-box-entry) 0)))
d404b3af 320
321
0ebef6c1 322;;;; Dialog
d404b3af 323
eb4f580c 324(defmethod shared-initialize ((dialog dialog) names &rest initargs &key button)
6baf860c 325 (declare (ignore button))
0ebef6c1 326 (call-next-method)
d404b3af 327 (dolist (button-definition (get-all initargs :button))
eb4f580c 328 (apply #'dialog-add-button dialog (mklist button-definition))))
0ebef6c1 329
d404b3af 330
331(defvar %*response-id-key* (gensym))
332
eb4f580c 333(defun %dialog-find-response-id-num (dialog id &optional create-p error-p)
d404b3af 334 (or
eb4f580c 335 (cadr (assoc id (rest (type-expand-1 'response-type))))
336 (let ((response-ids (object-data dialog %*response-id-key*)))
d404b3af 337 (cond
eb4f580c 338 ((and response-ids (position id response-ids :test #'equal)))
339 (create-p
340 (cond
341 (response-ids
342 (vector-push-extend id response-ids)
343 (1- (length response-ids)))
344 (t
345 (setf
346 (object-data dialog %*response-id-key*)
347 (make-array 1 :adjustable t :fill-pointer t :initial-element id))
348 0)))
349 (error-p
350 (error "Invalid response: ~A" id))))))
d404b3af 351
352(defun %dialog-find-response-id (dialog response-id-num)
353 (if (< response-id-num 0)
354 (car
355 (rassoc
356 (list response-id-num)
eb4f580c 357 (rest (type-expand-1 'response-type)) :test #'equal))
358 (aref (object-data dialog %*response-id-key*) response-id-num )))
d404b3af 359
360
0ebef6c1 361(defmethod signal-connect ((dialog dialog) signal function &key object after)
362 (let ((response-id-num (%dialog-find-response-id-num dialog signal)))
363 (cond
364 (response-id-num
365 (call-next-method
366 dialog 'response
367 #'(lambda (dialog id)
368 (when (= id response-id-num)
369 (cond
370 ((eq object t) (funcall function dialog))
371 (object (funcall function object))
372 (t (funcall function)))))
373 :object t :after after))
eb4f580c 374 ((call-next-method)))))
d404b3af 375
376
0ebef6c1 377(defbinding dialog-run () nil
378 (dialog dialog))
d404b3af 379
0ebef6c1 380(defbinding dialog-response (dialog response-id) nil
d404b3af 381 (dialog dialog)
0ebef6c1 382 ((%dialog-find-response-id-num dialog response-id nil t) int))
d404b3af 383
384
385(defbinding %dialog-add-button () button
386 (dialog dialog)
387 (text string)
388 (response-id-num int))
389
eb4f580c 390(defun dialog-add-button (dialog label &optional (response label)
391 &key default object after)
392 "Adds a button to the dialog. If no response is given, then label
393 will be used."
394 (let* ((id (if (functionp response)
395 label
396 response))
397 (id-num (%dialog-find-response-id-num dialog id t))
398 (button (%dialog-add-button dialog label id-num)))
399 (when (functionp response)
400 (signal-connect dialog id response :object object :after after))
401 (when default
402 (%dialog-set-default-response dialog id-num))
d404b3af 403 button))
404
405
406(defbinding %dialog-add-action-widget () button
407 (dialog dialog)
408 (action-widget widget)
409 (response-id-num int))
410
eb4f580c 411(defun dialog-add-action-widget (dialog widget &optional (response widget)
412 &key default object after)
413 (let* ((id (if (functionp response)
414 widget
415 response))
416 (id-num (%dialog-find-response-id-num dialog id t)))
417 (%dialog-add-action-widget dialog widget id-num)
418 (when (functionp response)
419 (signal-connect dialog id response :object object :after after))
420 (when default
421 (%dialog-set-default-response dialog id-num))
d404b3af 422 widget))
d404b3af 423
d404b3af 424
0ebef6c1 425(defbinding %dialog-set-default-response () nil
426 (dialog dialog)
427 (response-id-num int))
d404b3af 428
0ebef6c1 429(defun dialog-set-default-response (dialog response-id)
430 (%dialog-set-default-response
431 dialog (%dialog-find-response-id-num dialog response-id nil t)))
d404b3af 432
0ebef6c1 433(defbinding dialog-set-response-sensitive (dialog response-id sensitive) nil
434 (dialog dialog)
435 ((%dialog-find-response-id-num dialog response-id nil t) int)
436 (sensitive boolean))
d404b3af 437
438
0ebef6c1 439;; Addition dialog functions
440
441(defmethod container-add ((dialog dialog) (child widget) &rest args)
eb4f580c 442 (apply #'container-add (dialog-vbox dialog) child args))
0ebef6c1 443
444(defmethod container-remove ((dialog dialog) (child widget))
eb4f580c 445 (container-remove (dialog-vbox dialog) child))
d404b3af 446
0ebef6c1 447(defmethod container-children ((dialog dialog))
eb4f580c 448 (container-children (dialog-vbox dialog)))
0ebef6c1 449
450(defmethod (setf container-children) (children (dialog dialog))
eb4f580c 451 (setf (container-children (dialog-vbox dialog)) children))
0d07716f 452
0d07716f 453
0d07716f 454
0ebef6c1 455;;; Drawing area -- no functions
0d07716f 456
457
c2c4a7e9 458;;; Entry
0d07716f 459
22dc653c 460(defbinding entry-get-layout () pango:layout
c2c4a7e9 461 (entry entry))
462
463(defbinding entry-get-layout-offsets () nil
464 (entry entry)
465 (x int :out)
466 (y int :out))
0d07716f 467
0d07716f 468
eb4f580c 469;;; Image
470
471(defbinding image-set-from-file () nil
472 (image image)
473 (filename pathname))
474
475(defbinding image-set-from-pixmap () nil
476 (image image)
477 (pixmap gdk:pixmap)
478 (mask gdk:bitmap))
479
480(defbinding image-set-from-stock () nil
481 (image image)
482 (stock-id string)
483 (icon-size icon-size))
484
485(defun image-set-from-pixmap-data (image pixmap-data)
486 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap-data)
487 (image-set-from-pixmap image pixmap mask)))
488
489(defun image-set-from-source (image source)
490 (etypecase source
491 (pathname (image-set-from-file image source))
492 (string (if (stock-lookup source)
493 (setf (image-stock image) source)
494 (image-set-from-file image source)))
495 (vector (image-set-from-pixmap-data image source))))
496
497
498(defmethod shared-initialize ((image image) names &rest initargs
499 &key file pixmap source)
500 (prog1
501 (if (vectorp pixmap)
502 (progn
503 (remf initargs :pixmap)
504 (apply #'call-next-method image names initargs))
505 (call-next-method))
506 (cond
507 (file (image-set-from-file image file))
508 ((vectorp pixmap) (image-set-from-pixmap-data image pixmap))
509 (source (image-set-from-source image source)))))
510
0d07716f 511
d404b3af 512;;; Label
0d07716f 513
c2c4a7e9 514(defbinding label-get-layout-offsets () nil
eb4f580c 515 (label label)
c2c4a7e9 516 (x int :out)
517 (y int :out))
518
d404b3af 519(defbinding label-select-region () nil
520 (label label)
521 (start int)
522 (end int))
0d07716f 523
eb4f580c 524(defbinding label-get-text () string
c2c4a7e9 525 (label label))
526
22dc653c 527(defbinding label-get-layout () pango:layout
c2c4a7e9 528 (label label))
529
eb4f580c 530(defbinding label-get-selection-bounds () boolean
c2c4a7e9 531 (label label)
532 (start int :out)
533 (end int :out))
30481825 534
0d07716f 535
536
537;;; Radio button
538
dd392521 539(defbinding %radio-button-get-group () pointer
2afcd8bd 540 (radio-button radio-button))
541
a60bd055 542(defbinding %radio-button-set-group () nil
2afcd8bd 543 (radio-button radio-button)
544 (group pointer))
0d07716f 545
2afcd8bd 546(defun radio-button-add-to-group (button1 button2)
547 "Add BUTTON1 to the group which BUTTON2 belongs to."
548 (%radio-button-set-group button1 (%radio-button-get-group button2)))
549
dd392521 550
2afcd8bd 551(defmethod initialize-instance ((button radio-button)
dd392521 552 &rest initargs &key group-with)
553 (declare (ignore initargs))
2afcd8bd 554 (call-next-method)
dd392521 555 (when group-with
378b3c5f 556 (radio-button-add-to-group button group-with)))
0d07716f 557
558
0d07716f 559;;; Item
560
a60bd055 561(defbinding item-select () nil
0d07716f 562 (item item))
563
a60bd055 564(defbinding item-deselect () nil
0d07716f 565 (item item))
566
a60bd055 567(defbinding item-toggle () nil
0d07716f 568 (item item))
569
570
571
572;;; Menu item
573
30481825 574(defun (setf menu-item-label) (label menu-item)
575 (make-instance 'accel-label
576 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
577 :visible t :parent menu-item)
578 label)
0d07716f 579
378b3c5f 580(defun menu-item-label (menu-item)
581 (with-slots (child) menu-item
582 (when (typep child 'label)
583 (label-label child))))
584
a60bd055 585(defbinding %menu-item-set-submenu () nil
30481825 586 (menu-item menu-item)
587 (submenu menu))
0d07716f 588
a60bd055 589(defbinding %menu-item-remove-submenu () nil
30481825 590 (menu-item menu-item))
0d07716f 591
30481825 592(defun (setf menu-item-submenu) (submenu menu-item)
593 (if (not submenu)
594 (%menu-item-remove-submenu menu-item)
595 (%menu-item-set-submenu menu-item submenu))
596 submenu)
0d07716f 597
378b3c5f 598(defbinding menu-item-set-accel-path () nil
599 (menu-item menu-item)
600 (accel-path string))
601
a60bd055 602(defbinding menu-item-select () nil
30481825 603 (menu-item menu-item))
0d07716f 604
a60bd055 605(defbinding menu-item-deselect () nil
30481825 606 (menu-item menu-item))
0d07716f 607
a60bd055 608(defbinding menu-item-activate () nil
30481825 609 (menu-item menu-item))
0d07716f 610
378b3c5f 611(defbinding menu-item-toggle-size-request () nil
612 (menu-item menu-item)
613 (requisition int :out))
614
615(defbinding menu-item-toggle-size-allocate () nil
616 (menu-item menu-item)
617 (allocation int))
618
0d07716f 619
620
30481825 621;;; Radio menu item
0d07716f 622
dd392521 623(defbinding %radio-menu-item-get-group () pointer
2afcd8bd 624 (radio-menu-item radio-menu-item))
625
a60bd055 626(defbinding %radio-menu-item-set-group () nil
2afcd8bd 627 (radio-menu-item radio-menu-item)
628 (group pointer))
629
2afcd8bd 630(defun radio-menu-item-add-to-group (item1 item2)
631 "Add ITEM1 to the group which ITEM2 belongs to."
632 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
633
634(defmethod initialize-instance ((item radio-menu-item)
dd392521 635 &rest initargs &key group-with)
636 (declare (ignore initargs))
378b3c5f 637 (prog1
638 (call-next-method)
639 (when group-with
640 (radio-menu-item-add-to-group item group-with))))
2afcd8bd 641
0d07716f 642
643
c2c4a7e9 644;;; Toggle button
645
646(defbinding toggle-button-toggled () nil
647 (toggle-button toggle-button))
648
649
650
0d07716f 651;;; Window
652
99821988 653(defmethod initialize-instance ((window window) &rest initargs &key accel-group)
654 (declare (ignore accel-group))
655 (call-next-method)
656 (mapc #'(lambda (accel-group)
657 (window-add-accel-group window accel-group))
658 (get-all initargs :accel-group)))
659
660
304cfb76 661(defbinding window-set-wmclass () nil
0d07716f 662 (window window)
663 (wmclass-name string)
664 (wmclass-class string))
665
a60bd055 666(defbinding window-add-accel-group () nil
0d07716f 667 (window window)
668 (accel-group accel-group))
669
a60bd055 670(defbinding window-remove-accel-group () nil
0d07716f 671 (window window)
672 (accel-group accel-group))
673
a60bd055 674(defbinding window-activate-focus () int
0d07716f 675 (window window))
676
a60bd055 677(defbinding window-activate-default () int
0d07716f 678 (window window))
679
304cfb76 680(defbinding window-set-default-size (window width height) int
0d07716f 681 (window window)
304cfb76 682 ((or width -1) int)
683 ((or height -1) int))
0d07716f 684
a60bd055 685;(defbinding window-set-geometry-hints)
0d07716f 686
99821988 687(defbinding window-list-toplevels () (glist (copy-of window))
688 "Returns a list of all existing toplevel windows.")
304cfb76 689
690(defbinding window-add-mnemonic (window key target) nil
691 (window window)
692 ((gdk:keyval-from-name key) unsigned-int)
693 (target widget))
694
695(defbinding window-remove-mnemonic (window key target) nil
696 (window window)
697 ((gdk:keyval-from-name key) unsigned-int)
698 (target widget))
699
700(defbinding window-mnemonic-activate (window key modifier) nil
701 (window window)
702 ((gdk:keyval-from-name key) unsigned-int)
703 (modifier gdk:modifier-type))
704
705(defbinding window-present () nil
706 (window window))
707
708(defbinding window-iconify () nil
709 (window window))
710
711(defbinding window-deiconify () nil
712 (window window))
713
714(defbinding window-stick () nil
715 (window window))
716
717(defbinding window-unstick () nil
718 (window window))
719
720(defbinding window-maximize () nil
721 (window window))
722
723(defbinding window-unmaximize () nil
724 (window window))
725
726(defbinding window-begin-resize-drag () nil
727 (window window)
728 (edge gdk:window-edge)
729 (button int)
730 (root-x int) (root-y int)
6baf860c 731 (timestamp unsigned-int))
304cfb76 732
733(defbinding window-begin-move-drag () nil
734 (window window)
735 (edge gdk:window-edge)
736 (button int)
737 (root-x int) (root-y int)
6baf860c 738 (timestamp unsigned-int))
304cfb76 739
740(defbinding window-set-frame-dimensions () nil
741 (window window)
742 (left int) (top int) (rigth int) (bottom int))
743
744(defbinding (window-default-icons "gtk_window_get_default_icon_list")
745 () (glist gdk:pixbuf))
746
747(defbinding %window-get-default-size () nil
748 (window window)
749 (width int :out)
750 (height int :out))
751
752(defun window-get-default-size (window)
753 (multiple-value-bind (width height) (%window-get-default-size window)
754 (values (unless (= width -1) width) (unless (= height -1) height))))
755
756(defbinding window-get-frame-dimensions () nil
757 (window window)
758 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
759
760(defbinding %window-get-icon-list () (glist gdk:pixbuf)
761 (window window))
762
763(defmethod window-icon ((window window))
764 (let ((icon-list (%window-get-icon-list window)))
765 (if (endp (rest icon-list))
766 (first icon-list)
767 icon-list)))
768
769(defbinding window-get-position () nil
770 (window window)
771 (root-x int :out)
772 (root-y int :out))
773
774(defbinding window-get-size () nil
775 (window window)
776 (width int :out)
777 (height int :out))
778
779(defbinding window-move () nil
780 (window window)
781 (x int)
782 (y int))
783
784(defbinding window-parse-geometry () boolean
785 (window window)
786 (geometry string))
787
788(defbinding window-reshow-with-initial-size () nil
789 (window window))
790
791(defbinding window-resize () nil
792 (window window)
793 (width int)
794 (heigth int))
795
796(defbinding %window-set-icon-list () nil
797 (window window)
798 (icon-list (glist gdk:pixbuf)))
799
800(defmethod (setf window-icon) (icon (window window))
801 (%window-set-icon-list window (mklist icon)))
802
803
0d07716f 804
805
eb4f580c 806;;; File chooser
0d07716f 807
0d07716f 808
0d07716f 809
810
30481825 811;;; Scrolled window
0d07716f 812
0d07716f 813(defun (setf scrolled-window-scrollbar-policy) (policy window)
814 (setf (scrolled-window-hscrollbar-policy window) policy)
815 (setf (scrolled-window-vscrollbar-policy window) policy))
816
a60bd055 817(defbinding scrolled-window-add-with-viewport () nil
0d07716f 818 (scrolled-window scrolled-window)
819 (child widget))
820
821
822
2afcd8bd 823
824
825
0d07716f 826
30481825 827;;; Statusbar
0d07716f 828
a60bd055 829(defbinding (statusbar-context-id "gtk_statusbar_get_context_id")
830 () unsigned-int
30481825 831 (statusbar statusbar)
832 (context-description string))
0d07716f 833
a60bd055 834(defbinding statusbar-push () unsigned-int
30481825 835 (statusbar statusbar)
836 (context-id unsigned-int)
837 (text string))
0d07716f 838
a60bd055 839(defbinding statusbar-pop () nil
30481825 840 (statusbar statusbar)
841 (context-id unsigned-int))
0d07716f 842
a60bd055 843(defbinding statusbar-remove () nil
30481825 844 (statusbar statusbar)
845 (context-id unsigned-int)
846 (message-id unsigned-int))
0d07716f 847
0d07716f 848
849
850;;; Fixed
851
a60bd055 852(defbinding fixed-put () nil
30481825 853 (fixed fixed)
854 (widget widget)
378b3c5f 855 (x int) (y int))
0d07716f 856
a60bd055 857(defbinding fixed-move () nil
30481825 858 (fixed fixed)
859 (widget widget)
378b3c5f 860 (x int) (y int))
0d07716f 861
862
863
2afcd8bd 864;;; Notebook
0d07716f 865
378b3c5f 866(defun %notebook-position (notebook page)
867 (etypecase page
868 (int page)
869 (keyword (case page
870 (:first 0)
871 (:last -1)
eb4f580c 872 (t (error "Invalid position keyword: ~A" page))))
378b3c5f 873 (widget (notebook-page-num notebook page t))))
874
875(defun %notebook-child (notebook position)
876 (typecase position
877 (widget position)
878 (t (notebook-nth-page-child notebook position))))
879
880
881(defbinding (notebook-insert "gtk_notebook_insert_page_menu")
30481825 882 (notebook position child tab-label &optional menu-label) nil
883 (notebook notebook)
884 (child widget)
885 ((if (stringp tab-label)
378b3c5f 886 (make-instance 'label :label tab-label)
30481825 887 tab-label) widget)
888 ((if (stringp menu-label)
378b3c5f 889 (make-instance 'label :label menu-label)
30481825 890 menu-label) (or null widget))
378b3c5f 891 ((%notebook-position notebook position) int))
0d07716f 892
378b3c5f 893(defun notebook-append (notebook child tab-label &optional menu-label)
894 (notebook-insert notebook :last child tab-label menu-label))
0d07716f 895
378b3c5f 896(defun notebook-prepend (notebook child tab-label &optional menu-label)
897 (notebook-insert notebook :first child tab-label menu-label))
0d07716f 898
378b3c5f 899(defbinding notebook-remove-page (notebook page) nil
30481825 900 (notebook notebook)
eb4f580c 901 ((%notebook-position notebook page) int))
0d07716f 902
a60bd055 903(defbinding %notebook-page-num () int
30481825 904 (notebook notebook)
905 (child widget))
906
378b3c5f 907(defun notebook-page-num (notebook child &optional error-p)
30481825 908 (let ((page-num (%notebook-page-num notebook child)))
909 (if (= page-num -1)
378b3c5f 910 (when error-p
911 (error "~A is not a child of ~A" child notebook))
30481825 912 page-num)))
913
a60bd055 914(defbinding notebook-next-page () nil
30481825 915 (notebook notebook))
0d07716f 916
a60bd055 917(defbinding notebook-prev-page () nil
30481825 918 (notebook notebook))
919
378b3c5f 920(defbinding notebook-reorder-child (notebook child position) nil
921 (notebook notebook)
922 (child widget)
923 ((%notebook-position notebook position) int))
924
a60bd055 925(defbinding notebook-popup-enable () nil
30481825 926 (notebook notebook))
927
a60bd055 928(defbinding notebook-popup-disable () nil
30481825 929 (notebook notebook))
930
378b3c5f 931(defbinding (notebook-nth-page-child "gtk_notebook_get_nth_page")
932 (notebook page) widget
933 (notebook notebook)
934 ((case page
935 (:first 0)
936 (:last -1)
937 (t page)) int))
938
eb4f580c 939
940(defbinding %notebook-get-current-page () int
378b3c5f 941 (notebook notebook))
942
eb4f580c 943(defun notebook-current-page-num (notebook)
944 (let ((num (%notebook-get-current-page notebook)))
945 (when (>= num 0)
946 num)))
947
378b3c5f 948(defun notebook-current-page (notebook)
eb4f580c 949 (let ((page-num (notebook-current-page-num notebook)))
950 (when page-num
951 (notebook-nth-page-child notebook page-num))))
378b3c5f 952
953(defbinding %notebook-set-current-page () nil
954 (notebook notebook)
955 (page-num int))
956
957(defun (setf notebook-current-page) (page notebook)
958 (%notebook-set-current-page notebook (%notebook-position notebook page))
959 page)
960
961
eb4f580c 962(defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
963 (notebook page) widget
964 (notebook notebook)
965 ((%notebook-child notebook page) widget))
378b3c5f 966
eb4f580c 967(defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
84967144 968 (notebook page) (copy-of string)
eb4f580c 969 (notebook notebook)
970 ((%notebook-child notebook page) widget))
378b3c5f 971
eb4f580c 972(defbinding %notebook-set-tab-label () nil
973 (notebook notebook)
974 (page widget)
975 (tab-label widget))
976
977(defun (setf notebook-tab-label) (tab-label notebook page)
978 (let ((widget (if (stringp tab-label)
979 (make-instance 'label :label tab-label)
980 tab-label)))
981 (%notebook-set-tab-label notebook (%notebook-child notebook page) widget)
982 widget))
378b3c5f 983
378b3c5f 984
eb4f580c 985(defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
986 (notebook page) widget
987 (notebook notebook)
988 ((%notebook-child notebook page) widget))
378b3c5f 989
eb4f580c 990(defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
84967144 991 (notebook page) (copy-of string)
eb4f580c 992 (notebook notebook)
993 ((%notebook-child notebook page) widget))
378b3c5f 994
eb4f580c 995(defbinding %notebook-set-menu-label () nil
996 (notebook notebook)
997 (page widget)
998 (menu-label widget))
999
1000(defun (setf notebook-menu-label) (menu-label notebook page)
1001 (let ((widget (if (stringp menu-label)
1002 (make-instance 'label :label menu-label)
1003 menu-label)))
1004 (%notebook-set-menu-label notebook (%notebook-child notebook page) widget)
1005 widget))
378b3c5f 1006
1007
1008(defbinding notebook-query-tab-label-packing (notebook page) nil
30481825 1009 (notebook notebook)
378b3c5f 1010 ((%notebook-child notebook page) widget)
30481825 1011 (expand boolean :out)
1012 (fill boolean :out)
1013 (pack-type pack-type :out))
1014
378b3c5f 1015(defbinding notebook-set-tab-label-packing
1016 (notebook page expand fill pack-type) nil
30481825 1017 (notebook notebook)
378b3c5f 1018 ((%notebook-child notebook page) widget)
30481825 1019 (expand boolean)
1020 (fill boolean)
1021 (pack-type pack-type))
1022
0d07716f 1023
1024
2afcd8bd 1025;;; Paned
0d07716f 1026
a60bd055 1027(defbinding paned-pack1 () nil
2afcd8bd 1028 (paned paned)
1029 (child widget)
1030 (resize boolean)
1031 (shrink boolean))
0d07716f 1032
a60bd055 1033(defbinding paned-pack2 () nil
2afcd8bd 1034 (paned paned)
1035 (child widget)
1036 (resize boolean)
1037 (shrink boolean))
0d07716f 1038
378b3c5f 1039(defun (setf paned-child1) (child paned)
1040 (paned-pack1 paned child nil t)
1041 child)
1042
1043(defun (setf paned-child2) (child paned)
1044 (paned-pack2 paned child t t)
1045 child)
1046
1047;; Defined in gtkglue.c
a60bd055 1048(defbinding paned-child1 () widget
2afcd8bd 1049 (paned paned)
1050 (resize boolean :out)
1051 (shrink boolean :out))
0d07716f 1052
378b3c5f 1053;; Defined in gtkglue.c
a60bd055 1054(defbinding paned-child2 () widget
2afcd8bd 1055 (paned paned)
1056 (resize boolean :out)
1057 (shrink boolean :out))
0d07716f 1058
0d07716f 1059
0d07716f 1060
2afcd8bd 1061;;; Layout
0d07716f 1062
a60bd055 1063(defbinding layout-put () nil
2afcd8bd 1064 (layout layout)
1065 (widget widget)
1066 (x int)
1067 (y int))
0d07716f 1068
a60bd055 1069(defbinding layout-move () nil
2afcd8bd 1070 (layout layout)
1071 (widget widget)
1072 (x int)
1073 (y int))
0d07716f 1074
0d07716f 1075
1076
0d07716f 1077;;; Menu shell
1078
378b3c5f 1079(defbinding menu-shell-insert (menu-shell menu-item position) nil
30481825 1080 (menu-shell menu-shell)
1081 (menu-item menu-item)
378b3c5f 1082 ((case position
1083 (:first 0)
1084 (:last -1)
1085 (t position)) int))
0d07716f 1086
30481825 1087(defun menu-shell-append (menu-shell menu-item)
378b3c5f 1088 (menu-shell-insert menu-shell menu-item :last))
0d07716f 1089
30481825 1090(defun menu-shell-prepend (menu-shell menu-item)
378b3c5f 1091 (menu-shell-insert menu-shell menu-item :fisrt))
0d07716f 1092
a60bd055 1093(defbinding menu-shell-deactivate () nil
30481825 1094 (menu-shell menu-shell))
0d07716f 1095
a60bd055 1096(defbinding menu-shell-select-item () nil
30481825 1097 (menu-shell menu-shell)
1098 (menu-item menu-item))
0d07716f 1099
a60bd055 1100(defbinding menu-shell-deselect () nil
30481825 1101 (menu-shell menu-shell))
0d07716f 1102
a60bd055 1103(defbinding menu-shell-activate-item () nil
30481825 1104 (menu-shell menu-shell)
1105 (menu-item menu-item)
1106 (fore-deactivate boolean))
0d07716f 1107
1108
1109
378b3c5f 1110;;; Menu
0d07716f 1111
378b3c5f 1112(defun %menu-position (menu child)
1113 (etypecase child
1114 (int child)
1115 (keyword (case child
1116 (:first 0)
1117 (:last -1)
eb4f580c 1118 (t (error "Invalid position keyword: ~A" child))))
378b3c5f 1119 (widget (menu-child-position menu child))))
0d07716f 1120
1121
378b3c5f 1122(defbinding menu-reorder-child (menu menu-item position) nil
1123 (menu menu)
1124 (menu-item menu-item)
1125 ((%menu-position menu position) int))
0d07716f 1126
7bde5a67 1127(def-callback-marshal %menu-popup-callback (nil (x int) (y int) (push-in boolean)))
0d07716f 1128
378b3c5f 1129(defbinding %menu-popup () nil
1130 (menu menu)
1131 (parent-menu-shell (or null menu-shell))
1132 (parent-menu-item (or null menu-item))
1133 (callback-func (or null pointer))
1134 (callback-id unsigned-int)
1135 (button unsigned-int)
1136 (activate-time (unsigned 32)))
1137
1138(defun menu-popup (menu button activate-time &key callback parent-menu-shell
1139 parent-menu-item)
1140 (if callback
4886872c 1141 (with-callback-function (id callback)
1142 (%menu-popup
1143 menu parent-menu-shell parent-menu-item
1144 (callback %menu-popup-callback) id button activate-time))
378b3c5f 1145 (%menu-popup
1146 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1147
1148(defbinding menu-set-accel-path () nil
1149 (menu menu)
1150 (accel-path string))
0d07716f 1151
a60bd055 1152(defbinding menu-reposition () nil
30481825 1153 (menu menu))
0d07716f 1154
a60bd055 1155(defbinding menu-popdown () nil
30481825 1156 (menu menu))
0d07716f 1157
378b3c5f 1158(defun menu-child-position (menu child)
1159 (position child (container-children menu)))
1160
1161(defun menu-active-num (menu)
1162 (menu-child-position menu (menu-active menu)))
1163
a60bd055 1164(defbinding %menu-set-active () nil
30481825 1165 (menu menu)
1166 (index unsigned-int))
0d07716f 1167
378b3c5f 1168(defun (setf menu-active) (menu child)
1169 (%menu-set-active menu (%menu-position menu child))
1170 child)
2afcd8bd 1171
0d07716f 1172
1173
30481825 1174;;; Table
0d07716f 1175
a60bd055 1176(defbinding table-resize () nil
30481825 1177 (table table)
1178 (rows unsigned-int)
1179 (columns unsigned-int))
0d07716f 1180
a60bd055 1181(defbinding table-attach (table child left right top bottom
378b3c5f 1182 &key (x-options '(:expand :fill))
1183 (y-options '(:expand :fill))
1184 (x-padding 0) (y-padding 0)) nil
30481825 1185 (table table)
1186 (child widget)
1187 (left unsigned-int)
1188 (right unsigned-int)
1189 (top unsigned-int)
1190 (bottom unsigned-int)
1191 (x-options attach-options)
1192 (y-options attach-options)
1193 (x-padding unsigned-int)
1194 (y-padding unsigned-int))
1195
dd392521 1196
a60bd055 1197(defbinding %table-set-row-spacing () nil
30481825 1198 (table table)
1199 (row unsigned-int)
1200 (spacing unsigned-int))
1201
dd392521 1202(defbinding %table-set-row-spacings () nil
1203 (table table)
1204 (spacing unsigned-int))
1205
1206(defun (setf table-row-spacing) (spacing table &optional row)
1207 (if row
1208 (%table-set-row-spacing table row spacing)
1209 (%table-set-row-spacings table spacing))
30481825 1210 spacing)
1211
dd392521 1212(defbinding %table-get-row-spacing () unsigned-int
30481825 1213 (table table)
dd392521 1214 (row unsigned-int))
1215
1216(defbinding %table-get-default-row-spacing () unsigned-int
1217 (table table))
1218
1219(defun table-row-spacing (table &optional row)
1220 (if row
1221 (%table-get-row-spacing table row)
1222 (%table-get-default-row-spacing table)))
1223
30481825 1224
a60bd055 1225(defbinding %table-set-col-spacing () nil
30481825 1226 (table table)
1227 (col unsigned-int)
1228 (spacing unsigned-int))
1229
dd392521 1230(defbinding %table-set-col-spacings () nil
1231 (table table)
1232 (spacing unsigned-int))
1233
1234(defun (setf table-col-spacing) (spacing table &optional col)
1235 (if col
1236 (%table-set-col-spacing table col spacing)
1237 (%table-set-col-spacings table spacing))
30481825 1238 spacing)
1239
dd392521 1240(defbinding %table-get-col-spacing () unsigned-int
30481825 1241 (table table)
dd392521 1242 (col unsigned-int))
1243
1244(defbinding %table-get-default-col-spacing () unsigned-int
1245 (table table))
1246
1247(defun table-col-spacing (table &optional col)
1248 (if col
1249 (%table-get-col-spacing table col)
1250 (%table-get-default-col-spacing table)))
1251
1252
30481825 1253
1254;;; Toolbar
1255
a60bd055 1256(defbinding %toolbar-insert-element () widget
30481825 1257 (toolbar toolbar)
1258 (type toolbar-child-type)
1259 (widget (or null widget))
1260 (text string)
1261 (tooltip-text string)
1262 (tooltip-private-text string)
1263 (icon (or null widget))
1264 (nil null)
1265 (nil null)
1266 (position int))
0d07716f 1267
378b3c5f 1268(defbinding %toolbar-insert-stock () widget
1269 (toolbar toolbar)
1270 (stock-id string)
1271 (tooltip-text string)
1272 (tooltip-private-text string)
1273 (nil null)
1274 (nil null)
1275 (position int))
1276
1277(defun toolbar-insert (toolbar position element
1278 &key tooltip-text tooltip-private-text
1279 type icon group callback object)
1280 (let* ((numpos (case position
eb4f580c 1281 (:first -1)
1282 (:last 0)
378b3c5f 1283 (t position)))
1284 (widget
1285 (cond
1286 ((or
1287 (eq type :space)
1288 (and (not type) (eq element :space)))
1289 (%toolbar-insert-element
1290 toolbar :space nil nil
1291 tooltip-text tooltip-private-text nil numpos))
1292 ((or
1293 (eq type :widget)
1294 (and (not type) (typep element 'widget)))
1295 (%toolbar-insert-element
1296 toolbar :widget element nil
1297 tooltip-text tooltip-private-text nil numpos))
1298 ((or
1299 (eq type :stock)
1300 (and
1301 (not type)
1302 (typep element 'string)
1303 (stock-lookup element)))
1304 (%toolbar-insert-stock
1305 toolbar element tooltip-text tooltip-private-text numpos))
1306 ((typep element 'string)
1307 (%toolbar-insert-element
1308 toolbar (or type :button) (when (eq type :radio-button) group)
eb4f580c 1309 element tooltip-text tooltip-private-text
1310 (etypecase icon
1311 (null nil)
1312 (widget icon)
1313 ((or pathname string vector)
1314 (make-instance 'image
1315 :source icon ; :icon-size (toolbar-icon-size toolbar)
1316 )))
1317 numpos))
378b3c5f 1318 ((error "Invalid element type: ~A" element)))))
30481825 1319 (when callback
378b3c5f 1320 (signal-connect widget 'clicked callback :object object))
1321 widget))
30481825 1322
378b3c5f 1323(defun toolbar-append (toolbar element &key tooltip-text tooltip-private-text
1324 type icon group callback object)
1325 (toolbar-insert
1326 toolbar :first element :type type :icon icon :group group
30481825 1327 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
378b3c5f 1328 :callback callback :object object))
30481825 1329
378b3c5f 1330(defun toolbar-prepend (toolbar element &key tooltip-text tooltip-private-text
1331 type icon group callback object)
1332 (toolbar-insert
1333 toolbar :last element :type type :icon icon :group group
30481825 1334 :tooltip-text tooltip-text :tooltip-private-text tooltip-private-text
378b3c5f 1335 :callback callback :object object))
1336
30481825 1337
1338(defun toolbar-insert-space (toolbar position)
378b3c5f 1339 (toolbar-insert toolbar position :space))
30481825 1340
1341(defun toolbar-append-space (toolbar)
378b3c5f 1342 (toolbar-append toolbar :space))
30481825 1343
1344(defun toolbar-prepend-space (toolbar)
378b3c5f 1345 (toolbar-prepend toolbar :space))
30481825 1346
0d07716f 1347
30481825 1348(defun toolbar-enable-tooltips (toolbar)
1349 (setf (toolbar-tooltips-p toolbar) t))
0d07716f 1350
30481825 1351(defun toolbar-disable-tooltips (toolbar)
1352 (setf (toolbar-tooltips-p toolbar) nil))
0d07716f 1353
1354
378b3c5f 1355(defbinding toolbar-remove-space () nil
1356 (toolbar toolbar)
1357 (position int))
0d07716f 1358
378b3c5f 1359(defbinding toolbar-unset-icon-size () nil
1360 (toolbar toolbar))
0d07716f 1361
378b3c5f 1362(defbinding toolbar-unset-style () nil
1363 (toolbar toolbar))
0d07716f 1364
1365
a60bd055 1366;;; Editable
eb4f580c 1367
a60bd055 1368(defbinding editable-select-region (editable &optional (start 0) end) nil
30481825 1369 (editable editable)
1370 (start int)
1371 ((or end -1) int))
0d07716f 1372
eb4f580c 1373(defbinding editable-get-selection-bounds (editable) nil
1374 (editable editable)
1375 (start int :out)
1376 (end int :out))
1377
a60bd055 1378(defbinding editable-insert-text
30481825 1379 (editable text &optional (position 0)) nil
1380 (editable editable)
1381 (text string)
1382 ((length text) int)
1383 ((or position -1) int :in-out))
0d07716f 1384
30481825 1385(defun editable-append-text (editable text)
1386 (editable-insert-text editable text nil))
0d07716f 1387
30481825 1388(defun editable-prepend-text (editable text)
1389 (editable-insert-text editable text 0))
0d07716f 1390
a60bd055 1391(defbinding editable-delete-text (editable &optional (start 0) end) nil
30481825 1392 (editable editable)
1393 (start int)
1394 ((or end -1) int))
0d07716f 1395
a60bd055 1396(defbinding (editable-text "gtk_editable_get_chars")
30481825 1397 (editable &optional (start 0) end) string
1398 (editable editable)
1399 (start int)
1400 ((or end -1) int))
0d07716f 1401
30481825 1402(defun (setf editable-text) (text editable)
1403 (if text
1404 (editable-delete-text
1405 editable
1406 (editable-insert-text editable text))
1407 (editable-delete-text editable))
1408 text)
0d07716f 1409
a60bd055 1410(defbinding editable-cut-clipboard () nil
30481825 1411 (editable editable))
0d07716f 1412
a60bd055 1413(defbinding editable-copy-clipboard () nil
30481825 1414 (editable editable))
0d07716f 1415
a60bd055 1416(defbinding editable-paste-clipboard () nil
30481825 1417 (editable editable))
0d07716f 1418
a60bd055 1419(defbinding editable-delete-selection () nil
30481825 1420 (editable editable))
0d07716f 1421
0d07716f 1422
0d07716f 1423
30481825 1424;;; Spin button
0d07716f 1425
30481825 1426(defun spin-button-value-as-int (spin-button)
1427 (round (spin-button-value spin-button)))
0d07716f 1428
a60bd055 1429(defbinding spin-button-spin () nil
30481825 1430 (spin-button spin-button)
1431 (direction spin-type)
1432 (increment single-float))
0d07716f 1433
a60bd055 1434(defbinding spin-button-update () nil
30481825 1435 (spin-button spin-button))
0d07716f 1436
1437
1438
1439; ;;; Ruler
1440
a60bd055 1441(defbinding ruler-set-range () nil
30481825 1442 (ruler ruler)
1443 (lower single-float)
1444 (upper single-float)
1445 (position single-float)
1446 (max-size single-float))
0d07716f 1447
a60bd055 1448(defbinding ruler-draw-ticks () nil
30481825 1449 (ruler ruler))
0d07716f 1450
a60bd055 1451(defbinding ruler-draw-pos () nil
30481825 1452 (ruler ruler))
0d07716f 1453
0d07716f 1454
0d07716f 1455
2afcd8bd 1456;;; Range
0d07716f 1457
eb4f580c 1458(defun range-lower (range)
1459 (adjustment-lower (range-adjustment range)))
0d07716f 1460
eb4f580c 1461(defun range-upper (range)
1462 (adjustment-upper (range-adjustment range)))
0d07716f 1463
eb4f580c 1464(defun (setf range-lower) (value range)
1465 (setf (adjustment-lower (range-adjustment range)) value))
0d07716f 1466
eb4f580c 1467(defun (setf range-upper) (value range)
1468 (setf (adjustment-upper (range-adjustment range)) value))
0d07716f 1469
eb4f580c 1470(defun range-page-increment (range)
1471 (adjustment-page-increment (range-adjustment range)))
0d07716f 1472
eb4f580c 1473(defun range-step-increment (range)
1474 (adjustment-step-increment (range-adjustment range)))
0d07716f 1475
eb4f580c 1476(defun (setf range-page-increment) (value range)
1477 (setf (adjustment-page-increment (range-adjustment range)) value))
0d07716f 1478
eb4f580c 1479(defun (setf range-step-increment) (value range)
1480 (setf (adjustment-step-increment (range-adjustment range)) value))
0d07716f 1481
eb4f580c 1482(defbinding range-set-range () nil
2afcd8bd 1483 (range range)
eb4f580c 1484 (lower double-float)
1485 (upper double-float))
0d07716f 1486
eb4f580c 1487(defbinding range-set-increments () nil
2afcd8bd 1488 (range range)
eb4f580c 1489 (step double-float)
1490 (page double-float))
0d07716f 1491
0d07716f 1492
2afcd8bd 1493;;; Scale
0d07716f 1494
dd392521 1495; (defbinding scale-draw-value () nil
1496; (scale scale))
0d07716f 1497
0d07716f 1498
0d07716f 1499
2afcd8bd 1500;;; Progress bar
0d07716f 1501
a60bd055 1502(defbinding progress-bar-pulse () nil
2afcd8bd 1503 (progress-bar progress-bar))
0d07716f 1504
1505
1506
378b3c5f 1507;;; Stock items
1508
99821988 1509(defbinding %stock-item-copy () pointer
1510 (location pointer))
1511
1512(defbinding %stock-item-free () nil
1513 (location pointer))
378b3c5f 1514
99821988 1515(defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
1516 (%stock-item-copy location))
1517
1518(defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
1519 (%stock-item-free location))
1520
1521(defbinding stock-add (stock-item) nil
1522 (stock-item stock-item)
1523 (1 unsigned-int))
1524
1525(defbinding stock-list-ids () (gslist string))
1526
1527(defbinding %stock-lookup () boolean
1528 (stock-id string)
1529 (location pointer))
1530
1531(defun stock-lookup (stock-id)
1532 (let ((location
1533 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
1534 (unwind-protect
1535 (when (%stock-lookup stock-id location)
1536 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
1537 (deallocate-memory location))))
0d07716f 1538
1539
1540;;; Tooltips
1541
a60bd055 1542(defbinding tooltips-enable () nil
2afcd8bd 1543 (tooltips tooltips))
0d07716f 1544
a60bd055 1545(defbinding tooltips-disable () nil
2afcd8bd 1546 (tooltips tooltips))
0d07716f 1547
dd392521 1548(defun (setf tooltips-enabled-p) (enable tooltips)
1549 (if enable
1550 (tooltips-enable tooltips)
1551 (tooltips-disable tooltips)))
1552
a60bd055 1553(defbinding tooltips-set-tip () nil
2afcd8bd 1554 (tooltips tooltips)
1555 (widget widget)
1556 (tip-text string)
1557 (tip-private string))
0d07716f 1558
a60bd055 1559(defbinding tooltips-force-window () nil
2afcd8bd 1560 (tooltips tooltips))
0d07716f 1561
1562
1563
2afcd8bd 1564;;; Rc
0d07716f 1565
a60bd055 1566(defbinding rc-add-default-file (filename) nil
2afcd8bd 1567 ((namestring (truename filename)) string))
0d07716f 1568
a60bd055 1569(defbinding rc-parse (filename) nil
2afcd8bd 1570 ((namestring (truename filename)) string))
0d07716f 1571
a60bd055 1572(defbinding rc-parse-string () nil
2afcd8bd 1573 (rc-string string))
0d07716f 1574
a60bd055 1575(defbinding rc-reparse-all () nil)
0d07716f 1576
a60bd055 1577(defbinding rc-get-style () style
2afcd8bd 1578 (widget widget))
0d07716f 1579
1580
1581
1582;;; Accelerator Groups
a60bd055 1583#|
1584(defbinding accel-group-get-default () accel-group)
0d07716f 1585
30481825 1586(deftype-method alien-ref accel-group (type-spec)
1587 (declare (ignore type-spec))
1588 '%accel-group-ref)
0d07716f 1589
30481825 1590(deftype-method alien-unref accel-group (type-spec)
1591 (declare (ignore type-spec))
1592 '%accel-group-unref)
1593
a60bd055 1594(defbinding %accel-group-ref () accel-group
30481825 1595 (accel-group (or accel-group pointer)))
1596
a60bd055 1597(defbinding %accel-group-unref () nil
30481825 1598 (accel-group (or accel-group pointer)))
0d07716f 1599
a60bd055 1600(defbinding accel-group-activate (accel-group key modifiers) boolean
0d07716f 1601 (accel-group accel-group)
1602 ((gdk:keyval-from-name key) unsigned-int)
1603 (modifiers gdk:modifier-type))
1604
a60bd055 1605(defbinding accel-groups-activate (object key modifiers) boolean
0d07716f 1606 (object object)
1607 ((gdk:keyval-from-name key) unsigned-int)
1608 (modifiers gdk:modifier-type))
1609
a60bd055 1610(defbinding accel-group-attach () nil
0d07716f 1611 (accel-group accel-group)
1612 (object object))
1613
a60bd055 1614(defbinding accel-group-detach () nil
0d07716f 1615 (accel-group accel-group)
1616 (object object))
1617
a60bd055 1618(defbinding accel-group-lock () nil
0d07716f 1619 (accel-group accel-group))
1620
a60bd055 1621(defbinding accel-group-unlock () nil
0d07716f 1622 (accel-group accel-group))
1623
1624
1625;;; Accelerator Groups Entries
1626
a60bd055 1627(defbinding accel-group-get-entry (accel-group key modifiers) accel-entry
0d07716f 1628 (accel-group accel-group)
1629 ((gdk:keyval-from-name key) unsigned-int)
1630 (modifiers gdk:modifier-type))
1631
a60bd055 1632(defbinding accel-group-lock-entry (accel-group key modifiers) nil
0d07716f 1633 (accel-group accel-group)
1634 ((gdk:keyval-from-name key) unsigned-int)
1635 (modifiers gdk:modifier-type))
1636
a60bd055 1637(defbinding accel-group-unlock-entry (accel-group key modifiers) nil
0d07716f 1638 (accel-group accel-group)
1639 ((gdk:keyval-from-name key) unsigned-int)
1640 (modifiers gdk:modifier-type))
1641
a60bd055 1642(defbinding accel-group-add
0d07716f 1643 (accel-group key modifiers flags object signal) nil
1644 (accel-group accel-group)
1645 ((gdk:keyval-from-name key) unsigned-int)
1646 (modifiers gdk:modifier-type)
1647 (flags accel-flags)
1648 (object object)
1649 ((name-to-string signal) string))
1650
a60bd055 1651(defbinding accel-group-add (accel-group key modifiers object) nil
0d07716f 1652 (accel-group accel-group)
1653 ((gdk:keyval-from-name key) unsigned-int)
1654 (modifiers gdk:modifier-type)
1655 (object object))
1656
1657
1658;;; Accelerator Signals
1659
a60bd055 1660(defbinding accel-group-handle-add
0d07716f 1661 (object signal-id accel-group key modifiers flags) nil
1662 (object object)
1663 (signal-id unsigned-int)
1664 (accel-group accel-group)
1665 ((gdk:keyval-from-name key) unsigned-int)
1666 (modifiers gdk:modifier-type)
1667 (flags accel-flags))
1668
a60bd055 1669(defbinding accel-group-handle-remove
0d07716f 1670 (object accel-group key modifiers) nil
1671 (object object)
1672 (accel-group accel-group)
1673 ((gdk:keyval-from-name key) unsigned-int)
1674 (modifiers gdk:modifier-type))
a60bd055 1675|#