// @(#)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 "TPoint.h" #include "GuiTypes.h" class TVirtualViewer3D; class TVirtualPadPainter; class TBrowser; class TBox; class TLegend; class TArrow; class TPad : public TVirtualPad, public TAttBBox2D { private: TObject *fTip; ///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; ///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 Resized() { Emit("Resized()"); } // *SIGNAL* 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); Int_t IncrementPaletteColor(Int_t i, TString opt); Int_t NextPaletteColor(); void DrawCollideGrid(); Bool_t PlaceBox(TObject *o, Double_t w, Double_t h, Double_t &xl, Double_t &yb); 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,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