// @(#)root/gl:$Id$
// Author:  Matevz Tadel, Feb 2007

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TGLPShapeRef.h"
#include "TGLPhysicalShape.h"

//______________________________________________________________________
//
// Base class for references to TGLPysicalShape that need to be notified
// when the shape is destroyed.
// Could also deliver 'change' notifications.

ClassImp(TGLPShapeRef);

//______________________________________________________________________
TGLPShapeRef::TGLPShapeRef() :
   fNextPSRef (0),
   fPShape    (0)
{
   // Default contructor.
}

//______________________________________________________________________
TGLPShapeRef::TGLPShapeRef(TGLPhysicalShape * shape) :
   fNextPSRef (0),
   fPShape    (0)
{
   // Constructor with known shape - reference it.

   SetPShape(shape);
}
//______________________________________________________________________
TGLPShapeRef::~TGLPShapeRef()
{
   // Destructor - unreference the shape if set.

   SetPShape(0);
}

//______________________________________________________________________
void TGLPShapeRef::SetPShape(TGLPhysicalShape * shape)
{
   // Set the shape. Unreference the old and reference the new.
   // This is virtual so that sub-classes can perform other tasks
   // on change. This function should be called first from there.
   //
   // This is also called from destructor of the refereced physical
   // shape with 0 argument.

   if (fPShape)
      fPShape->RemoveReference(this);
   fPShape = shape;
   if (fPShape)
      fPShape->AddReference(this);
}

//______________________________________________________________________
void TGLPShapeRef::PShapeModified()
{
   // This is called from physical shape when it is modified.
   // Sub-classes can override and take appropriate action.
}
 TGLPShapeRef.cxx:1
 TGLPShapeRef.cxx:2
 TGLPShapeRef.cxx:3
 TGLPShapeRef.cxx:4
 TGLPShapeRef.cxx:5
 TGLPShapeRef.cxx:6
 TGLPShapeRef.cxx:7
 TGLPShapeRef.cxx:8
 TGLPShapeRef.cxx:9
 TGLPShapeRef.cxx:10
 TGLPShapeRef.cxx:11
 TGLPShapeRef.cxx:12
 TGLPShapeRef.cxx:13
 TGLPShapeRef.cxx:14
 TGLPShapeRef.cxx:15
 TGLPShapeRef.cxx:16
 TGLPShapeRef.cxx:17
 TGLPShapeRef.cxx:18
 TGLPShapeRef.cxx:19
 TGLPShapeRef.cxx:20
 TGLPShapeRef.cxx:21
 TGLPShapeRef.cxx:22
 TGLPShapeRef.cxx:23
 TGLPShapeRef.cxx:24
 TGLPShapeRef.cxx:25
 TGLPShapeRef.cxx:26
 TGLPShapeRef.cxx:27
 TGLPShapeRef.cxx:28
 TGLPShapeRef.cxx:29
 TGLPShapeRef.cxx:30
 TGLPShapeRef.cxx:31
 TGLPShapeRef.cxx:32
 TGLPShapeRef.cxx:33
 TGLPShapeRef.cxx:34
 TGLPShapeRef.cxx:35
 TGLPShapeRef.cxx:36
 TGLPShapeRef.cxx:37
 TGLPShapeRef.cxx:38
 TGLPShapeRef.cxx:39
 TGLPShapeRef.cxx:40
 TGLPShapeRef.cxx:41
 TGLPShapeRef.cxx:42
 TGLPShapeRef.cxx:43
 TGLPShapeRef.cxx:44
 TGLPShapeRef.cxx:45
 TGLPShapeRef.cxx:46
 TGLPShapeRef.cxx:47
 TGLPShapeRef.cxx:48
 TGLPShapeRef.cxx:49
 TGLPShapeRef.cxx:50
 TGLPShapeRef.cxx:51
 TGLPShapeRef.cxx:52
 TGLPShapeRef.cxx:53
 TGLPShapeRef.cxx:54
 TGLPShapeRef.cxx:55
 TGLPShapeRef.cxx:56
 TGLPShapeRef.cxx:57
 TGLPShapeRef.cxx:58
 TGLPShapeRef.cxx:59
 TGLPShapeRef.cxx:60
 TGLPShapeRef.cxx:61
 TGLPShapeRef.cxx:62
 TGLPShapeRef.cxx:63
 TGLPShapeRef.cxx:64
 TGLPShapeRef.cxx:65
 TGLPShapeRef.cxx:66
 TGLPShapeRef.cxx:67
 TGLPShapeRef.cxx:68
 TGLPShapeRef.cxx:69
 TGLPShapeRef.cxx:70