Moved handle box demo to avoid compiler warning.
[clg] / gtk / gtk.lisp
CommitLineData
560af5c5 1;; Common Lisp bindings for GTK+ v2.0
bbaeff4b 2;; Copyright (C) 1999-2001 Espen S. Johnsen <esj@stud.cs.uit.no>
560af5c5 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
881fe3c3 18;; $Id: gtk.lisp,v 1.40 2005-04-17 21:39:04 espen Exp $
560af5c5 19
20
21(in-package "GTK")
22
23;;; Gtk version
24
6bb23851 25(defbinding check-version () (copy-of string)
560af5c5 26 (required-major unsigned-int)
27 (required-minor unsigned-int)
28 (required-micro unsigned-int))
29
bbaeff4b 30(defbinding query-version () nil
560af5c5 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
6bb23851 42(defbinding get-default-language () (copy-of pango:language))
560af5c5 43
44
9adccb27 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)
73572c12 59 (add-fd-handler (gdk:display-connection-number) :input #'main-iterate-all)
60 (setq *periodic-polling-function* #'main-iterate-all)
61 (setq *max-event-to-sec* 0)
62 (setq *max-event-to-usec* 1000))))
9adccb27 63
64
667a112b 65;;; Misc
66
67(defbinding grab-add () nil
68 (widget widget))
69
7abdba43 70(defbinding grab-get-current () widget)
667a112b 71
72(defbinding grab-remove () nil
73 (widget widget))
74
75
647c99e5 76;;; About dialog
77
78#+gtk2.6
79(progn
80 (def-callback-marshal %about-dialog-activate-link-func
81 (nil (dialog about-dialog) (link (copy-of string))))
82
83 (defbinding about-dialog-set-email-hook (function) nil
84 ((callback %about-dialog-activate-link-func) pointer)
85 ((register-callback-function function) unsigned-int)
86 ((callback user-data-destroy-func) pointer))
87
88 (defbinding about-dialog-set-url-hook (function) nil
89 ((callback %about-dialog-activate-link-func) pointer)
90 ((register-callback-function function) unsigned-int)
91 ((callback user-data-destroy-func) pointer)))
92
93
0f476ab5 94;;; Acccel group
560af5c5 95
31700e82 96(defbinding %accel-group-connect () nil
97 (accel-group accel-group)
98 (key unsigned-int)
99 (modifiers gdk:modifier-type)
100 (flags accel-flags)
101 (gclosure gclosure))
102
103(defun accel-group-connect (group accelerator function &optional flags)
104 (multiple-value-bind (key modifiers) (accelerator-parse accelerator)
105 (let ((gclosure (make-callback-closure function)))
106 (%accel-group-connect group key modifiers flags gclosure)
107 gclosure)))
108
109(defbinding accel-group-connect-by-path (group path function) nil
110 (group accel-group)
111 (path string)
112 ((make-callback-closure function) gclosure :return))
113
114(defbinding %accel-group-disconnect (group gclosure) boolean
115 (group accel-group)
116 (gclosure gclosure))
117
118(defbinding %accel-group-disconnect-key () boolean
119 (group accel-group)
120 (key unsigned-int)
121 (modifiers gdk:modifier-type))
122
123(defun accel-group-disconnect (group accelerator)
124 (etypecase accelerator
125 (gclosure (%accel-group-disconnect group accelerator))
126 (string
127 (multiple-value-bind (key modifiers) (accelerator-parse accelerator)
128 (%accel-group-disconnect-key group key modifiers)))))
129
130(defbinding accel-group-lock () nil
131 (accel-group accel-group))
132
133(defbinding accel-group-unlock () nil
134 (accel-group accel-group))
135
136(defbinding %accel-groups-activate () boolean
137 (object gobject)
138 (key unsigned-int)
139 (modifiers gdk:modifier-type))
140
141(defun accel-groups-activate (object accelerator)
142 (multiple-value-bind (key modifiers) (accelerator-parse accelerator)
143 (%accel-groups-activate object key modifiers)))
144
145(defbinding accel-groups-from-object () (gslist accel-groups)
146 (object gobject))
147
73572c12 148(defbinding accelerator-valid-p (key &optional modifiers) boolean
31700e82 149 (key unsigned-int)
150 (modifiers gdk:modifier-type))
151
152(defbinding %accelerator-parse () nil
153 (accelerator string)
154 (key unsigned-int :out)
155 (modifiers gdk:modifier-type :out))
156
157(defun accelerator-parse (accelerator)
158 (multiple-value-bind (key modifiers) (%accelerator-parse accelerator)
159 (if (zerop key)
160 (error "Invalid accelerator: ~A" accelerator)
161 (values key modifiers))))
162
163(defbinding accelerator-name () string
164 (key unsigned-int)
165 (modifiers gdk:modifier-type))
166
167#+gtk2.6
168(defbinding accelerator-get-label () string
169 (key unsigned-int)
170 (modifiers gdk:modifier-type))
171
172(defbinding %accelerator-set-default-mod-mask () nil
173 (default-modifiers gdk:modifier-type))
174
175(defun (setf accelerator-default-modifier-mask) (default-modifiers)
176 (%accelerator-set-default-mod-mask default-modifiers))
177
178(defbinding (accelerator-default-modifier-mask "gtk_accelerator_get_default_mod_mask") () gdk:modifier-type)
560af5c5 179
1047e159 180
560af5c5 181;;; Acccel label
182
bbaeff4b 183(defbinding accel-label-refetch () boolean
560af5c5 184 (accel-label accel-label))
185
186
31700e82 187
188;;; Accel map
189
190(defbinding %accel-map-add-entry () nil
191 (path string)
192 (key unsigned-int)
193 (modifiers gdk:modifier-type))
194
195(defun accel-map-add-entry (path accelerator)
196 (multiple-value-bind (key modifiers) (accelerator-parse accelerator)
197 (%accel-map-add-entry path key modifiers)))
198
199(defbinding accel-map-lookup-entry () boolean
200 (path string)
201 (key pointer)) ;accel-key))
202
203(defbinding %accel-map-change-entry () boolean
204 (path string)
205 (key unsigned-int)
206 (modifiers gdk:modifier-type)
207 (replace boolean))
208
209(defun accel-map-change-entry (path accelerator &optional replace)
210 (multiple-value-bind (key modifiers) (accelerator-parse accelerator)
211 (%accel-map-change-entry path key modifiers replace)))
212
213(defbinding accel-map-load () nil
214 (filename pathname))
215
216(defbinding accel-map-save () nil
217 (filename pathname))
218
219(defbinding accel-map-get () accel-map)
220
221(defbinding accel-map-lock-path () nil
222 (path string))
223
224(defbinding accel-map-unlock-path () nil
225 (path string))
226
227
228
d76e9fca 229;;; Accessible
230
231(defbinding accessible-connect-widget-destroyed () nil
232 (accessible accessible))
233
234
0f476ab5 235;;; Adjustment
560af5c5 236
d76e9fca 237(defmethod initialize-instance ((adjustment adjustment) &key value)
1047e159 238 (prog1
239 (call-next-method)
240 ;; we need to make sure that the value is set last, otherwise it
d76e9fca 241 ;; may be outside current limits and ignored
1047e159 242 (when value
243 (setf (slot-value adjustment 'value) value))))
244
245
0f476ab5 246(defbinding adjustment-changed () nil
247 (adjustment adjustment))
248
249(defbinding adjustment-value-changed () nil
250 (adjustment adjustment))
251
252(defbinding adjustment-clamp-page () nil
253 (adjustment adjustment)
254 (lower single-float)
255 (upper single-float))
560af5c5 256
0f476ab5 257
68f519e0 258;;; Alignment
259
260(defbinding alignment-set () nil
261 (alognment alignment)
262 (x-align single-float)
263 (y-align single-float)
264 (x-scale single-float)
265 (y-scale single-float))
266
267(defbinding alignment-get-padding () nil
268 (alognment alignment)
269 (top unsigned-int :out)
270 (bottom unsigned-int :out)
271 (left unsigned-int :out)
272 (right unsigned-int :out))
273
274(defbinding alignment-set-padding () nil
275 (alognment alignment)
276 (top unsigned-int)
277 (bottom unsigned-int)
278 (left unsigned-int)
279 (right unsigned-int))
280
281
0f476ab5 282;;; Aspect frame
283
284
285;;; Bin
560af5c5 286
287(defun (setf bin-child) (child bin)
0f476ab5 288 (when-bind (current-child (bin-child bin))
289 (container-remove bin current-child))
560af5c5 290 (container-add bin child)
291 child)
292
14c94516 293(defmethod compute-signal-function ((bin bin) signal function object)
294 (declare (ignore signal))
295 (if (eq object :child)
cb4bf772 296 #'(lambda (&rest args)
297 (apply function (bin-child bin) (rest args)))
298 (call-next-method)))
0f476ab5 299
300
301;;; Box
302
303(defbinding box-pack-start () nil
304 (box box)
305 (child widget)
306 (expand boolean)
307 (fill boolean)
308 (padding unsigned-int))
309
310(defbinding box-pack-end () nil
311 (box box)
312 (child widget)
313 (expand boolean)
314 (fill boolean)
315 (padding unsigned-int))
316
d76e9fca 317(defun box-pack (box child &key end (expand t) (fill t) (padding 0))
1a1949c7 318 (if end
f5b67f2b 319 (box-pack-end box child expand fill padding)
320 (box-pack-start box child expand fill padding)))
0f476ab5 321
322(defbinding box-reorder-child () nil
323 (box box)
324 (child widget)
325 (position int))
326
327(defbinding box-query-child-packing () nil
328 (box box)
329 (child widget)
330 (expand boolean :out)
331 (fill boolean :out)
332 (padding unsigned-int :out)
333 (pack-type pack-type :out))
334
335(defbinding box-set-child-packing () nil
336 (box box)
337 (child widget)
338 (expand boolean)
339 (fill boolean)
340 (padding unsigned-int)
341 (pack-type pack-type))
342
343
344
560af5c5 345;;; Button
346
d76e9fca 347(defmethod initialize-instance ((button button) &rest initargs &key stock)
348 (if stock
349 (apply #'call-next-method button :label stock :use-stock t initargs)
350 (call-next-method)))
351
352
bbaeff4b 353(defbinding button-pressed () nil
560af5c5 354 (button button))
355
0f476ab5 356(defbinding button-released () nil
357 (button button))
358
359(defbinding button-clicked () nil
360 (button button))
361
362(defbinding button-enter () nil
363 (button button))
364
365(defbinding button-leave () nil
366 (button button))
367
368
369
370;;; Calendar
371
372(defbinding calendar-select-month () int
373 (calendar calendar)
374 (month unsigned-int)
375 (year unsigned-int))
376
377(defbinding calendar-select-day () nil
378 (calendar calendar)
379 (day unsigned-int))
380
381(defbinding calendar-mark-day () int
382 (calendar calendar)
383 (day unsigned-int))
384
385(defbinding calendar-unmark-day () int
386 (calendar calendar)
387 (day unsigned-int))
388
389(defbinding calendar-clear-marks () nil
390 (calendar calendar))
391
d76e9fca 392(defbinding calendar-get-date () nil
0f476ab5 393 (calendar calendar)
394 (year unsigned-int :out)
395 (month unsigned-int :out)
396 (day unsigned-int :out))
397
398(defbinding calendar-freeze () nil
399 (calendar calendar))
400
401(defbinding calendar-thaw () nil
402 (calendar calendar))
403
404
0f476ab5 405;;; Check menu item
406
407(defbinding check-menu-item-toggled () nil
408 (check-menu-item check-menu-item))
409
410
0f476ab5 411;;; Color selection
412
413(defbinding (color-selection-is-adjusting-p
414 "gtk_color_selection_is_adjusting") () boolean
415 (colorsel color-selection))
416
417
418
419;;; Color selection dialog -- no functions
420
421
422
1a1949c7 423;;;; Combo Box
0f476ab5 424
d76e9fca 425(defmethod initialize-instance ((combo-box combo-box) &rest initargs
426 &key model content active)
427 (remf initargs :active)
428 (if model
429 (apply #'call-next-method combo-box initargs)
430 (progn
431 (apply #'call-next-method combo-box
432 :model (make-instance 'list-store :column-types '(string))
433 initargs)
434 (unless (typep combo-box 'combo-box-entry)
435 (let ((cell (make-instance 'cell-renderer-text)))
436 (cell-layout-pack combo-box cell :expand t)
437 (cell-layout-add-attribute combo-box cell :text 0)))))
438 (when content
439 (mapc #'(lambda (text)
440 (combo-box-append-text combo-box text))
441 content))
442 (when active
443 (setf (combo-box-active combo-box) active)))
444
1a1949c7 445
446;; (defmethod shared-initialize :after ((combo-box combo-box) names &key active)
447;; (when active
448;; (signal-emit combo-box 'changed)))
449
450(defbinding combo-box-append-text () nil
451 (combo-box combo-box)
452 (text string))
453
454(defbinding combo-box-insert-text () nil
455 (combo-box combo-box)
456 (position int)
457 (text string))
458
459(defbinding combo-box-prepend-text () nil
460 (combo-box combo-box)
461 (text string))
462
463#+gtk2.6
464(defbinding combo-box-get-active-text () string
465 (combo-box combo-box))
0f476ab5 466
1a1949c7 467(defbinding combo-box-popup () nil
468 (combo-box combo-box))
0f476ab5 469
1a1949c7 470(defbinding combo-box-popdown () nil
471 (combo-box combo-box))
472
473
474
475;;;; Combo Box Entry
476
d76e9fca 477(defmethod initialize-instance ((combo-box-entry combo-box-entry) &key model)
1a1949c7 478 (call-next-method)
479 (unless model
480 (setf (combo-box-entry-text-column combo-box-entry) 0)))
0f476ab5 481
482
48da76bf 483;;;; Dialog
0f476ab5 484
c49be931 485(defmethod shared-initialize ((dialog dialog) names &rest initargs
486 &key button buttons)
487 (declare (ignore button buttons))
488 (prog1
489 (call-next-method)
490 (initial-apply-add dialog #'dialog-add-button initargs :button :buttons)))
48da76bf 491
0f476ab5 492
14c94516 493(defun dialog-response-id (dialog response &optional create-p error-p)
494 "Returns a numeric response id"
495 (if (typep response 'response-type)
496 (response-type-to-int response)
497 (let ((responses (object-data dialog 'responses)))
498 (cond
499 ((and responses (position response responses :test #'equal)))
500 (create-p
1047e159 501 (cond
14c94516 502 (responses
503 (vector-push-extend response responses)
504 (1- (length responses)))
1047e159 505 (t
506 (setf
14c94516 507 (object-data dialog 'responses)
508 (make-array 1 :adjustable t :fill-pointer t
509 :initial-element response))
1047e159 510 0)))
511 (error-p
14c94516 512 (error "Invalid response: ~A" response))))))
0f476ab5 513
14c94516 514(defun dialog-find-response (dialog id)
515 "Finds a symbolic response given a numeric id"
516 (if (< id 0)
517 (int-to-response-type id)
518 (aref (object-data dialog 'responses) id)))
519
520
521(defmethod compute-signal-id ((dialog dialog) signal)
522 (if (dialog-response-id dialog signal)
523 (ensure-signal-id 'response dialog)
524 (call-next-method)))
525
526(defmethod compute-signal-function ((dialog dialog) signal function object)
527 (declare (ignore function object))
528 (let ((callback (call-next-method))
529 (id (dialog-response-id dialog signal)))
530 (if id
531 #'(lambda (dialog response)
532 (when (= response id)
533 (funcall callback dialog)))
534 callback)))
0f476ab5 535
48da76bf 536(defbinding dialog-run () nil
537 (dialog dialog))
0f476ab5 538
14c94516 539(defbinding dialog-response (dialog response) nil
0f476ab5 540 (dialog dialog)
14c94516 541 ((dialog-response-id dialog response nil t) int))
0f476ab5 542
543
544(defbinding %dialog-add-button () button
545 (dialog dialog)
546 (text string)
14c94516 547 (response-id int))
0f476ab5 548
1047e159 549(defun dialog-add-button (dialog label &optional (response label)
550 &key default object after)
40b2615c 551 "Adds a button to the dialog."
14c94516 552 (let* ((signal (if (functionp response)
553 label
554 response))
555 (id (dialog-response-id dialog signal t))
556 (button (%dialog-add-button dialog label id)))
1047e159 557 (when (functionp response)
14c94516 558 (signal-connect dialog signal response :object object :after after))
1047e159 559 (when default
14c94516 560 (%dialog-set-default-response dialog id))
0f476ab5 561 button))
562
563
14c94516 564(defbinding %dialog-add-action-widget () nil
0f476ab5 565 (dialog dialog)
566 (action-widget widget)
14c94516 567 (response-id int))
0f476ab5 568
1047e159 569(defun dialog-add-action-widget (dialog widget &optional (response widget)
570 &key default object after)
14c94516 571 (let* ((signal (if (functionp response)
572 widget
573 response))
574 (id (dialog-response-id dialog signal t)))
575 (unless (widget-hidden-p widget)
576 (widget-show widget))
577 (%dialog-add-action-widget dialog widget id)
1047e159 578 (when (functionp response)
14c94516 579 (signal-connect dialog signal response :object object :after after))
1047e159 580 (when default
14c94516 581 (%dialog-set-default-response dialog id))
0f476ab5 582 widget))
0f476ab5 583
0f476ab5 584
48da76bf 585(defbinding %dialog-set-default-response () nil
586 (dialog dialog)
14c94516 587 (response-id int))
0f476ab5 588
14c94516 589(defun dialog-set-default-response (dialog response)
48da76bf 590 (%dialog-set-default-response
14c94516 591 dialog (dialog-response-id dialog response nil t)))
0f476ab5 592
14c94516 593(defbinding dialog-set-response-sensitive (dialog response sensitive) nil
48da76bf 594 (dialog dialog)
14c94516 595 ((dialog-response-id dialog response nil t) int)
48da76bf 596 (sensitive boolean))
0f476ab5 597
40b2615c 598#+gtk2.6
647c99e5 599(defbinding alternative-dialog-button-order-p (&optional screen) boolean
600 (screen (or null gdk:screen)))
40b2615c 601
602#+gtk2.6
603(defbinding (dialog-set-alternative-button-order
604 "gtk_dialog_set_alternative_button_order_from_array")
605 (dialog new-order)
606 (dialog dialog)
607 ((length new-order) int)
14c94516 608 ((map 'vector #'(lambda (response)
609 (dialog-response-id dialog response nil t))
40b2615c 610 new-order) (vector int)))
0f476ab5 611
48da76bf 612
613(defmethod container-add ((dialog dialog) (child widget) &rest args)
1047e159 614 (apply #'container-add (dialog-vbox dialog) child args))
48da76bf 615
14c94516 616
48da76bf 617(defmethod container-remove ((dialog dialog) (child widget))
1047e159 618 (container-remove (dialog-vbox dialog) child))
0f476ab5 619
48da76bf 620(defmethod container-children ((dialog dialog))
1047e159 621 (container-children (dialog-vbox dialog)))
48da76bf 622
623(defmethod (setf container-children) (children (dialog dialog))
1047e159 624 (setf (container-children (dialog-vbox dialog)) children))
560af5c5 625
560af5c5 626
aaa6e6cb 627;;; Entry
560af5c5 628
aaa6e6cb 629(defbinding entry-get-layout-offsets () nil
630 (entry entry)
631 (x int :out)
632 (y int :out))
560af5c5 633
d76e9fca 634(defbinding entry-layout-index-to-text-index () int
635 (entry entry)
636 (layout-index int))
637
638(defbinding entry-text-index-to-layout-index () int
639 (entry entry)
640 (text-index int))
641
560af5c5 642
f45fd227 643;;; Entry Completion
644
645(def-callback-marshal %entry-completion-match-func
646 (boolean entry-completion string (copy-of tree-iter)))
647
648(defbinding entry-completion-set-match-func (completion function) nil
649 (completion entry-completion)
650 ((callback %entry-completion-match-func) pointer)
651 ((register-callback-function function) unsigned-int)
73572c12 652 ((callback user-data-destroy-func) pointer))
f45fd227 653
654(defbinding entry-completion-complete () nil
655 (completion entry-completion))
656
657#+gtk2.6
658(defbinding entry-completion-insert-prefix () nil
659 (completion entry-completion))
660
661(defbinding entry-completion-insert-action-text () nil
662 (completion entry-completion)
663 (index int)
664 (text string))
665
666(defbinding entry-completion-insert-action-markup () nil
667 (completion entry-completion)
668 (index int)
669 (markup string))
670
671(defbinding entry-completion-delete-action () nil
672 (completion entry-completion)
673 (index int))
674
675
68f519e0 676;;; File Chooser
677
678(defmethod initialize-instance ((file-chooser file-chooser) &rest initargs
679 &key filter filters shortcut-folder
680 shortcut-folders shortcut-folder-uti
681 shortcut-folder-uris)
682 (declare (ignore filter filters shortcut-folder shortcut-folders
683 shortcut-folder-uti shortcut-folder-uris))
684 (prog1
685 (call-next-method)
686 (initial-add file-chooser #'file-chooser-add-filter
687 initargs :filer :filters)
688 (initial-add file-chooser #'file-chooser-add-shortcut-folder
689 initargs :shortcut-folder :shortcut-folders)
690 (initial-add file-chooser #'file-chooser-add-shortcut-folder-uri
691 initargs :shortcut-folder-uri :shortcut-folders-uris)))
692
693
694(defbinding file-chooser-select-filename () boolean
695 (file-chooser file-chooser)
696 (filename string))
697
698(defbinding file-chooser-unselect-filename () nil
699 (file-chooser file-chooser)
700 (filename string))
701
702(defbinding file-chooser-select-all () boolean
703 (file-chooser file-chooser))
704
705(defbinding file-chooser-unselect-all () boolean
706 (file-chooser file-chooser))
707
708(defbinding file-chooser-get-filenames () (gslist string)
709 (file-chooser file-chooser))
710
711(defbinding file-chooser-select-uri () boolean
712 (file-chooser file-chooser)
713 (uri string))
714
715(defbinding file-chooser-unselect-uri () nil
716 (file-chooser file-chooser)
717 (uri string))
718
719(defbinding file-chooser-get-uris () (gslist string)
720 (file-chooser file-chooser))
721
722(defbinding file-chooser-add-filter () nil
723 (file-chooser file-chooser)
724 (filter file-filter))
725
726(defbinding file-chooser-remove-filter () nil
727 (file-chooser file-chooser)
728 (filter file-filter))
729
730(defbinding file-chooser-list-filters () (gslist file-filter)
731 (file-chooser file-chooser))
732
733(defbinding file-chooser-add-shortcut-folder () boolean
734 (file-chooser file-chooser)
735 (folder string)
736 (nil null))
737
738(defbinding file-chooser-remove-shortcut-folder () nil
739 (file-chooser file-chooser)
740 (folder string)
741 (nil null))
742
743(defbinding file-chooser-list-shortcut-folders () (gslist string)
744 (file-chooser file-chooser))
745
746(defbinding file-chooser-add-shortcut-folder-uri () boolean
747 (file-chooser file-chooser)
748 (uri string)
749 (nil null))
750
751(defbinding file-chooser-remove-shortcut-folder-uri () nil
752 (file-chooser file-chooser)
753 (uri string)
754 (nil null))
755
756(defbinding file-chooser-list-shortcut-folder-uris () (gslist string)
757 (file-chooser file-chooser))
758
759
760;;; File Filter
761
762(defmethod initialize-instance ((file-filter file-filter) &rest initargs
763 &key mime-type mime-types pattern patterns
764 pixbuf-formats)
765 (declare (ignore mime-type mime-types pattern patterns))
766 (prog1
767 (call-next-method)
768 (when pixbuf-formats
769 #-gtk2.6(warn "Initarg :PIXBUF-FORMATS not supportet in this version of Gtk")
770 #+gtk2.6(file-filter-add-pixbuf-formats file-filter))
771 (initial-add file-filter #'file-filter-add-mime-type
772 initargs :mime-type :mime-types)
773 (initial-add file-filter #'file-filter-add-pattern
774 initargs :pattern :patterns)))
775
776
777(defbinding file-filter-add-mime-type () nil
778 (filter file-filter)
779 (mime-type string))
780
781(defbinding file-filter-add-pattern () nil
782 (filter file-filter)
783 (pattern string))
784
785#+gtk2.6
786(defbinding file-filter-add-pixbuf-formats () nil
647c99e5 787 (filter file-filter))
68f519e0 788
789(def-callback-marshal %file-filter-func (boolean file-filter-info))
790
73572c12 791(defbinding file-filter-add-custom (filter needed function) nil
68f519e0 792 (filter file-filter)
793 (needed file-filter-flags)
794 ((callback %file-filter-func) pointer)
795 ((register-callback-function function) unsigned-int)
73572c12 796 ((callback user-data-destroy-func) pointer))
68f519e0 797
798(defbinding file-filter-get-needed () file-filter-flags
799 (filter file-filter))
800
801(defbinding file-filter-filter () boolean
802 (filter file-filter)
803 (filter-info file-filter-info))
804
805
806
1047e159 807;;; Image
808
809(defbinding image-set-from-file () nil
810 (image image)
811 (filename pathname))
812
d76e9fca 813(defmethod (setf image-pixmap) ((data vector) (image image))
814 (multiple-value-bind (pixmap mask) (gdk:pixmap-create data)
815 (setf (image-pixmap image) pixmap)
816 (setf (image-mask image) mask)))
817
818(defmethod initialize-instance ((image image) &rest initargs &key pixmap file)
819 (cond
820 ((typep pixmap 'vector)
821 (multiple-value-bind (pixmap mask) (gdk:pixmap-create pixmap)
822 (apply #'call-next-method image :pixmap pixmap :mask mask initargs)))
823 (file
824 (prog1
825 (call-next-method)
826 (image-set-from-file image file)))
827 ((call-next-method))))
1047e159 828
cb4bf772 829(defun create-image-widget (source &optional mask)
d76e9fca 830 (etypecase source
831 (gdk:pixbuf (make-instance 'image :pixbuf source))
832 (string (make-instance 'image :stock source))
833 (pathname (make-instance 'image :file source))
834 ((or list vector) (make-instance 'image :pixmap source))
835 (gdk:pixmap (make-instance 'image :pixmap source :mask mask))))
1047e159 836
1047e159 837
d76e9fca 838;;; Image menu item
1047e159 839
d76e9fca 840(defmethod initialize-instance ((item image-menu-item) &rest initargs &key image)
841 (if (and image (not (typep image 'widget)))
cb4bf772 842 (apply #'call-next-method item :image (create-image-widget image) initargs)
d76e9fca 843 (call-next-method)))
1047e159 844
d76e9fca 845
846(defmethod (setf image-menu-item-image) ((widget widget) (item image-menu-item))
847 (setf (slot-value item 'image) widget))
848
849(defmethod (setf image-menu-item-image) (image (item image-menu-item))
cb4bf772 850 (setf (image-menu-item-image item) (create-image-widget image)))
1047e159 851
560af5c5 852
0f476ab5 853;;; Label
560af5c5 854
881fe3c3 855(defmethod shared-initialize ((label label) names &key pattern)
856 (declare (ignore names))
857 (call-next-method)
858 (when pattern
859 (setf (label-pattern label) pattern)))
860
aaa6e6cb 861(defbinding label-get-layout-offsets () nil
1047e159 862 (label label)
aaa6e6cb 863 (x int :out)
864 (y int :out))
865
0f476ab5 866(defbinding label-select-region () nil
867 (label label)
868 (start int)
869 (end int))
560af5c5 870
1047e159 871(defbinding label-get-selection-bounds () boolean
aaa6e6cb 872 (label label)
873 (start int :out)
874 (end int :out))
f36ca6af 875
560af5c5 876
877
878;;; Radio button
879
e5b416f0 880(defbinding %radio-button-get-group () pointer
d520140e 881 (radio-button radio-button))
882
bbaeff4b 883(defbinding %radio-button-set-group () nil
d520140e 884 (radio-button radio-button)
885 (group pointer))
560af5c5 886
cb4bf772 887(defmethod add-to-radio-group ((button1 radio-button) (button2 radio-button))
d520140e 888 "Add BUTTON1 to the group which BUTTON2 belongs to."
889 (%radio-button-set-group button1 (%radio-button-get-group button2)))
890
d76e9fca 891(defmethod initialize-instance ((button radio-button) &key group)
892 (prog1
893 (call-next-method)
894 (when group
cb4bf772 895 (add-to-radio-group button group))))
560af5c5 896
897
560af5c5 898;;; Item
899
bbaeff4b 900(defbinding item-select () nil
560af5c5 901 (item item))
902
bbaeff4b 903(defbinding item-deselect () nil
560af5c5 904 (item item))
905
bbaeff4b 906(defbinding item-toggle () nil
560af5c5 907 (item item))
908
909
910
911;;; Menu item
912
d76e9fca 913(defmethod initialize-instance ((item menu-item) &key label)
914 (prog1
915 (call-next-method)
916 (when label
917 (setf (menu-item-label item) label))))
918
919
f36ca6af 920(defun (setf menu-item-label) (label menu-item)
921 (make-instance 'accel-label
922 :label label :xalign 0.0 :yalign 0.5 :accel-widget menu-item
d76e9fca 923 :use-underline (menu-item-use-underline-p menu-item)
924 :visible t :parent menu-item)
f36ca6af 925 label)
560af5c5 926
f5b67f2b 927(defun menu-item-label (menu-item)
d76e9fca 928 (when (and (slot-boundp menu-item 'child)
929 (typep (bin-child menu-item) 'label))
930 (label-label (bin-child menu-item))))
f5b67f2b 931
d76e9fca 932(defbinding menu-item-remove-submenu () nil
f36ca6af 933 (menu-item menu-item))
560af5c5 934
f5b67f2b 935(defbinding menu-item-set-accel-path () nil
936 (menu-item menu-item)
937 (accel-path string))
938
bbaeff4b 939(defbinding menu-item-select () nil
f36ca6af 940 (menu-item menu-item))
560af5c5 941
bbaeff4b 942(defbinding menu-item-deselect () nil
f36ca6af 943 (menu-item menu-item))
560af5c5 944
bbaeff4b 945(defbinding menu-item-activate () nil
f36ca6af 946 (menu-item menu-item))
560af5c5 947
f5b67f2b 948(defbinding menu-item-toggle-size-request () nil
949 (menu-item menu-item)
950 (requisition int :out))
951
952(defbinding menu-item-toggle-size-allocate () nil
953 (menu-item menu-item)
954 (allocation int))
955
560af5c5 956
d76e9fca 957;;; Menu tool button
958
959#+gtk2.6
647c99e5 960(defbinding menu-tool-button-set-arrow-tooltip () nil
d76e9fca 961 (menu-tool-button menu-tool-button)
962 (tooltips tooltips)
963 (tip-text string)
964 (tip-private string))
965
966
f4267180 967;;; Message dialog
968
7a2e0799 969(defmethod initialize-instance ((dialog message-dialog)
970 &key (message-type :info) (buttons :close)
971 flags text #+gtk 2.6 secondary-text
972 transient-parent)
f4267180 973 (setf
974 (slot-value dialog 'location)
7a2e0799 975 (%message-dialog-new transient-parent flags message-type buttons))
976 (when text
977 (message-dialog-set-markup dialog text))
978 #+gtk2.6
979 (when secondary-text
980 (message-dialog-format-secondary-markup dialog secondary-text))
981 (call-next-method))
f4267180 982
983
984(defbinding %message-dialog-new () pointer
985 (parent (or null window))
986 (flags dialog-flags)
987 (type message-type)
988 (buttons buttons-type)
7a2e0799 989 (nil null))
f4267180 990
991(defbinding message-dialog-set-markup () nil
992 (message-dialog message-dialog)
993 (markup string))
994
995#+gtk2.6
996(defbinding message-dialog-format-secondary-text () nil
997 (message-dialog message-dialog)
998 (text string))
999
1000#+gtk2.6
1001(defbinding message-dialog-format-secondary-markup () nil
1002 (message-dialog message-dialog)
1003 (markup string))
1004
1005
560af5c5 1006
f36ca6af 1007;;; Radio menu item
560af5c5 1008
e5b416f0 1009(defbinding %radio-menu-item-get-group () pointer
d520140e 1010 (radio-menu-item radio-menu-item))
1011
bbaeff4b 1012(defbinding %radio-menu-item-set-group () nil
d520140e 1013 (radio-menu-item radio-menu-item)
1014 (group pointer))
1015
cb4bf772 1016(defmethod add-to-radio-group ((item1 radio-menu-item) (item2 radio-menu-item))
d520140e 1017 "Add ITEM1 to the group which ITEM2 belongs to."
1018 (%radio-menu-item-set-group item1 (%radio-menu-item-get-group item2)))
1019
d76e9fca 1020(defmethod initialize-instance ((item radio-menu-item) &key group)
f5b67f2b 1021 (prog1
1022 (call-next-method)
d76e9fca 1023 (when group
cb4bf772 1024 (add-to-radio-group item group))))
1025
d520140e 1026
560af5c5 1027
d76e9fca 1028;;; Radio tool button
1029
1030(defbinding %radio-tool-button-get-group () pointer
1031 (radio-tool-button radio-tool-button))
1032
1033(defbinding %radio-tool-button-set-group () nil
1034 (radio-tool-button radio-tool-button)
1035 (group pointer))
1036
cb4bf772 1037(defmethod add-to-radio-group ((button1 radio-tool-button) (button2 radio-tool-button))
d76e9fca 1038 "Add BUTTON1 to the group which BUTTON2 belongs to."
1039 (%radio-tool-button-set-group button1 (%radio-tool-button-get-group button2)))
1040
cb4bf772 1041(defmethod add-activate-callback ((widget widget) function &key object after)
1042 (if object
1043 (signal-connect widget 'clicked
1044 #'(lambda (object)
1045 (when (slot-value widget 'active)
1046 (funcall function object (slot-value widget 'value))))
1047 :object object :after after)
1048 (signal-connect widget 'clicked
1049 #'(lambda ()
1050 (when (slot-value widget 'active)
1051 (funcall function (slot-value widget 'value))))
1052 :after after)))
d76e9fca 1053
1054(defmethod initialize-instance ((button radio-tool-button) &key group)
1055 (prog1
1056 (call-next-method)
1057 (when group
cb4bf772 1058 (add-to-radio-group button group))))
1059
d76e9fca 1060
560af5c5 1061
aaa6e6cb 1062;;; Toggle button
1063
1064(defbinding toggle-button-toggled () nil
1065 (toggle-button toggle-button))
1066
1067
560af5c5 1068;;; Window
1069
c49be931 1070(defmethod initialize-instance ((window window) &rest initargs
1071 &key accel-group accel-groups)
1072 (declare (ignore accel-group accel-groups))
1073 (prog1
1074 (call-next-method)
1075 (initial-add window #'window-add-accel-group
1076 initargs :accel-group :accel-groups)))
73d58e01 1077
1078
7625ebd8 1079(defbinding window-set-wmclass () nil
560af5c5 1080 (window window)
1081 (wmclass-name string)
1082 (wmclass-class string))
1083
bbaeff4b 1084(defbinding window-add-accel-group () nil
560af5c5 1085 (window window)
1086 (accel-group accel-group))
1087
bbaeff4b 1088(defbinding window-remove-accel-group () nil
560af5c5 1089 (window window)
1090 (accel-group accel-group))
1091
bbaeff4b 1092(defbinding window-activate-focus () int
560af5c5 1093 (window window))
1094
bbaeff4b 1095(defbinding window-activate-default () int
560af5c5 1096 (window window))
1097
7625ebd8 1098(defbinding window-set-default-size (window width height) int
560af5c5 1099 (window window)
7625ebd8 1100 ((or width -1) int)
1101 ((or height -1) int))
560af5c5 1102
4d16221f 1103(defbinding %window-set-geometry-hints () nil
1104 (window window)
1105 (geometry gdk:geometry)
1106 (geometry-mask gdk:window-hints))
1107
1108(defun window-set-geometry-hints (window &key min-width min-height
1109 max-width max-height base-width base-height
1110 width-inc height-inc min-aspect max-aspect
1111 (gravity nil gravity-p) min-size max-size)
1112 (let ((geometry (make-instance 'gdk:geometry
1113 :min-width (or min-width -1)
1114 :min-height (or min-height -1)
1115 :max-width (or max-width -1)
1116 :max-height (or max-height -1)
1117 :base-width (or base-width 0)
1118 :base-height (or base-height 0)
1119 :width-inc (or width-inc 0)
1120 :height-inc (or height-inc 0)
1121 :min-aspect (or min-aspect 0)
1122 :max-aspect (or max-aspect 0)
1123 :gravity gravity))
1124 (mask ()))
1125 (when (or min-size min-width min-height)
1126 (push :min-size mask))
1127 (when (or max-size max-width max-height)
1128 (push :max-size mask))
1129 (when (or base-width base-height)
1130 (push :base-size mask))
1131 (when (or width-inc height-inc)
1132 (push :resize-inc mask))
1133 (when (or min-aspect max-aspect)
1134 (push :aspect mask))
1135 (when gravity-p
1136 (push :win-gravity mask))
1137 (%window-set-geometry-hints window geometry mask)))
560af5c5 1138
73d58e01 1139(defbinding window-list-toplevels () (glist (copy-of window))
1140 "Returns a list of all existing toplevel windows.")
7625ebd8 1141
1142(defbinding window-add-mnemonic (window key target) nil
1143 (window window)
1144 ((gdk:keyval-from-name key) unsigned-int)
1145 (target widget))
1146
1147(defbinding window-remove-mnemonic (window key target) nil
1148 (window window)
1149 ((gdk:keyval-from-name key) unsigned-int)
1150 (target widget))
1151
1152(defbinding window-mnemonic-activate (window key modifier) nil
1153 (window window)
1154 ((gdk:keyval-from-name key) unsigned-int)
1155 (modifier gdk:modifier-type))
1156
4d16221f 1157(defbinding window-activate-key () boolean
1158 (window window)
1159 (event gdk:key-event))
1160
1161(defbinding window-propagate-key-event () boolean
1162 (window window)
1163 (event gdk:key-event))
1164
7625ebd8 1165(defbinding window-present () nil
1166 (window window))
1167
1168(defbinding window-iconify () nil
1169 (window window))
1170
1171(defbinding window-deiconify () nil
1172 (window window))
1173
1174(defbinding window-stick () nil
1175 (window window))
1176
1177(defbinding window-unstick () nil
1178 (window window))
1179
1180(defbinding window-maximize () nil
1181 (window window))
1182
1183(defbinding window-unmaximize () nil
1184 (window window))
1185
4d16221f 1186(defbinding window-fullscreen () nil
1187 (window window))
1188
1189(defbinding window-unfullscreen () nil
1190 (window window))
1191
1192(defbinding window-set-keep-above () nil
1193 (window window)
1194 (setting boolean))
1195
1196(defbinding window-set-keep-below () nil
1197 (window window)
1198 (setting boolean))
1199
7625ebd8 1200(defbinding window-begin-resize-drag () nil
1201 (window window)
1202 (edge gdk:window-edge)
1203 (button int)
1204 (root-x int) (root-y int)
9adccb27 1205 (timestamp unsigned-int))
7625ebd8 1206
1207(defbinding window-begin-move-drag () nil
1208 (window window)
1209 (edge gdk:window-edge)
1210 (button int)
1211 (root-x int) (root-y int)
9adccb27 1212 (timestamp unsigned-int))
7625ebd8 1213
1214(defbinding window-set-frame-dimensions () nil
1215 (window window)
1216 (left int) (top int) (rigth int) (bottom int))
1217
7625ebd8 1218(defbinding %window-get-default-size () nil
1219 (window window)
1220 (width int :out)
1221 (height int :out))
1222
1223(defun window-get-default-size (window)
1224 (multiple-value-bind (width height) (%window-get-default-size window)
1225 (values (unless (= width -1) width) (unless (= height -1) height))))
1226
1227(defbinding window-get-frame-dimensions () nil
1228 (window window)
1229 (left int :out) (top int :out) (rigth int :out) (bottom int :out))
1230
1231(defbinding %window-get-icon-list () (glist gdk:pixbuf)
1232 (window window))
1233
7625ebd8 1234(defbinding window-get-position () nil
1235 (window window)
1236 (root-x int :out)
1237 (root-y int :out))
1238
1239(defbinding window-get-size () nil
1240 (window window)
1241 (width int :out)
1242 (height int :out))
1243
1244(defbinding window-move () nil
1245 (window window)
1246 (x int)
1247 (y int))
1248
1249(defbinding window-parse-geometry () boolean
1250 (window window)
1251 (geometry string))
1252
1253(defbinding window-reshow-with-initial-size () nil
1254 (window window))
1255
1256(defbinding window-resize () nil
1257 (window window)
1258 (width int)
1259 (heigth int))
1260
4d16221f 1261(defbinding (window-default-icon-list "gtk_window_get_default_icon_list")
1262 () (glist gdk:pixbuf))
1263
1264(defun window-default-icon ()
1265 (first (window-default-icon-list)))
1266
1267(defbinding %window-set-default-icon-list () nil
1268 (icons (glist gdk:pixbuf)))
1269
1270(defun (setf window-default-icon-list) (icons)
1271 (%window-set-default-icon-list icons)
1272 icons)
1273
1274(defbinding %window-set-default-icon () nil
1275 (icons (glist gdk:pixbuf)))
1276
1277(defmethod (setf window-default-icon) ((icon gdk:pixbuf))
1278 (%window-set-default-icon icon)
1279 icon)
1280
1281(defmethod (setf window-group) ((group window-group) (window window))
1282 (window-group-add-window group window)
1283 group)
1284
1285(defbinding %window-set-default-icon-from-file () boolean
1286 (filename pathname)
1287 (nil null))
1288
1289(defmethod (setf window-default-icon) ((icon-file pathname))
1290 (%window-set-default-icon-from-file icon-file)
1291 icon-file)
1292
1293(defbinding %window-set-icon-from-file () boolean
1294 (window window)
1295 (filename pathname)
1296 (nil null))
1297
1298(defmethod (setf window-icon) ((icon-file pathname) (window window))
1299 (%window-set-icon-from-file window icon-file)
1300 icon-file)
1301
1302(defbinding window-set-auto-startup-notification () nil
1303 (setting boolean))
1304
1305(defbinding decorated-window-init () nil
1306 (window window))
1307
1308(defbinding decorated-window-calculate-frame-size () nil
1309 (window window))
1310
1311(defbinding decorated-window-set-title () nil
7625ebd8 1312 (window window)
4d16221f 1313 (title string))
7625ebd8 1314
4d16221f 1315(defbinding decorated-window-move-resize-window () nil
1316 (window window)
1317 (x int)
1318 (y int)
1319 (width int)
1320 (heigth int))
7625ebd8 1321
1322
4d16221f 1323;;; Window group
560af5c5 1324
4d16221f 1325(defmethod initialize-instance ((window-group window-group) &rest initargs
1326 &key window windows)
1327 (declare (ignore window windows))
1328 (prog1
1329 (call-next-method)
1330 (initial-add window-group #'window-group-add-window
1331 initargs :window :windows)))
560af5c5 1332
560af5c5 1333
4d16221f 1334(defbinding window-group-add-window () nil
1335 (window-group window-group)
1336 (window window))
560af5c5 1337
4d16221f 1338(defbinding window-group-remove-window () nil
1339 (window-group window-group)
1340 (window window))
560af5c5 1341
1342
f36ca6af 1343;;; Scrolled window
560af5c5 1344
560af5c5 1345(defun (setf scrolled-window-scrollbar-policy) (policy window)
1346 (setf (scrolled-window-hscrollbar-policy window) policy)
1347 (setf (scrolled-window-vscrollbar-policy window) policy))
1348
bbaeff4b 1349(defbinding scrolled-window-add-with-viewport () nil
560af5c5 1350 (scrolled-window scrolled-window)
1351 (child widget))
1352
7a2e0799 1353(defmethod shared-initialize ((window scrolled-window) names &key policy)
1354 (declare (ignore names))
1355 (when policy
1356 (setf (slot-value window 'hscrollbar-policy) policy)
1357 (setf (slot-value window 'vscrollbar-policy) policy))
1358 (call-next-method))
d520140e 1359
560af5c5 1360
f36ca6af 1361;;; Statusbar
560af5c5 1362
d76e9fca 1363(defbinding statusbar-get-context-id () unsigned-int
f36ca6af 1364 (statusbar statusbar)
1365 (context-description string))
560af5c5 1366
bbaeff4b 1367(defbinding statusbar-push () unsigned-int
f36ca6af 1368 (statusbar statusbar)
1369 (context-id unsigned-int)
1370 (text string))
560af5c5 1371
bbaeff4b 1372(defbinding statusbar-pop () nil
f36ca6af 1373 (statusbar statusbar)
1374 (context-id unsigned-int))
560af5c5 1375
bbaeff4b 1376(defbinding statusbar-remove () nil
f36ca6af 1377 (statusbar statusbar)
1378 (context-id unsigned-int)
1379 (message-id unsigned-int))
560af5c5 1380
560af5c5 1381
1382
1383;;; Fixed
1384
bbaeff4b 1385(defbinding fixed-put () nil
f36ca6af 1386 (fixed fixed)
1387 (widget widget)
f5b67f2b 1388 (x int) (y int))
560af5c5 1389
bbaeff4b 1390(defbinding fixed-move () nil
f36ca6af 1391 (fixed fixed)
1392 (widget widget)
f5b67f2b 1393 (x int) (y int))
560af5c5 1394
1395
1396
d520140e 1397;;; Notebook
560af5c5 1398
68f519e0 1399(defun %ensure-notebook-position (notebook page)
f5b67f2b 1400 (etypecase page
68f519e0 1401 (position page)
f5b67f2b 1402 (widget (notebook-page-num notebook page t))))
1403
68f519e0 1404(defun %ensure-notebook-child (notebook position)
f5b67f2b 1405 (typecase position
1406 (widget position)
68f519e0 1407 (t (notebook-get-nth-page notebook position))))
f5b67f2b 1408
1409(defbinding (notebook-insert "gtk_notebook_insert_page_menu")
f36ca6af 1410 (notebook position child tab-label &optional menu-label) nil
1411 (notebook notebook)
1412 (child widget)
1413 ((if (stringp tab-label)
f5b67f2b 1414 (make-instance 'label :label tab-label)
f36ca6af 1415 tab-label) widget)
1416 ((if (stringp menu-label)
f5b67f2b 1417 (make-instance 'label :label menu-label)
f36ca6af 1418 menu-label) (or null widget))
68f519e0 1419 ((%ensure-notebook-position notebook position) position))
560af5c5 1420
f5b67f2b 1421(defun notebook-append (notebook child tab-label &optional menu-label)
1422 (notebook-insert notebook :last child tab-label menu-label))
560af5c5 1423
f5b67f2b 1424(defun notebook-prepend (notebook child tab-label &optional menu-label)
1425 (notebook-insert notebook :first child tab-label menu-label))
560af5c5 1426
f5b67f2b 1427(defbinding notebook-remove-page (notebook page) nil
f36ca6af 1428 (notebook notebook)
68f519e0 1429 ((%ensure-notebook-position notebook page) position))
560af5c5 1430
bbaeff4b 1431(defbinding %notebook-page-num () int
f36ca6af 1432 (notebook notebook)
1433 (child widget))
1434
f5b67f2b 1435(defun notebook-page-num (notebook child &optional error-p)
f36ca6af 1436 (let ((page-num (%notebook-page-num notebook child)))
1437 (if (= page-num -1)
f5b67f2b 1438 (when error-p
68f519e0 1439 (error "~A is not a page in ~A" child notebook))
f36ca6af 1440 page-num)))
1441
bbaeff4b 1442(defbinding notebook-next-page () nil
f36ca6af 1443 (notebook notebook))
560af5c5 1444
bbaeff4b 1445(defbinding notebook-prev-page () nil
f36ca6af 1446 (notebook notebook))
1447
f5b67f2b 1448(defbinding notebook-reorder-child (notebook child position) nil
1449 (notebook notebook)
1450 (child widget)
1451 ((%notebook-position notebook position) int))
1452
bbaeff4b 1453(defbinding notebook-popup-enable () nil
f36ca6af 1454 (notebook notebook))
1455
bbaeff4b 1456(defbinding notebook-popup-disable () nil
f36ca6af 1457 (notebook notebook))
1458
68f519e0 1459(defbinding notebook-get-nth-page () widget
f5b67f2b 1460 (notebook notebook)
68f519e0 1461 (page position))
f5b67f2b 1462
68f519e0 1463(defun %notebook-current-page (notebook)
1464 (when (slot-boundp notebook 'current-page-num)
1465 (notebook-get-nth-page notebook (notebook-current-page-num notebook))))
f5b67f2b 1466
1467(defun (setf notebook-current-page) (page notebook)
68f519e0 1468 (setf (notebook-current-page notebook) (notebook-page-num notebook page)))
f5b67f2b 1469
1047e159 1470(defbinding (notebook-tab-label "gtk_notebook_get_tab_label")
1471 (notebook page) widget
1472 (notebook notebook)
68f519e0 1473 ((%ensure-notebook-child notebook page) widget))
f5b67f2b 1474
1047e159 1475(defbinding (notebook-tab-label-text "gtk_notebook_get_tab_label_text")
6bb23851 1476 (notebook page) (copy-of string)
1047e159 1477 (notebook notebook)
68f519e0 1478 ((%ensure-notebook-child notebook page) widget))
f5b67f2b 1479
1047e159 1480(defbinding %notebook-set-tab-label () nil
1481 (notebook notebook)
1482 (page widget)
1483 (tab-label widget))
1484
1485(defun (setf notebook-tab-label) (tab-label notebook page)
1486 (let ((widget (if (stringp tab-label)
1487 (make-instance 'label :label tab-label)
1488 tab-label)))
68f519e0 1489 (%notebook-set-tab-label notebook (%ensure-notebook-child notebook page) widget)
1047e159 1490 widget))
f5b67f2b 1491
f5b67f2b 1492
1047e159 1493(defbinding (notebook-menu-label "gtk_notebook_get_menu_label")
1494 (notebook page) widget
1495 (notebook notebook)
68f519e0 1496 ((%ensure-notebook-child notebook page) widget))
f5b67f2b 1497
1047e159 1498(defbinding (notebook-menu-label-text "gtk_notebook_get_menu_label_text")
6bb23851 1499 (notebook page) (copy-of string)
1047e159 1500 (notebook notebook)
68f519e0 1501 ((%ensure-notebook-child notebook page) widget))
f5b67f2b 1502
1047e159 1503(defbinding %notebook-set-menu-label () nil
1504 (notebook notebook)
1505 (page widget)
1506 (menu-label widget))
1507
1508(defun (setf notebook-menu-label) (menu-label notebook page)
1509 (let ((widget (if (stringp menu-label)
1510 (make-instance 'label :label menu-label)
1511 menu-label)))
68f519e0 1512 (%notebook-set-menu-label notebook (%ensure-notebook-child notebook page) widget)
1047e159 1513 widget))
f5b67f2b 1514
1515
1516(defbinding notebook-query-tab-label-packing (notebook page) nil
f36ca6af 1517 (notebook notebook)
f5b67f2b 1518 ((%notebook-child notebook page) widget)
f36ca6af 1519 (expand boolean :out)
1520 (fill boolean :out)
1521 (pack-type pack-type :out))
1522
f5b67f2b 1523(defbinding notebook-set-tab-label-packing
1524 (notebook page expand fill pack-type) nil
f36ca6af 1525 (notebook notebook)
f5b67f2b 1526 ((%notebook-child notebook page) widget)
f36ca6af 1527 (expand boolean)
1528 (fill boolean)
1529 (pack-type pack-type))
1530
560af5c5 1531
1532
d520140e 1533;;; Paned
560af5c5 1534
bbaeff4b 1535(defbinding paned-pack1 () nil
d520140e 1536 (paned paned)
1537 (child widget)
1538 (resize boolean)
1539 (shrink boolean))
560af5c5 1540
bbaeff4b 1541(defbinding paned-pack2 () nil
d520140e 1542 (paned paned)
1543 (child widget)
1544 (resize boolean)
1545 (shrink boolean))
560af5c5 1546
560af5c5 1547
d520140e 1548;;; Layout
560af5c5 1549
bbaeff4b 1550(defbinding layout-put () nil
d520140e 1551 (layout layout)
68f519e0 1552 (child widget)
d520140e 1553 (x int)
1554 (y int))
560af5c5 1555
bbaeff4b 1556(defbinding layout-move () nil
d520140e 1557 (layout layout)
68f519e0 1558 (child widget)
d520140e 1559 (x int)
1560 (y int))
560af5c5 1561
68f519e0 1562(defbinding layout-set-size () nil
1563 (layout layout)
1564 (width unsigned-int)
1565 (height unsigned-int))
1566
1567(defbinding layout-get-size () nil
1568 (layout layout)
1569 (width unsigned-int :out)
1570 (height unsigned-int :out))
560af5c5 1571
1572
560af5c5 1573;;; Menu shell
1574
f5b67f2b 1575(defbinding menu-shell-insert (menu-shell menu-item position) nil
f36ca6af 1576 (menu-shell menu-shell)
1577 (menu-item menu-item)
f5b67f2b 1578 ((case position
1579 (:first 0)
1580 (:last -1)
1581 (t position)) int))
560af5c5 1582
f36ca6af 1583(defun menu-shell-append (menu-shell menu-item)
f5b67f2b 1584 (menu-shell-insert menu-shell menu-item :last))
560af5c5 1585
f36ca6af 1586(defun menu-shell-prepend (menu-shell menu-item)
f5b67f2b 1587 (menu-shell-insert menu-shell menu-item :fisrt))
560af5c5 1588
bbaeff4b 1589(defbinding menu-shell-deactivate () nil
f36ca6af 1590 (menu-shell menu-shell))
560af5c5 1591
bbaeff4b 1592(defbinding menu-shell-select-item () nil
f36ca6af 1593 (menu-shell menu-shell)
1594 (menu-item menu-item))
560af5c5 1595
d76e9fca 1596(defbinding menu-shell-select-first () nil
1597 (menu-shell menu-shell)
1598 (search-sensitive boolean))
1599
bbaeff4b 1600(defbinding menu-shell-deselect () nil
f36ca6af 1601 (menu-shell menu-shell))
560af5c5 1602
bbaeff4b 1603(defbinding menu-shell-activate-item () nil
f36ca6af 1604 (menu-shell menu-shell)
1605 (menu-item menu-item)
1606 (fore-deactivate boolean))
560af5c5 1607
d76e9fca 1608(defbinding menu-shell-cancel () nil
1609 (menu-shell menu-shell))
560af5c5 1610
1611
f5b67f2b 1612;;; Menu
560af5c5 1613
f5b67f2b 1614(defun %menu-position (menu child)
1615 (etypecase child
1616 (int child)
1617 (keyword (case child
1618 (:first 0)
1619 (:last -1)
1047e159 1620 (t (error "Invalid position keyword: ~A" child))))
f5b67f2b 1621 (widget (menu-child-position menu child))))
560af5c5 1622
1623
f5b67f2b 1624(defbinding menu-reorder-child (menu menu-item position) nil
1625 (menu menu)
1626 (menu-item menu-item)
1627 ((%menu-position menu position) int))
560af5c5 1628
d76e9fca 1629(defbinding menu-attach () nil
1630 (menu menu)
1631 (menu-item menu-item)
1632 (left-attach unsigned-int)
1633 (right-attach unsigned-int)
1634 (top-attach unsigned-int)
1635 (bottom-attach unsigned-int))
1636
1637(def-callback-marshal %menu-position-func (nil (menu menu) (x int) (y int) (push-in boolean)))
560af5c5 1638
f5b67f2b 1639(defbinding %menu-popup () nil
1640 (menu menu)
1641 (parent-menu-shell (or null menu-shell))
1642 (parent-menu-item (or null menu-item))
1643 (callback-func (or null pointer))
1644 (callback-id unsigned-int)
1645 (button unsigned-int)
1646 (activate-time (unsigned 32)))
1647
1648(defun menu-popup (menu button activate-time &key callback parent-menu-shell
1649 parent-menu-item)
1650 (if callback
1a1949c7 1651 (with-callback-function (id callback)
1652 (%menu-popup
1653 menu parent-menu-shell parent-menu-item
d76e9fca 1654 (callback %menu-position-func) id button activate-time))
f5b67f2b 1655 (%menu-popup
1656 menu parent-menu-shell parent-menu-item nil 0 button activate-time)))
1657
1658(defbinding menu-set-accel-path () nil
1659 (menu menu)
1660 (accel-path string))
560af5c5 1661
bbaeff4b 1662(defbinding menu-reposition () nil
f36ca6af 1663 (menu menu))
560af5c5 1664
bbaeff4b 1665(defbinding menu-popdown () nil
f36ca6af 1666 (menu menu))
560af5c5 1667
f5b67f2b 1668(defun menu-child-position (menu child)
1669 (position child (container-children menu)))
1670
1671(defun menu-active-num (menu)
1672 (menu-child-position menu (menu-active menu)))
1673
bbaeff4b 1674(defbinding %menu-set-active () nil
f36ca6af 1675 (menu menu)
1676 (index unsigned-int))
560af5c5 1677
f5b67f2b 1678(defun (setf menu-active) (menu child)
1679 (%menu-set-active menu (%menu-position menu child))
1680 child)
d520140e 1681
d76e9fca 1682(defcallback %menu-detach-func (nil (widget widget) (menu menu))
1683 (funcall (object-data menu 'detach-func) widget menu))
1684
1685(defbinding %menu-attach-to-widget () nil
1686 (menu menu)
1687 (widget widget)
1688 ((callback %menu-detach-func) pointer))
1689
1690(defun menu-attach-to-widget (menu widget function)
1691 (setf (object-data menu 'detach-func) function)
1692 (%menu-attach-to-widget menu widget))
1693
1694(defbinding menu-detach () nil
1695 (menu menu))
1696
1697#+gtk2.6
1698(defbinding menu-get-for-attach-widget () (copy-of (glist widget))
1699 (widget widget))
1700
1701(defbinding menu-set-monitor () nil
1702 (menu menu)
1703 (monitor-num int))
560af5c5 1704
1705
f36ca6af 1706;;; Table
560af5c5 1707
bbaeff4b 1708(defbinding table-resize () nil
f36ca6af 1709 (table table)
1710 (rows unsigned-int)
1711 (columns unsigned-int))
560af5c5 1712
bbaeff4b 1713(defbinding table-attach (table child left right top bottom
c49be931 1714 &key options x-options y-options
1715 (x-padding 0) (y-padding 0)) nil
f36ca6af 1716 (table table)
1717 (child widget)
1718 (left unsigned-int)
1719 (right unsigned-int)
1720 (top unsigned-int)
1721 (bottom unsigned-int)
c49be931 1722 ((append (mklist options) (mklist x-options)) attach-options)
1723 ((append (mklist options) (mklist y-options)) attach-options)
f36ca6af 1724 (x-padding unsigned-int)
1725 (y-padding unsigned-int))
1726
e5b416f0 1727
bbaeff4b 1728(defbinding %table-set-row-spacing () nil
f36ca6af 1729 (table table)
1730 (row unsigned-int)
1731 (spacing unsigned-int))
1732
e5b416f0 1733(defbinding %table-set-row-spacings () nil
1734 (table table)
1735 (spacing unsigned-int))
1736
1737(defun (setf table-row-spacing) (spacing table &optional row)
1738 (if row
1739 (%table-set-row-spacing table row spacing)
1740 (%table-set-row-spacings table spacing))
f36ca6af 1741 spacing)
1742
e5b416f0 1743(defbinding %table-get-row-spacing () unsigned-int
f36ca6af 1744 (table table)
e5b416f0 1745 (row unsigned-int))
1746
1747(defbinding %table-get-default-row-spacing () unsigned-int
1748 (table table))
1749
1750(defun table-row-spacing (table &optional row)
1751 (if row
1752 (%table-get-row-spacing table row)
1753 (%table-get-default-row-spacing table)))
1754
f36ca6af 1755
bbaeff4b 1756(defbinding %table-set-col-spacing () nil
f36ca6af 1757 (table table)
1758 (col unsigned-int)
1759 (spacing unsigned-int))
1760
e5b416f0 1761(defbinding %table-set-col-spacings () nil
1762 (table table)
1763 (spacing unsigned-int))
1764
1765(defun (setf table-col-spacing) (spacing table &optional col)
1766 (if col
1767 (%table-set-col-spacing table col spacing)
1768 (%table-set-col-spacings table spacing))
f36ca6af 1769 spacing)
1770
e5b416f0 1771(defbinding %table-get-col-spacing () unsigned-int
f36ca6af 1772 (table table)
e5b416f0 1773 (col unsigned-int))
1774
1775(defbinding %table-get-default-col-spacing () unsigned-int
1776 (table table))
1777
1778(defun table-col-spacing (table &optional col)
1779 (if col
1780 (%table-get-col-spacing table col)
1781 (%table-get-default-col-spacing table)))
1782
1783
f36ca6af 1784
1785;;; Toolbar
1786
cb4bf772 1787(defmethod initialize-instance ((toolbar toolbar) &rest initargs &key tooltips)
1788 (if (eq tooltips t)
1789 (apply #'call-next-method toolbar
1790 :tooltips (make-instance 'tooltips) initargs)
1791 (call-next-method)))
560af5c5 1792
cb4bf772 1793(defbinding %toolbar-insert () nil
f5b67f2b 1794 (toolbar toolbar)
cb4bf772 1795 (tool-item tool-item)
1796 (position position))
f36ca6af 1797
cb4bf772 1798(defun toolbar-insert (toolbar tool-item &optional (position :end))
1799 (%toolbar-insert toolbar tool-item position)
1800 (%tool-item-update-tooltips tool-item))
f5b67f2b 1801
cb4bf772 1802(defbinding toolbar-get-item-index () int
1803 (toolbar toolbar)
1804 (item tool-item))
f36ca6af 1805
cb4bf772 1806(defbinding toolbar-get-nth-item () tool-item
1807 (toolbar toolbar)
1808 (n int))
f36ca6af 1809
cb4bf772 1810(defbinding toolbar-get-drop-index () int
1811 (toolbar toolbar)
1812 (x int) (y int))
f36ca6af 1813
cb4bf772 1814(defbinding toolbar-set-drop-highlight-item () nil
1815 (toolbar toolbar)
1816 (tool-item tool-item)
1817 (index int))
f36ca6af 1818
560af5c5 1819
cb4bf772 1820;;; Tool button
560af5c5 1821
cb4bf772 1822(defmethod initialize-instance ((button tool-button) &rest initargs &key icon)
1823 (if (and icon (not (typep icon 'widget)))
1824 (apply #'call-next-method button :icon (create-image-widget icon) initargs)
1825 (call-next-method)))
560af5c5 1826
1827
cb4bf772 1828;;; Tool item
560af5c5 1829
cb4bf772 1830(defbinding tool-item-set-tooltip () nil
1831 (tool-item tool-item)
1832 (tooltips tooltips)
1833 (tip-text string)
1834 (tip-private string))
560af5c5 1835
560af5c5 1836
cb4bf772 1837(defun %tool-item-update-tooltips (tool-item)
1838 (when (and
1839 (slot-boundp tool-item 'parent)
1840 (or
1841 (user-data-p tool-item 'tip-text)
1842 (user-data-p tool-item 'tip-private)))
1843 (tool-item-set-tooltip
1844 tool-item (toolbar-tooltips (widget-parent tool-item))
1845 (or (user-data tool-item 'tip-text) "")
1846 (or (user-data tool-item 'tip-private) ""))))
1847
1848(defmethod (setf tool-item-tip-text) ((tip-text string) (tool-item tool-item))
1849 (setf (user-data tool-item 'tip-text) tip-text)
1850 (%tool-item-update-tooltips tool-item)
1851 tip-text)
1852
1853(defmethod (setf tool-item-tip-private) ((tip-private string) (tool-item tool-item))
1854 (setf (user-data tool-item 'tip-private) tip-private)
1855 (%tool-item-update-tooltips tool-item)
1856 tip-private)
1857
1858(defmethod container-add ((toolbar toolbar) (tool-item tool-item) &rest args)
1859 (declare (ignore args))
1860 (prog1
1861 (call-next-method)
1862 (%tool-item-update-tooltips tool-item)))
560af5c5 1863
d76e9fca 1864
1865(defbinding tool-item-retrieve-proxy-menu-item () widget
1866 (tool-item tool-item))
1867
1868(defbinding (tool-item-proxy-menu-item
1869 "gtk_tool_item_get_proxy_menu_item") () menu-item
1870 (tool-item tool-item)
1871 (menu-item-id string))
1872
1873(defbinding %tool-item-set-proxy-menu-item () nil
1874 (tool-item tool-item)
1875 (menu-item-id string)
1876 (menu-item menu-item))
1877
1878(defun (setf tool-item-proxy-menu-item) (menu-item menu-item-id tool-item)
1879 (%tool-item-set-proxy-menu-item menu-item-id tool-item menu-item)
1880 menu-item)
1881
1882#+gtk2.6
1883(defbinding tool-item-rebuild-menu () nil
1884 (tool-item tool-item))
1885
1886
bbaeff4b 1887;;; Editable
1047e159 1888
bbaeff4b 1889(defbinding editable-select-region (editable &optional (start 0) end) nil
f36ca6af 1890 (editable editable)
1891 (start int)
1892 ((or end -1) int))
560af5c5 1893
1047e159 1894(defbinding editable-get-selection-bounds (editable) nil
1895 (editable editable)
1896 (start int :out)
1897 (end int :out))
1898
d76e9fca 1899(defbinding editable-insert-text (editable text &optional (position 0)) nil
f36ca6af 1900 (editable editable)
1901 (text string)
1902 ((length text) int)
34fe0ead 1903 (position position :in-out))
560af5c5 1904
f36ca6af 1905(defun editable-append-text (editable text)
1906 (editable-insert-text editable text nil))
560af5c5 1907
f36ca6af 1908(defun editable-prepend-text (editable text)
1909 (editable-insert-text editable text 0))
560af5c5 1910
bbaeff4b 1911(defbinding editable-delete-text (editable &optional (start 0) end) nil
f36ca6af 1912 (editable editable)
1913 (start int)
1914 ((or end -1) int))
560af5c5 1915
bbaeff4b 1916(defbinding (editable-text "gtk_editable_get_chars")
f36ca6af 1917 (editable &optional (start 0) end) string
1918 (editable editable)
1919 (start int)
1920 ((or end -1) int))
560af5c5 1921
f36ca6af 1922(defun (setf editable-text) (text editable)
1923 (if text
1924 (editable-delete-text
1925 editable
1926 (editable-insert-text editable text))
1927 (editable-delete-text editable))
1928 text)
560af5c5 1929
bbaeff4b 1930(defbinding editable-cut-clipboard () nil
f36ca6af 1931 (editable editable))
560af5c5 1932
bbaeff4b 1933(defbinding editable-copy-clipboard () nil
f36ca6af 1934 (editable editable))
560af5c5 1935
bbaeff4b 1936(defbinding editable-paste-clipboard () nil
f36ca6af 1937 (editable editable))
560af5c5 1938
bbaeff4b 1939(defbinding editable-delete-selection () nil
f36ca6af 1940 (editable editable))
560af5c5 1941
560af5c5 1942
560af5c5 1943
f36ca6af 1944;;; Spin button
560af5c5 1945
d76e9fca 1946(defbinding spin-button-configure () nil
1947 (spin-button spin-button)
1948 (adjustment adjustment)
1949 (climb-rate double-float)
1950 (digits unsigned-int))
1951
1952(defbinding spin-button-set-range () nil
1953 (spin-button spin-button)
1954 (min double-float)
1955 (max double-float))
1956
1957(defbinding spin-button-get-range () nil
1958 (spin-button spin-button)
1959 (min double-float :out)
1960 (max double-float :out))
1961
f36ca6af 1962(defun spin-button-value-as-int (spin-button)
1963 (round (spin-button-value spin-button)))
560af5c5 1964
510fbcc1 1965(defbinding %spin-button-spin () nil
f36ca6af 1966 (spin-button spin-button)
1967 (direction spin-type)
510fbcc1 1968 (increment double-float))
1969
1970(defun spin-button-spin (spin-button value)
1971 (etypecase value
1972 (real (%spin-button-spin spin-button :spin-user-defined value))
1973 (spin-type (%spin-button-spin spin-button value 0))))
1974
560af5c5 1975
bbaeff4b 1976(defbinding spin-button-update () nil
f36ca6af 1977 (spin-button spin-button))
560af5c5 1978
1979
1980
1981; ;;; Ruler
1982
bbaeff4b 1983(defbinding ruler-set-range () nil
f36ca6af 1984 (ruler ruler)
1985 (lower single-float)
1986 (upper single-float)
1987 (position single-float)
1988 (max-size single-float))
560af5c5 1989
68f519e0 1990(defbinding ruler-get-range () nil
1991 (ruler ruler)
1992 (lower single-float :out)
1993 (upper single-float :out)
1994 (position single-float :out)
1995 (max-size single-float :out))
560af5c5 1996
560af5c5 1997
560af5c5 1998
d520140e 1999;;; Range
560af5c5 2000
1047e159 2001(defun range-lower (range)
2002 (adjustment-lower (range-adjustment range)))
560af5c5 2003
1047e159 2004(defun range-upper (range)
2005 (adjustment-upper (range-adjustment range)))
560af5c5 2006
1047e159 2007(defun (setf range-lower) (value range)
2008 (setf (adjustment-lower (range-adjustment range)) value))
560af5c5 2009
1047e159 2010(defun (setf range-upper) (value range)
2011 (setf (adjustment-upper (range-adjustment range)) value))
560af5c5 2012
1047e159 2013(defun range-page-increment (range)
2014 (adjustment-page-increment (range-adjustment range)))
560af5c5 2015
1047e159 2016(defun range-step-increment (range)
2017 (adjustment-step-increment (range-adjustment range)))
560af5c5 2018
1047e159 2019(defun (setf range-page-increment) (value range)
2020 (setf (adjustment-page-increment (range-adjustment range)) value))
560af5c5 2021
1047e159 2022(defun (setf range-step-increment) (value range)
2023 (setf (adjustment-step-increment (range-adjustment range)) value))
560af5c5 2024
1047e159 2025(defbinding range-set-range () nil
d520140e 2026 (range range)
1047e159 2027 (lower double-float)
2028 (upper double-float))
560af5c5 2029
1047e159 2030(defbinding range-set-increments () nil
d520140e 2031 (range range)
1047e159 2032 (step double-float)
2033 (page double-float))
560af5c5 2034
560af5c5 2035
d520140e 2036;;; Scale
560af5c5 2037
68f519e0 2038(defbinding scale-get-layout-offsets () nil
2039 (scale scale)
2040 (x int :out)
2041 (y int :out))
560af5c5 2042
560af5c5 2043
d520140e 2044;;; Progress bar
560af5c5 2045
bbaeff4b 2046(defbinding progress-bar-pulse () nil
d520140e 2047 (progress-bar progress-bar))
560af5c5 2048
2049
c49be931 2050;;; Size group
2051
2052(defmethod initialize-instance ((size-group size-group) &rest initargs
2053 &key widget widgets)
2054 (declare (ignore widget widgets))
2055 (prog1
2056 (call-next-method)
2057 (initial-add size-group #'size-group-add-widget
2058 initargs :widget :widgets)))
2059
2060
2061(defbinding size-group-add-widget () nil
2062 (size-group size-group)
2063 (widget widget))
2064
2065(defbinding size-group-remove-widget () nil
2066 (size-group size-group)
2067 (widget widget))
2068
560af5c5 2069
f5b67f2b 2070;;; Stock items
2071
73d58e01 2072(defbinding %stock-item-copy () pointer
2073 (location pointer))
2074
2075(defbinding %stock-item-free () nil
2076 (location pointer))
f5b67f2b 2077
73d58e01 2078(defmethod reference-foreign ((class (eql (find-class 'stock-item))) location)
2079 (%stock-item-copy location))
2080
2081(defmethod unreference-foreign ((class (eql (find-class 'stock-item))) location)
2082 (%stock-item-free location))
2083
2084(defbinding stock-add (stock-item) nil
2085 (stock-item stock-item)
2086 (1 unsigned-int))
2087
2088(defbinding stock-list-ids () (gslist string))
2089
2090(defbinding %stock-lookup () boolean
2091 (stock-id string)
2092 (location pointer))
2093
2094(defun stock-lookup (stock-id)
2095 (let ((location
2096 (allocate-memory (proxy-instance-size (find-class 'stock-item)))))
2097 (unwind-protect
2098 (when (%stock-lookup stock-id location)
2099 (ensure-proxy-instance 'stock-item (%stock-item-copy location)))
2100 (deallocate-memory location))))
560af5c5 2101
2102
2103;;; Tooltips
2104
bbaeff4b 2105(defbinding tooltips-enable () nil
d520140e 2106 (tooltips tooltips))
560af5c5 2107
bbaeff4b 2108(defbinding tooltips-disable () nil
d520140e 2109 (tooltips tooltips))
560af5c5 2110
e5b416f0 2111(defun (setf tooltips-enabled-p) (enable tooltips)
2112 (if enable
2113 (tooltips-enable tooltips)
2114 (tooltips-disable tooltips)))
2115
bbaeff4b 2116(defbinding tooltips-set-tip () nil
d520140e 2117 (tooltips tooltips)
2118 (widget widget)
2119 (tip-text string)
2120 (tip-private string))
560af5c5 2121
d76e9fca 2122(defbinding tooltips-data-get () tooltips-data
2123 (widget widget))
2124
bbaeff4b 2125(defbinding tooltips-force-window () nil
d520140e 2126 (tooltips tooltips))
560af5c5 2127
d76e9fca 2128(defbinding tooltips-get-info-from-tip-window () boolean
2129 (tip-window window)
2130 (tooltips tooltips :out)
2131 (current-widget widget :out))
560af5c5 2132
2133
d520140e 2134;;; Rc
560af5c5 2135
bbaeff4b 2136(defbinding rc-add-default-file (filename) nil
d520140e 2137 ((namestring (truename filename)) string))
560af5c5 2138
bbaeff4b 2139(defbinding rc-parse (filename) nil
d520140e 2140 ((namestring (truename filename)) string))
560af5c5 2141
bbaeff4b 2142(defbinding rc-parse-string () nil
d520140e 2143 (rc-string string))
560af5c5 2144
bbaeff4b 2145(defbinding rc-reparse-all () nil)
560af5c5 2146
bbaeff4b 2147(defbinding rc-get-style () style
d520140e 2148 (widget widget))