;;;;
;;;; S c r o l l b a r . s t k 	  --  Scrollbar class definition
;;;;
;;;; Copyright (C) 1993,1994,1995 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;; 
;;;; 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.
;;;;
;;;;           Author: Erick Gallesio [eg@kaolin.unice.fr]
;;;;    Creation date:  5-Mar-1994 17:19
;;;; Last file update: 26-Apr-1995 14:09

(require "Basics")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; <Scrollbar> class
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-class <Scrollbar> (<Tk-simple-widget>)
  ((active-foreground :accessor     active-foreground
		      :init-keyword :active-foreground
		      :tk-name	    activeforeground
		      :allocation   :tk-virtual)
   (foreground 	      :accessor     foreground
		      :init-keyword :foreground
		      :allocation   :tk-virtual)
   (orientation       :accessor     orientation
		      :init-keyword :orientation
		      :tk-name	    orient
		      :allocation   :tk-virtual)
   (repeat-delay      :accessor     repeat-delay
		      :init-keyword :repeat-delay
		      :tk-name	    repeatdelay
		      :allocation   :tk-virtual)
   (repeat-interval   :accessor     repeat-interval
		      :init-keyword :repeat-interval
		      :tk-name	    repeatinterval
		      :allocation   :tk-virtual)
   (command 	      :accessor     command
		      :init-keyword :command
		      :allocation   :tk-virtual)  
   (width 	      :accessor     width
		      :init-keyword :width
		      :allocation   :tk-virtual)
   ;; Fictive slot 
   (value	      :accessor     value
		      :init-keyword :value
		      :allocation   :virtual
		      :slot-ref     (lambda (o)  
				      ((slot-ref o 'Id) 'get))
		      :slot-set!    (lambda (o v) 
				      (apply (slot-ref o 'Id) 'set v)))))

(define-method tk-constructor ((self <Scrollbar>))
  Tk:scrollbar)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; Scrollbar Methods
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-method initialize ((self <Scrollbar>) args)
  (next-method)
  (let ((val (get-keyword :value args #f)))
    ;; If a value is specified at init-time init, set it.
    (when val 
	  (set! (value self) val))))

(define-method scrollbar-set! ((self <Scrollbar>) x y z w)
  ((slot-ref self 'Id) 'set x y z w))

(define-method scrollbar-get ((self <Scrollbar>))
  ((slot-ref self 'Id) 'get))

(provide "Scrollbar")
