19 ClassImp(TLegendEntry);
30 TLegendEntry::TLegendEntry(): TAttText(), TAttLine(), TAttFill(), TAttMarker()
51 TLegendEntry::TLegendEntry(
const TObject* obj,
const char* label, Option_t* option )
52 :TAttText(0,0,0,0,0), TAttLine(1,1,1), TAttFill(0,0), TAttMarker(1,21,1)
55 if ( !label && obj ) fLabel = obj->GetTitle();
58 if (obj) SetObject((TObject*)obj);
64 TLegendEntry::TLegendEntry(
const TLegendEntry &entry ) : TObject(entry), TAttText(entry), TAttLine(entry), TAttFill(entry), TAttMarker(entry)
66 ((TLegendEntry&)entry).Copy(*
this);
72 TLegendEntry::~TLegendEntry()
80 void TLegendEntry::Copy( TObject &obj )
const
83 TAttText::Copy((TLegendEntry&)obj);
84 TAttLine::Copy((TLegendEntry&)obj);
85 TAttFill::Copy((TLegendEntry&)obj);
86 TAttMarker::Copy((TLegendEntry&)obj);
87 ((TLegendEntry&)obj).fObject = fObject;
88 ((TLegendEntry&)obj).fLabel = fLabel;
89 ((TLegendEntry&)obj).fOption = fOption;
95 void TLegendEntry::Print( Option_t *)
const
98 std::cout <<
"TLegendEntry: Object ";
99 if ( fObject ) output = fObject->GetName();
100 else output =
"NULL";
101 std::cout << output <<
" Label ";
102 if ( fLabel ) output = fLabel.Data();
103 else output =
"NULL";
104 std::cout << output <<
" Option ";
105 if (fOption ) output = fOption.Data();
106 else output =
"NULL";
107 std::cout << output << std::endl;
114 void TLegendEntry::SaveEntry(std::ostream &out,
const char* name )
117 if ( gROOT->ClassSaved( TLegendEntry::Class() ) ) {
120 out <<
" TLegendEntry *entry=";
122 TString objname =
"NULL";
123 if ( fObject ) objname = fObject->GetName();
124 out << name <<
"->AddEntry("<<quote<<objname<<quote<<
","<<quote<<
125 fLabel.Data()<<quote<<
","<<quote<<fOption.Data()<<quote<<
");"<<std::endl;
126 SaveFillAttributes(out,
"entry",0,0);
127 SaveLineAttributes(out,
"entry",0,0,0);
128 SaveMarkerAttributes(out,
"entry",0,0,0);
129 SaveTextAttributes(out,
"entry",0,0,0,0,0);
135 void TLegendEntry::SetObject(TObject* obj )
137 if ( ( fObject && fLabel == fObject->GetTitle() ) || !fLabel ) {
138 if (obj) fLabel = obj->GetTitle();
146 void TLegendEntry::SetObject(
const char* objectName)
149 TList* padprimitives = gPad->GetListOfPrimitives();
150 if (padprimitives) obj = padprimitives->FindObject( objectName );
151 if (obj) SetObject( obj );