;;;; ;;;; Listboxes bindings and procs ;;;; ;;;; Copyright © 1993-1998 Erick Gallesio - I3S-CNRS/ESSI ;;;; ;;;; Permission to use, copy, and/or distribute this software and its ;;;; documentation for any purpose and without fee is hereby granted, provided ;;;; that both the above copyright notice and this permission notice appear in ;;;; all copies and derived works. Fees for distribution or use of this ;;;; software or derived works may only be charged with express written ;;;; permission of the copyright holder. ;;;; This software is provided ``as is'' without express or implied warranty. ;;;; ;;;; This software is a derivative work of other copyrighted softwares; the ;;;; copyright notices of these softwares are placed in the file COPYRIGHTS ;;;; ;;;; ;;;; Author: Erick Gallesio [eg@unice.fr] ;;;; Creation date: 17-May-1993 12:35 ;;;; Last file update: 8-Dec-1998 13:09 ;;;; (select-module Tk) ;; ;; Global variables used in this file ;; (define tk::listbox-selection '()) (define tk::listbox-prev 0) ;; ---------------------------------------------------------------------- ;; Class bindings for listbox widgets. ;; ---------------------------------------------------------------------- (define-binding "Listbox" "<1>" (|W| x y) ; Note: the check for existence of %W below is because this binding ; is sometimes invoked after a window has been deleted (e.g. because ; there is a double-click binding on the widget that deletes it). Users ; can put "break"s in their bindings to avoid the error, but this check ; makes that unnecessary. (when (winfo 'exists |W|) (Tk:listbox-begin-select |W| (|W| 'index (format #f "@~A,~A" x y))))) (define-binding "Listbox" "" ;; Ignore double clicks so that users can define their own behaviors. ;; Among other things, this prevents errors if the user deletes the ;; listbox on a double click. (lambda () #f)) (define-binding "Listbox" "" (|W| x y) (set! tk::x x) (set! tk::y y) (Tk:listbox-motion |W| (|W| 'index (format #f "@~A,~A" x y)))) (define-binding "Listbox" "" (|W| x y) (Tk:cancel-repeat) (|W| 'activate (format #f "@~A,~A" x y))) (define-binding "Listbox" "" (|W| x y) (Tk:listbox-begin-extend |W| (|W| 'index (format #f "@~A,~A" x y)))) (define-binding "Listbox" "" (|W| x y) (Tk:listbox-begin-toggle |W| (|W| 'index (format #f "@~A,~A" x y)))) (define-binding "Listbox" "" (|W| x y) (set! tk::x x) (set! tk::y y) (Tk:listbox-auto-scan |W|)) (define-binding "Listbox" "" () (Tk:cancel-repeat)) (define-binding "Listbox" "" (|W|) (Tk:listbox-up-down |W| -1)) (define-binding "Listbox" "" (|W|) (Tk:listbox-extend-up-down |W| -1)) (define-binding "Listbox" "" (|W|) (Tk:listbox-up-down |W| 1)) (define-binding "Listbox" "" (|W|) (Tk:listbox-extend-up-down |W| 1)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll -1 'units)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll -1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll 1 'units)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll 1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'yview 'scroll -1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'yview 'scroll 1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll -1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'scroll 1 'pages)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'moveto 0)) (define-binding "Listbox" "" (|W|) (|W| 'xview 'moveto 1)) (define-binding "Listbox" "" (|W|) (|W| 'activate 0) (|W| 'see 0) (|W| 'selection 'clear 0 'end) (|W| 'selection 'set 0)) (define-binding "Listbox" "" (|W|) (Tk:listbox-data-extend |W| 0)) (define-binding "Listbox" "" (|W|) (|W| 'activate 'end) (|W| 'see 'end) (|W| 'selection 'clear 0 'end) (|W| 'selection 'set 'end)) (define-binding "Listbox" "" (|W|) (Tk:listbox-data-extend |W| (|W| 'index 'end))) (define-binding "Listbox" "<>" (|W|) (when (equal? (selection 'own :displayof |W|) |W|) (clipboard 'clear :displayof |W|) (clipboard 'append :displayof |W| (selection 'get :displayof |W|)))) (define-binding "Listbox" "" (|W|) (Tk:listbox-begin-select |W| (|W| 'index 'active))) (define-binding "Listbox" "