Logo ROOT  
Reference Guide
TLegend.h
Go to the documentation of this file.
1 // @(#)root/graf:$Id$
2 // Author: Matthew.Adam.Dobbs 06/09/99
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 //--------------------------------------------------------------------------
12 #ifndef ROOT_TLegend
13 #define ROOT_TLegend
14 
15 
16 #include "TPave.h"
17 #include "TAttText.h"
18 
19 class TObject;
20 class TList;
21 class TLegendEntry;
22 
23 class TLegend : public TPave , public TAttText {
24 
25 protected:
26  TLegend& operator=(const TLegend&);
27 
28 public:
29  TLegend();
31  const char* header = "", Option_t* option="brNDC" );
32  TLegend( Double_t w, Double_t h, const char* header = "", Option_t* option="brNDC" );
33  virtual ~TLegend();
34  TLegend( const TLegend &legend );
35 
36  TLegendEntry *AddEntry(const TObject* obj, const char* label = "", Option_t* option = "lpf" );
37  TLegendEntry *AddEntry(const char *name, const char* label = "", Option_t* option = "lpf" );
38  virtual void Clear( Option_t* option = "" ); // *MENU*
39  virtual void Copy( TObject &obj ) const;
40  virtual void DeleteEntry(); // *MENU*
41  virtual void Draw( Option_t* option = "" );
42  virtual void EditEntryAttFill();
43  virtual void EditEntryAttLine();
44  virtual void EditEntryAttMarker();
45  virtual void EditEntryAttText();
47  TLegendEntry *GetEntry() const;
49  virtual const char *GetHeader() const;
51  Float_t GetMargin() const { return fMargin; }
52  Int_t GetNColumns() const { return fNColumns; }
53  Int_t GetNRows() const;
54  virtual void InsertEntry( const char* objectName = "",const char* label = "",
55  Option_t* option = "lpf" ); // *MENU*
56  virtual void Paint( Option_t* option = "" );
57  virtual void PaintPrimitives();
58  virtual void Print( Option_t* option = "" ) const;
59  virtual void RecursiveRemove(TObject *obj);
60  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
61  void SetDefaults() { fEntrySeparation = 0.1f; fMargin = 0.25f; fNColumns = 1; fColumnSeparation = 0.0f; }
62  void SetColumnSeparation( Float_t columnSeparation )
63  { fColumnSeparation = columnSeparation; } // *MENU*
64  virtual void SetEntryLabel( const char* label ); // *MENU*
65  virtual void SetEntryOption( Option_t* option ); // *MENU*
66  void SetEntrySeparation( Float_t entryseparation )
67  { fEntrySeparation = entryseparation; } // *MENU*
68  virtual void SetHeader( const char *header = "", Option_t *option = "" ); // *MENU*
69  void SetMargin( Float_t margin ) { fMargin = margin; } // *MENU*
70  void SetNColumns( Int_t nColumns ); // *MENU*
71 
72 protected:
73  TList *fPrimitives; ///< List of TLegendEntries
74  Float_t fEntrySeparation; ///< Separation between entries, as a fraction of
75  ///< The space allocated to one entry.
76  ///< Typical value is 0.1.
77  Float_t fMargin; ///< Fraction of total width used for symbol
78  Int_t fNColumns; ///< Number of columns in the legend
79  Float_t fColumnSeparation; ///< Separation between columns, as a fraction of
80  ///< The space allowed to one column
81 
82  ClassDef(TLegend,3) // Legend of markers/lines/boxes to represent obj's
83 };
84 
85 #endif
TLegend::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save this legend as C++ statements on output stream out to be used with the SaveAs ....
Definition: TLegend.cxx:1049
TAttText
Definition: TAttText.h:18
TLegend::fEntrySeparation
Float_t fEntrySeparation
Separation between entries, as a fraction of The space allocated to one entry.
Definition: TLegend.h:74
TLegend::PaintPrimitives
virtual void PaintPrimitives()
Paint the entries (list of primitives) for this legend.
Definition: TLegend.cxx:615
TLegend::operator=
TLegend & operator=(const TLegend &)
Assignment operator.
Definition: TLegend.cxx:295
TLegend::SetNColumns
void SetNColumns(Int_t nColumns)
Set the number of columns for the legend.
Definition: TLegend.cxx:603
TAttText.h
TLegend::GetColumnSeparation
Float_t GetColumnSeparation() const
Definition: TLegend.h:46
TLegend::GetListOfPrimitives
TList * GetListOfPrimitives() const
Definition: TLegend.h:50
TLegend::SetDefaults
void SetDefaults()
Definition: TLegend.h:61
Float_t
float Float_t
Definition: RtypesCore.h:57
TLegend::SetEntryOption
virtual void SetEntryOption(Option_t *option)
Edit the option of the entry pointed to by the mouse.
Definition: TLegend.cxx:1089
Int_t
int Int_t
Definition: RtypesCore.h:45
TLegend::GetMargin
Float_t GetMargin() const
Definition: TLegend.h:51
TLegend::EditEntryAttLine
virtual void EditEntryAttLine()
Edit the line attributes for the entry pointed by the mouse.
Definition: TLegend.cxx:442
TLegend::SetHeader
virtual void SetHeader(const char *header="", Option_t *option="")
Sets the header, which is the "title" that appears at the top of the legend.
Definition: TLegend.cxx:1099
TLegend::fMargin
Float_t fMargin
Fraction of total width used for symbol.
Definition: TLegend.h:77
TLegend::~TLegend
virtual ~TLegend()
Default destructor.
Definition: TLegend.cxx:311
TLegend::GetEntrySeparation
Float_t GetEntrySeparation() const
Definition: TLegend.h:48
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TLegend::Clear
virtual void Clear(Option_t *option="")
Clear all entries in this legend, including the header.
Definition: TLegend.cxx:390
h
#define h(i)
Definition: RSha256.hxx:124
TLegend::DeleteEntry
virtual void DeleteEntry()
Delete entry at the mouse position.
Definition: TLegend.cxx:411
TLegend::GetNRows
Int_t GetNRows() const
Get the number of rows.
Definition: TLegend.cxx:583
TLegend::SetEntrySeparation
void SetEntrySeparation(Float_t entryseparation)
Definition: TLegend.h:66
TLegend::AddEntry
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition: TLegend.cxx:330
TLegendEntry
Definition: TLegendEntry.h:24
TLegend::EditEntryAttMarker
virtual void EditEntryAttMarker()
Edit the marker attributes for the entry pointed by the mouse.
Definition: TLegend.cxx:453
TLegend::SetEntryLabel
virtual void SetEntryLabel(const char *label)
Edit the label of the entry pointed to by the mouse.
Definition: TLegend.cxx:1080
TPave
Definition: TPave.h:19
TLegend::TLegend
TLegend()
Default constructor.
Definition: TLegend.cxx:200
TLegend::GetHeader
virtual const char * GetHeader() const
Returns the header, which is the title that appears at the top of the legend.
Definition: TLegend.cxx:517
TLegend::Copy
virtual void Copy(TObject &obj) const
Copy this legend into "obj".
Definition: TLegend.cxx:399
TLegend::fPrimitives
TList * fPrimitives
List of TLegendEntries.
Definition: TLegend.h:73
TLegend::EditEntryAttText
virtual void EditEntryAttText()
Edit the text attributes for the entry pointed by the mouse.
Definition: TLegend.cxx:464
TLegend::EditEntryAttFill
virtual void EditEntryAttFill()
Edit the fill attributes for the entry pointed by the mouse.
Definition: TLegend.cxx:431
Double_t
double Double_t
Definition: RtypesCore.h:59
TLegend::fNColumns
Int_t fNColumns
Number of columns in the legend.
Definition: TLegend.h:78
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TLegend::fColumnSeparation
Float_t fColumnSeparation
Separation between columns, as a fraction of The space allowed to one column.
Definition: TLegend.h:79
TLegend::Print
virtual void Print(Option_t *option="") const
Dump this TLegend and its contents.
Definition: TLegend.cxx:1027
name
char name[80]
Definition: TGX11.cxx:110
TLegend::Paint
virtual void Paint(Option_t *option="")
Paint this legend with its current attributes.
Definition: TLegend.cxx:558
TPave.h
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TLegend::Draw
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Definition: TLegend.cxx:423
TLegend
Definition: TLegend.h:23
TLegend::SetColumnSeparation
void SetColumnSeparation(Float_t columnSeparation)
Definition: TLegend.h:62
TLegend::RecursiveRemove
virtual void RecursiveRemove(TObject *obj)
Reset the legend entries pointing to "obj".
Definition: TLegend.cxx:1036
TLegend::GetNColumns
Int_t GetNColumns() const
Definition: TLegend.h:52
TLegend::InsertEntry
virtual void InsertEntry(const char *objectName="", const char *label="", Option_t *option="lpf")
Add a new entry before the entry at the mouse position.
Definition: TLegend.cxx:533
TList
Definition: TList.h:44
TLegend::GetEntry
TLegendEntry * GetEntry() const
Get entry pointed to by the mouse.
Definition: TLegend.cxx:476
TLegend::SetMargin
void SetMargin(Float_t margin)
Definition: TLegend.h:69
int