1    	// @(#)root/gpad:$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_TPad
13   	#define ROOT_TPad
14   	
15   	
16   	//////////////////////////////////////////////////////////////////////////
17   	//                                                                      //
18   	// TPad                                                                 //
19   	//                                                                      //
20   	// A Graphics pad.                                                      //
21   	//                                                                      //
22   	//                                                                      //
23   	//////////////////////////////////////////////////////////////////////////
24   	
25   	#ifndef ROOT_TVirtualPad
26   	#include "TVirtualPad.h"
27   	#endif
28   	#ifndef ROOT_TAttBBox2D
29   	#include "TAttBBox2D.h"
30   	#endif
31   	#ifndef ROOT_TPoint
32   	#include "TPoint.h"
33   	#endif
34   	#ifndef ROOT_GuiTypes
35   	#include "GuiTypes.h"
36   	#endif
37   	
38   	class TVirtualViewer3D;
39   	class TVirtualPadPainter;
40   	class TBrowser;
41   	class TBox;
42   	class TLegend;
43   	class TArrow;
44   	
45   	
46   	class TPad : public TVirtualPad, public TAttBBox2D {
47   	
48   	private:
49   	   TObject      *fTip;             //! tool tip associated with box
50   	
51   	protected:
52   	   Double_t      fX1;              //  X of lower X coordinate
53   	   Double_t      fY1;              //  Y of lower Y coordinate
54   	   Double_t      fX2;              //  X of upper X coordinate
55   	   Double_t      fY2;              //  Y of upper Y coordinate
56   	
57   	   Double_t      fXtoAbsPixelk;    //  Conversion coefficient for X World to absolute pixel
58   	   Double_t      fXtoPixelk;       //  Conversion coefficient for X World to pixel
59   	   Double_t      fXtoPixel;        //    xpixel = fXtoPixelk + fXtoPixel*xworld
60   	   Double_t      fYtoAbsPixelk;    //  Conversion coefficient for Y World to absolute pixel
61   	   Double_t      fYtoPixelk;       //  Conversion coefficient for Y World to pixel
62   	   Double_t      fYtoPixel;        //    ypixel = fYtoPixelk + fYtoPixel*yworld
63   	
64   	   Double_t      fUtoAbsPixelk;    //  Conversion coefficient for U NDC to absolute pixel
65   	   Double_t      fUtoPixelk;       //  Conversion coefficient for U NDC to pixel
66   	   Double_t      fUtoPixel;        //    xpixel = fUtoPixelk + fUtoPixel*undc
67   	   Double_t      fVtoAbsPixelk;    //  Conversion coefficient for V NDC to absolute pixel
68   	   Double_t      fVtoPixelk;       //  Conversion coefficient for V NDC to pixel
69   	   Double_t      fVtoPixel;        //    ypixel = fVtoPixelk + fVtoPixel*vndc
70   	
71   	   Double_t      fAbsPixeltoXk;    //  Conversion coefficient for absolute pixel to X World
72   	   Double_t      fPixeltoXk;       //  Conversion coefficient for pixel to X World
73   	   Double_t      fPixeltoX;        //     xworld = fPixeltoXk + fPixeltoX*xpixel
74   	   Double_t      fAbsPixeltoYk;    //  Conversion coefficient for absolute pixel to Y World
75   	   Double_t      fPixeltoYk;       //  Conversion coefficient for pixel to Y World
76   	   Double_t      fPixeltoY;        //     yworld = fPixeltoYk + fPixeltoY*ypixel
77   	
78   	   Double_t      fXlowNDC;         //  X bottom left corner of pad in NDC [0,1]
79   	   Double_t      fYlowNDC;         //  Y bottom left corner of pad in NDC [0,1]
80   	   Double_t      fXUpNDC;
81   	   Double_t      fYUpNDC;
82   	   Double_t      fWNDC;            //  Width of pad along X in NDC
83   	   Double_t      fHNDC;            //  Height of pad along Y in NDC
84   	
85   	   Double_t      fAbsXlowNDC;      //  Absolute X top left corner of pad in NDC [0,1]
86   	   Double_t      fAbsYlowNDC;      //  Absolute Y top left corner of pad in NDC [0,1]
87   	   Double_t      fAbsWNDC;         //  Absolute Width of pad along X in NDC
88   	   Double_t      fAbsHNDC;         //  Absolute Height of pad along Y in NDC
89   	
90   	   Double_t      fUxmin;           //  Minimum value on the X axis
91   	   Double_t      fUymin;           //  Minimum value on the Y axis
92   	   Double_t      fUxmax;           //  Maximum value on the X axis
93   	   Double_t      fUymax;           //  Maximum value on the Y axis
94   	
95   	   Double_t      fTheta;           //  theta angle to view as lego/surface
96   	   Double_t      fPhi;             //  phi angle   to view as lego/surface
97   	
98   	   Double_t      fAspectRatio;     //  ratio of w/h in case of fixed ratio
99   	
100  	   Int_t         fPixmapID;        //! Off-screen pixmap identifier
101  	   Int_t         fGLDevice;        //! OpenGL off-screen pixmap identifier
102  	   Bool_t        fCopyGLDevice;    //!
103  	   Bool_t        fEmbeddedGL;      //!
104  	   Int_t         fNumber;          //  pad number identifier
105  	   Int_t         fTickx;           //  Set to 1 if tick marks along X
106  	   Int_t         fTicky;           //  Set to 1 if tick marks along Y
107  	   Int_t         fLogx;            //  (=0 if X linear scale, =1 if log scale)
108  	   Int_t         fLogy;            //  (=0 if Y linear scale, =1 if log scale)
109  	   Int_t         fLogz;            //  (=0 if Z linear scale, =1 if log scale)
110  	   Int_t         fPadPaint;        //  Set to 1 while painting the pad
111  	   Int_t         fCrosshair;       //  Crosshair type (0 if no crosshair requested)
112  	   Int_t         fCrosshairPos;    //  Position of crosshair
113  	   Short_t       fBorderSize;      //  pad bordersize in pixels
114  	   Short_t       fBorderMode;      //  Bordermode (-1=down, 0 = no border, 1=up)
115  	   Bool_t        fModified;        //  Set to true when pad is modified
116  	   Bool_t        fGridx;           //  Set to true if grid along X
117  	   Bool_t        fGridy;           //  Set to true if grid along Y
118  	   Bool_t        fAbsCoord;        //  Use absolute coordinates
119  	   Bool_t        fEditable;        //  True if canvas is editable
120  	   Bool_t        fFixedAspectRatio; //  True if fixed aspect ratio
121  	   TPad         *fMother;          //! pointer to mother of the list
122  	   TCanvas      *fCanvas;          //! Pointer to mother canvas
123  	   TList        *fPrimitives;      //->List of primitives (subpads)
124  	   TList        *fExecs;           //  List of commands to be executed when a pad event occurs
125  	   TString       fName;            //  Pad name
126  	   TString       fTitle;           //  Pad title
127  	   TFrame       *fFrame;           //! Pointer to 2-D frame (if one exists)
128  	   TView        *fView;            //! Pointer to 3-D view (if one exists)
129  	   TObject      *fPadPointer;      //! free pointer
130  	   TObject      *fPadView3D;       //! 3D View of this TPad
131  	   static Int_t  fgMaxPickDistance;//  Maximum Pick Distance
132  	
133  	   // 3D Viewer support
134  	   TVirtualViewer3D *fViewer3D;    //! Current 3D viewer
135  	
136  	   void          DestroyExternalViewer3D();
137  	   virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
138  	   virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
139  	   virtual void  HideToolTip(Int_t event);
140  	   void          PaintBorder(Color_t color, Bool_t tops);
141  	   virtual void  PaintBorderPS(Double_t xl,Double_t yl,Double_t xt,Double_t yt,Int_t bmode,Int_t bsize,Int_t dark,Int_t light);
142  	   void          PaintDate();
143  	   virtual void  SavePrimitive(std::ostream &out, Option_t *option = "");
144  	   virtual void  SetBatch(Bool_t batch=kTRUE);
145  	
146  	private:
147  	   TPad(const TPad &pad);  // cannot copy pads, use TObject::Clone()
148  	   TPad &operator=(const TPad &rhs);  // idem
149  	
150  	   void CopyBackgroundPixmap(Int_t x, Int_t y);
151  	   void CopyBackgroundPixmaps(TPad *start, TPad *stop, Int_t x, Int_t y);
152  	   void DrawDist(Rectangle_t aBBox, Rectangle_t bBBox, char mode);
153  	
154  	public:
155  	   // TPad status bits
156  	   enum {
157  	      kFraming      = BIT(6),
158  	      kHori         = BIT(9),
159  	      kClipFrame    = BIT(10),
160  	      kPrintingPS   = BIT(11),
161  	      kCannotMove   = BIT(12),
162  	      kClearAfterCR = BIT(14)
163  	   };
164  	
165  	   TPad();
166  	   TPad(const char *name, const char *title, Double_t xlow,
167  	        Double_t ylow, Double_t xup, Double_t yup,
168  	        Color_t color=-1, Short_t bordersize=-1, Short_t bordermode=-2);
169  	   virtual ~TPad();
170  	   void              AbsCoordinates(Bool_t set) { fAbsCoord = set; }
171  	   Double_t          AbsPixeltoX(Int_t px) {return fAbsPixeltoXk + px*fPixeltoX;}
172  	   Double_t          AbsPixeltoY(Int_t py) {return fAbsPixeltoYk + py*fPixeltoY;}
173  	   virtual void      AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
174  	   virtual void      AddExec(const char *name, const char *command);
175  	   virtual void      AutoExec();
176  	   virtual void      Browse(TBrowser *b);
177  	   virtual TLegend  *BuildLegend(Double_t x1=0.5, Double_t y1=0.67, Double_t x2=0.88, Double_t y2=0.88, const char *title=""); // *MENU*
178  	   TVirtualPad*      cd(Int_t subpadnumber=0); // *MENU*
179  	   void              Clear(Option_t *option="");
180  	   virtual Int_t     Clip(Float_t *x, Float_t *y, Float_t xclipl, Float_t yclipb, Float_t xclipr, Float_t yclipt);
181  	   virtual Int_t     Clip(Double_t *x, Double_t *y, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt);
182  	   virtual Int_t     ClippingCode(Double_t x, Double_t y, Double_t xcl1, Double_t ycl1, Double_t xcl2, Double_t ycl2);
183  	   virtual Int_t     ClipPolygon(Int_t n, Double_t *x, Double_t *y, Int_t nn, Double_t *xc, Double_t *yc, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt);
184  	   virtual void      Close(Option_t *option="");
185  	   virtual void      Closed() { Emit("Closed()"); } // *SIGNAL*
186  	   virtual void      CopyPixmap();
187  	   virtual void      CopyPixmaps();
188  	   virtual void      DeleteExec(const char *name);
189  	   virtual void      Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0); // *MENU*
190  	   virtual void      DivideSquare(Int_t n, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0);
191  	   virtual void      Draw(Option_t *option="");
192  	   virtual void      DrawClassObject(const TObject *obj, Option_t *option="");
193  	   static  void      DrawColorTable();
194  	   virtual void      DrawCrosshair();
195  	   TH1F             *DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char *title="");
196  	   virtual void      ExecuteEventAxis(Int_t event, Int_t px, Int_t py, TAxis *axis);
197  	   virtual TObject  *FindObject(const char *name) const;
198  	   virtual TObject  *FindObject(const TObject *obj) const;
199  	   virtual void      UseCurrentStyle();  // *MENU*
200  	   virtual Short_t   GetBorderMode() const { return fBorderMode;}
201  	   virtual Short_t   GetBorderSize() const { return fBorderSize;}
202  	   Int_t             GetCrosshair() const;
203  	   virtual Int_t     GetCanvasID() const;
204  	   virtual TCanvasImp *GetCanvasImp() const;
205  	   TFrame           *GetFrame();
206  	   virtual Int_t     GetEvent() const;
207  	   virtual Int_t     GetEventX() const;
208  	   virtual Int_t     GetEventY() const;
209  	   virtual Color_t   GetHighLightColor() const;
210  	   virtual void      GetRange(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2);
211  	   virtual void      GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
212  	   virtual void      GetPadPar(Double_t &xlow, Double_t &ylow, Double_t &xup, Double_t &yup);
213  	   Double_t          GetXlowNDC() const {return fXlowNDC;}
214  	   Double_t          GetYlowNDC() const {return fYlowNDC;}
215  	   Double_t          GetWNDC() const {return fWNDC;}
216  	   Double_t          GetHNDC() const {return fHNDC;}
217  	   virtual UInt_t    GetWw() const;
218  	   virtual UInt_t    GetWh() const;
219  	   Double_t          GetAbsXlowNDC() const {return fAbsXlowNDC;}
220  	   Double_t          GetAbsYlowNDC() const {return fAbsYlowNDC;}
221  	   Double_t          GetAbsWNDC() const {return fAbsWNDC;}
222  	   Double_t          GetAbsHNDC() const {return fAbsHNDC;}
223  	   Double_t          GetAspectRatio() const { return fAspectRatio; }
224  	   Double_t          GetPhi() const   {return fPhi;}
225  	   Double_t          GetTheta() const {return fTheta;}
226  	   Double_t          GetUxmin() const {return fUxmin;}
227  	   Double_t          GetUymin() const {return fUymin;}
228  	   Double_t          GetUxmax() const {return fUxmax;}
229  	   Double_t          GetUymax() const {return fUymax;}
230  	   Bool_t            GetGridx() const {return fGridx;}
231  	   Bool_t            GetGridy() const {return fGridy;}
232  	   Int_t             GetNumber() const {return fNumber;}
233  	   Int_t             GetTickx() const {return fTickx;}
234  	   Int_t             GetTicky() const {return fTicky;}
235  	   Double_t          GetX1() const { return fX1; }
236  	   Double_t          GetX2() const { return fX2; }
237  	   Double_t          GetY1() const { return fY1; }
238  	   Double_t          GetY2() const { return fY2; }
239  	   static Int_t      GetMaxPickDistance();
240  	   TList            *GetListOfPrimitives() const {return fPrimitives;}
241  	   TList            *GetListOfExecs() const {return fExecs;}
242  	   virtual TObject  *GetPrimitive(const char *name) const;  //obsolete, use FindObject instead
243  	   virtual TObject  *GetSelected() const;
244  	   virtual TVirtualPad  *GetPad(Int_t subpadnumber) const;
245  	   virtual TObject  *GetPadPointer() const {return fPadPointer;}
246  	   TVirtualPad      *GetPadSave() const;
247  	   TVirtualPad      *GetSelectedPad() const;
248  	   Int_t             GetGLDevice();
249  	   TView            *GetView() const {return fView;}
250  	   TObject          *GetView3D() const {return fPadView3D;}// Return 3D View of this TPad
251  	   Int_t             GetLogx() const {return fLogx;}
252  	   Int_t             GetLogy() const {return fLogy;}
253  	   Int_t             GetLogz() const {return fLogz;}
254  	   virtual TVirtualPad *GetMother() const {return fMother;}
255  	   const char       *GetName() const {return fName.Data();}
256  	   const char       *GetTitle() const {return fTitle.Data();}
257  	   virtual TCanvas  *GetCanvas() const { return fCanvas; }
258  	   virtual TVirtualPad *GetVirtCanvas() const ;
259  	   virtual TVirtualPadPainter *GetPainter();
260  	   Int_t             GetPadPaint() const {return fPadPaint;}
261  	   Int_t             GetPixmapID() const {return fPixmapID;}
262  	   ULong_t           Hash() const { return fName.Hash(); }
263  	   virtual Bool_t    HasCrosshair() const;
264  	   void              HighLight(Color_t col=kRed, Bool_t set=kTRUE);
265  	   Bool_t            HasFixedAspectRatio() const { return fFixedAspectRatio; }
266  	   virtual Bool_t    IsBatch() const;
267  	   virtual Bool_t    IsEditable() const {return fEditable;}
268  	   Bool_t            IsFolder() const {return kTRUE;}
269  	   Bool_t            IsModified() const {return fModified;}
270  	   virtual Bool_t    IsRetained() const;
271  	   virtual Bool_t    IsVertical() const {return !TestBit(kHori);}
272  	   virtual void      ls(Option_t *option="") const;
273  	   void              Modified(Bool_t flag=1);  // *SIGNAL*
274  	   virtual Bool_t    OpaqueMoving() const;
275  	   virtual Bool_t    OpaqueResizing() const;
276  	   Double_t          PadtoX(Double_t x) const;
277  	   Double_t          PadtoY(Double_t y) const;
278  	   virtual void      Paint(Option_t *option="");
279  	   void              PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
280  	   void              PaintFillArea(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
281  	   void              PaintFillArea(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
282  	   void              PaintFillAreaHatches(Int_t n, Double_t *x, Double_t *y, Int_t FillStyle);
283  	   void              PaintHatches(Double_t dy, Double_t angle, Int_t nn, Double_t *xx, Double_t *yy);
284  	   void              PaintPadFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
285  	   void              PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
286  	   void              PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2);
287  	   void              PaintLine3D(Float_t *p1, Float_t *p2);
288  	   void              PaintLine3D(Double_t *p1, Double_t *p2);
289  	   void              PaintPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
290  	   void              PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
291  	   void              PaintPolyLine3D(Int_t n, Double_t *p);
292  	   void              PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
293  	   void              PaintPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
294  	   void              PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
295  	   virtual void      PaintModified();
296  	   void              PaintText(Double_t x, Double_t y, const char *text);
297  	   void              PaintText(Double_t x, Double_t y, const wchar_t *text);
298  	   void              PaintTextNDC(Double_t u, Double_t v, const char *text);
299  	   void              PaintTextNDC(Double_t u, Double_t v, const wchar_t *text);
300  	   virtual TPad     *Pick(Int_t px, Int_t py, TObjLink *&pickobj);
301  	   Double_t          PixeltoX(Int_t px);
302  	   Double_t          PixeltoY(Int_t py);
303  	   virtual void      PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
304  	   virtual void      Pop();  // *MENU*
305  	   virtual void      Print(const char *filename="") const;
306  	   virtual void      Print(const char *filename, Option_t *option);
307  	   virtual void      Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2); // *MENU* *ARGS={x1=>fX1,y1=>fY1,x2=>fX2,y2=>fY2}
308  	   virtual void      RangeChanged() { Emit("RangeChanged()"); } // *SIGNAL*
309  	   virtual void      RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
310  	   virtual void      RangeAxisChanged() { Emit("RangeAxisChanged()"); } // *SIGNAL*
311  	   virtual void      RecursiveRemove(TObject *obj);
312  	   virtual void      RedrawAxis(Option_t *option="");
313  	   virtual void      ResetView3D(TObject *view=0){fPadView3D=view;}
314  	   virtual void      ResizePad(Option_t *option="");
315  	   virtual void      SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
316  	   virtual void      SetBorderMode(Short_t bordermode) {fBorderMode = bordermode; Modified();} // *MENU*
317  	   virtual void      SetBorderSize(Short_t bordersize) {fBorderSize = bordersize; Modified();} // *MENU*
318  	   void              SetCanvas(TCanvas *c) { fCanvas = c; }
319  	   virtual void      SetCanvasSize(UInt_t ww, UInt_t wh);
320  	   virtual void      SetCrosshair(Int_t crhair=1); // *TOGGLE*
321  	   virtual void      SetCursor(ECursor cursor);
322  	   virtual void      SetDoubleBuffer(Int_t mode=1);
323  	   virtual void      SetDrawOption(Option_t *option="");
324  	   virtual void      SetEditable(Bool_t mode=kTRUE); // *TOGGLE*
325  	   virtual void      SetFixedAspectRatio(Bool_t fixed = kTRUE);  // *TOGGLE*
326  	   virtual void      SetGrid(Int_t valuex = 1, Int_t valuey = 1) {fGridx = valuex; fGridy = valuey; Modified();}
327  	   virtual void      SetGridx(Int_t value = 1) {fGridx = value; Modified();} // *TOGGLE*
328  	   virtual void      SetGridy(Int_t value = 1) {fGridy = value; Modified();} // *TOGGLE*
329  	   virtual void      SetFillStyle(Style_t fstyle);
330  	   virtual void      SetLogx(Int_t value = 1); // *TOGGLE*
331  	   virtual void      SetLogy(Int_t value = 1); // *TOGGLE*
332  	   virtual void      SetLogz(Int_t value = 1); // *TOGGLE*
333  	   virtual void      SetNumber(Int_t number) {fNumber = number;}
334  	   virtual void      SetPad(const char *name, const char *title,
335  	                           Double_t xlow, Double_t ylow, Double_t xup,
336  	                           Double_t yup, Color_t color=35,
337  	                           Short_t bordersize=5, Short_t bordermode=-1);
338  	   virtual void      SetPad(Double_t xlow, Double_t ylow, Double_t xup, Double_t yup);
339  	   virtual void      SetAttFillPS(Color_t color, Style_t style);
340  	   virtual void      SetAttLinePS(Color_t color, Style_t style, Width_t lwidth);
341  	   virtual void      SetAttMarkerPS(Color_t color, Style_t style, Size_t msize);
342  	   virtual void      SetAttTextPS(Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize);
343  	   static  void      SetMaxPickDistance(Int_t maxPick=5);
344  	   virtual void      SetName(const char *name) {fName = name;} // *MENU*
345  	   virtual void      SetSelected(TObject *obj);
346  	   virtual void      SetTicks(Int_t valuex = 1, Int_t valuey = 1) {fTickx = valuex; fTicky = valuey; Modified();}
347  	   virtual void      SetTickx(Int_t value = 1) {fTickx = value; Modified();} // *TOGGLE*
348  	   virtual void      SetTicky(Int_t value = 1) {fTicky = value; Modified();} // *TOGGLE*
349  	   virtual void      SetTitle(const char *title="") {fTitle = title;}
350  	   virtual void      SetTheta(Double_t theta=30) {fTheta = theta; Modified();}
351  	   virtual void      SetPhi(Double_t phi=30) {fPhi = phi; Modified();}
352  	   virtual void      SetToolTipText(const char *text, Long_t delayms = 1000);
353  	   virtual void      SetVertical(Bool_t vert=kTRUE);
354  	   virtual void      SetView(TView *view = 0);
355  	   virtual void      SetViewer3D(TVirtualViewer3D *viewer3d) {fViewer3D = viewer3d;}
356  	
357  	   virtual void      SetGLDevice(Int_t dev) {fGLDevice = dev;}
358  	   virtual void      SetCopyGLDevice(Bool_t copy) {fCopyGLDevice = copy;}
359  	
360  	   virtual void      ShowGuidelines(TObject *object, const Int_t event, const char mode = 'i', const bool cling = true);
361  	   virtual void      Update();
362  	   Int_t             UtoAbsPixel(Double_t u) const {return Int_t(fUtoAbsPixelk + u*fUtoPixel);}
363  	   Int_t             VtoAbsPixel(Double_t v) const {return Int_t(fVtoAbsPixelk + v*fVtoPixel);}
364  	   Int_t             UtoPixel(Double_t u) const;
365  	   Int_t             VtoPixel(Double_t v) const;
366  	   virtual TObject  *WaitPrimitive(const char *pname="", const char *emode="");
367  	   Int_t             XtoAbsPixel(Double_t x) const;
368  	   Int_t             YtoAbsPixel(Double_t y) const;
369  	   Double_t          XtoPad(Double_t x) const;
370  	   Double_t          YtoPad(Double_t y) const;
371  	   Int_t             XtoPixel(Double_t x) const;
372  	   Int_t             YtoPixel(Double_t y) const;
373  	   virtual void      XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const;
374  	   virtual void      XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const;
375  	
376  	   virtual TObject  *CreateToolTip(const TBox *b, const char *text, Long_t delayms);
377  	   virtual void      DeleteToolTip(TObject *tip);
378  	   virtual void      ResetToolTip(TObject *tip);
379  	   virtual void      CloseToolTip(TObject *tip);
380  	
381  	   virtual void      x3d(Option_t *type=""); // Depreciated
382  	
383  	   virtual TVirtualViewer3D *GetViewer3D(Option_t * type = "");
384  	   virtual Bool_t            HasViewer3D() const { return (fViewer3D); }
385  	   virtual void              ReleaseViewer3D(Option_t * type = "");
386  	
387  	   virtual Rectangle_t  GetBBox();
388  	   virtual TPoint       GetBBoxCenter();
389  	   virtual void         SetBBoxCenter(const TPoint &p);
390  	   virtual void         SetBBoxCenterX(const Int_t x);
391  	   virtual void         SetBBoxCenterY(const Int_t y);
392  	   virtual void         SetBBoxX1(const Int_t x);
393  	   virtual void         SetBBoxX2(const Int_t x);
394  	   virtual void         SetBBoxY1(const Int_t y);
395  	   virtual void         SetBBoxY2(const Int_t y);
396  	
397  	   virtual void      RecordPave(const TObject *obj);              // *SIGNAL*
398  	   virtual void      RecordLatex(const TObject *obj);             // *SIGNAL*
399  	   virtual void      EventPave() { Emit("EventPave()"); }         // *SIGNAL*
400  	   virtual void      StartEditing() { Emit("StartEditing()"); }   // *SIGNAL*
401  	
402  	   ClassDef(TPad,11)  //A Graphics pad
403  	};
404  	
405  	
406  	//______________________________________________________________________________
407  	inline void TPad::Modified(Bool_t flag)
408  	{
409  	   if (!fModified && flag) Emit("Modified()");
410  	   fModified = flag;
411  	}
412  	
413  	
414  	//______________________________________________________________________________
415  	inline void TPad::AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
416  	{
417  	   x = AbsPixeltoX(xpixel);
418  	   y = AbsPixeltoY(ypixel);
419  	}
420  	
421  	
422  	//______________________________________________________________________________
423  	inline Double_t TPad::PixeltoX(Int_t px)
424  	{
425  	   if (fAbsCoord) return fAbsPixeltoXk + px*fPixeltoX;
426  	   else           return fPixeltoXk    + px*fPixeltoX;
427  	}
428  	
429  	
430  	//______________________________________________________________________________
431  	inline Double_t TPad::PixeltoY(Int_t py)
432  	{
433  	   if (fAbsCoord) return fAbsPixeltoYk + py*fPixeltoY;
434  	   else           return fPixeltoYk    + py*fPixeltoY;
435  	}
436  	
437  	
438  	//______________________________________________________________________________
439  	inline void TPad::PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
440  	{
441  	   x = PixeltoX(xpixel);
442  	   y = PixeltoY(ypixel);
443  	}
444  	
445  	
446  	//______________________________________________________________________________
447  	inline Int_t TPad::UtoPixel(Double_t u) const
448  	{
449  	   Double_t val;
450  	   if (fAbsCoord) val = fUtoAbsPixelk + u*fUtoPixel;
451  	   else           val = u*fUtoPixel;
452  	   if (val < -kMaxPixel) return -kMaxPixel;
453  	   if (val >  kMaxPixel) return  kMaxPixel;
454  	   return Int_t(val);
455  	}
456  	
457  	
458  	//______________________________________________________________________________
459  	inline Int_t TPad::VtoPixel(Double_t v) const
460  	{
461  	   Double_t val;
462  	   if (fAbsCoord) val = fVtoAbsPixelk + v*fVtoPixel;
463  	   else           val = fVtoPixelk    + v*fVtoPixel;
464  	   if (val < -kMaxPixel) return -kMaxPixel;
465  	   if (val >  kMaxPixel) return  kMaxPixel;
466  	   return Int_t(val);
467  	}
468  	
469  	
470  	//______________________________________________________________________________
471  	inline Int_t TPad::XtoAbsPixel(Double_t x) const
472  	{
473  	   Double_t val = fXtoAbsPixelk + x*fXtoPixel;
474  	   if (val < -kMaxPixel) return -kMaxPixel;
475  	   if (val >  kMaxPixel) return  kMaxPixel;
476  	   return Int_t(val);
477  	}
478  	
479  	
480  	//______________________________________________________________________________
481  	inline Int_t TPad::XtoPixel(Double_t x) const
482  	{
483  	   Double_t val;
484  	   if (fAbsCoord) val = fXtoAbsPixelk + x*fXtoPixel;
485  	   else           val = fXtoPixelk    + x*fXtoPixel;
486  	   if (val < -kMaxPixel) return -kMaxPixel;
487  	   if (val >  kMaxPixel) return  kMaxPixel;
488  	   return Int_t(val);
489  	}
490  	
491  	
492  	//______________________________________________________________________________
493  	inline Int_t TPad::YtoAbsPixel(Double_t y) const
494  	{
495  	   Double_t val = fYtoAbsPixelk + y*fYtoPixel;
496  	   if (val < -kMaxPixel) return -kMaxPixel;
497  	   if (val >  kMaxPixel) return  kMaxPixel;
498  	   return Int_t(val);
499  	}
500  	
501  	
502  	//______________________________________________________________________________
503  	inline Int_t TPad::YtoPixel(Double_t y) const
504  	{
505  	   Double_t val;
506  	   if (fAbsCoord) val = fYtoAbsPixelk + y*fYtoPixel;
507  	   else           val = fYtoPixelk    + y*fYtoPixel;
508  	   if (val < -kMaxPixel) return -kMaxPixel;
509  	   if (val >  kMaxPixel) return  kMaxPixel;
510  	   return Int_t(val);
511  	}
512  	
513  	
514  	//______________________________________________________________________________
515  	inline void TPad::XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const
516  	{
517  	   xpixel = XtoAbsPixel(x);
518  	   ypixel = YtoAbsPixel(y);
519  	}
520  	
521  	
522  	//______________________________________________________________________________
523  	inline void TPad::XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const
524  	{
525  	   xpixel = XtoPixel(x);
526  	   ypixel = YtoPixel(y);
527  	}
528  	
529  	
530  	//______________________________________________________________________________
531  	inline void TPad::SetDrawOption(Option_t *)
532  	{ }
533  	
534  	#endif
535  	
536