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
18
19
20/** \class TPaveClass
21\ingroup gpad
22
23A TPaveLabel specialized to process classes inside a TClassTree.
24A TPaveClass object is used by the TClassTree to represent a class.
25A TPaveClass has the same graphical representation as a TPaveLabel.
26
27Using the context menu on can select additional options in the ClassTree:
28 - Show classes using this class
29 - Show all classes used by this class
30*/
31
32////////////////////////////////////////////////////////////////////////////////
33/// PaveClass default constructor.
34
36{
37 fClassTree = nullptr;
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// PaveClass normal constructor.
42
44 :TPaveLabel(x1,y1,x2,y2,label,"br")
45{
47 SetName(label);
48 SetTextFont(61);
49}
50
51////////////////////////////////////////////////////////////////////////////////
52/// PaveClass default destructor.
53
57
58////////////////////////////////////////////////////////////////////////////////
59/// PaveClass copy constructor.
60
62{
63 PaveClass.TPaveClass::Copy(*this);
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Copy this PaveClass to PaveClass.
68
69void TPaveClass::Copy(TObject &obj) const
70{
72 ((TPaveClass&)obj).fClassTree = fClassTree;
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// Draw classes.
77
78void TPaveClass::DrawClasses(const char *classes)
79{
80 if (!fClassTree) return;
81 if (!strcmp(classes,"this")) fClassTree->Draw(GetName());
82 else fClassTree->Draw(classes);
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Save as.
87
88void TPaveClass::SaveAs(const char *filename, Option_t *option) const
89{
90 if (!fClassTree) return;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// Set classes.
96
97void TPaveClass::SetClasses(const char *classes, Option_t *option)
98{
99 if (!fClassTree) return;
100 if (!strcmp(classes,"this")) fClassTree->SetClasses(GetName(),option);
101 else fClassTree->SetClasses(classes,option);
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Set link options in the ClassTree object.
106///
107/// - "C" show References from code
108/// - "H" show "Has a" relations
109/// - "M" show Multiple Inheritance
110/// - "R" show References from data members
111
117
118////////////////////////////////////////////////////////////////////////////////
119/// Show classes used by.
120
121void TPaveClass::ShowClassesUsedBy(const char *classes)
122{
123 if (!fClassTree) return;
124 if (!strcmp(classes,"this")) fClassTree->ShowClassesUsedBy(GetName());
125 else fClassTree->ShowClassesUsedBy(classes);
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Show classes using.
130
131void TPaveClass::ShowClassesUsing(const char *classes)
132{
133 if (!fClassTree) return;
134 if (!strcmp(classes,"this")) fClassTree->ShowClassesUsing(GetName());
135 else fClassTree->ShowClassesUsing(classes);
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Save primitive as a C++ statement(s) on output stream out
140
141void TPaveClass::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
142{
143 SavePrimitiveConstructor(out, Class(), "pclass",
144 TString::Format("%g, %g, %g, %g, \"%s\", \"%s\"", fX1, fY1, fX2, fY2,
145 TString(fLabel).ReplaceSpecialCppChars().Data(),
146 TString(fOption).ReplaceSpecialCppChars().Data()));
147
148 SaveFillAttributes(out, "pclass", 0, 1001);
149 SaveLineAttributes(out, "pclass", 1, 1, 1);
150 SaveTextAttributes(out, "pclass", 22, 0, 1, 62, 0);
151
152 out << " pclass->Draw();\n";
153}
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
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:238
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:274
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:372
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
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:771
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:58
virtual void SetName(const char *name="")
Definition TPave.h:81
TString fOption
Pave style.
Definition TPave.h:30
Basic string class.
Definition TString.h:138
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384