Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
19class TObject;
20class TList;
21class TLegendEntry;
22
23class TLegend : public TPave , public TAttText {
24
25protected:
27
28public:
31 const char* header = "", Option_t* option="brNDC" );
32 TLegend( Double_t w, Double_t h, const char* header = "", Option_t* option="brNDC" );
33 ~TLegend() override;
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 void Clear( Option_t* option = "" ) override; // *MENU*
39 void Copy( TObject &obj ) const override;
40 virtual void DeleteEntry(); // *MENU*
41 void Draw( Option_t* option = "" ) override;
42 virtual void EditEntryAttFill();
43 virtual void EditEntryAttLine();
44 virtual void EditEntryAttMarker();
45 virtual void EditEntryAttText();
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 void Paint( Option_t* option = "" ) override;
57 virtual void PaintPrimitives();
58 void Print( Option_t* option = "" ) const override;
59 void RecursiveRemove(TObject *obj) override;
60 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
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
72protected:
73 TList *fPrimitives{nullptr}; ///< 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 ClassDefOverride(TLegend,3) // Legend of markers/lines/boxes to represent obj's
83};
84
85#endif
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
Storage class for one entry of a TLegend.
virtual void InsertEntry(const char *objectName="", const char *label="", Option_t *option="lpf")
void Copy(TObject &obj) const override
Copy a Box.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
virtual void EditEntryAttText()
void SetNColumns(Int_t nColumns)
void Draw(Option_t *option="") override
Draw this box with its current attributes.
TLegend(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char *header="", Option_t *option="brNDC")
TLegend(const TLegend &legend)
TLegendEntry * GetEntry() const
Float_t GetColumnSeparation() const
Definition TLegend.h:46
void Clear(Option_t *option="") override
Float_t fEntrySeparation
Separation between entries, as a fraction of The space allocated to one entry.
Definition TLegend.h:74
void SetEntrySeparation(Float_t entryseparation)
Definition TLegend.h:66
TList * GetListOfPrimitives() const
Definition TLegend.h:50
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
void Paint(Option_t *option="") override
Paint this box with its current attributes.
Int_t GetNColumns() const
Definition TLegend.h:52
void SetDefaults()
Definition TLegend.h:61
void RecursiveRemove(TObject *obj) override
Recursively remove this object from a list.
virtual const char * GetHeader() const
Float_t fMargin
Fraction of total width used for symbol.
Definition TLegend.h:77
Int_t GetNRows() const
virtual void SetHeader(const char *header="", Option_t *option="")
TList * fPrimitives
List of TLegendEntries.
Definition TLegend.h:73
Int_t fNColumns
Number of columns in the legend.
Definition TLegend.h:78
Float_t fColumnSeparation
Separation between columns, as a fraction of The space allowed to one column.
Definition TLegend.h:79
virtual void EditEntryAttMarker()
virtual void SetEntryOption(Option_t *option)
virtual void EditEntryAttLine()
TLegendEntry * AddEntry(const char *name, const char *label="", Option_t *option="lpf")
Float_t GetEntrySeparation() const
Definition TLegend.h:48
TLegend(Double_t w, Double_t h, const char *header="", Option_t *option="brNDC")
~TLegend() override
TLegend & operator=(const TLegend &)
virtual void SetEntryLabel(const char *label)
virtual void PaintPrimitives()
void Print(Option_t *option="") const override
Dump this box with its attributes.
void SetMargin(Float_t margin)
Definition TLegend.h:69
virtual void DeleteEntry()
virtual void EditEntryAttFill()
Float_t GetMargin() const
Definition TLegend.h:51
void SetColumnSeparation(Float_t columnSeparation)
Definition TLegend.h:62
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:42
TObject()
TObject constructor.
Definition TObject.h:259
TPave()
Pave default constructor.
Definition TPave.cxx:35