TLegend.h

Go to the documentation of this file.
00001 // @(#)root/graf:$Id: TLegend.h 26711 2008-12-06 19:50:17Z brun $
00002 // Author: Matthew.Adam.Dobbs   06/09/99
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 //--------------------------------------------------------------------------
00012 #ifndef ROOT_TLegend
00013 #define ROOT_TLegend
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TLegend        (a second attempt- the first was TPadLegend           //
00019 // Matthew.Adam.Dobbs@Cern.CH, September 1999                           //
00020 // Legend of markers/lines/boxes for histos & graphs                    //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TPave
00025 #include "TPave.h"
00026 #endif
00027 #ifndef ROOT_TAttText
00028 #include "TAttText.h"
00029 #endif
00030 
00031 class TObject;
00032 class TList;
00033 class TLegendEntry;
00034 
00035 class TLegend : public TPave , public TAttText {
00036 
00037 protected:
00038    TLegend& operator=(const TLegend&);
00039 
00040 public:
00041    TLegend();
00042    TLegend( Double_t x1, Double_t y1, Double_t x2, Double_t y2,
00043             const char* header = "", Option_t* option="brNDC" );
00044    virtual ~TLegend();
00045    TLegend( const TLegend &legend );
00046 
00047    TLegendEntry   *AddEntry(const TObject* obj, const char* label = "", Option_t* option = "lpf" );
00048    TLegendEntry   *AddEntry(const char *name, const char* label = "", Option_t* option = "lpf" );
00049    virtual void    Clear( Option_t* option = "" ); // *MENU*
00050    virtual void    Copy( TObject &obj ) const;
00051    virtual void    DeleteEntry(); // *MENU*
00052    virtual void    Draw( Option_t* option = "" );
00053    virtual void    EditEntryAttFill();
00054    virtual void    EditEntryAttLine();
00055    virtual void    EditEntryAttMarker();
00056    virtual void    EditEntryAttText();
00057    Float_t         GetColumnSeparation() const { return fColumnSeparation; }
00058    TLegendEntry   *GetEntry() const;
00059    Float_t         GetEntrySeparation() const { return fEntrySeparation; }
00060    virtual const char *GetHeader() const;
00061    TList          *GetListOfPrimitives() const {return fPrimitives;}
00062    Float_t         GetMargin() const { return fMargin; }
00063    Int_t           GetNColumns() const { return fNColumns; }
00064    Int_t           GetNRows() const;
00065    virtual void    InsertEntry( const char* objectName = "",const char* label = "",
00066                              Option_t* option = "lpf" ); // *MENU*
00067    virtual void    Paint( Option_t* option = "" );
00068    virtual void    PaintPrimitives();
00069    virtual void    Print( Option_t* option = "" ) const;
00070    virtual void    RecursiveRemove(TObject *obj);
00071    virtual void    SavePrimitive(ostream &out, Option_t *option  = "");
00072    void            SetDefaults() { fEntrySeparation = 0.1f; fMargin = 0.25f; fNColumns = 1; fColumnSeparation = 0.0f; }
00073    void            SetColumnSeparation( Float_t columnSeparation )
00074                      { fColumnSeparation = columnSeparation; } // *MENU*
00075    virtual void    SetEntryLabel( const char* label ); // *MENU*
00076    virtual void    SetEntryOption( Option_t* option ); // *MENU*
00077    void            SetEntrySeparation( Float_t entryseparation )
00078                      { fEntrySeparation = entryseparation; } // *MENU*
00079    virtual void    SetHeader( const char *header = "" );  // *MENU*
00080    void            SetMargin( Float_t margin ) { fMargin = margin; } // *MENU*
00081    void            SetNColumns( Int_t nColumns ); // *MENU*
00082 
00083 protected:
00084    TList     *fPrimitives;       // list of TLegendEntries
00085    Float_t    fEntrySeparation;  // separation between entries, as a fraction of
00086                                  // the space allocated to one entry.
00087                                  // Typical value is 0.1.
00088    Float_t    fMargin;           // fraction of total width used for symbol
00089    Int_t      fNColumns;         // number of columns in the legend
00090    Float_t    fColumnSeparation; // separation between columns, as a fraction of 
00091                                  // the space allowed to one column
00092 
00093    ClassDef(TLegend,2) // Legend of markers/lines/boxes to represent obj's
00094 };
00095 
00096 #endif

Generated on Tue Jul 5 14:14:09 2011 for ROOT_528-00b_version by  doxygen 1.5.1