Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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-2021, 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
24A TPaveLabel specialized to process classes inside a TClassTree.
25A TPaveClass object is used by the TClassTree to represent a class.
26A TPaveClass has the same graphical representation as a TPaveLabel.
27
28Using 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 = nullptr;
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// PaveClass normal constructor.
43
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
62TPaveClass::TPaveClass(const TPaveClass &PaveClass) : TPaveLabel(PaveClass)
63{
64 PaveClass.TPaveClass::Copy(*this);
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Copy this PaveClass to PaveClass.
69
70void TPaveClass::Copy(TObject &obj) const
71{
73 ((TPaveClass&)obj).fClassTree = fClassTree;
74}
75
76////////////////////////////////////////////////////////////////////////////////
77/// Draw classes.
78
79void 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
89void TPaveClass::SaveAs(const char *filename, Option_t *option) const
90{
91 if (!fClassTree) return;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Set classes.
97
98void 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;
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Show classes used by.
121
122void 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
132void 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
142void 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}
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:406
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:239
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:275
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:373
Double_t fX1
X of 1st point.
Definition TBox.h:28
Double_t fY2
Y of 2nd point.
Definition TBox.h:31
Double_t fX2
X of 2nd point.
Definition TBox.h:30
Double_t fY1
Y of 1st point.
Definition TBox.h:29
Draw inheritance tree and their relations for a list of classes.
Definition TClassTree.h:22
virtual void ShowClassesUsedBy(const char *classes)
mark classes used by the list of classes in classes
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.
void SaveAs(const char *filename="", Option_t *option="") const override
save current configuration in a Root file if filename is blank, the name of the file will be the curr...
virtual void ShowClassesUsing(const char *classes)
mark classes using any class in the list of classes in classes
void Draw(const char *classes="") override
Draw the inheritance tree and relations for the list of classes see this class header for the syntax ...
Mother of all ROOT objects.
Definition TObject.h:41
A TPaveLabel specialized to process classes inside a TClassTree.
Definition TPaveClass.h:23
void Copy(TObject &PaveVar) const override
Copy this PaveClass to PaveClass.
virtual void ShowLinks(Option_t *option="HMR")
Set link options in the ClassTree object.
virtual void ShowClassesUsedBy(const char *classes="this")
Show classes used by.
virtual void DrawClasses(const char *classes="this")
Draw classes.
TPaveClass()
PaveClass default constructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
~TPaveClass() override
PaveClass default destructor.
TClassTree * fClassTree
Pointer to the TClassTree referencing this object.
Definition TPaveClass.h:26
virtual void ShowClassesUsing(const char *classes="this")
Show classes using.
virtual void SetClasses(const char *classes="this", Option_t *option="ID")
Set classes.
static TClass * Class()
void SaveAs(const char *filename="", Option_t *option="") const override
Save as.
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
void Copy(TObject &pavelabel) const override
Copy this pavelabel to pavelabel.
TString fLabel
Label written at the center of Pave.
Definition TPaveLabel.h:23
const char * GetName() const override
Returns name of object.
Definition TPave.h:56
virtual void SetName(const char *name="")
Definition TPave.h:79
TString fOption
Pave style.
Definition TPave.h:30