ROOT logo
// @(#)root/graf:$Id: TLegend.h 26711 2008-12-06 19:50:17Z brun $
// Author: Matthew.Adam.Dobbs   06/09/99

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
//--------------------------------------------------------------------------
#ifndef ROOT_TLegend
#define ROOT_TLegend


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TLegend        (a second attempt- the first was TPadLegend           //
// Matthew.Adam.Dobbs@Cern.CH, September 1999                           //
// Legend of markers/lines/boxes for histos & graphs                    //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TPave
#include "TPave.h"
#endif
#ifndef ROOT_TAttText
#include "TAttText.h"
#endif

class TObject;
class TList;
class TLegendEntry;

class TLegend : public TPave , public TAttText {

protected:
   TLegend& operator=(const TLegend&);

public:
   TLegend();
   TLegend( Double_t x1, Double_t y1, Double_t x2, Double_t y2,
            const char* header = "", Option_t* option="brNDC" );
   virtual ~TLegend();
   TLegend( const TLegend &legend );

   TLegendEntry   *AddEntry(const TObject* obj, const char* label = "", Option_t* option = "lpf" );
   TLegendEntry   *AddEntry(const char *name, const char* label = "", Option_t* option = "lpf" );
   virtual void    Clear( Option_t* option = "" ); // *MENU*
   virtual void    Copy( TObject &obj ) const;
   virtual void    DeleteEntry(); // *MENU*
   virtual void    Draw( Option_t* option = "" );
   virtual void    EditEntryAttFill();
   virtual void    EditEntryAttLine();
   virtual void    EditEntryAttMarker();
   virtual void    EditEntryAttText();
   Float_t         GetColumnSeparation() const { return fColumnSeparation; }
   TLegendEntry   *GetEntry() const;
   Float_t         GetEntrySeparation() const { return fEntrySeparation; }
   virtual const char *GetHeader() const;
   TList          *GetListOfPrimitives() const {return fPrimitives;}
   Float_t         GetMargin() const { return fMargin; }
   Int_t           GetNColumns() const { return fNColumns; }
   Int_t           GetNRows() const;
   virtual void    InsertEntry( const char* objectName = "",const char* label = "",
                             Option_t* option = "lpf" ); // *MENU*
   virtual void    Paint( Option_t* option = "" );
   virtual void    PaintPrimitives();
   virtual void    Print( Option_t* option = "" ) const;
   virtual void    RecursiveRemove(TObject *obj);
   virtual void    SavePrimitive(ostream &out, Option_t *option  = "");
   void            SetDefaults() { fEntrySeparation = 0.1f; fMargin = 0.25f; fNColumns = 1; fColumnSeparation = 0.0f; }
   void            SetColumnSeparation( Float_t columnSeparation )
                     { fColumnSeparation = columnSeparation; } // *MENU*
   virtual void    SetEntryLabel( const char* label ); // *MENU*
   virtual void    SetEntryOption( Option_t* option ); // *MENU*
   void            SetEntrySeparation( Float_t entryseparation )
                     { fEntrySeparation = entryseparation; } // *MENU*
   virtual void    SetHeader( const char *header = "" );  // *MENU*
   void            SetMargin( Float_t margin ) { fMargin = margin; } // *MENU*
   void            SetNColumns( Int_t nColumns ); // *MENU*

protected:
   TList     *fPrimitives;       // list of TLegendEntries
   Float_t    fEntrySeparation;  // separation between entries, as a fraction of
                                 // the space allocated to one entry.
                                 // Typical value is 0.1.
   Float_t    fMargin;           // fraction of total width used for symbol
   Int_t      fNColumns;         // number of columns in the legend
   Float_t    fColumnSeparation; // separation between columns, as a fraction of 
                                 // the space allowed to one column

   ClassDef(TLegend,2) // Legend of markers/lines/boxes to represent obj's
};

#endif
 TLegend.h:1
 TLegend.h:2
 TLegend.h:3
 TLegend.h:4
 TLegend.h:5
 TLegend.h:6
 TLegend.h:7
 TLegend.h:8
 TLegend.h:9
 TLegend.h:10
 TLegend.h:11
 TLegend.h:12
 TLegend.h:13
 TLegend.h:14
 TLegend.h:15
 TLegend.h:16
 TLegend.h:17
 TLegend.h:18
 TLegend.h:19
 TLegend.h:20
 TLegend.h:21
 TLegend.h:22
 TLegend.h:23
 TLegend.h:24
 TLegend.h:25
 TLegend.h:26
 TLegend.h:27
 TLegend.h:28
 TLegend.h:29
 TLegend.h:30
 TLegend.h:31
 TLegend.h:32
 TLegend.h:33
 TLegend.h:34
 TLegend.h:35
 TLegend.h:36
 TLegend.h:37
 TLegend.h:38
 TLegend.h:39
 TLegend.h:40
 TLegend.h:41
 TLegend.h:42
 TLegend.h:43
 TLegend.h:44
 TLegend.h:45
 TLegend.h:46
 TLegend.h:47
 TLegend.h:48
 TLegend.h:49
 TLegend.h:50
 TLegend.h:51
 TLegend.h:52
 TLegend.h:53
 TLegend.h:54
 TLegend.h:55
 TLegend.h:56
 TLegend.h:57
 TLegend.h:58
 TLegend.h:59
 TLegend.h:60
 TLegend.h:61
 TLegend.h:62
 TLegend.h:63
 TLegend.h:64
 TLegend.h:65
 TLegend.h:66
 TLegend.h:67
 TLegend.h:68
 TLegend.h:69
 TLegend.h:70
 TLegend.h:71
 TLegend.h:72
 TLegend.h:73
 TLegend.h:74
 TLegend.h:75
 TLegend.h:76
 TLegend.h:77
 TLegend.h:78
 TLegend.h:79
 TLegend.h:80
 TLegend.h:81
 TLegend.h:82
 TLegend.h:83
 TLegend.h:84
 TLegend.h:85
 TLegend.h:86
 TLegend.h:87
 TLegend.h:88
 TLegend.h:89
 TLegend.h:90
 TLegend.h:91
 TLegend.h:92
 TLegend.h:93
 TLegend.h:94
 TLegend.h:95
 TLegend.h:96