1    	// @(#)root/hist:$Id$
2    	// Author: Rene Brun   12/12/94
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_TAxis
13   	#define ROOT_TAxis
14   	
15   	
16   	//////////////////////////////////////////////////////////////////////////
17   	//                                                                      //
18   	// TAxis                                                                //
19   	//                                                                      //
20   	// Axis class.                                                          //
21   	//                                                                      //
22   	//////////////////////////////////////////////////////////////////////////
23   	
24   	#ifndef ROOT_TNamed
25   	#include "TNamed.h"
26   	#endif
27   	#ifndef ROOT_TAttAxis
28   	#include "TAttAxis.h"
29   	#endif
30   	#ifndef ROOT_TArrayD
31   	#include "TArrayD.h"
32   	#endif
33   	
34   	class THashList;
35   	
36   	class TAxis : public TNamed, public TAttAxis {
37   	
38   	private:
39   	   Int_t        fNbins;          //Number of bins
40   	   Double_t     fXmin;           //low edge of first bin
41   	   Double_t     fXmax;           //upper edge of last bin
42   	   TArrayD      fXbins;          //Bin edges array in X
43   	   Int_t        fFirst;          //first bin to display
44   	   Int_t        fLast;           //last bin to display
45   	   UShort_t     fBits2;          //second bit status word
46   	   Bool_t       fTimeDisplay;    //on/off displaying time values instead of numerics
47   	   TString      fTimeFormat;     //Date&time format, ex: 09/12/99 12:34:00
48   	   TObject     *fParent;         //!Object owning this axis
49   	   THashList   *fLabels;         //List of labels
50   	
51   	public:
52   	   // TAxis status bits
53   	   enum { kTickPlus      = BIT(9),
54   	          kTickMinus     = BIT(10),
55   	          kAxisRange     = BIT(11),
56   	          kCenterTitle   = BIT(12),
57   	          kCenterLabels  = BIT(14), //bit 13 is used by TObject
58   	          kRotateTitle   = BIT(15),
59   	          kPalette       = BIT(16),
60   	          kNoExponent    = BIT(17),
61   	          kLabelsHori    = BIT(18),
62   	          kLabelsVert    = BIT(19),
63   	          kLabelsDown    = BIT(20),
64   	          kLabelsUp      = BIT(21),
65   	          kIsInteger     = BIT(22),
66   	          kMoreLogLabels = BIT(23),
67   	          kDecimals      = BIT(11)}; //in fBits2
68   	
69   	   TAxis();
70   	   TAxis(Int_t nbins, Double_t xmin, Double_t xmax);
71   	   TAxis(Int_t nbins, const Double_t *xbins);
72   	   TAxis(const TAxis &axis);
73   	   virtual ~TAxis();
74   	   TAxis& operator=(const TAxis&);
75   	
76   	   virtual void       CenterLabels(Bool_t center=kTRUE);  // *TOGGLE* *GETTER=GetCenterLabels
77   	   virtual void       CenterTitle(Bool_t center=kTRUE);  // *TOGGLE* *GETTER=GetCenterTitle
78   	   const char        *ChooseTimeFormat(Double_t axislength=0);
79   	   virtual void       Copy(TObject &axis) const;
80   	   virtual void       Delete(Option_t * /*option*/ ="") { }
81   	   virtual Int_t      DistancetoPrimitive(Int_t px, Int_t py);
82   	   virtual TObject   *DrawClone(Option_t * /*option*/ ="") const {return 0;}
83   	   virtual void       ExecuteEvent(Int_t event, Int_t px, Int_t py);
84   	   virtual Int_t      FindBin(Double_t x);
85   	   virtual Int_t      FindBin(const char *label);
86   	   virtual Int_t      FindFixBin(Double_t x) const;
87   	   virtual Double_t   GetBinCenter(Int_t bin) const;
88   	   virtual Double_t   GetBinCenterLog(Int_t bin) const;
89   	   const char        *GetBinLabel(Int_t bin) const;
90   	   virtual Double_t   GetBinLowEdge(Int_t bin) const;
91   	   virtual Double_t   GetBinUpEdge(Int_t bin) const;
92   	   virtual Double_t   GetBinWidth(Int_t bin) const;
93   	   virtual void       GetCenter(Double_t *center) const;
94   	           Bool_t     GetCenterLabels() const;
95   	           Bool_t     GetCenterTitle() const;
96   	   THashList         *GetLabels() {return fLabels;}
97   	   virtual void       GetLowEdge(Double_t *edge) const;
98   	           Bool_t     GetMoreLogLabels() const;
99   	           Int_t      GetNbins() const { return fNbins; }
100  	           Bool_t     GetNoExponent() const;
101  	           Bool_t     GetDecimals() const;
102  	   virtual TObject   *GetParent() const {return fParent;}
103  	           Bool_t     GetRotateTitle() const;
104  	   virtual const char *GetTicks() const;
105  	   virtual Bool_t     GetTimeDisplay() const {return fTimeDisplay;}
106  	   virtual const char *GetTimeFormat() const {return fTimeFormat.Data();}
107  	   virtual const char *GetTimeFormatOnly() const;
108  	   const char        *GetTitle() const {return fTitle.Data();}
109  	   const TArrayD     *GetXbins() const {return &fXbins;}
110  	           Int_t      GetFirst() const;
111  	           Int_t      GetLast() const;
112  	           Double_t   GetXmin() const {return fXmin;}
113  	           Double_t   GetXmax() const {return fXmax;}
114  	   virtual void       ImportAttributes(const TAxis *axis);
115  	   Bool_t             IsVariableBinSize() const {
116  	                         // true if axis has variable bin sizes, false otherwise
117  	                         return (fXbins.GetSize() != 0);
118  	                      }
119  	   virtual void       LabelsOption(Option_t *option="h");  // *MENU*
120  	   virtual void       RotateTitle(Bool_t rotate=kTRUE); // *TOGGLE* *GETTER=GetRotateTitle
121  	   virtual void       SaveAttributes(std::ostream &out, const char *name, const char *subname);
122  	   virtual void       Set(Int_t nbins, Double_t xmin, Double_t xmax);
123  	   virtual void       Set(Int_t nbins, const Float_t *xbins);
124  	   virtual void       Set(Int_t nbins, const Double_t *xbins);
125  	   virtual void       SetBinLabel(Int_t bin, const char *label);
126  	   virtual void       SetDefaults();
127  	   virtual void       SetDrawOption(Option_t * /*option*/ ="") { }
128  	   virtual void       SetLimits(Double_t xmin, Double_t xmax);
129  	   virtual void       SetMoreLogLabels(Bool_t more=kTRUE);  // *TOGGLE* *GETTER=GetMoreLogLabels
130  	   virtual void       SetNoExponent(Bool_t noExponent=kTRUE);  // *TOGGLE* *GETTER=GetNoExponent
131  	   virtual void       SetDecimals(Bool_t dot=kTRUE);  // *TOGGLE* *GETTER=GetDecimals
132  	   virtual void       SetParent(TObject *obj) {fParent = obj;}
133  	   virtual void       SetRange(Int_t first=0, Int_t last=0);  // *MENU*
134  	   virtual void       SetRangeUser(Double_t ufirst, Double_t ulast);  // *MENU*
135  	   virtual void       SetTicks(Option_t *option="+"); // *MENU*
136  	   virtual void       SetTimeDisplay(Int_t value) {fTimeDisplay = (value != 0);} // *TOGGLE*
137  	   virtual void       SetTimeFormat(const char *format="");  // *MENU*
138  	   virtual void       SetTimeOffset(Double_t toffset, Option_t *option="local");
139  	   virtual void       UnZoom();  // *MENU*
140  	   virtual void       ZoomOut(Double_t factor=0, Double_t offset=0);  // *MENU*
141  	
142  	   ClassDef(TAxis,9)  //Axis class
143  	};
144  	
145  	#endif
146  	
147