TPad
class description - source file - inheritance tree
private:
TPad(const TPad& pad)
void CopyBackgroundPixmap(Int_t x, Int_t y)
void CopyBackgroundPixmaps(TPad* start, TPad* stop, Int_t x, Int_t y)
TPad& operator=(const TPad& rhs)
protected:
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)
virtual void SavePrimitive(ofstream& out, const Option_t* option)
virtual void SetBatch(Bool_t batch = kTRUE)
public:
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()
virtual void AbsCoordinates(Bool_t set)
virtual Double_t AbsPixeltoX(Int_t px)
virtual void AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t& x, Double_t& y)
virtual Double_t AbsPixeltoY(Int_t py)
virtual void AddExec(const char* name, const char* command)
virtual void AutoExec()
virtual void Browse(TBrowser* b)
virtual void cd(Int_t subpadnumber = 0)
static TClass* Class()
virtual void Clear(const 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 void Close(const Option_t* option)
virtual void Closed()
virtual void CloseToolTip(TObject* tip)
virtual void CopyPixmap()
virtual void CopyPixmaps()
virtual void CreateNewEllipse(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual void CreateNewLine(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual void CreateNewPad(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual void CreateNewPave(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual void CreateNewPolyLine(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual void CreateNewText(Int_t event, Int_t px, Int_t py, Int_t mode)
virtual TObject* CreateToolTip(const TBox* b, const char* text, Long_t delayms)
virtual void DeleteExec(const char* name)
virtual void DeleteToolTip(TObject* tip)
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 Draw(const Option_t* option)
virtual void DrawClassObject(const TObject* obj, const Option_t* option)
static void DrawColorTable()
virtual void DrawCrosshair()
virtual TH1F* DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char* title)
virtual void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
virtual void DrawText(Double_t x, Double_t y, const char* text)
virtual void DrawTextNDC(Double_t u, Double_t v, const char* text)
virtual TObject* FindObject(const char* name) const
virtual TObject* FindObject(const TObject* obj) const
virtual Double_t GetAbsHNDC() const
virtual Double_t GetAbsWNDC() const
virtual Double_t GetAbsXlowNDC() const
virtual Double_t GetAbsYlowNDC() const
virtual Double_t GetAspectRatio() const
virtual Short_t GetBorderMode() const
virtual Short_t GetBorderSize() const
virtual TCanvas* GetCanvas() const
virtual Int_t GetCanvasID() const
Int_t GetCrosshair() const
virtual Int_t GetEvent() const
virtual Int_t GetEventX() const
virtual Int_t GetEventY() const
virtual TFrame* GetFrame()
virtual Bool_t GetGridx() const
virtual Bool_t GetGridy() const
virtual Color_t GetHighLightColor() const
virtual Double_t GetHNDC() const
virtual TList* GetListOfExecs() const
virtual TList* GetListOfPrimitives() const
virtual Int_t GetLogx() const
virtual Int_t GetLogy() const
virtual Int_t GetLogz() const
static Int_t GetMaxPickDistance()
virtual TVirtualPad* GetMother() const
virtual const char* GetName() const
virtual Int_t GetNumber() const
virtual TVirtualPad* GetPad(Int_t subpadnumber) const
virtual Int_t GetPadPaint() const
virtual void GetPadPar(Double_t& xlow, Double_t& ylow, Double_t& xup, Double_t& yup)
virtual TObject* GetPadPointer() const
virtual TVirtualPad* GetPadSave() const
virtual Double_t GetPhi() const
virtual Int_t GetPixmapID() const
virtual TObject* GetPrimitive(const char* name) 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 TObject* GetSelected() const
virtual TVirtualPad* GetSelectedPad() const
virtual Double_t GetTheta() const
virtual Int_t GetTickx() const
virtual Int_t GetTicky() const
virtual const char* GetTitle() const
virtual Double_t GetUxmax() const
virtual Double_t GetUxmin() const
virtual Double_t GetUymax() const
virtual Double_t GetUymin() const
virtual TView* GetView() const
virtual TPadView3D* GetView3D() const
virtual TVirtualPad* GetVirtCanvas() const
virtual UInt_t GetWh() const
virtual Double_t GetWNDC() const
virtual UInt_t GetWw() const
virtual Double_t GetX1() const
virtual Double_t GetX2() const
virtual Double_t GetXlowNDC() const
virtual Double_t GetY1() const
virtual Double_t GetY2() const
virtual Double_t GetYlowNDC() const
virtual Bool_t HasCrosshair() const
virtual Bool_t HasFixedAspectRatio() const
virtual ULong_t Hash() const
virtual void HighLight(Color_t col = kRed, Bool_t set = kTRUE)
virtual TClass* IsA() const
virtual Bool_t IsBatch() const
virtual Bool_t IsEditable() const
virtual Bool_t IsFolder() const
virtual Bool_t IsModified() const
virtual Bool_t IsRetained() const
virtual Bool_t IsVertical() const
virtual void ls(const Option_t* option) const
virtual void Modified(Bool_t flag = 1)
virtual Bool_t OpaqueMoving() const
virtual Bool_t OpaqueResizing() const
virtual Double_t PadtoX(Double_t x) const
virtual Double_t PadtoY(Double_t y) const
virtual void Paint(const Option_t* option)
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const Option_t* option)
virtual void PaintFillArea(Int_t n, Float_t* x, Float_t* y, const Option_t* option)
virtual void PaintFillArea(Int_t n, Double_t* x, Double_t* y, const Option_t* option)
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual void PaintLine3D(Float_t* p1, Float_t* p2)
virtual void PaintLine3D(Double_t* p1, Double_t* p2)
virtual void PaintLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
virtual void PaintModified()
virtual void PaintPadFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
virtual void PaintPolyLine(Int_t n, Float_t* x, Float_t* y, const Option_t* option)
virtual void PaintPolyLine(Int_t n, Double_t* x, Double_t* y, const Option_t* option)
virtual void PaintPolyLine3D(Int_t n, Double_t* p)
virtual void PaintPolyLineNDC(Int_t n, Double_t* x, Double_t* y, const Option_t* option)
virtual void PaintPolyMarker(Int_t n, Float_t* x, Float_t* y, const Option_t* option)
virtual void PaintPolyMarker(Int_t n, Double_t* x, Double_t* y, const Option_t* option)
virtual void PaintText(Double_t x, Double_t y, const char* text)
virtual void PaintTextNDC(Double_t u, Double_t v, const char* text)
virtual TPad* Pick(Int_t px, Int_t py, TObjLink*& pickobj)
virtual Double_t PixeltoX(Int_t px)
virtual void PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t& x, Double_t& y)
virtual Double_t PixeltoY(Int_t py)
virtual void Pop()
virtual void Print(const char* filename) const
virtual void Print(const char* filename, const Option_t* option)
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
virtual void RangeAxisChanged()
virtual void RangeChanged()
virtual void RecursiveRemove(TObject* obj)
virtual void RedrawAxis(const Option_t* option)
virtual void ResetToolTip(TObject* tip)
virtual void ResetView3D(TPadView3D* view = 0)
virtual void ResizePad(const Option_t* option)
virtual void SaveAs(const char* filename)
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)
virtual void SetBorderMode(Short_t bordermode)
virtual void SetBorderSize(Short_t bordersize)
virtual void SetCanvas(TCanvas* 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(const Option_t* option)
virtual void SetEditable(Bool_t mode = kTRUE)
virtual void SetFillStyle(Style_t fstyle)
virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE)
virtual void SetGrid(Int_t valuex = 1, Int_t valuey = 1)
virtual void SetGridx(Int_t value = 1)
virtual void SetGridy(Int_t value = 1)
virtual void SetLogx(Int_t value = 1)
virtual void SetLogy(Int_t value = 1)
virtual void SetLogz(Int_t value = 1)
static void SetMaxPickDistance(Int_t maxPick = 5)
virtual void SetName(const char* name)
virtual void SetNumber(Int_t 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 SetPhi(Double_t phi = 30)
virtual void SetSelected(TObject* obj)
virtual void SetTheta(Double_t theta = 30)
virtual void SetTicks(Int_t valuex = 1, Int_t valuey = 1)
virtual void SetTickx(Int_t value = 1)
virtual void SetTicky(Int_t value = 1)
virtual void SetTitle(const char* title)
virtual void SetToolTipText(const char* text, Long_t delayms = 1000)
virtual void SetVertical(Bool_t vert = kTRUE)
virtual void SetView(TView* view)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
virtual void Update()
virtual void UpdateFillAttributes(Int_t col, Int_t sty)
virtual void UpdateLineAttributes(Int_t col, Int_t sty, Int_t width)
virtual void UpdateMarkerAttributes(Int_t col, Int_t sty, Float_t msiz)
virtual void UpdateTextAttributes(Int_t align, Float_t angle, Int_t col, Int_t font, Float_t tsize)
virtual void UseCurrentStyle()
virtual Int_t UtoAbsPixel(Double_t u) const
virtual Int_t UtoPixel(Double_t u) const
virtual Int_t VtoAbsPixel(Double_t v) const
virtual Int_t VtoPixel(Double_t v) const
virtual TObject* WaitPrimitive(const char* pname, const char* emode)
virtual void x3d(const Option_t* option)
virtual Int_t XtoAbsPixel(Double_t x) const
virtual Double_t XtoPad(Double_t x) const
virtual Int_t XtoPixel(Double_t x) 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 Int_t YtoAbsPixel(Double_t y) const
virtual Double_t YtoPad(Double_t y) const
virtual Int_t YtoPixel(Double_t y) const
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 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 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
TPadView3D* fPadView3D ! 3D View of this TPad
static Int_t fgMaxPickDistance Maximum Pick Distance
public:
static const enum TPad:: kFraming
static const enum TPad:: kHori
static const enum TPad:: kPrintingPS
static const enum TPad:: kClearAfterCR
See also
-
TButton, TCanvas, TSlider
The Pad class is the most important graphics class in the ROOT system.
/*
*/
A Pad is contained in a Canvas.
A Pad may contain other pads (unlimited pad hierarchy).
A pad is a linked list of primitives of any type (graphics objects,
histograms, detectors, tracks, etc.).
Adding a new element into a pad is in general performed by the Draw
member function of the object classes.
It is important to realize that the pad is a linked list of references
to the original object.
For example, in case of an histogram, the histogram.Draw() operation
only stores a reference to the histogram object and not a graphical
representation of this histogram.
When the mouse is used to change (say the bin content), the bin content
of the original histogram is changed !!
The convention used in ROOT is that a Draw operation only adds
a reference to the object. The effective drawing is performed when
when the canvas receives a signal to be painted.
This signal is generally sent when typing carriage return in the
command input or when a graphical operation has been performed on one
of the pads of this canvas.
When a Canvas/Pad is repainted, the member function Paint for all
objects in the Pad linked list is invoked.
When the mouse is moved on the Pad, The member function DistancetoPrimitive
is called for all the elements in the pad. DistancetoPrimitive returns
the distance in pixels to this object.
when the object is within the distance window, the member function
ExecuteEvent is called for this object.
in ExecuteEvent, move, changes can be performed on the object.
For examples of DistancetoPrimitive and ExecuteEvent functions,
see classes TLine::DistancetoPrimitive, TLine::ExecuteEvent
TBox::DistancetoPrimitive, TBox::ExecuteEvent
TH1::DistancetoPrimitive, TH1::ExecuteEvent
A Pad supports linear and log scales coordinate systems.
The transformation coefficients are explained in TPad::ResizePad.
An example of pads hierarchy is shown below:
/*
*/
TPad(): TVirtualPad()
*-*-*-*-*-*-*-*-*-*-*Pad default constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =======================
TPad(const char *name, const char *title, Double_t xlow,
Double_t ylow, Double_t xup, Double_t yup,
Color_t color, Short_t bordersize, Short_t bordermode)
: TVirtualPad(name,title,xlow,ylow,xup,yup,color,bordersize,bordermode)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*Pad constructor-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===============
A pad is a linked list of primitives.
A pad is contained in a canvas. It may contain other pads.
A pad has attributes. When a pad is created, the attributes
defined in the current style are copied to the pad attributes.
xlow [0,1] is the position of the bottom left point of the pad
expressed in the mother pad reference system
ylow [0,1] is the Y position of this point.
xup [0,1] is the x position of the top right point of the pad
expressed in the mother pad reference system
yup [0,1] is the Y position of this point.
the bordersize is in pixels
bordermode = -1 box looks as it is behind the screen
bordermode = 0 no special effects
bordermode = 1 box looks as it is in front of the screen
~TPad()
*-*-*-*-*-*-*-*-*-*-*Pad destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==============
void AddExec(const char *name, const char*command)
Add a new TExec object to the list of Execs.
When an event occurs in the pad (mouse click, etc) the list of CINT commands
in the list of Execs are executed via TPad::AutoExec.
When a pad event occurs (mouse move, click, etc) all the commands
contained in the fExecs list are executed in the order found in the list.
This facility is activated by default. It can be deactivated by using
the canvas "Option" menu.
The following examples of TExec commands are provided in the tutorials:
macros exec1.C and exec2.C.
Example1 of use of exec1.C
==========================
Root > TFile f("hsimple.root")
Root > hpx.Draw()
Root > c1.AddExec("ex1",".x exec1.C")
At this point you can use the mouse to click on the contour of
the histogram hpx. When the mouse is clicked, the bin number and its
contents are printed.
Example2 of use of exec1.C
==========================
Root > TFile f("hsimple.root")
Root > hpxpy.Draw()
Root > c1.AddExec("ex2",".x exec2.C")
When moving the mouse in the canvas, a second canvas shows the
projection along X of the bin corresponding to the Y position
of the mouse. The resulting histogram is fitted with a gaussian.
A "dynamic" line shows the current bin position in Y.
This more elaborated example can be used as a starting point
to develop more powerful interactive applications exploiting CINT
as a development engine.
void AutoExec()
Execute the list of Execs when a pad event occurs.
void Browse(TBrowser *b)
void cd(Int_t subpadnumber)
*-*-*-*-*-*-*-*-*Set Current Pad*-*-*-*-*-**-*-*-*-*-*-*-*
*-* ====================
When a canvas/pad is divided via TPad::Divide, one can directly
set the current path to one of the subdivisions.
See TPad::Divide for the convention to number subpads.
For example:
c1.Divide(2,3); // create 6 pads (2 divisions along x, 3 along y).
To set the current pad to the bottom right pad, do
c1.cd(6);
Note1: c1.cd() is equivalent to c1.cd(0) and sets the current pad
to c1 itself.
Note2: after a statement like c1.cd(6), the global variable gPad
points to the current pad. One can use gPad to set attributes
of the current pad.
Note3: One can get a pointer to one of the sub-pads of pad with:
TPad *subpad = (TPad*)pad->GetPad(subpadnumber);
void Clear(Option_t *option)
*-*-*-*-*-*-*-*-*Delete all pad primitives*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =========================
If the bit kClearAfterCR has been set for this pad, the Clear function
will execute only after having pressed a CarriageReturn
Set the bit with mypad->SetBit(TPad::kClearAfterCR)
Int_t Clip(Float_t *x, Float_t *y, Float_t xclipl, Float_t yclipb, Float_t xclipr, Float_t yclipt)
Clipping routine: Cohen Sutherland algorithm.
If Clip ==2 the segment is outside the boundary.
If Clip ==1 the segment has one point outside the boundary.
If Clip ==0 the segment is inside the boundary.
_Input parameters:
x[2], y[2] : Segment coordinates
xclipl, yclipb, xclipr, yclipt : Clipping boundary
_Output parameters:
x[2], y[2] : New segment coordinates
Int_t Clip(Double_t *x, Double_t *y, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt)
Clipping routine: Cohen Sutherland algorithm.
If Clip ==2 the segment is outside the boundary.
If Clip ==1 the segment has one point outside the boundary.
If Clip ==0 the segment is inside the boundary.
_Input parameters:
x[2], y[2] : Segment coordinates
xclipl, yclipb, xclipr, yclipt : Clipping boundary
_Output parameters:
x[2], y[2] : New segment coordinates
Int_t ClippingCode(Double_t x, Double_t y, Double_t xcl1, Double_t ycl1, Double_t xcl2, Double_t ycl2)
Compute the endpoint codes for TPad::Clip.
void Close(Option_t *)
Delete all primitives in pad and pad itself.
Pad cannot be used anymore after this call.
Emits signal "Closed()".
void CopyPixmap()
*-*-*-*-*-*-*-*-*Copy the pixmap of the pad to the canvas*-*-*-*-*-*-*
*-* ========================================
void CopyPixmaps()
*-*-*-*-*-*-*-*-*Copy the sub-pixmaps of the pad to the canvas*-*-*-*-*-*-*
*-* =============================================
void CreateNewEllipse(Int_t event, Int_t px, Int_t py, Int_t mode)
*-*-*-*-*-*-*-*-*-*-*Create a new arc/ellipse in this pad*-*-*-*-*-*-*-*-*-*
*-* ====================================
Function called by TPad::ExecuteEvent when the action "Create NewEllipse"
has been selected in the Canvas pulldown menu.
Click left button to indicate arrow starting position.
Release left button to terminate the arrow.
void CreateNewLine(Int_t event, Int_t px, Int_t py, Int_t mode)
*-*-*-*-*-*-*-*-*-*-*Create a new arrow in this pad*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==============================
Function called by TPad::ExecuteEvent when the action "Create NewArrow"
has been selected in the Canvas pulldown menu.
Click left button to indicate arrow starting position.
Release left button to terminate the arrow.
void CreateNewPad(Int_t event, Int_t px, Int_t py, Int_t)
*-*-*-*-*-*-*-*-*-*-*Create a new pad in this pad*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ============================
Function called by TPad::ExecuteEvent when the action "Create NewPad"
has been selected in the Canvas pulldown menu.
Click left button to indicate one corner of the pad
Click left button to indicate the opposite corner
The new pad is inserted in the pad where the first point is selected.
void CreateNewPave(Int_t event, Int_t px, Int_t py, Int_t mode)
*-*-*-*-*-*-*-*-*-*Create a new pavetext in this pad*-*-*-*-*-*-*-*-*-*-*
*-* =================================
Function called by TPad::ExecuteEvent when the action "Create NewPaveText"
has been selected in the Canvas pulldown menu.
Click left button to indicate one corner of the pavelabel.
Release left button at the opposite corner.
void CreateNewPolyLine(Int_t event, Int_t px, Int_t py, Int_t mode)
*-*-*-*-*-*-*-*-*-*Create a new PolyLine*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ======================
Click left button to indicate a new point
Click right button to close the polyline
mode = 0 normal polyline
mode = 0 smooth polyline
This function is called when the item NewPolyLine is selected in the
canvas pulldown menu.
void CreateNewText(Int_t event, Int_t px, Int_t py, Int_t mode)
*-*-*-*-*-*-*-*-*-*Create a new TLatex at the cursor position*-*-*-*-*-*-*-*
*-* ==========================================
Click left button to indicate the text position
This function is called when the item NewText is selected in the
canvas pulldown menu.
void DeleteExec(const char *name)
Remove TExec name from the list of Execs.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a box*-*-*-*-*-*
*-* ==========================================
Compute the closest distance of approach from point px,py to the
edges of this pad.
The distance is computed in pixels units.
void Divide(Int_t nx, Int_t ny, Float_t xmargin, Float_t ymargin, Int_t color)
*-*-*-*-*-*-*-*-*Automatic pad generation by division*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
The current canvas is divided in nx by ny equal divisions(pads).
xmargin is the space along x between pads in percent of canvas.
ymargin is the space along y between pads in percent of canvas.
color is the color of the new pads. If 0, color is the canvas color.
Pads are automatically named canvasname_n where n is the division number
starting from top left pad.
Example if canvasname=c1 , nx=2, ny=3
...............................................................
. . .
. . .
. . .
. c1_1 . c1_2 .
. . .
. . .
. . .
...............................................................
. . .
. . .
. . .
. c1_3 . c1_4 .
. . .
. . .
. . .
...............................................................
. . .
. . .
. . .
. c1_5 . c1_6 .
. . .
. . .
...............................................................
Once a pad is divided into subpads, one can set the current pad
to a subpad with a given division number as illustrated above
with TPad::cd(subpad_number).
For example, to set the current pad to c1_4, one can do:
c1->cd(4)
Note1: c1.cd() is equivalent to c1.cd(0) and sets the current pad
to c1 itself.
Note2: after a statement like c1.cd(6), the global variable gPad
points to the current pad. One can use gPad to set attributes
of the current pad.
void Draw(Option_t *option)
*-*-*-*-*-*-*-*-*Draw Pad in Current pad (re-parent pad if necessary)*-*-*-*
*-* ====================================================
void DrawClassObject(const TObject *classobj, Option_t *option)
Draw class inheritance tree of the class to which obj belongs.
If a class B inherits from a class A, description of B is drawn
on the right side of description of A.
Member functions overridden by B are shown in class A with a blue line
crossing-out the corresponding member function.
The following picture is the class inheritance tree of class TPaveLabel:
/*
*/
void DrawCrosshair()
Function called to draw a crosshair in the canvas
Example:
Root > TFile f("hsimple.root");
Root > hpxpy.Draw();
Root > c1.SetCrosshair();
When moving the mouse in the canvas, a crosshair is drawn
TH1F* DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, const char *title)
Draw a pad frame
Compute real pad range taking into account all margins
Use services of TH1F class
void DrawColorTable()
*-*-*-*-static function to Display Color Table in a pad*-*-*-*-*-*-*
*-* ===============================================
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
*-*-*-*-*-*-*-*-*Draw line in CurrentPad World coordinates*-*-*-*-*-*-*-*
*-* =========================================
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
*-*-*-*-*-*-*-*-*Draw line in CurrentPad NDC coordinates*-*-*-*-*-*-*-*
*-* =======================================
void DrawText(Double_t x, Double_t y, const char *text)
*-*-*-*-*-*-*-*-*Draw text in CurrentPad World coordinates*-*-*-*-*-*-*-*
*-* =========================================
void DrawTextNDC(Double_t u, Double_t v, const char *text)
*-*-*-*-*-*-*-*-*Draw text in CurrentPad NDC coordinates*-*-*-*-*-*-*-*
*-* =======================================
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-* =========================================
This member function is called when a TPad object is clicked.
If the mouse is clicked in one of the 4 corners of the pad (PA,PB,PC,PD)
the pad is resized with the rubber rectangle.
If the mouse is clicked inside the pad, the pad is moved.
If the mouse is clicked on the 4 edges (L,R,T,B), the pad is scaled
parallel to this edge.
PA T PB
+--------------------------------------------+
| |
| |
| |
L| INSIDE |R
| |
| |
| |
| |
+--------------------------------------------+
PD B PC
Note that this function duplicates on purpose the functionality
already implemented in TBox::ExecuteEvent.
If somebody modifies this function, may be similar changes should also
be applied to TBox::ExecuteEvent.
TObject* FindObject(const char *name) const
TObject* FindObject(const TObject *) const
not implemented yet
Int_t GetCanvasID() const
Int_t GetEvent() const
Int_t GetEventX() const
Int_t GetEventY() const
TVirtualPad* GetVirtCanvas() const
Color_t GetHighLightColor() const
Int_t GetMaxPickDistance()
static function (see also TPad::SetMaxPickDistance)
TObject* GetSelected() const
TVirtualPad* GetSelectedPad() const
TVirtualPad* GetPadSave() const
UInt_t GetWh() const
UInt_t GetWw() const
void HideToolTip(Int_t event)
Hide tool tip depending on the event type. Typically tool tips
are hidden when event is not a kMouseEnter and not a kMouseMotion
event.
Bool_t IsBatch() const
Bool_t IsRetained() const
Bool_t OpaqueMoving() const
Bool_t OpaqueResizing() const
void SetBatch(Bool_t batch)
void SetCanvasSize(UInt_t ww, UInt_t wh)
void SetCursor(ECursor cursor)
void SetDoubleBuffer(Int_t mode)
void SetSelected(TObject *obj)
void Update()
TFrame* GetFrame()
TObject* GetPrimitive(const char *name) const
TVirtualPad* GetPad(Int_t subpadnumber) const
Get a pointer to subpadnumber of this pad
void GetPadPar(Double_t &xlow, Double_t &ylow, Double_t &xup, Double_t &yup)
*-*-*-*-*-*-*-*Return lower and upper bounds of the pad in NDC coordinates
*-* ===========================================================
void GetRange(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
*-*-*-*-*-*-*-*Return pad world coordinates range*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================================
void GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax)
*-*-*-*-*-*-*-*Return pad axis coordinates range*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================================
void HighLight(Color_t color, Bool_t set)
void ls(Option_t *option) const
*-*-*-*-*-*-*-*-*-*List all primitives in pad*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==========================
Double_t PadtoX(Double_t x) const
Double_t PadtoY(Double_t y) const
Double_t XtoPad(Double_t x) const
Double_t YtoPad(Double_t y) const
void Paint(Option_t *option)
*-*-*-*-*-*-*-*-*-*Paint all primitives in pad*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===========================
void PaintBorder(Color_t color, Bool_t tops)
*-*-*-*-*-*-*-*-*-*Paint the pad border*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================
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)
*-*-*-*-*-*-*-*Paint a frame border with Postscript*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
void PaintPadFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
*-*-*-*-*-*-*-*-*-*Paint histogram/graph frame*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===========================
void PaintModified()
*-*-*-*-*-*-*Traverse pad hierarchy and (re)paint only modified pads*-*-*-*
*-* =======================================================
void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *)
*-*-*-*-*-*-*-*-*Paint box in CurrentPad World coordinates*-*-*-*-*-*-*-*-*-*
*-* =========================================
void CopyBackgroundPixmaps(TPad *start, TPad *stop, Int_t x, Int_t y)
Copy pixmaps of pads laying below pad "stop" into pad "stop". This
gives the effect of pad "stop" being transparent.
void CopyBackgroundPixmap(Int_t x, Int_t y)
Copy pixmap of this pad as background of the current pad.
void PaintFillArea(Int_t nn, Float_t *xx, Float_t *yy, Option_t *)
*-*-*-*-*-*-*-*-*Paint fill area in CurrentPad World coordinates*-*-*-*-*-*-*
*-* ===============================================
void PaintFillArea(Int_t nn, Double_t *xx, Double_t *yy, Option_t *)
*-*-*-*-*-*-*-*-*Paint fill area in CurrentPad World coordinates*-*-*-*-*-*-*
*-* ===============================================
void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
*-*-*-*-*-*-*-*-*Paint line in CurrentPad World coordinates*-*-*-*-*-*-*-*
*-* ==========================================
void PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2)
*-*-*-*-*-*-*-*Draw a line with coordinates in NDC*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
void PaintLine3D(Float_t *p1, Float_t *p2)
*-*-*-*-*-*-*-*-*Paint 3-D line in the CurrentPad*-*-*-*-*-*-*-*-*-*-*
*-* ================================
void PaintLine3D(Double_t *p1, Double_t *p2)
*-*-*-*-*-*-*-*-*Paint 3-D line in the CurrentPad*-*-*-*-*-*-*-*-*-*-*
*-* ================================
void PaintPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *)
*-*-*-*-*-*-*-*-*Paint polyline in CurrentPad World coordinates*-*-*-*-*-*-*
*-* ==============================================
void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *)
*-*-*-*-*-*-*-*-*Paint polyline in CurrentPad World coordinates*-*-*-*-*-*-*
*-* ==============================================
void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *)
*-*-*-*-*-*-*-*-*Paint polyline in CurrentPad NDC coordinates*-*-*-*-*-*-*
*-* ============================================
void PaintPolyLine3D(Int_t n, Double_t *p)
*-*-*-*-*-*-*-*-*Paint 3-D polyline in the CurrentPad*-*-*-*-*-*-*-*-*-*-*
*-* ====================================
void PaintPolyMarker(Int_t nn, Float_t *x, Float_t *y, Option_t *)
*-*-*-*-*-*-*-*-*Paint polymarker in CurrentPad World coordinates*-*-*-*-*-*
*-* ================================================
void PaintPolyMarker(Int_t nn, Double_t *x, Double_t *y, Option_t *)
*-*-*-*-*-*-*-*-*Paint polymarker in CurrentPad World coordinates*-*-*-*-*-*
*-* ================================================
void PaintText(Double_t x, Double_t y, const char *text)
*-*-*-*-*-*-*-*-*Paint text in CurrentPad World coordinates*-*-*-*-*-*-*-*
*-* ==========================================
void PaintTextNDC(Double_t u, Double_t v, const char *text)
*-*-*-*-*-*-*-*-*Paint text in CurrentPad NDC coordinates*-*-*-*-*-*-*-*
*-* ========================================
TPad* Pick(Int_t px, Int_t py, TObjLink *&pickobj)
*-*-*-*-*-*-*-*-*Search for an object at pixel position px,py*-*-*-*-*-*-*
*-* ============================================
Check if point is in this pad.
If yes, check if it is in one of the subpads
If found in the pad, compute closest distance of approach
to each primitive.
If one distance of approach is found to be within the limit Distancemaximum
the corresponding primitive is selected and the routine returns.
void Pop()
*-*-*-*-*-*-*-*-*-*-*Pop pad to the top of the stack*-*-*-*-*-*-*-*-*-*-*-*
*-* ===============================
void Print(const char *filename) const
Save Pad contents on a file in various formats
===============================================
if filename is "", the file produced is padname.ps
if filename starts with a dot, the padname is added in front
if filename contains .eps, an Encapsulated Postscript file is produced
if filename contains .gif, a GIF file is produced
if filename contains .C or .cxx, a C++ macro file is produced
if filename contains .root, a Root file is produced
See comments in TPad::SaveAs or the TPad::Print function below
void Print(const char *filename, Option_t *option)
*-*-*-*-*Save Pad contents on a file in various formats*-*-*-*-*-*
*-* ==============================================
if option = 0 - as "ps"
"ps" - Postscript file is produced (see special cases below)
"eps" - an Encapsulated Postscript file is produced
"svg" - a SVG file is produced
"gif" - a GIF file is produced
"cxx" - a C++ macro file is produced
filename = 0 - filename is defined by the GetName and its
extension is defined with the option
When Postscript output is selected (ps, eps), the pad is saved
to filename.ps or filename.eps. The aspect ratio of the pad is preserved
on the Postscript file. When the "ps" option is selected, the Postscript
page will be landscape format if the pad is in landscape format, otherwise
portrait format is selected.
The physical size of the Postscript page is the one selected in the
current style. This size can be modified via TStyle::SetPaperSize.
Examples:
gStyle->SetPaperSize(kA4); //default
gStyle->SetPaperSize(kUSLetter);
where kA4 and kUSLetter are defined in the enum EPaperSize in TStyle.h
An alternative is to call:
gStyle->SetPaperSize(20,26); same as kA4
or gStyle->SetPaperSize(20,24); same as kUSLetter
The above numbers take into account some margins and are in centimeters.
To generate a Postscript file containing more than one picture, see
class TPostScript.
Writing several canvases to the same Postscript file
----------------------------------------------------
if the Postscript file name finishes with "(", the file is not closed
if the Postscript file name finishes with ")" and the file has been opened
with "(", the file is closed. Example:
{
TCanvas c1("c1");
h1.Draw();
c1.Print("c1.ps("); //write canvas and keep the ps file open
h2.Draw();
c1.Print("c1.ps"); canvas is added to "c1.ps"
h3.Draw();
c1.Print("c1.ps)"); canvas is added to "c1.ps" and ps file is closed
}
Note that the following sequence writes the canvas to "c1.ps" and closes the ps file.:
TCanvas c1("c1");
h1.Draw();
c1.Print("c1.ps");
The TCanvas::Print("file.ps(") mechanism is very useful, but it can be
a little inconvenient to have the action of opening/closing a file
being atomic with printing a page. Particularly if pages are being
generated in some loop one needs to detect the special cases of first
and last page and then munge the argument to Print() accordingly.
The "[" and "]" can be used instead of "(" and ")". Example:
c1.Print("file.ps["); // No actual print, just open file.ps
for (int i=0; i<10; ++i) {
// fill canvas for context i
// ...
c1.Print("file.ps"); // actually print canvas to file
}// end loop
c1.Print("file.ps]"); // No actual print, just close.
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Emits signal "RangeChanged()", in the slot get the range
via GetRange().
void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
Set axis coordinate system for the pad.
The axis coordinate system is a subset of the world coordinate system
xmin,ymin is the origin of the current coordinate system,
xmax is the end of the X axis, ymax is the end of the Y axis.
By default a margin of 10 per cent is left on all sides of the pad
Emits signal "RangeAxisChanged()", in the slot get the axis range
via GetRangeAxis().
void RecursiveRemove(TObject *obj)
*-*-*-*-*-*-*-*Recursively remove object from a pad and its subpads*-*-*-*-*
*-* ====================================================
void RedrawAxis(Option_t *option)
Redraw the frame axis
Redrawing axis may be necessary in case of superimposed histograms
when one or more histograms have a fill color
Instead of calling this function, it may be more convenient
to call directly h1->Draw("sameaxis") where h1 is the pointer
to the first histogram drawn in the pad.
By default, if the pad has the options gridx or/and gridy activated,
the grid is not drawn by this function.
if option="g" is specified, this will force the drawing of the grid
on top of the picture
get first histogram in the list of primitives
void ResizePad(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*Compute pad conversion coefficients*-*-*-*-*-*-*-*-*
*-* ===================================
Conversion from x to px & y to py
=================================
x - xmin px - pxlow xrange = xmax-xmin
-------- = ---------- with
xrange pxrange pxrange = pxmax-pxmin
pxrange(x-xmin)
==> px = --------------- + pxlow = fXtoPixelk + fXtoPixel * x
xrange
==> fXtoPixelk = pxlow - pxrange*xmin/xrange
fXtoPixel = pxrange/xrange
where pxlow = fAbsXlowNDC*fCw
pxrange = fAbsWNDC*fCw
y - ymin py - pylow yrange = ymax-ymin
-------- = ---------- with
yrange pyrange pyrange = pymax-pymin
pyrange(y-ymin)
==> py = --------------- + pylow = fYtoPixelk + fYtoPixel * y
yrange
==> fYtoPixelk = pylow - pyrange*ymin/yrange
fYtoPixel = pyrange/yrange
where pylow = (1-fAbsYlowNDC)*fCh
pyrange = -fAbsHNDC*fCh
- Conversion from px to x & py to y
=================================
xrange(px-pxlow)
==> x = ---------------- + xmin = fPixeltoXk + fPixeltoX * px
pxrange
-
==> fPixeltoXk = xmin - pxlow*xrange/pxrange
fPixeltoX = xrange/pxrange
yrange(py-pylow)
==> y = ---------------- + ymin = fPixeltoYk + fPixeltoY * py
pyrange
-
==> fPixeltoYk = ymin - pylow*yrange/pyrange
fPixeltoY = yrange/pyrange
-----------------------------------------------------------------------
Computation of the coefficients in case of LOG scales
- =====================================================
A, Conversion from pixel coordinates to world coordinates
Log(x) - Log(xmin) Log(x/xmin) px - pxlow
u = --------------------- = ------------- = -----------
Log(xmax) - Log(xmin) Log(xmax/xmin) pxrange
==> Log(x/xmin) = u*Log(xmax/xmin)
x = xmin*exp(u*Log(xmax/xmin)
Let alfa = Log(xmax/xmin)/fAbsWNDC
x = xmin*exp(-alfa*pxlow) + exp(alfa*px)
x = fPixeltoXk*exp(fPixeltoX*px)
==> fPixeltoXk = xmin*exp(-alfa*pxlow)
fPixeltoX = alfa
Log(y) - Log(ymin) Log(y/ymin) pylow - py
v = --------------------- = ------------- = -----------
Log(ymax) - Log(ymin) Log(ymax/ymin) pyrange
Let beta = Log(ymax/ymin)/pyrange
Log(y/ymin) = beta*pylow - beta*py
y/ymin = exp(beta*pylow - beta*py)
y = ymin*exp(beta*pylow)*exp(-beta*py)
==> y = fPixeltoYk*exp(fPixeltoY*py)
fPixeltoYk = ymin*exp(beta*pylow)
fPixeltoY = -beta
- B, Conversion from World coordinates to pixel coordinates
px = pxlow + u*pxrange
= pxlow + Log(x/xmin)/alfa
= pxlow -Log(xmin)/alfa + Log(x)/alfa
= fXtoPixelk + fXtoPixel*Log(x)
==> fXtoPixelk = pxlow -Log(xmin)/alfa
==> fXtoPixel = 1/alfa
py = pylow - Log(y/ymin)/beta
= fYtoPixelk + fYtoPixel*Log(y)
==> fYtoPixelk = pylow - Log(ymin)/beta
fYtoPixel = 1/beta
void SaveAs(const char *filename)
*-*-*-*-*Save Pad contents on a file in various formats*-*-*-*-*-*
*-* ===============================================
if filename is "", the file produced is padname.ps
if filename starts with a dot, the padname is added in front
if filename contains .eps, an Encapsulated Postscript file is produced
if filename contains .svg, a SVG file is produced
if filename contains .gif, a GIF file is produced
if filename contains .C or .cxx, a C++ macro file is produced
if filename contains .root, a Root file is produced
See comments in TPad::Print for the Postscript formats
void SavePrimitive(ofstream &out, Option_t *)
*-*-*-*-*-*Save primitives in this pad on the C++ source file out*-*-*-*-*-*
*-* ======================================================
void SetFixedAspectRatio(Bool_t fixed)
Fix pad aspect ratio to current value if fixed is true.
void SetEditable(Bool_t mode)
Set pad editable yes/no
If a pad is not editable:
- one cannot modify the pad and its objects via the mouse.
- one cannot add new objects to the pad
void SetFillStyle(Style_t fstyle)
Overrride TAttFill::FillStyle for TPad because we want to handle style=0
as style 4000.
void SetLogx(Int_t value)
*-*-*-*-*-*-*-*-*Set Lin/Log scale for X
*-* ========================
void SetLogy(Int_t value)
*-*-*-*-*-*-*-*-*Set Lin/Log scale for Y
*-* ========================
void SetLogz(Int_t value)
*-*-*-*-*-*-*-*-*Set Lin/Log scale for Z
*-* ========================
void SetPad(Double_t xlow, Double_t ylow, Double_t xup, Double_t yup)
Set canvas range for pad and resize the pad. If the aspect ratio
was fixed before the call it will be un-fixed.
void SetPad(const char *name, const char *title,
Double_t xlow, Double_t ylow, Double_t xup, Double_t yup,
Color_t color, Short_t bordersize, Short_t bordermode)
*-*-*-*-*-*-*-*-*Set all pad parameters*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ======================
if (!IsEditable()) return;
void SetAttFillPS(Color_t color, Style_t style)
*-*-*-*-*-*-*-*-*Set postscript fill area attributes*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
void SetAttLinePS(Color_t color, Style_t style, Width_t lwidth)
*-*-*-*-*-*-*-*-*Set postscript line attributes*-*-*-*-*-*-*-*-*-*-*
*-* ==============================
void SetAttMarkerPS(Color_t color, Style_t style, Size_t msize)
*-*-*-*-*-*-*-*-*Set postscript marker attributes*-*-*-*-*-*-*-*-*-*-*
*-* ================================
void SetAttTextPS(Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize)
*-*-*-*-*-*-*-*-*Set postscript text attributes*-*-*-*-*-*-*-*-*-*-*
*-* ==============================
void SetCrosshair(Int_t crhair)
set crosshair active/inactive
if crhair != 0, a crosshair will be drawn in the pad and its subpads
void SetMaxPickDistance(Int_t maxPick)
static function to set the maximum Pick Distance fgMaxPickDistance
This parameter is used in TPad::Pick to select an object if
its DistancetoPrimitive returns a value < fgMaxPickDistance
The default value is 5 pixels. Setting a smaller value will make
picking more precise but also more difficult
void SetToolTipText(const char *text, Long_t delayms)
Set tool tip text associated with this pad. The delay is in
milliseconds (minimum 250). To remove tool tip call method with
text = 0.
void SetVertical(Bool_t vert)
Set pad vertical (default) or horizontal
void Streamer(TBuffer &b)
*-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =========================================
void UpdateFillAttributes(Int_t col, Int_t sty)
update fill area attributes via the dialog canvas
void UpdateLineAttributes(Int_t col, Int_t sty, Int_t width)
update line attributes via the dialog canvas
void UpdateMarkerAttributes(Int_t col, Int_t sty, Float_t msiz)
update marker attributes via the dialog canvas
void UpdateTextAttributes(Int_t align,Float_t angle,Int_t col,Int_t font,Float_t tsize)
update text attributes via the dialog canvas
void UseCurrentStyle()
*-*-*-*-*-*Force a copy of current style for all objects in pad*-*-*-*-*
*-* ====================================================
TObject* WaitPrimitive(const char *pname, const char *emode)
Loop and sleep until a primitive with name=pname
is found in the pad.
If emode is given, the editor is automatically set to emode, ie
it is not required to have the editor control bar.
The possible values for emode are:
emode = "" (default). User will select the mode via the editor bar
= "Arc", "Line", "Arrow", "Button", "Diamond", "Ellipse",
= "Pad","pave", "PaveLabel","PaveText", "PavesText",
= "PolyLine", "CurlyLine", "CurlyArc", "Text", "Marker", "CutG"
if emode is specified and it is not valid, "PolyLine" is assumed.
if emode is not specified or ="", an attempt is to use pname[1...]
for example if pname="TArc", emode="Arc" will be assumed.
When this function is called within a macro, the macro execution
is suspended until a primitive corresponding to the arguments
is found in the pad.
If CRTL/C is typed in the pad, the function returns 0.
While this function is executing, one can use the mouse, interact
with the graphics pads, use the Inspector, Browser, TreeViewer, etc.
Examples:
c1.WaitPrimitive(); // Return the first created primitive
// whatever it is.
// If a double-click with the mouse is executed
// in the pad or any key pressed, the function
// returns 0.
c1.WaitPrimitive("ggg"); // Set the editor in mode "PolyLine/Graph"
// Create a polyline, then using the context
// menu item "SetName", change the name
// of the created TGraph to "ggg"
c1.FindObject("Arc"); // Set the editor in mode "Arc". Returns
// as soon as a TArc object is created.
c1.FindObject("lat","Text"); // Set the editor in Text/Latex mode.
// Create a text object, then Set its name to "lat"
The following macro waits for 10 primitives of any type to be created.
{
TCanvas c1("c1");
TObject *obj;
for (Int_t i=0;i<10;i++) {
obj = gPad->WaitPrimitive();
if (!obj) break;
printf("Loop i=%d, found objIsA=%s, name=%sn",
i,obj->ClassName(),obj->GetName());
}
}
TObject* CreateToolTip(const TBox *box, const char *text, Long_t delayms)
Create a tool tip and return its pointer.
void DeleteToolTip(TObject *tip)
Delete tool tip object.
void ResetToolTip(TObject *tip)
Reset tool tip, i.e. within time specified in CreateToolTip the
tool tip will pop up.
void CloseToolTip(TObject *tip)
Hide tool tip.
void x3d(Option_t *option)
*-*-*-*-*-*Invokes the x3d package to view the content of a pad*-*-*-*-*-*-*
*-* ====================================================
Inline Functions
TPad& operator=(const TPad& rhs)
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)
void AbsCoordinates(Bool_t set)
Double_t AbsPixeltoX(Int_t px)
Double_t AbsPixeltoY(Int_t py)
void AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t& x, Double_t& y)
void Closed()
Short_t GetBorderMode() const
Short_t GetBorderSize() const
Int_t GetCrosshair() const
Double_t GetXlowNDC() const
Double_t GetYlowNDC() const
Double_t GetWNDC() const
Double_t GetHNDC() const
Double_t GetAbsXlowNDC() const
Double_t GetAbsYlowNDC() const
Double_t GetAbsWNDC() const
Double_t GetAbsHNDC() const
Double_t GetAspectRatio() const
Double_t GetPhi() const
Double_t GetTheta() const
Double_t GetUxmin() const
Double_t GetUymin() const
Double_t GetUxmax() const
Double_t GetUymax() const
Bool_t GetGridx() const
Bool_t GetGridy() const
Int_t GetNumber() const
Int_t GetTickx() const
Int_t GetTicky() const
Double_t GetX1() const
Double_t GetX2() const
Double_t GetY1() const
Double_t GetY2() const
TList* GetListOfPrimitives() const
TList* GetListOfExecs() const
TObject* GetPadPointer() const
TView* GetView() const
TPadView3D* GetView3D() const
Int_t GetLogx() const
Int_t GetLogy() const
Int_t GetLogz() const
TVirtualPad* GetMother() const
const char* GetName() const
const char* GetTitle() const
TCanvas* GetCanvas() const
Int_t GetPadPaint() const
Int_t GetPixmapID() const
ULong_t Hash() const
Bool_t HasCrosshair() const
Bool_t HasFixedAspectRatio() const
Bool_t IsEditable() const
Bool_t IsFolder() const
Bool_t IsModified() const
Bool_t IsVertical() const
void Modified(Bool_t flag = 1)
Double_t PixeltoX(Int_t px)
Double_t PixeltoY(Int_t py)
void PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t& x, Double_t& y)
void RangeChanged()
void RangeAxisChanged()
void ResetView3D(TPadView3D* view = 0)
void SetBorderMode(Short_t bordermode)
void SetBorderSize(Short_t bordersize)
void SetCanvas(TCanvas* c)
void SetDrawOption(const Option_t* option)
void SetGrid(Int_t valuex = 1, Int_t valuey = 1)
void SetGridx(Int_t value = 1)
void SetGridy(Int_t value = 1)
void SetNumber(Int_t number)
void SetName(const char* name)
void SetTicks(Int_t valuex = 1, Int_t valuey = 1)
void SetTickx(Int_t value = 1)
void SetTicky(Int_t value = 1)
void SetTitle(const char* title)
void SetTheta(Double_t theta = 30)
void SetPhi(Double_t phi = 30)
void SetView(TView* view)
Int_t UtoAbsPixel(Double_t u) const
Int_t VtoAbsPixel(Double_t v) const
Int_t UtoPixel(Double_t u) const
Int_t VtoPixel(Double_t v) const
Int_t XtoAbsPixel(Double_t x) const
Int_t YtoAbsPixel(Double_t y) const
Int_t XtoPixel(Double_t x) const
Int_t YtoPixel(Double_t y) const
void XYtoAbsPixel(Double_t x, Double_t y, Int_t& xpixel, Int_t& ypixel) const
void XYtoPixel(Double_t x, Double_t y, Int_t& xpixel, Int_t& ypixel) const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void StreamerNVirtual(TBuffer& b)
Author: Rene Brun 12/12/94
Last update: root/gpad:$Name: $:$Id: TPad.cxx,v 1.101 2003/04/09 08:18:04 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.