;;;; Notepad.stklos -- Notepad widget ;;;; ;;;; Copyright © 1997-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. ;;;; ;;;; Author: Erick Gallesio [eg@unice.fr] ;;;; Creation date: 1-Feb-1997 11:43 ;;;; Last file update: 3-Sep-1999 20:14 (eg) (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) (class :init-keyword :class :init-form "Notepad") (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