;;;; Notepad.stklos -- Notepad widget ;;;; ;;;; Copyright © 1997-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. ;;;; ;;;; $Id: Notepad.stklos 1.1 Sun, 30 Aug 1998 11:09:20 +0200 eg $ ;;;; ;;;; Author: Erick Gallesio [eg@unice.fr] ;;;; Creation date: 1-Feb-1997 11:43 ;;;; Last file update: 29-Aug-1998 12:40 (require "Tk-classes") (select-module STklos+Tk) (export select-tab unselect-tab current-tab) (define-class () (%cache ; A small label used to cache the bottom of tabs %page ; The frame which contains the page associated to a tab %tabs ; All the tabs (first one is a fake one) (%current :init-form #f) (width :accessor width :allocation :propagated :propagate-to (%page)) (height :accessor height :allocation :propagated :propagate-to (%page)) (background :accessor background :init-keyword :background :allocation :virtual :slot-ref (lambda (o) (background (slot-ref o '%cache))) :slot-set! (lambda (o v) (for-each (lambda (x) (slot-set! x 'background v)) (list* (slot-ref o 'frame) (slot-ref o '%cache) (slot-ref o '%page) (slot-ref o '%tabs))))) (foreground :accessor foreground :init-keyword :foreground :allocation :virtual :slot-ref (lambda (o) (foreground (car (slot-ref o '%tabs)))) :slot-set! (lambda (o v) (for-each (lambda (x) (slot-set! x 'foreground v)) (slot-ref o '%tabs)))))) (define-method initialize-composite-widget ((self ) initargs frame) (let* ((w (get-keyword :width initargs 500)) (h (get-keyword :height initargs 300)) (f (make :parent frame :border-width 2 :relief "raised" :width w :height h)) (c (make :parent frame :border-width 0 :height 4))) (pack f :side 'bottom :fill 'both :expand #t) (pack 'propagate f #f) ;; Create a first button in the frame. This button is never mapped but serves ;; as a prototype for next tabs (slot-set! self '%tabs (list (make