// @(#)root/gpad:$Id$
// Author: Rene Brun   12/12/94

/*************************************************************************
 * 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_TPad
#define ROOT_TPad


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TPad                                                                 //
//                                                                      //
// A Graphics pad.                                                      //
//                                                                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualPad
#include "TVirtualPad.h"
#endif
#ifndef ROOT_TAttBBox2D
#include "TAttBBox2D.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#ifndef ROOT_GuiTypes
#include "GuiTypes.h"
#endif

class TVirtualViewer3D;
class TVirtualPadPainter;
class TBrowser;
class TBox;
class TLegend;
class TArrow;


class TPad : public TVirtualPad, public TAttBBox2D {

private:
   TObject      *fTip;             //! tool tip associated with box

protected:
   Double_t      fX1;              //  X of lower X coordinate
   Double_t      fY1;              //  Y of lower Y coordinate
   Double_t      fX2;              //  X of upper X coordinate
   Double_t      fY2;              //  Y of upper Y coordinate

   Double_t      fXtoAbsPixelk;    //  Conversion coefficient for X World to absolute pixel
   Double_t      fXtoPixelk;       //  Conversion coefficient for X World to pixel
   Double_t      fXtoPixel;        //    xpixel = fXtoPixelk + fXtoPixel*xworld
   Double_t      fYtoAbsPixelk;    //  Conversion coefficient for Y World to absolute pixel
   Double_t      fYtoPixelk;       //  Conversion coefficient for Y World to pixel
   Double_t      fYtoPixel;        //    ypixel = fYtoPixelk + fYtoPixel*yworld

   Double_t      fUtoAbsPixelk;    //  Conversion coefficient for U NDC to absolute pixel
   Double_t      fUtoPixelk;       //  Conversion coefficient for U NDC to pixel
   Double_t      fUtoPixel;        //    xpixel = fUtoPixelk + fUtoPixel*undc
   Double_t      fVtoAbsPixelk;    //  Conversion coefficient for V NDC to absolute pixel
   Double_t      fVtoPixelk;       //  Conversion coefficient for V NDC to pixel
   Double_t      fVtoPixel;        //    ypixel = fVtoPixelk + fVtoPixel*vndc

   Double_t      fAbsPixeltoXk;    //  Conversion coefficient for absolute pixel to X World
   Double_t      fPixeltoXk;       //  Conversion coefficient for pixel to X World
   Double_t      fPixeltoX;        //     xworld = fPixeltoXk + fPixeltoX*xpixel
   Double_t      fAbsPixeltoYk;    //  Conversion coefficient for absolute pixel to Y World
   Double_t      fPixeltoYk;       //  Conversion coefficient for pixel to Y World
   Double_t      fPixeltoY;        //     yworld = fPixeltoYk + fPixeltoY*ypixel

   Double_t      fXlowNDC;         //  X bottom left corner of pad in NDC [0,1]
   Double_t      fYlowNDC;         //  Y bottom left corner of pad in NDC [0,1]
   Double_t      fXUpNDC;
   Double_t      fYUpNDC;
   Double_t      fWNDC;            //  Width of pad along X in NDC
   Double_t      fHNDC;            //  Height of pad along Y in NDC

   Double_t      fAbsXlowNDC;      //  Absolute X top left corner of pad in NDC [0,1]
   Double_t      fAbsYlowNDC;      //  Absolute Y top left corner of pad in NDC [0,1]
   Double_t      fAbsWNDC;         //  Absolute Width of pad along X in NDC
   Double_t      fAbsHNDC;         //  Absolute Height of pad along Y in NDC

   Double_t      fUxmin;           //  Minimum value on the X axis
   Double_t      fUymin;           //  Minimum value on the Y axis
   Double_t      fUxmax;           //  Maximum value on the X axis
   Double_t      fUymax;           //  Maximum value on the Y axis

   Double_t      fTheta;           //  theta angle to view as lego/surface
   Double_t      fPhi;             //  phi angle   to view as lego/surface

   Double_t      fAspectRatio;     //  ratio of w/h in case of fixed ratio

   Int_t         fPixmapID;        //! Off-screen pixmap identifier
   Int_t         fGLDevice;        //! OpenGL off-screen pixmap identifier
   Bool_t        fCopyGLDevice;    //!
   Bool_t        fEmbeddedGL;      //!
   Int_t         fNumber;          //  pad number identifier
   Int_t         fTickx;           //  Set to 1 if tick marks along X
   Int_t         fTicky;           //  Set to 1 if tick marks along Y
   Int_t         fLogx;            //  (=0 if X linear scale, =1 if log scale)
   Int_t         fLogy;            //  (=0 if Y linear scale, =1 if log scale)
   Int_t         fLogz;            //  (=0 if Z linear scale, =1 if log scale)
   Int_t         fPadPaint;        //  Set to 1 while painting the pad
   Int_t         fCrosshair;       //  Crosshair type (0 if no crosshair requested)
   Int_t         fCrosshairPos;    //  Position of crosshair
   Short_t       fBorderSize;      //  pad bordersize in pixels
   Short_t       fBorderMode;      //  Bordermode (-1=down, 0 = no border, 1=up)
   Bool_t        fModified;        //  Set to true when pad is modified
   Bool_t        fGridx;           //  Set to true if grid along X
   Bool_t        fGridy;           //  Set to true if grid along Y
   Bool_t        fAbsCoord;        //  Use absolute coordinates
   Bool_t        fEditable;        //  True if canvas is editable
   Bool_t        fFixedAspectRatio; //  True if fixed aspect ratio
   TPad         *fMother;          //! pointer to mother of the list
   TCanvas      *fCanvas;          //! Pointer to mother canvas
   TList        *fPrimitives;      //->List of primitives (subpads)
   TList        *fExecs;           //  List of commands to be executed when a pad event occurs
   TString       fName;            //  Pad name
   TString       fTitle;           //  Pad title
   TFrame       *fFrame;           //! Pointer to 2-D frame (if one exists)
   TView        *fView;            //! Pointer to 3-D view (if one exists)
   TObject      *fPadPointer;      //! free pointer
   TObject      *fPadView3D;       //! 3D View of this TPad
   static Int_t  fgMaxPickDistance;//  Maximum Pick Distance

   // 3D Viewer support
   TVirtualViewer3D *fViewer3D;    //! Current 3D viewer

   void          DestroyExternalViewer3D();
   virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
   virtual void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
   virtual void  HideToolTip(Int_t event);
   void          PaintBorder(Color_t color, Bool_t tops);
   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);
   void          PaintDate();
   virtual void  SavePrimitive(std::ostream &out, Option_t *option = "");
   virtual void  SetBatch(Bool_t batch=kTRUE);

private:
   TPad(const TPad &pad);  // cannot copy pads, use TObject::Clone()
   TPad &operator=(const TPad &rhs);  // idem

   void CopyBackgroundPixmap(Int_t x, Int_t y);
   void CopyBackgroundPixmaps(TPad *start, TPad *stop, Int_t x, Int_t y);
   void DrawDist(Rectangle_t aBBox, Rectangle_t bBBox, char mode);

public:
   // TPad status bits
   enum {
      kFraming      = BIT(6),
      kHori         = BIT(9),
      kClipFrame    = BIT(10),
      kPrintingPS   = BIT(11),
      kCannotMove   = BIT(12),
      kClearAfterCR = BIT(14)
   };

   TPad();
   TPad(const char *name, const char *title, Double_t xlow,
        Double_t ylow, Double_t xup, Double_t yup,
        Color_t color=-1, Short_t bordersize=-1, Short_t bordermode=-2);
   virtual ~TPad();
   void              AbsCoordinates(Bool_t set) { fAbsCoord = set; }
   Double_t          AbsPixeltoX(Int_t px) {return fAbsPixeltoXk + px*fPixeltoX;}
   Double_t          AbsPixeltoY(Int_t py) {return fAbsPixeltoYk + py*fPixeltoY;}
   virtual void      AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
   virtual void      AddExec(const char *name, const char *command);
   virtual void      AutoExec();
   virtual void      Browse(TBrowser *b);
   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*
   TVirtualPad*      cd(Int_t subpadnumber=0); // *MENU*
   void              Clear(Option_t *option="");
   virtual Int_t     Clip(Float_t *x, Float_t *y, Float_t xclipl, Float_t yclipb, Float_t xclipr, Float_t yclipt);
   virtual Int_t     Clip(Double_t *x, Double_t *y, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt);
   virtual Int_t     ClippingCode(Double_t x, Double_t y, Double_t xcl1, Double_t ycl1, Double_t xcl2, Double_t ycl2);
   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);
   virtual void      Close(Option_t *option="");
   virtual void      Closed() { Emit("Closed()"); } // *SIGNAL*
   virtual void      CopyPixmap();
   virtual void      CopyPixmaps();
   virtual void      DeleteExec(const char *name);
   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*
   virtual void      DivideSquare(Int_t n, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0);
   virtual void      Draw(Option_t *option="");
   virtual void      DrawClassObject(const TObject *obj, Option_t *option="");
   static  void      DrawColorTable();
   virtual void      DrawCrosshair();
   TH1F             *DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char *title="");
   virtual void      ExecuteEventAxis(Int_t event, Int_t px, Int_t py, TAxis *axis);
   virtual TObject  *FindObject(const char *name) const;
   virtual TObject  *FindObject(const TObject *obj) const;
   virtual void      UseCurrentStyle();  // *MENU*
   virtual Short_t   GetBorderMode() const { return fBorderMode;}
   virtual Short_t   GetBorderSize() const { return fBorderSize;}
   Int_t             GetCrosshair() const;
   virtual Int_t     GetCanvasID() const;
   virtual TCanvasImp *GetCanvasImp() const;
   TFrame           *GetFrame();
   virtual Int_t     GetEvent() const;
   virtual Int_t     GetEventX() const;
   virtual Int_t     GetEventY() const;
   virtual Color_t   GetHighLightColor() const;
   virtual void      GetRange(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2);
   virtual void      GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
   virtual void      GetPadPar(Double_t &xlow, Double_t &ylow, Double_t &xup, Double_t &yup);
   Double_t          GetXlowNDC() const {return fXlowNDC;}
   Double_t          GetYlowNDC() const {return fYlowNDC;}
   Double_t          GetWNDC() const {return fWNDC;}
   Double_t          GetHNDC() const {return fHNDC;}
   virtual UInt_t    GetWw() const;
   virtual UInt_t    GetWh() const;
   Double_t          GetAbsXlowNDC() const {return fAbsXlowNDC;}
   Double_t          GetAbsYlowNDC() const {return fAbsYlowNDC;}
   Double_t          GetAbsWNDC() const {return fAbsWNDC;}
   Double_t          GetAbsHNDC() const {return fAbsHNDC;}
   Double_t          GetAspectRatio() const { return fAspectRatio; }
   Double_t          GetPhi() const   {return fPhi;}
   Double_t          GetTheta() const {return fTheta;}
   Double_t          GetUxmin() const {return fUxmin;}
   Double_t          GetUymin() const {return fUymin;}
   Double_t          GetUxmax() const {return fUxmax;}
   Double_t          GetUymax() const {return fUymax;}
   Bool_t            GetGridx() const {return fGridx;}
   Bool_t            GetGridy() const {return fGridy;}
   Int_t             GetNumber() const {return fNumber;}
   Int_t             GetTickx() const {return fTickx;}
   Int_t             GetTicky() const {return fTicky;}
   Double_t          GetX1() const { return fX1; }
   Double_t          GetX2() const { return fX2; }
   Double_t          GetY1() const { return fY1; }
   Double_t          GetY2() const { return fY2; }
   static Int_t      GetMaxPickDistance();
   TList            *GetListOfPrimitives() const {return fPrimitives;}
   TList            *GetListOfExecs() const {return fExecs;}
   virtual TObject  *GetPrimitive(const char *name) const;  //obsolete, use FindObject instead
   virtual TObject  *GetSelected() const;
   virtual TVirtualPad  *GetPad(Int_t subpadnumber) const;
   virtual TObject  *GetPadPointer() const {return fPadPointer;}
   TVirtualPad      *GetPadSave() const;
   TVirtualPad      *GetSelectedPad() const;
   Int_t             GetGLDevice();
   TView            *GetView() const {return fView;}
   TObject          *GetView3D() const {return fPadView3D;}// Return 3D View of this TPad
   Int_t             GetLogx() const {return fLogx;}
   Int_t             GetLogy() const {return fLogy;}
   Int_t             GetLogz() const {return fLogz;}
   virtual TVirtualPad *GetMother() const {return fMother;}
   const char       *GetName() const {return fName.Data();}
   const char       *GetTitle() const {return fTitle.Data();}
   virtual TCanvas  *GetCanvas() const { return fCanvas; }
   virtual TVirtualPad *GetVirtCanvas() const ;
   virtual TVirtualPadPainter *GetPainter();
   Int_t             GetPadPaint() const {return fPadPaint;}
   Int_t             GetPixmapID() const {return fPixmapID;}
   ULong_t           Hash() const { return fName.Hash(); }
   virtual Bool_t    HasCrosshair() const;
   void              HighLight(Color_t col=kRed, Bool_t set=kTRUE);
   Bool_t            HasFixedAspectRatio() const { return fFixedAspectRatio; }
   virtual Bool_t    IsBatch() const;
   virtual Bool_t    IsEditable() const {return fEditable;}
   Bool_t            IsFolder() const {return kTRUE;}
   Bool_t            IsModified() const {return fModified;}
   virtual Bool_t    IsRetained() const;
   virtual Bool_t    IsVertical() const {return !TestBit(kHori);}
   virtual void      ls(Option_t *option="") const;
   void              Modified(Bool_t flag=1);  // *SIGNAL*
   virtual Bool_t    OpaqueMoving() const;
   virtual Bool_t    OpaqueResizing() const;
   Double_t          PadtoX(Double_t x) const;
   Double_t          PadtoY(Double_t y) const;
   virtual void      Paint(Option_t *option="");
   void              PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
   void              PaintFillArea(Int_t n, Float_t *x, Float_t *y, Option_t *option=""); // Obsolete
   void              PaintFillArea(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
   void              PaintFillAreaHatches(Int_t n, Double_t *x, Double_t *y, Int_t FillStyle);
   void              PaintHatches(Double_t dy, Double_t angle, Int_t nn, Double_t *xx, Double_t *yy);
   void              PaintPadFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
   void              PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
   void              PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2);
   void              PaintLine3D(Float_t *p1, Float_t *p2);
   void              PaintLine3D(Double_t *p1, Double_t *p2);
   void              PaintPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
   void              PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
   void              PaintPolyLine3D(Int_t n, Double_t *p);
   void              PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
   void              PaintPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option="");
   void              PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option="");
   virtual void      PaintModified();
   void              PaintText(Double_t x, Double_t y, const char *text);
   void              PaintText(Double_t x, Double_t y, const wchar_t *text);
   void              PaintTextNDC(Double_t u, Double_t v, const char *text);
   void              PaintTextNDC(Double_t u, Double_t v, const wchar_t *text);
   virtual TPad     *Pick(Int_t px, Int_t py, TObjLink *&pickobj);
   Double_t          PixeltoX(Int_t px);
   Double_t          PixeltoY(Int_t py);
   virtual void      PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
   virtual void      Pop();  // *MENU*
   virtual void      Print(const char *filename="") const;
   virtual void      Print(const char *filename, Option_t *option);
   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}
   virtual void      RangeChanged() { Emit("RangeChanged()"); } // *SIGNAL*
   virtual void      RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
   virtual void      RangeAxisChanged() { Emit("RangeAxisChanged()"); } // *SIGNAL*
   virtual void      RecursiveRemove(TObject *obj);
   virtual void      RedrawAxis(Option_t *option="");
   virtual void      ResetView3D(TObject *view=0){fPadView3D=view;}
   virtual void      ResizePad(Option_t *option="");
   virtual void      SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
   virtual void      SetBorderMode(Short_t bordermode) {fBorderMode = bordermode; Modified();} // *MENU*
   virtual void      SetBorderSize(Short_t bordersize) {fBorderSize = bordersize; Modified();} // *MENU*
   void              SetCanvas(TCanvas *c) { fCanvas = c; }
   virtual void      SetCanvasSize(UInt_t ww, UInt_t wh);
   virtual void      SetCrosshair(Int_t crhair=1); // *TOGGLE*
   virtual void      SetCursor(ECursor cursor);
   virtual void      SetDoubleBuffer(Int_t mode=1);
   virtual void      SetDrawOption(Option_t *option="");
   virtual void      SetEditable(Bool_t mode=kTRUE); // *TOGGLE*
   virtual void      SetFixedAspectRatio(Bool_t fixed = kTRUE);  // *TOGGLE*
   virtual void      SetGrid(Int_t valuex = 1, Int_t valuey = 1) {fGridx = valuex; fGridy = valuey; Modified();}
   virtual void      SetGridx(Int_t value = 1) {fGridx = value; Modified();} // *TOGGLE*
   virtual void      SetGridy(Int_t value = 1) {fGridy = value; Modified();} // *TOGGLE*
   virtual void      SetFillStyle(Style_t fstyle);
   virtual void      SetLogx(Int_t value = 1); // *TOGGLE*
   virtual void      SetLogy(Int_t value = 1); // *TOGGLE*
   virtual void      SetLogz(Int_t value = 1); // *TOGGLE*
   virtual void      SetNumber(Int_t number) {fNumber = number;}
   virtual void      SetPad(const char *name, const char *title,
                           Double_t xlow, Double_t ylow, Double_t xup,
                           Double_t yup, Color_t color=35,
                           Short_t bordersize=5, Short_t bordermode=-1);
   virtual void      SetPad(Double_t xlow, Double_t ylow, Double_t xup, Double_t yup);
   virtual void      SetAttFillPS(Color_t color, Style_t style);
   virtual void      SetAttLinePS(Color_t color, Style_t style, Width_t lwidth);
   virtual void      SetAttMarkerPS(Color_t color, Style_t style, Size_t msize);
   virtual void      SetAttTextPS(Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize);
   static  void      SetMaxPickDistance(Int_t maxPick=5);
   virtual void      SetName(const char *name) {fName = name;} // *MENU*
   virtual void      SetSelected(TObject *obj);
   virtual void      SetTicks(Int_t valuex = 1, Int_t valuey = 1) {fTickx = valuex; fTicky = valuey; Modified();}
   virtual void      SetTickx(Int_t value = 1) {fTickx = value; Modified();} // *TOGGLE*
   virtual void      SetTicky(Int_t value = 1) {fTicky = value; Modified();} // *TOGGLE*
   virtual void      SetTitle(const char *title="") {fTitle = title;}
   virtual void      SetTheta(Double_t theta=30) {fTheta = theta; Modified();}
   virtual void      SetPhi(Double_t phi=30) {fPhi = phi; Modified();}
   virtual void      SetToolTipText(const char *text, Long_t delayms = 1000);
   virtual void      SetVertical(Bool_t vert=kTRUE);
   virtual void      SetView(TView *view = 0);
   virtual void      SetViewer3D(TVirtualViewer3D *viewer3d) {fViewer3D = viewer3d;}

   virtual void      SetGLDevice(Int_t dev) {fGLDevice = dev;}
   virtual void      SetCopyGLDevice(Bool_t copy) {fCopyGLDevice = copy;}

   virtual void      ShowGuidelines(TObject *object, const Int_t event, const char mode = 'i', const bool cling = true);
   virtual void      Update();
   Int_t             UtoAbsPixel(Double_t u) const {return Int_t(fUtoAbsPixelk + u*fUtoPixel);}
   Int_t             VtoAbsPixel(Double_t v) const {return Int_t(fVtoAbsPixelk + v*fVtoPixel);}
   Int_t             UtoPixel(Double_t u) const;
   Int_t             VtoPixel(Double_t v) const;
   virtual TObject  *WaitPrimitive(const char *pname="", const char *emode="");
   Int_t             XtoAbsPixel(Double_t x) const;
   Int_t             YtoAbsPixel(Double_t y) const;
   Double_t          XtoPad(Double_t x) const;
   Double_t          YtoPad(Double_t y) const;
   Int_t             XtoPixel(Double_t x) const;
   Int_t             YtoPixel(Double_t y) const;
   virtual void      XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const;
   virtual void      XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const;

   virtual TObject  *CreateToolTip(const TBox *b, const char *text, Long_t delayms);
   virtual void      DeleteToolTip(TObject *tip);
   virtual void      ResetToolTip(TObject *tip);
   virtual void      CloseToolTip(TObject *tip);

   virtual void      x3d(Option_t *type=""); // Depreciated

   virtual TVirtualViewer3D *GetViewer3D(Option_t * type = "");
   virtual Bool_t            HasViewer3D() const { return (fViewer3D); }
   virtual void              ReleaseViewer3D(Option_t * type = "");

   virtual Rectangle_t  GetBBox();
   virtual TPoint       GetBBoxCenter();
   virtual void         SetBBoxCenter(const TPoint &p);
   virtual void         SetBBoxCenterX(const Int_t x);
   virtual void         SetBBoxCenterY(const Int_t y);
   virtual void         SetBBoxX1(const Int_t x);
   virtual void         SetBBoxX2(const Int_t x);
   virtual void         SetBBoxY1(const Int_t y);
   virtual void         SetBBoxY2(const Int_t y);

   virtual void      RecordPave(const TObject *obj);              // *SIGNAL*
   virtual void      RecordLatex(const TObject *obj);             // *SIGNAL*
   virtual void      EventPave() { Emit("EventPave()"); }         // *SIGNAL*
   virtual void      StartEditing() { Emit("StartEditing()"); }   // *SIGNAL*

   ClassDef(TPad,11)  //A Graphics pad
};


//______________________________________________________________________________
inline void TPad::Modified(Bool_t flag)
{
   if (!fModified && flag) Emit("Modified()");
   fModified = flag;
}


//______________________________________________________________________________
inline void TPad::AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
{
   x = AbsPixeltoX(xpixel);
   y = AbsPixeltoY(ypixel);
}


//______________________________________________________________________________
inline Double_t TPad::PixeltoX(Int_t px)
{
   if (fAbsCoord) return fAbsPixeltoXk + px*fPixeltoX;
   else           return fPixeltoXk    + px*fPixeltoX;
}


//______________________________________________________________________________
inline Double_t TPad::PixeltoY(Int_t py)
{
   if (fAbsCoord) return fAbsPixeltoYk + py*fPixeltoY;
   else           return fPixeltoYk    + py*fPixeltoY;
}


//______________________________________________________________________________
inline void TPad::PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
{
   x = PixeltoX(xpixel);
   y = PixeltoY(ypixel);
}


//______________________________________________________________________________
inline Int_t TPad::UtoPixel(Double_t u) const
{
   Double_t val;
   if (fAbsCoord) val = fUtoAbsPixelk + u*fUtoPixel;
   else           val = u*fUtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline Int_t TPad::VtoPixel(Double_t v) const
{
   Double_t val;
   if (fAbsCoord) val = fVtoAbsPixelk + v*fVtoPixel;
   else           val = fVtoPixelk    + v*fVtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline Int_t TPad::XtoAbsPixel(Double_t x) const
{
   Double_t val = fXtoAbsPixelk + x*fXtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline Int_t TPad::XtoPixel(Double_t x) const
{
   Double_t val;
   if (fAbsCoord) val = fXtoAbsPixelk + x*fXtoPixel;
   else           val = fXtoPixelk    + x*fXtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline Int_t TPad::YtoAbsPixel(Double_t y) const
{
   Double_t val = fYtoAbsPixelk + y*fYtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline Int_t TPad::YtoPixel(Double_t y) const
{
   Double_t val;
   if (fAbsCoord) val = fYtoAbsPixelk + y*fYtoPixel;
   else           val = fYtoPixelk    + y*fYtoPixel;
   if (val < -kMaxPixel) return -kMaxPixel;
   if (val >  kMaxPixel) return  kMaxPixel;
   return Int_t(val);
}


//______________________________________________________________________________
inline void TPad::XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const
{
   xpixel = XtoAbsPixel(x);
   ypixel = YtoAbsPixel(y);
}


//______________________________________________________________________________
inline void TPad::XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const
{
   xpixel = XtoPixel(x);
   ypixel = YtoPixel(y);
}


//______________________________________________________________________________
inline void TPad::SetDrawOption(Option_t *)
{ }

#endif

 TPad.h:1
 TPad.h:2
 TPad.h:3
 TPad.h:4
 TPad.h:5
 TPad.h:6
 TPad.h:7
 TPad.h:8
 TPad.h:9
 TPad.h:10
 TPad.h:11
 TPad.h:12
 TPad.h:13
 TPad.h:14
 TPad.h:15
 TPad.h:16
 TPad.h:17
 TPad.h:18
 TPad.h:19
 TPad.h:20
 TPad.h:21
 TPad.h:22
 TPad.h:23
 TPad.h:24
 TPad.h:25
 TPad.h:26
 TPad.h:27
 TPad.h:28
 TPad.h:29
 TPad.h:30
 TPad.h:31
 TPad.h:32
 TPad.h:33
 TPad.h:34
 TPad.h:35
 TPad.h:36
 TPad.h:37
 TPad.h:38
 TPad.h:39
 TPad.h:40
 TPad.h:41
 TPad.h:42
 TPad.h:43
 TPad.h:44
 TPad.h:45
 TPad.h:46
 TPad.h:47
 TPad.h:48
 TPad.h:49
 TPad.h:50
 TPad.h:51
 TPad.h:52
 TPad.h:53
 TPad.h:54
 TPad.h:55
 TPad.h:56
 TPad.h:57
 TPad.h:58
 TPad.h:59
 TPad.h:60
 TPad.h:61
 TPad.h:62
 TPad.h:63
 TPad.h:64
 TPad.h:65
 TPad.h:66
 TPad.h:67
 TPad.h:68
 TPad.h:69
 TPad.h:70
 TPad.h:71
 TPad.h:72
 TPad.h:73
 TPad.h:74
 TPad.h:75
 TPad.h:76
 TPad.h:77
 TPad.h:78
 TPad.h:79
 TPad.h:80
 TPad.h:81
 TPad.h:82
 TPad.h:83
 TPad.h:84
 TPad.h:85
 TPad.h:86
 TPad.h:87
 TPad.h:88
 TPad.h:89
 TPad.h:90
 TPad.h:91
 TPad.h:92
 TPad.h:93
 TPad.h:94
 TPad.h:95
 TPad.h:96
 TPad.h:97
 TPad.h:98
 TPad.h:99
 TPad.h:100
 TPad.h:101
 TPad.h:102
 TPad.h:103
 TPad.h:104
 TPad.h:105
 TPad.h:106
 TPad.h:107
 TPad.h:108
 TPad.h:109
 TPad.h:110
 TPad.h:111
 TPad.h:112
 TPad.h:113
 TPad.h:114
 TPad.h:115
 TPad.h:116
 TPad.h:117
 TPad.h:118
 TPad.h:119
 TPad.h:120
 TPad.h:121
 TPad.h:122
 TPad.h:123
 TPad.h:124
 TPad.h:125
 TPad.h:126
 TPad.h:127
 TPad.h:128
 TPad.h:129
 TPad.h:130
 TPad.h:131
 TPad.h:132
 TPad.h:133
 TPad.h:134
 TPad.h:135
 TPad.h:136
 TPad.h:137
 TPad.h:138
 TPad.h:139
 TPad.h:140
 TPad.h:141
 TPad.h:142
 TPad.h:143
 TPad.h:144
 TPad.h:145
 TPad.h:146
 TPad.h:147
 TPad.h:148
 TPad.h:149
 TPad.h:150
 TPad.h:151
 TPad.h:152
 TPad.h:153
 TPad.h:154
 TPad.h:155
 TPad.h:156
 TPad.h:157
 TPad.h:158
 TPad.h:159
 TPad.h:160
 TPad.h:161
 TPad.h:162
 TPad.h:163
 TPad.h:164
 TPad.h:165
 TPad.h:166
 TPad.h:167
 TPad.h:168
 TPad.h:169
 TPad.h:170
 TPad.h:171
 TPad.h:172
 TPad.h:173
 TPad.h:174
 TPad.h:175
 TPad.h:176
 TPad.h:177
 TPad.h:178
 TPad.h:179
 TPad.h:180
 TPad.h:181
 TPad.h:182
 TPad.h:183
 TPad.h:184
 TPad.h:185
 TPad.h:186
 TPad.h:187
 TPad.h:188
 TPad.h:189
 TPad.h:190
 TPad.h:191
 TPad.h:192
 TPad.h:193
 TPad.h:194
 TPad.h:195
 TPad.h:196
 TPad.h:197
 TPad.h:198
 TPad.h:199
 TPad.h:200
 TPad.h:201
 TPad.h:202
 TPad.h:203
 TPad.h:204
 TPad.h:205
 TPad.h:206
 TPad.h:207
 TPad.h:208
 TPad.h:209
 TPad.h:210
 TPad.h:211
 TPad.h:212
 TPad.h:213
 TPad.h:214
 TPad.h:215
 TPad.h:216
 TPad.h:217
 TPad.h:218
 TPad.h:219
 TPad.h:220
 TPad.h:221
 TPad.h:222
 TPad.h:223
 TPad.h:224
 TPad.h:225
 TPad.h:226
 TPad.h:227
 TPad.h:228
 TPad.h:229
 TPad.h:230
 TPad.h:231
 TPad.h:232
 TPad.h:233
 TPad.h:234
 TPad.h:235
 TPad.h:236
 TPad.h:237
 TPad.h:238
 TPad.h:239
 TPad.h:240
 TPad.h:241
 TPad.h:242
 TPad.h:243
 TPad.h:244
 TPad.h:245
 TPad.h:246
 TPad.h:247
 TPad.h:248
 TPad.h:249
 TPad.h:250
 TPad.h:251
 TPad.h:252
 TPad.h:253
 TPad.h:254
 TPad.h:255
 TPad.h:256
 TPad.h:257
 TPad.h:258
 TPad.h:259
 TPad.h:260
 TPad.h:261
 TPad.h:262
 TPad.h:263
 TPad.h:264
 TPad.h:265
 TPad.h:266
 TPad.h:267
 TPad.h:268
 TPad.h:269
 TPad.h:270
 TPad.h:271
 TPad.h:272
 TPad.h:273
 TPad.h:274
 TPad.h:275
 TPad.h:276
 TPad.h:277
 TPad.h:278
 TPad.h:279
 TPad.h:280
 TPad.h:281
 TPad.h:282
 TPad.h:283
 TPad.h:284
 TPad.h:285
 TPad.h:286
 TPad.h:287
 TPad.h:288
 TPad.h:289
 TPad.h:290
 TPad.h:291
 TPad.h:292
 TPad.h:293
 TPad.h:294
 TPad.h:295
 TPad.h:296
 TPad.h:297
 TPad.h:298
 TPad.h:299
 TPad.h:300
 TPad.h:301
 TPad.h:302
 TPad.h:303
 TPad.h:304
 TPad.h:305
 TPad.h:306
 TPad.h:307
 TPad.h:308
 TPad.h:309
 TPad.h:310
 TPad.h:311
 TPad.h:312
 TPad.h:313
 TPad.h:314
 TPad.h:315
 TPad.h:316
 TPad.h:317
 TPad.h:318
 TPad.h:319
 TPad.h:320
 TPad.h:321
 TPad.h:322
 TPad.h:323
 TPad.h:324
 TPad.h:325
 TPad.h:326
 TPad.h:327
 TPad.h:328
 TPad.h:329
 TPad.h:330
 TPad.h:331
 TPad.h:332
 TPad.h:333
 TPad.h:334
 TPad.h:335
 TPad.h:336
 TPad.h:337
 TPad.h:338
 TPad.h:339
 TPad.h:340
 TPad.h:341
 TPad.h:342
 TPad.h:343
 TPad.h:344
 TPad.h:345
 TPad.h:346
 TPad.h:347
 TPad.h:348
 TPad.h:349
 TPad.h:350
 TPad.h:351
 TPad.h:352
 TPad.h:353
 TPad.h:354
 TPad.h:355
 TPad.h:356
 TPad.h:357
 TPad.h:358
 TPad.h:359
 TPad.h:360
 TPad.h:361
 TPad.h:362
 TPad.h:363
 TPad.h:364
 TPad.h:365
 TPad.h:366
 TPad.h:367
 TPad.h:368
 TPad.h:369
 TPad.h:370
 TPad.h:371
 TPad.h:372
 TPad.h:373
 TPad.h:374
 TPad.h:375
 TPad.h:376
 TPad.h:377
 TPad.h:378
 TPad.h:379
 TPad.h:380
 TPad.h:381
 TPad.h:382
 TPad.h:383
 TPad.h:384
 TPad.h:385
 TPad.h:386
 TPad.h:387
 TPad.h:388
 TPad.h:389
 TPad.h:390
 TPad.h:391
 TPad.h:392
 TPad.h:393
 TPad.h:394
 TPad.h:395
 TPad.h:396
 TPad.h:397
 TPad.h:398
 TPad.h:399
 TPad.h:400
 TPad.h:401
 TPad.h:402
 TPad.h:403
 TPad.h:404
 TPad.h:405
 TPad.h:406
 TPad.h:407
 TPad.h:408
 TPad.h:409
 TPad.h:410
 TPad.h:411
 TPad.h:412
 TPad.h:413
 TPad.h:414
 TPad.h:415
 TPad.h:416
 TPad.h:417
 TPad.h:418
 TPad.h:419
 TPad.h:420
 TPad.h:421
 TPad.h:422
 TPad.h:423
 TPad.h:424
 TPad.h:425
 TPad.h:426
 TPad.h:427
 TPad.h:428
 TPad.h:429
 TPad.h:430
 TPad.h:431
 TPad.h:432
 TPad.h:433
 TPad.h:434
 TPad.h:435
 TPad.h:436
 TPad.h:437
 TPad.h:438
 TPad.h:439
 TPad.h:440
 TPad.h:441
 TPad.h:442
 TPad.h:443
 TPad.h:444
 TPad.h:445
 TPad.h:446
 TPad.h:447
 TPad.h:448
 TPad.h:449
 TPad.h:450
 TPad.h:451
 TPad.h:452
 TPad.h:453
 TPad.h:454
 TPad.h:455
 TPad.h:456
 TPad.h:457
 TPad.h:458
 TPad.h:459
 TPad.h:460
 TPad.h:461
 TPad.h:462
 TPad.h:463
 TPad.h:464
 TPad.h:465
 TPad.h:466
 TPad.h:467
 TPad.h:468
 TPad.h:469
 TPad.h:470
 TPad.h:471
 TPad.h:472
 TPad.h:473
 TPad.h:474
 TPad.h:475
 TPad.h:476
 TPad.h:477
 TPad.h:478
 TPad.h:479
 TPad.h:480
 TPad.h:481
 TPad.h:482
 TPad.h:483
 TPad.h:484
 TPad.h:485
 TPad.h:486
 TPad.h:487
 TPad.h:488
 TPad.h:489
 TPad.h:490
 TPad.h:491
 TPad.h:492
 TPad.h:493
 TPad.h:494
 TPad.h:495
 TPad.h:496
 TPad.h:497
 TPad.h:498
 TPad.h:499
 TPad.h:500
 TPad.h:501
 TPad.h:502
 TPad.h:503
 TPad.h:504
 TPad.h:505
 TPad.h:506
 TPad.h:507
 TPad.h:508
 TPad.h:509
 TPad.h:510
 TPad.h:511
 TPad.h:512
 TPad.h:513
 TPad.h:514
 TPad.h:515
 TPad.h:516
 TPad.h:517
 TPad.h:518
 TPad.h:519
 TPad.h:520
 TPad.h:521
 TPad.h:522
 TPad.h:523
 TPad.h:524
 TPad.h:525
 TPad.h:526
 TPad.h:527
 TPad.h:528
 TPad.h:529
 TPad.h:530
 TPad.h:531
 TPad.h:532
 TPad.h:533
 TPad.h:534
 TPad.h:535