;;;; ;;;; Listboxes bindings and procs ;;;; ;;;; Copyright © 1993-1999 Erick Gallesio - I3S-CNRS/ESSI ;;;; ;;;; Permission to use, copy, modify, distribute,and license this ;;;; software and its documentation for any purpose is hereby granted, ;;;; provided that existing copyright notices are retained in all ;;;; copies and that this notice is included verbatim in any ;;;; distributions. No written agreement, license, or royalty fee is ;;;; required for any of the authorized uses. ;;;; 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: 3-Sep-1999 19:52 (eg) ;;;; (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" "