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
22
23////////////////////////////////////////////////////////////////////////////////
24/// Default constructor.
25
27 fNextPSRef (nullptr),
28 fPShape (nullptr)
29{
30}
31
32////////////////////////////////////////////////////////////////////////////////
33/// Constructor with known shape - reference it.
34
36 fNextPSRef (nullptr),
37 fPShape (nullptr)
38{
39 SetPShape(shape);
40}
41////////////////////////////////////////////////////////////////////////////////
42/// Destructor - unreference the shape if set.
43
48
49////////////////////////////////////////////////////////////////////////////////
50/// Set the shape. Unreference the old and reference the new.
51/// This is virtual so that sub-classes can perform other tasks
52/// on change. This function should be called first from there.
53///
54/// This is also called from destructor of the referenced physical
55/// shape with 0 argument.
56
58{
59 if (fPShape)
61 fPShape = shape;
62 if (fPShape)
63 fPShape->AddReference(this);
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// This is called from physical shape when it is modified.
68/// Sub-classes can override and take appropriate action.
69
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.