Logo ROOT  
Reference Guide
TPaveClass.cxx
Go to the documentation of this file.
1 // @(#)root/gpad:$Id$
2 // Author: Rene Brun 06/08/99
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #include "TROOT.h"
12 #include "Buttons.h"
13 #include "TPaveClass.h"
14 #include "TClassTree.h"
15 
16 #include <iostream>
17 
19 
20 
21 /** \class TPaveClass
22 \ingroup gpad
23 
24 A TPaveLabel specialized to process classes inside a TClassTree.
25 A TPaveClass object is used by the TClassTree to represent a class.
26 A TPaveClass has the same graphical representation as a TPaveLabel.
27 
28 Using the context menu on can select additional options in the ClassTree:
29  - Show classes using this class
30  - Show all classes used by this class
31 */
32 
33 ////////////////////////////////////////////////////////////////////////////////
34 /// PaveClass default constructor.
35 
37 {
38  fClassTree = 0;
39 }
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 /// PaveClass normal constructor.
43 
44 TPaveClass::TPaveClass(Double_t x1, Double_t y1,Double_t x2, Double_t y2, const char *label, TClassTree *classtree)
45  :TPaveLabel(x1,y1,x2,y2,label,"br")
46 {
47  fClassTree = classtree;
48  SetName(label);
49  SetTextFont(61);
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// PaveClass default destructor.
54 
56 {
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// PaveClass copy constructor.
61 
62 TPaveClass::TPaveClass(const TPaveClass &PaveClass) : TPaveLabel(PaveClass)
63 {
64  ((TPaveClass&)PaveClass).Copy(*this);
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Copy this PaveClass to PaveClass.
69 
70 void TPaveClass::Copy(TObject &obj) const
71 {
72  TPaveLabel::Copy(obj);
73  ((TPaveClass&)obj).fClassTree = fClassTree;
74 }
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Draw classes.
78 
79 void TPaveClass::DrawClasses(const char *classes)
80 {
81  if (!fClassTree) return;
82  if (!strcmp(classes,"this")) fClassTree->Draw(GetName());
83  else fClassTree->Draw(classes);
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// Save as.
88 
89 void TPaveClass::SaveAs(const char *filename, Option_t *option) const
90 {
91  if (!fClassTree) return;
92  fClassTree->SaveAs(filename,option);
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// Set classes.
97 
98 void TPaveClass::SetClasses(const char *classes, Option_t *option)
99 {
100  if (!fClassTree) return;
101  if (!strcmp(classes,"this")) fClassTree->SetClasses(GetName(),option);
102  else fClassTree->SetClasses(classes,option);
103 }
104 
105 ////////////////////////////////////////////////////////////////////////////////
106 /// Set link options in the ClassTree object.
107 ///
108 /// - "C" show References from code
109 /// - "H" show "Has a" relations
110 /// - "M" show Multiple Inheritance
111 /// - "R" show References from data members
112 
114 {
115  if (!fClassTree) return;
116  fClassTree->ShowLinks(option);
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// Show classes used by.
121 
122 void TPaveClass::ShowClassesUsedBy(const char *classes)
123 {
124  if (!fClassTree) return;
125  if (!strcmp(classes,"this")) fClassTree->ShowClassesUsedBy(GetName());
126  else fClassTree->ShowClassesUsedBy(classes);
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// Show classes using.
131 
132 void TPaveClass::ShowClassesUsing(const char *classes)
133 {
134  if (!fClassTree) return;
135  if (!strcmp(classes,"this")) fClassTree->ShowClassesUsing(GetName());
136  else fClassTree->ShowClassesUsing(classes);
137 }
138 
139 ////////////////////////////////////////////////////////////////////////////////
140 /// Save primitive as a C++ statement(s) on output stream out
141 
142 void TPaveClass::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
143 {
144  char quote = '"';
145  out<<" "<<std::endl;
146  if (gROOT->ClassSaved(TPaveClass::Class())) {
147  out<<" ";
148  } else {
149  out<<" TPaveClass *";
150  }
151  out<<"pclass = new TPaveClass("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2
152  <<","<<quote<<fLabel<<quote<<","<<quote<<fOption<<quote<<");"<<std::endl;
153 
154  SaveFillAttributes(out,"pclass",0,1001);
155  SaveLineAttributes(out,"pclass",1,1,1);
156  SaveTextAttributes(out,"pclass",22,0,1,62,0);
157 
158  out<<" pclass->Draw();"<<std::endl;
159 }
TPaveClass::~TPaveClass
virtual ~TPaveClass()
PaveClass default destructor.
Definition: TPaveClass.cxx:55
TPaveClass::TPaveClass
TPaveClass()
PaveClass default constructor.
Definition: TPaveClass.cxx:36
TPaveLabel::fLabel
TString fLabel
Label written at the center of Pave.
Definition: TPaveLabel.h:29
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TClassTree::Draw
virtual void Draw(const char *classes="")
Draw the inheritance tree and relations for the list of classes see this class header for the syntax ...
Definition: TClassTree.cxx:262
Buttons.h
TAttText::SaveTextAttributes
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
Save text attributes as C++ statement(s) on output stream out.
Definition: TAttText.cxx:344
TBox::fX2
Double_t fX2
X of 2nd point.
Definition: TBox.h:30
TBox::fX1
Double_t fX1
X of 1st point.
Definition: TBox.h:28
TAttLine::SaveLineAttributes
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition: TAttLine.cxx:270
TPaveClass::SaveAs
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save as.
Definition: TPaveClass.cxx:89
TPaveClass::ShowLinks
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
Definition: TPaveClass.cxx:113
TPaveClass::SetClasses
virtual void SetClasses(const char *classes="this", Option_t *option="ID")
Set classes.
Definition: TPaveClass.cxx:98
TAttFill::SaveFillAttributes
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition: TAttFill.cxx:234
TClassTree.h
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TROOT.h
TPaveClass::ShowClassesUsing
virtual void ShowClassesUsing(const char *classes="this")
Show classes using.
Definition: TPaveClass.cxx:132
TPaveClass::Copy
void Copy(TObject &PaveVar) const
Copy this PaveClass to PaveClass.
Definition: TPaveClass.cxx:70
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TClassTree
Definition: TClassTree.h:21
TPaveClass
Definition: TPaveClass.h:23
TPaveLabel::Copy
void Copy(TObject &pavelabel) const
Copy this pavelabel to pavelabel.
Definition: TPaveLabel.cxx:67
TPave::GetName
Option_t * GetName() const
Returns name of object.
Definition: TPave.h:62
TClassTree::ShowClassesUsing
virtual void ShowClassesUsing(const char *classes)
mark classes using any class in the list of classes in classes
Definition: TClassTree.cxx:925
TClassTree::SaveAs
virtual void SaveAs(const char *filename="", Option_t *option="") const
save current configuration in a Root file if filename is blank, the name of the file will be the curr...
Definition: TClassTree.cxx:684
TBox::fY1
Double_t fY1
Y of 1st point.
Definition: TBox.h:29
TPaveClass::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TPaveClass.cxx:142
TPaveLabel
Definition: TPaveLabel.h:20
TClassTree::ShowClassesUsedBy
virtual void ShowClassesUsedBy(const char *classes)
mark classes used by the list of classes in classes
Definition: TClassTree.cxx:894
TPaveClass::ShowClassesUsedBy
virtual void ShowClassesUsedBy(const char *classes="this")
Show classes used by.
Definition: TPaveClass.cxx:122
TClassTree::SetClasses
virtual void SetClasses(const char *classes, Option_t *option="ID")
Set the list of classes for which the hierarchy is to be drawn See Paint for the syntax.
Definition: TClassTree.cxx:860
Double_t
double Double_t
Definition: RtypesCore.h:59
TPave::fOption
TString fOption
Pave style.
Definition: TPave.h:36
TClassTree::ShowLinks
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
Definition: TClassTree.cxx:1039
TPaveClass::DrawClasses
virtual void DrawClasses(const char *classes="this")
Draw classes.
Definition: TPaveClass.cxx:79
TObject
Definition: TObject.h:37
TBox::fY2
Double_t fY2
Y of 2nd point.
Definition: TBox.h:31
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TPaveClass::fClassTree
TClassTree * fClassTree
Pointer to the TClassTree referencing this object.
Definition: TPaveClass.h:32
TPaveClass.h
SetTextFont
pt SetTextFont(42)
TPave::SetName
virtual void SetName(const char *name="")
Definition: TPave.h:81
Class
void Class()
Definition: Class.C:29
gROOT
#define gROOT
Definition: TROOT.h:406