anchor.diff:  ;;; -*- Mode: Lisp; Package: CLIM-INTERNALS -*-
   
  -;;;  (c) copyright 1998,1999,2000 by Michael McDonald (mikemac@mikemac.com)
  +;;;  (c) copyright 1998,1999,2000 by 
  +;;;  Michael McDonald (mikemac@mikemac.com), 
  +;;;  Robert Strandh (strandh@labri.u-bordeaux.fr), 
  +;;;  Iban Hatchondo (hatchond@emi.u-bordeaux.fr),
  +;;;  Julien Boninfante (boninfan@emi.u-bordeaux.fr).
   
   ;;; This library is free software; you can redistribute it and/or
   ;;; modify it under the terms of the GNU Library General Public
  
positive.code: (defmethod sheet-children ((sheet sheet))
    nil)
  
  (defmethod sheet-transformation ((sheet sheet))
    (error "Attempting to get the TRANSFORMATION of a SHEET that doesn't contain one"))
  
  (defmethod (setf sheet-transformation) (transformation (sheet sheet))
    (declare (ignore transformation))
    (error "Attempting to set the TRANSFORMATION of a SHEET that doesn't contain one"))
  
  (defmethod sheet-medium ((sheet sheet))
    (error "Attempting to get the MEDIUM of a SHEET that doesn't contain one"))
  
  (defmethod (setf sheet-medium) (medium (sheet sheet))
    (declare (ignore medium))
    (error "Attempting to set the MEDIUM of a SHEET that doesn't contain one"))
  
  ;;; SHEET error conditions
  
  (define-condition sheet-already-has-parent (error)
    (
     ))
  
  (define-condition sheet-is-not-child (error)
    (
     ))
  
  ;;; SHEET relationship functions
  
  (defmethod sheet-adopt-child ((sheet sheet) (child sheet))
    (error "SHEET attempting to adopt a child"))
  
  (defmethod sheet-disown-child ((sheet sheet) (child sheet) &key (errorp t))
    (cond
     ((eq (sheet-parent child) sheet)
      (set-sheets-parent child nil)
      (with-slots (children) sheet
        (setf children (remove child children)))
      )
     (errorp
      (error 'sheet-is-not-child)))
    child)
  
negative.code: ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
  ;;; Boston, MA  02111-1307  USA.
  
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; The sheet protocol
  
  (in-package :CLIM-INTERNALS)
  
  (defgeneric sheet-parent (sheet)
    (:documentation
     "Returns the parent of the sheet SHEET or nil if the sheet has
  no parent"))
  
  (defgeneric sheet-children (sheet)
    (:documentation
     "Returns a list of sheets that are the children of the sheet SHEET.
  Some sheet classes support only a single child; in this case, the
  result of sheet-children will be a list of one element. This
  function returns objects that reveal CLIM's internal state ; do not
  modify those objects."))
  
  (defgeneric sheet-adopt-child (sheet child)
    (:documentation
     "Adds the child sheet child to the set of children of the sheet SHEET,
  and makes the sheet the child's parent. If child already has a parent, 
  the sheet-already-has-parent error will be signalled.
  
  Some sheet classes support only a single child. For such sheets, 
  attempting to adopt more than a single child will cause the 
  sheet-supports-only-one-child error to be signalled."))
  
  (defgeneric sheet-disown-child (sheet child &key (errorp t)))
  (defgeneric sheet-enabled-children (sheet))
  (defgeneric sheet-ancestor-p (sheet putative-ancestor))
  (defgeneric raise-sheet (sheet))
  
  ;;; not for external use
  (defgeneric raise-sheet-internal (sheet parent))
  
  (defgeneric bury-sheet (sheet))
  
  ;;; not for external use
  (defgeneric bury-sheet-internal (sheet parent))
  
  (defgeneric reorder-sheets (sheet new-ordering))
  (defgeneric sheet-enabled-p (sheet))
  (defgeneric (setf sheet-enabled-p) (enabled-p sheet))
  (defgeneric sheet-viewable-p (sheet))
  (defgeneric sheet-occluding-sheets (sheet child))
  
  ;;; not for external use
  (defgeneric realize-hierarchy (sheet port))
  (defgeneric realize-sheet (sheet port))
  (defgeneric unrealize-hierarchy (sheet))
  (defgeneric unrealize-sheet (sheet))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; Sheet geometry
  
  (defgeneric sheet-transformation (sheet))
  (defgeneric (setf sheet-transformation) (transformation sheet))
  (defgeneric sheet-region (sheet))
  (defgeneric (setf sheet-region) (region sheet))
  (defgeneric map-sheet-position-to-parent (sheet x y))
  (defgeneric map-sheet-position-to-child (sheet x y))
  (defgeneric map-sheet-rectangle*-to-parent (sheet x1 y1 x2 y2))
  (defgeneric map-sheet-rectangle*-to-child (sheet x1 y1 x2 y2))
  (defgeneric child-containing-position (sheet x y))
  (defgeneric children-overlapping-region (sheet region))
  (defgeneric children-overlapping-rectangle* (sheet x1 y1 x2 y2))
  (defgeneric sheet-delta-transformation (sheet ancestor))
  (defgeneric sheet-allocated-region (sheet child))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; input protocol
  
  (defgeneric dispatch-event (client event))
  (defgeneric queue-event (client event))
  (defgeneric handle-event (client event))
  (defgeneric event-read (client))
  (defgeneric event-read-no-hang (client))
  (defgeneric event-peek (client &optional event-type))
  (defgeneric event-unread (client event))
  (defgeneric event-listen (client))
  (defgeneric sheet-direct-mirror (sheet))
  (defgeneric sheet-mirrored-ancestor (sheet))
  (defgeneric sheet-mirror (sheet))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; repaint protocol
  
  (defgeneric dispatch-repaint (sheet region))
  (defgeneric queue-repaint (sheet region))
  (defgeneric handle-repaint (sheet medium region))
  (defgeneric repaint-sheet (sheet region))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; notification protocol
  
  (defgeneric note-sheet-grafted (sheet))
  (defgeneric note-sheet-degrafted (sheet))
  (defgeneric note-sheet-adopted (sheet))
  (defgeneric note-sheet-disowned (sheet))
  (defgeneric note-sheet-enabled (sheet))
  (defgeneric note-sheet-disabled (sheet))
  (defgeneric note-sheet-region-changed (sheet))
  (defgeneric note-sheet-transformation-changed (sheet))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;;
  ;;;; sheet protocol class
  
  (defclass sheet ()
    ((region :initarg :region :accessor sheet-region)
     (enabled-p :initform nil :accessor sheet-enabled-p)))
  
  (defun sheetp (x)
    (typep x 'sheet))
  