Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLPShapeRef.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel, Feb 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TGLPShapeRef.h"
13#include "TGLPhysicalShape.h"
14
15/** \class TGLPShapeRef
16\ingroup opengl
17Base class for references to TGLPysicalShape that need to be notified
18when the shape is destroyed.
19Could also deliver 'change' notifications.
20*/
21
23
24////////////////////////////////////////////////////////////////////////////////
25/// Default constructor.
26
28 fNextPSRef (0),
29 fPShape (0)
30{
31}
32
33////////////////////////////////////////////////////////////////////////////////
34/// Constructor with known shape - reference it.
35
37 fNextPSRef (0),
38 fPShape (0)
39{
40 SetPShape(shape);
41}
42////////////////////////////////////////////////////////////////////////////////
43/// Destructor - unreference the shape if set.
44
46{
47 SetPShape(0);
48}
49
50////////////////////////////////////////////////////////////////////////////////
51/// Set the shape. Unreference the old and reference the new.
52/// This is virtual so that sub-classes can perform other tasks
53/// on change. This function should be called first from there.
54///
55/// This is also called from destructor of the referenced physical
56/// shape with 0 argument.
57
59{
60 if (fPShape)
62 fPShape = shape;
63 if (fPShape)
64 fPShape->AddReference(this);
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// This is called from physical shape when it is modified.
69/// Sub-classes can override and take appropriate action.
70
72{
73}
#define ClassImp(name)
Definition Rtypes.h:364
Base class for references to TGLPysicalShape that need to be notified when the shape is destroyed.
TGLPShapeRef()
Default constructor.
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
TGLPhysicalShape * fPShape
virtual void PShapeModified()
This is called from physical shape when it is modified.
virtual ~TGLPShapeRef()
Destructor - unreference the shape if set.
Concrete physical shape - a GL drawable.
void RemoveReference(TGLPShapeRef *ref)
Remove reference ref.
void AddReference(TGLPShapeRef *ref)
Add reference ref.