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 "Riostream.h"
12#include "TROOT.h"
13#include "Buttons.h"
14#include "TPaveClass.h"
15
17
18
19/** \class TPaveClass
20\ingroup gpad
21
22A TPaveLabel specialized to process classes inside a TClassTree.
23A TPaveClass object is used by the TClassTree to represent a class.
24A TPaveClass has the same graphical representation as a TPaveLabel.
25
26Using the context menu on can select additional options in the ClassTree:
27 - Show classes using this class
28 - Show all classes used by this class
29*/
30
31////////////////////////////////////////////////////////////////////////////////
32/// PaveClass default constructor.
33
35{
36 fClassTree = 0;
37}
38
39////////////////////////////////////////////////////////////////////////////////
40/// PaveClass normal constructor.
41
43 :TPaveLabel(x1,y1,x2,y2,label,"br")
44{
45 fClassTree = classtree;
46 SetName(label);
47 SetTextFont(61);
48}
49
50////////////////////////////////////////////////////////////////////////////////
51/// PaveClass default destructor.
52
54{
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// PaveClass copy constructor.
59
60TPaveClass::TPaveClass(const TPaveClass &PaveClass) : TPaveLabel(PaveClass)
61{
62 ((TPaveClass&)PaveClass).Copy(*this);
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// Copy this PaveClass to PaveClass.
67
68void TPaveClass::Copy(TObject &obj) const
69{
71 ((TPaveClass&)obj).fClassTree = fClassTree;
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Draw classes.
76
77void TPaveClass::DrawClasses(const char *classes)
78{
79 if (!fClassTree) return;
80 if (!strcmp(classes,"this")) fClassTree->Draw(GetName());
81 else fClassTree->Draw(classes);
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Save as.
86
87void TPaveClass::SaveAs(const char *filename, Option_t *option) const
88{
89 if (!fClassTree) return;
90 fClassTree->SaveAs(filename,option);
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Set classes.
95
96void TPaveClass::SetClasses(const char *classes, Option_t *option)
97{
98 if (!fClassTree) return;
99 if (!strcmp(classes,"this")) fClassTree->SetClasses(GetName(),option);
100 else fClassTree->SetClasses(classes,option);
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Set link options in the ClassTree object.
105///
106/// - "C" show References from code
107/// - "H" show "Has a" relations
108/// - "M" show Multiple Inheritance
109/// - "R" show References from data members
110
112{
113 if (!fClassTree) return;
114 fClassTree->ShowLinks(option);
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Show classes used by.
119
120void TPaveClass::ShowClassesUsedBy(const char *classes)
121{
122 if (!fClassTree) return;
123 if (!strcmp(classes,"this")) fClassTree->ShowClassesUsedBy(GetName());
124 else fClassTree->ShowClassesUsedBy(classes);
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Show classes using.
129
130void TPaveClass::ShowClassesUsing(const char *classes)
131{
132 if (!fClassTree) return;
133 if (!strcmp(classes,"this")) fClassTree->ShowClassesUsing(GetName());
134 else fClassTree->ShowClassesUsing(classes);
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Save primitive as a C++ statement(s) on output stream out
139
140void TPaveClass::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
141{
142 char quote = '"';
143 out<<" "<<std::endl;
144 if (gROOT->ClassSaved(TPaveClass::Class())) {
145 out<<" ";
146 } else {
147 out<<" TPaveClass *";
148 }
149 out<<"pclass = new TPaveClass("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2
150 <<","<<quote<<fLabel<<quote<<","<<quote<<fOption<<quote<<");"<<std::endl;
151
152 SaveFillAttributes(out,"pclass",0,1001);
153 SaveLineAttributes(out,"pclass",1,1,1);
154 SaveTextAttributes(out,"pclass",22,0,1,62,0);
155
156 out<<" pclass->Draw();"<<std::endl;
157}
void Class()
Definition: Class.C:29
static const double x2[5]
static const double x1[5]
double Double_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
#define gROOT
Definition: TROOT.h:415
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
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
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Definition: TAttText.h:45
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
Double_t fX1
X of 1st point.
Definition: TBox.h:30
Double_t fY2
Y of 2nd point.
Definition: TBox.h:33
Double_t fX2
X of 2nd point.
Definition: TBox.h:32
Double_t fY1
Y of 1st point.
Definition: TBox.h:31
Draw inheritance tree and their relations for a list of classes.
Definition: TClassTree.h:21
virtual void ShowClassesUsedBy(const char *classes)
mark classes used by the list of classes in classes
Definition: TClassTree.cxx:890
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
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:856
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:681
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:259
virtual void ShowClassesUsing(const char *classes)
mark classes using any class in the list of classes in classes
Definition: TClassTree.cxx:921
Mother of all ROOT objects.
Definition: TObject.h:37
A TPaveLabel specialized to process classes inside a TClassTree.
Definition: TPaveClass.h:19
void Copy(TObject &PaveVar) const
Copy this PaveClass to PaveClass.
Definition: TPaveClass.cxx:68
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
Definition: TPaveClass.cxx:111
virtual void ShowClassesUsedBy(const char *classes="this")
Show classes used by.
Definition: TPaveClass.cxx:120
virtual void DrawClasses(const char *classes="this")
Draw classes.
Definition: TPaveClass.cxx:77
TPaveClass()
PaveClass default constructor.
Definition: TPaveClass.cxx:34
virtual ~TPaveClass()
PaveClass default destructor.
Definition: TPaveClass.cxx:53
TClassTree * fClassTree
Pointer to the TClassTree referencing this object.
Definition: TPaveClass.h:22
virtual void ShowClassesUsing(const char *classes="this")
Show classes using.
Definition: TPaveClass.cxx:130
virtual void SetClasses(const char *classes="this", Option_t *option="ID")
Set classes.
Definition: TPaveClass.cxx:96
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save as.
Definition: TPaveClass.cxx:87
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TPaveClass.cxx:140
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:20
void Copy(TObject &pavelabel) const
Copy this pavelabel to pavelabel.
Definition: TPaveLabel.cxx:67
TString fLabel
Label written at the center of Pave.
Definition: TPaveLabel.h:23
virtual void SetName(const char *name="")
Definition: TPave.h:75
Option_t * GetName() const
Returns name of object.
Definition: TPave.h:56
TString fOption
Pave style.
Definition: TPave.h:30