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