// @(#)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 #include "TVirtualPad.h" #include "TAttBBox2D.h" #include class TVirtualViewer3D; class TVirtualPadPainter; class TBrowser; class TBox; class TLegend; class TArrow; class TPoint; class TWebCanvas; class TPad : public TVirtualPad, public TAttBBox2D { friend class TWebCanvas; private: TObject *fTip{nullptr}; ///List of primitives (subpads) TList *fExecs{nullptr}; ///< List of commands to be executed when a pad event occurs TString fName; ///< Pad name TString fTitle; ///< Pad title TFrame *fFrame{nullptr}; /// fCollideGrid;///fX1,y1=>fY1,x2=>fX2,y2=>fY2} virtual void RangeChanged() { Emit("RangeChanged()"); } // *SIGNAL* void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax) override; void RecursiveRemove(TObject *obj) override; void RedrawAxis(Option_t *option="") override; void ResetView3D(TObject *view=nullptr) override { fPadView3D=view; } void ResizePad(Option_t *option="") override; virtual void Resized() { Emit("Resized()"); } // *SIGNAL* void SaveAs(const char *filename="",Option_t *option="") const override; // *MENU* void SetBorderMode(Short_t bordermode) override { fBorderMode = bordermode; Modified(); } // *MENU* void SetBorderSize(Short_t bordersize) override { fBorderSize = bordersize; Modified(); } // *MENU* void SetCanvas(TCanvas *c) override { fCanvas = c; } void SetCanvasSize(UInt_t ww, UInt_t wh) override; void SetCrosshair(Int_t crhair=1) override; // *TOGGLE* void SetCursor(ECursor cursor) override; void SetDoubleBuffer(Int_t mode=1) override; void SetDrawOption(Option_t *option="") override; void SetEditable(Bool_t mode=kTRUE) override; // *TOGGLE* void SetFixedAspectRatio(Bool_t fixed = kTRUE) override; // *TOGGLE* void SetGrid(Int_t valuex = 1, Int_t valuey = 1) override { fGridx = valuex; fGridy = valuey; Modified(); } void SetGridx(Int_t value = 1) override { fGridx = value; Modified(); } // *TOGGLE* void SetGridy(Int_t value = 1) override { fGridy = value; Modified(); } // *TOGGLE* void SetFillStyle(Style_t fstyle) override; void SetLogx(Int_t value = 1) override; // *TOGGLE* void SetLogy(Int_t value = 1) override; // *TOGGLE* void SetLogz(Int_t value = 1) override; // *TOGGLE* virtual void SetNumber(Int_t number) { fNumber = number; } 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) override; void SetPad(Double_t xlow, Double_t ylow, Double_t xup, Double_t yup) override; void SetAttFillPS(Color_t color, Style_t style) override; void SetAttLinePS(Color_t color, Style_t style, Width_t lwidth) override; void SetAttMarkerPS(Color_t color, Style_t style, Size_t msize) override; void SetAttTextPS(Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize) override; static void SetMaxPickDistance(Int_t maxPick=5); void SetName(const char *name) override { fName = name; } // *MENU* void SetSelected(TObject *obj) override; void SetTicks(Int_t valuex = 1, Int_t valuey = 1) override { fTickx = valuex; fTicky = valuey; Modified(); } void SetTickx(Int_t value = 1) override { fTickx = value; Modified(); } // *TOGGLE* void SetTicky(Int_t value = 1) override { fTicky = value; Modified(); } // *TOGGLE* void SetTitle(const char *title="") override { fTitle = title; } void SetTheta(Double_t theta=30) override { fTheta = theta; Modified(); } void SetPhi(Double_t phi=30) override { fPhi = phi; Modified(); } void SetToolTipText(const char *text, Long_t delayms = 1000) override; void SetVertical(Bool_t vert=kTRUE) override; void SetView(TView *view = nullptr) override; void SetViewer3D(TVirtualViewer3D *viewer3d) override { fViewer3D = viewer3d; } virtual void SetGLDevice(Int_t dev) {fGLDevice = dev;} void SetCopyGLDevice(Bool_t copy) override { fCopyGLDevice = copy; } void ShowGuidelines(TObject *object, const Int_t event, const char mode = 'i', const bool cling = true) override; void Update() override; void UpdateAsync() override; Int_t UtoAbsPixel(Double_t u) const override { return Int_t(fUtoAbsPixelk + u*fUtoPixel); } Int_t VtoAbsPixel(Double_t v) const override { return Int_t(fVtoAbsPixelk + v*fVtoPixel); } Int_t UtoPixel(Double_t u) const override; Int_t VtoPixel(Double_t v) const override; TObject *WaitPrimitive(const char *pname="", const char *emode="") override; Int_t XtoAbsPixel(Double_t x) const override; Int_t YtoAbsPixel(Double_t y) const override; Double_t XtoPad(Double_t x) const override; Double_t YtoPad(Double_t y) const override; Int_t XtoPixel(Double_t x) const override; Int_t YtoPixel(Double_t y) const override; 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; TObject *CreateToolTip(const TBox *b, const char *text, Long_t delayms) override; void DeleteToolTip(TObject *tip) override; void ResetToolTip(TObject *tip) override; void CloseToolTip(TObject *tip) override; Int_t IncrementPaletteColor(Int_t i, TString opt) override; Int_t NextPaletteColor() override; void DrawCollideGrid(); Bool_t PlaceBox(TObject *o, Double_t w, Double_t h, Double_t &xl, Double_t &yb, Option_t* option = "lb") override; virtual void x3d(Option_t *type=""); // Depreciated TVirtualViewer3D *GetViewer3D(Option_t * type = "") override; Bool_t HasViewer3D() const override { return fViewer3D != nullptr; } void ReleaseViewer3D(Option_t * type = "") override; Rectangle_t GetBBox() override; TPoint GetBBoxCenter() override; void SetBBoxCenter(const TPoint &p) override; void SetBBoxCenterX(const Int_t x) override; void SetBBoxCenterY(const Int_t y) override; void SetBBoxX1(const Int_t x) override; void SetBBoxX2(const Int_t x) override; void SetBBoxY1(const Int_t y) override; void SetBBoxY2(const Int_t y) override; 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* ClassDefOverride(TPad,13) //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