#ifndef ROOT_TPad
#define ROOT_TPad
#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;
protected:
Double_t fX1;
Double_t fY1;
Double_t fX2;
Double_t fY2;
Double_t fXtoAbsPixelk;
Double_t fXtoPixelk;
Double_t fXtoPixel;
Double_t fYtoAbsPixelk;
Double_t fYtoPixelk;
Double_t fYtoPixel;
Double_t fUtoAbsPixelk;
Double_t fUtoPixelk;
Double_t fUtoPixel;
Double_t fVtoAbsPixelk;
Double_t fVtoPixelk;
Double_t fVtoPixel;
Double_t fAbsPixeltoXk;
Double_t fPixeltoXk;
Double_t fPixeltoX;
Double_t fAbsPixeltoYk;
Double_t fPixeltoYk;
Double_t fPixeltoY;
Double_t fXlowNDC;
Double_t fYlowNDC;
Double_t fXUpNDC;
Double_t fYUpNDC;
Double_t fWNDC;
Double_t fHNDC;
Double_t fAbsXlowNDC;
Double_t fAbsYlowNDC;
Double_t fAbsWNDC;
Double_t fAbsHNDC;
Double_t fUxmin;
Double_t fUymin;
Double_t fUxmax;
Double_t fUymax;
Double_t fTheta;
Double_t fPhi;
Double_t fAspectRatio;
Int_t fPixmapID;
Int_t fGLDevice;
Bool_t fCopyGLDevice;
Bool_t fEmbeddedGL;
Int_t fNumber;
Int_t fTickx;
Int_t fTicky;
Int_t fLogx;
Int_t fLogy;
Int_t fLogz;
Int_t fPadPaint;
Int_t fCrosshair;
Int_t fCrosshairPos;
Short_t fBorderSize;
Short_t fBorderMode;
Bool_t fModified;
Bool_t fGridx;
Bool_t fGridy;
Bool_t fAbsCoord;
Bool_t fEditable;
Bool_t fFixedAspectRatio;
TPad *fMother;
TCanvas *fCanvas;
TList *fPrimitives;
TList *fExecs;
TString fName;
TString fTitle;
TFrame *fFrame;
TView *fView;
TObject *fPadPointer;
TObject *fPadView3D;
static Int_t fgMaxPickDistance;
TVirtualViewer3D *fViewer3D;
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);
TPad &operator=(const TPad &rhs);
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:
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="");
TVirtualPad* cd(Int_t subpadnumber=0);
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()"); }
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);
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();
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;
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;}
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);
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="");
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();
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);
virtual void RangeChanged() { Emit("RangeChanged()"); }
virtual void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
virtual void RangeAxisChanged() { Emit("RangeAxisChanged()"); }
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;
virtual void SetBorderMode(Short_t bordermode) {fBorderMode = bordermode; Modified();}
virtual void SetBorderSize(Short_t bordersize) {fBorderSize = bordersize; Modified();}
void SetCanvas(TCanvas *c) { fCanvas = c; }
virtual void SetCanvasSize(UInt_t ww, UInt_t wh);
virtual void SetCrosshair(Int_t crhair=1);
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);
virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE);
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();}
virtual void SetGridy(Int_t value = 1) {fGridy = value; Modified();}
virtual void SetFillStyle(Style_t fstyle);
virtual void SetLogx(Int_t value = 1);
virtual void SetLogy(Int_t value = 1);
virtual void SetLogz(Int_t value = 1);
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;}
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();}
virtual void SetTicky(Int_t value = 1) {fTicky = value; Modified();}
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="");
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);
virtual void RecordLatex(const TObject *obj);
virtual void EventPave() { Emit("EventPave()"); }
virtual void StartEditing() { Emit("StartEditing()"); }
ClassDef(TPad,11)
};
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