;;;;
;;;;  S c a l e . s t k			-- Scale 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.
;;;
;;;; 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@kaolin.unice.fr]
;;;;    Creation date: 30-Mar-1993 15:28
;;;; Last file update: 27-Mar-1995 15:14


(require "Basics")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; <Scale> class definition
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define-class <Scale> (<Tk-simple-widget>)
  ((active-foreground	:init-keyword :active-foreground 
			:accessor active-foreground
			:tk-name activeforeground
			:allocation :tk-virtual)
   (command		:init-keyword :command 
			:accessor command 
			:allocation :tk-virtual)
   (font 		:init-keyword :font 
			:accessor font 
			:allocation  :tk-virtual)
   (foreground 		:init-keyword :foreground 
			:accessor foreground 
			:allocation :tk-virtual)
   (orientation 	:init-keyword :orientation
			:accessor orientation
			:tk-name orient
			:allocation :tk-virtual)
   (from 		:init-keyword :from 
			:accessor from 
			:allocation :tk-virtual)
   (text 		:init-keyword :text 
			:accessor text-of
			:tk-name label
			:allocation :tk-virtual)
   (scale-length	:init-keyword :scale-length 
			:accessor scale-length
			:tk-name length
			:allocation :tk-virtual)
    (show-value 	:init-keyword :show-value
			:accessor show-value
			:tk-name showvalue
			:allocation :tk-virtual)
    (slider-foreground 	:init-keyword :slider-foreground
			:accessor slider-foreground 
			:tk-name sliderforeground
			:allocation :tk-virtual)
    (slider-length 	:init-keyword :slider-length 
			:accessor slider-length 
			:tk-name sliderlength
			:allocation :tk-virtual)
    (state 		:init-keyword :state 
			:accessor state 
			:allocation :tk-virtual)
    (tick 		:init-keyword :tick 
			:accessor tick 
			:allocation :tk-virtual)
    (to 		:init-keyword :to 
			:accessor to 
			:allocation :tk-virtual)
    (width 		:init-keyword :width 
			:accessor 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) 
					((slot-ref o 'Id) 'set v)))))

(define-method tk-constructor ((self <Scale>))
  Tk:scale)

;;;
;;;  <Scale> methods
;;;

(define-method initialize ((self <Scale>) initargs)
  (next-method)
  (let* ((val (get-keyword :value initargs #f)))
    ;; If a value is specified upon init, set it.
    (when val
	  (slot-set! self 'value val))))

(provide "Scale")