TCanvas
class description - source file - inheritance tree
private:
TCanvas TCanvas(const TCanvas& canvas)
void Build()
virtual void CopyPixmaps()
void DrawEventStatus(Int_t button, Int_t x, Int_t y, TObject* selected)
TCanvas& operator=(const TCanvas& rhs)
protected:
void Constructor()
void Constructor(const Text_t* name, const Text_t* title, Int_t form)
void Constructor(const Text_t* name, const Text_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
void Constructor(const Text_t* name, const Text_t* title, Int_t ww, Int_t wh)
void Destructor()
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
public:
TCanvas TCanvas(const Text_t* name, const Text_t* title, Int_t form = 1)
TCanvas TCanvas(const Text_t* name, const Text_t* title, Int_t ww, Int_t wh)
TCanvas TCanvas(const Text_t* name, const Text_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
TCanvas TCanvas()
TCanvas TCanvas(const Text_t* name, Int_t ww, Int_t wh, Int_t winid)
virtual void ~TCanvas()
virtual void cd(Int_t subpadnumber = 0)
TClass* Class()
virtual void Clear(Option_t* option)
virtual void Close(Option_t* option)
virtual void Draw(Option_t* option)
virtual void DrawClone(Option_t* option)
virtual void EditorBar()
void EnterLeave(TPad* prevSelPad, TObject* prevSelObj)
void FeedbackMode(Bool_t set)
void Flush()
void ForceUpdate()
virtual Int_t GetCanvasID() const
TCanvasImp* GetCanvasImp()
virtual void GetCanvasPar(Int_t& wtopx, Int_t& wtopy, UInt_t& ww, UInt_t& wh)
TContextMenu* GetContextMenu()
const Text_t* GetDISPLAY() const
Int_t GetDoubleBuffer()
TControlBar* GetEditorBar()
virtual Int_t GetEvent() const
virtual Int_t GetEventX() const
virtual Int_t GetEventY() const
virtual Color_t GetHighLightColor() const
virtual void* GetPadDivision(Int_t xdivision = 1, Int_t ydivision = 1)
virtual TVirtualPad* GetPadSave() const
virtual TObject* GetSelected()
Option_t* GetSelectedOpt() const
virtual TVirtualPad* GetSelectedPad() const
Bool_t GetShowEventStatus()
virtual UInt_t GetWh()
UInt_t GetWindowHeight() const
Int_t GetWindowTopX()
Int_t GetWindowTopY()
UInt_t GetWindowWidth() const
virtual UInt_t GetWw()
Size_t GetXsizeReal()
Size_t GetXsizeUser()
Size_t GetYsizeReal()
Size_t GetYsizeUser()
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Bool_t HasMenuBar() const
void Iconify()
virtual TClass* IsA() const
virtual Bool_t IsBatch()
virtual Bool_t IsRetained()
virtual void ls(Option_t* option)
void MakeDefCanvas()
void MoveOpaque(Int_t set = 1)
virtual Bool_t OpaqueMoving() const
virtual Bool_t OpaqueResizing() const
virtual void Paint(Option_t* option)
virtual void Resize(Option_t* option)
void ResizeOpaque(Int_t set = 1)
void SaveSource(const Text_t* filename, Option_t* option)
virtual void SetBatch(Bool_t batch = kTRUE)
virtual void SetCanvasSize(UInt_t ww, UInt_t wh)
virtual void SetCursor(ECursor cursor)
virtual void SetDoubleBuffer(Int_t mode = 1)
void SetHighLightColor(Color_t col)
void SetRetained(Bool_t retained = kTRUE)
virtual void SetSelected(TObject* obj)
virtual void SetTitle(const Text_t* title)
void SetWindowPosition(Int_t x, Int_t y)
void SetWindowSize(UInt_t ww, UInt_t wh)
void Show()
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Size(Float_t xsizeuser = 0, Float_t ysizeuser = 0)
virtual void Streamer(TBuffer& b)
virtual void ToggleEventStatus()
virtual void Update()
virtual void UseCurrentStyle()
protected:
TString fDISPLAY Name of destination screen
Int_t fDoubleBuffer Double buffer flag (0=off, 1=on)
Bool_t fRetained Retain structure flag
Size_t fXsizeUser User specified size of canvas along X in CM
Size_t fYsizeUser User specified size of canvas along Y in CM
Size_t fXsizeReal Current size of canvas along X in CM
Size_t fYsizeReal Current size of canvas along Y in CM
Int_t fCanvasID Canvas identifier
Int_t fWindowTopX Top X position of window (in pixels)
Int_t fWindowTopY Top Y position of window (in pixels)
UInt_t fWindowWidth Width of window (including borders, etc.)
UInt_t fWindowHeight Height of window (including menubar, borders, etc.)
UInt_t fCw Width of the canvas along X (pixels)
UInt_t fCh Height of the canvas along Y (pixels)
TAttCanvas fCatt Canvas attributes
TObject* fSelected Currently selected object
TString fSelectedOpt Drawing option of selected object
TVirtualPad* fSelectedPad Pad containing currently selected object
TVirtualPad* fPadSave Pointer to saved pad in HandleInput
Int_t fEvent Type of current or last handled event
Int_t fEventX Last X mouse position in canvas
Int_t fEventY Last Y mouse position in canvas
Bool_t fShowEventStatus Show event status panel
TControlBar* fEditorBar Editor control bar
TCanvasImp* fCanvasImp Window system specific canvas implementation
Bool_t fMoveOpaque Move objects in opaque mode
Bool_t fResizeOpaque Resize objects in opaque mode
Color_t fHighLightColor Highlight color of active pad
Bool_t fBatch True when in batchmode
Bool_t fMenuBar False if no menubar is displayed
TContextMenu* fContextMenu Context menu pointer
See also
-
TDialogCanvas
A Canvas is an area mapped to a window directly under
the control of the display manager.
A ROOT session may have several canvases open at any given time.
A Canvas may be subdivided into independent graphical areas: the PADs
A canvas has a default pad which has the name of the canvas itself.
An example of a Canvas layout is sketched in the picture below.
***********************************************************************
* Tool Bar menus for Canvas *
***********************************************************************
* *
* ************************************ ************************* *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * P1 * * P2 * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* ************************************ ************************* *
* *
***********************************************************************
This canvas contains two pads named P1 and P2.
Both Canvas, P1 and P2 can be moved, grown, shrinked using the
normal rules of the Display manager.
A copy of a real canvas with 4 pads is shown in the picture below.
/*
*/
Once objects have been drawn in a canvas, they can be edited/moved
by pointing directly to them. The cursor shape is changed
to suggest the type of action that one can do on this object.
Clicking with the right mouse button on an object pops-up
a contextmenu with a complete list of actions possible on this object.
A graphical editor may be started from the canvas "Edit" menu.
Select the "Editor" item. This will show the following editor menu.
/*
*/
For example, to draw a new TText primitive, select the option Text,
then click at the position where you want to draw the text. Type <CR>
when you have finished typing the string.
A canvas may be automatically divided into pads via TPad::Divide.
TCanvas() : TPad()
void Constructor()
Canvas default constructor
TCanvas(const char *name, Int_t ww, Int_t wh, Int_t winid)
Create an embedded canvas, i.e. a canvas that is in a TGCanvas widget
which is placed in a TGFrame. This ctor is only called via the
TRootEmbeddedCanvas class.
TCanvas(const Text_t *name, const Text_t *title, Int_t form) : TPad()
void Constructor(const Text_t *name, const Text_t *title, Int_t form)
*-*-*-*-*-*-*-*-*Canvas constructor using a template*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
Create a new canvas with a predefined size form.
if form < 0 the menubar is not shown.
form = 1 700x500 at 10,10 (set by TStyle::SetCanvasDefH,W,X,Y)
form = 2 500x500 at 20,20
form = 3 500x500 at 30,30
form = 4 500x500 at 40,40
form = 5 500x500 at 50,50
TCanvas(const Text_t *name, const Text_t *title, Int_t ww, Int_t wh) : TPad()
*-*-*-*-*-*-*-*-*-*-*-*Canvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================
Create a new canvas at a random position.
wide is the canvas size in pixels along X
if ww < 0 the menubar is not shown.
wh is the canvas size in pixels along Y
void Constructor(const Text_t *name, const Text_t *title, Int_t ww, Int_t wh)
*-*-*-*-*-*-*-*-*-*-*-*Canvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================
Create a new canvas at a random position.
wide is the canvas size in pixels along X
if ww < 0 the menubar is not shown.
wh is the canvas size in pixels along Y
TCanvas(const Text_t *name, const Text_t *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
: TPad()
*-*-*-*-*-*-*-*-*-*-*-*Canvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==================
Create a new canvas.
wtopx,wtopy are the pixel coordinates of the top left corner of the canvas
if wtopx < 0) the menubar is not shown.
ww is the canvas size in pixels along X
wh is the canvas size in pixels along Y
void Constructor(const Text_t *name, const Text_t *title, Int_t wtopx, Int_t wtopy, Int_t
ww, Int_t wh)
void Build()
Build a canvas. Called by all constructors.
~TCanvas()
*-*-*-*-*-*-*-*-*-*-*Canvas default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =========================
void Destructor()
void cd(Int_t subpadnumber)
*-*-*-*-*-*-*-*-*-*-*-*Set current canvas & pad*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ========================
see TPad::cd for explanation of parameter
void Clear(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*Clear canvas*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ============
Remove all primitives in default pad
Remove all pads (except default pad)
void Close(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*Close canvas*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ============
Delete window/pads data structure
void CopyPixmaps()
*-*-*-*-*-*-*-*-*Copy the canvas pixmap of the pad to the canvas*-*-*-*-*-*-*
*-* ===============================================
void Draw(Option_t *)
Draw a canvas.
If a canvas with the name is already on the screen, the canvas is repainted.
This function is useful when a canvas object has been saved in a Root file.
One can then do:
Root > Tfile f("file.root");
Root > canvas.Draw();
void DrawClone(Option_t *option)
Draw a clone of this canvas
void DrawEventStatus(Int_t event, Int_t px, Int_t py, TObject *selected)
*-*-*-*-*-*-*Report name and title of primitive below the cursor*-*-*-*-*-*
*-* ===================================================
This function is called when the option "Event Status"
in the canvas menu "Options" is selected.
void EditorBar()
*-*-*-*-*-*-*-*-*-*-*Create the Editor Controlbar*-*-*-*-*-*-*-*-*-*
*-* ============================
void EnterLeave(TPad *prevSelPad, TObject *prevSelObj)
Generate kMouseEnter and kMouseLeave events depending on the previously
selected object and the currently selected object. Does nothing if the
selected object does not change.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
*-* =========================================
This member function must be implemented to realize the action
corresponding to the mouse click on the object in the canvas
Only handle mouse motion events in TCanvas, all other events are
ignored for the time being
void FeedbackMode(Bool_t set)
*-*-*-*-*-*-*-*-*Turn rubberband feedback mode on or off*-*-*-*-*-*-*-*-*-*-*
*-* =======================================
void Flush()
*-*-*-*-*-*-*-*-*Flush canvas buffers*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ====================
void UseCurrentStyle()
*-*-*-*-*-*Force a copy of current style for all objects in canvas*-*-*-*-*
*-* =======================================================
void* GetPadDivision(Int_t, Int_t)
*-*-*-*-*-*-*-*-*Return pad corresponding to one canvas division*-*-*-*-*
*-* ===============================================
Int_t GetWindowTopX()
Returns current top x position of window on screen.
Int_t GetWindowTopY()
Returns current top y position of window on screen.
void HandleInput(EEventType event, Int_t px, Int_t py)
*-*-*-*-*-*-*-*-*-*Handle Input Events*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================
Handle input events, like button up/down in current canvas.
void ls(Option_t *option)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*List all pads*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =============
void MakeDefCanvas()
*-*-*-*-*-*-*Static function to build a default canvas*-*-*-*-*-*-*-*-*-*-*
*-* =========================================
void MoveOpaque(Int_t set)
*-*-*-*-*-*-*-*-*Set option to move objects/pads in a canvas*-*-*-*-*-*-*-*
*-* ===========================================
if set = 1 (default) graphics objects are moved in opaque mode
= 0 only the outline of objects is drawn when moving them
The option opaque produces the best effect. It requires however a
a reasonably fast workstation or response time.
void Paint(Option_t *option)
*-*-*-*-*-*-*-*-*Paint canvas*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ============
void Resize(Option_t *)
*-*-*-*-*-*-*Recompute canvas parameters following a X11 Resize*-*-*-*-*-*-*
*-* ==================================================
void SaveSource(const Text_t *filename, Option_t *option)
*-*-*-*-*-*-*Save primitives in this canvas as a C++ macro file*-*-*-*-*-*
*-* ==================================================
void SetBatch(Bool_t batch)
Toggle batch mode. However, if the canvas is created without a window
then batch mode always stays set.
void SetCanvasSize(UInt_t ww, UInt_t wh)
Set Width and Height of canvas to ww and wh respectively
If ww and/or wh are greater than the current canvas window
a scroll bar is automatically generated.
Use this function to zoom in a canvas and naviguate via
the scroll bars.
void SetCursor(ECursor cursor)
*-*-*-*-*-*-*-*-*-*-*Set cursor*-*-**-*-*-*-*-*-*-*-*-*-*-*-*
*-* ==========
void SetDoubleBuffer(Int_t mode)
*-*-*-*-*-*-*-*-*-*-*Set Double Buffer On/Off*-*-**-*-*-*-*-*-*-*-*-*-*-*-*
*-* ========================
void SetTitle(const Text_t *title)
*-*-*-*-*-*-*-*-*-*-*Set Canvas title*-*-**-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===============
void Size(Float_t xsize, Float_t ysize)
*-*-*-*-*-*-*Set the canvas scale in centimeters*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* ===================================
This information is used by PostScript to set the page size.
xsize = size of the canvas in centimeters along X
ysize = size of the canvas in centimeters along Y
if xsize and ysize are not equal to 0, then the scale factors will
be computed to keep the ratio ysize/xsize independently of the canvas
size (parts of the physical canvas will be unused).
if xsize = 0 and ysize is not zero, then xsize will be computed
to fit to the current canvas scale. If the canvas is resized,
a new value for xsize will be recomputed. In this case the aspect
ratio is not preserved.
if both xsize = 0 and ysize = 0, then the scaling is automatic.
the largest dimension will be allocated a size of 20 centimeters.
void Streamer(TBuffer &b)
*-*-*-*-*-*-*-*-*Stream a class object*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =========================================
void ToggleEventStatus()
Toggle event statusbar.
void Update()
*-*-*-*-*-*-*-*-*Update canvas pad buffers*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* =========================
Inline Functions
TCanvas& operator=(const TCanvas& rhs)
TCanvas TCanvas(const Text_t* name, Int_t ww, Int_t wh, Int_t winid)
void ForceUpdate()
const Text_t* GetDISPLAY() const
TContextMenu* GetContextMenu()
Int_t GetDoubleBuffer()
TControlBar* GetEditorBar()
Int_t GetEvent() const
Int_t GetEventX() const
Int_t GetEventY() const
Color_t GetHighLightColor() const
TVirtualPad* GetPadSave() const
TObject* GetSelected()
Option_t* GetSelectedOpt() const
TVirtualPad* GetSelectedPad() const
Bool_t GetShowEventStatus()
Size_t GetXsizeUser()
Size_t GetYsizeUser()
Size_t GetXsizeReal()
Size_t GetYsizeReal()
Int_t GetCanvasID() const
TCanvasImp* GetCanvasImp()
UInt_t GetWindowWidth() const
UInt_t GetWindowHeight() const
UInt_t GetWw()
UInt_t GetWh()
void GetCanvasPar(Int_t& wtopx, Int_t& wtopy, UInt_t& ww, UInt_t& wh)
Bool_t HasMenuBar() const
void Iconify()
Bool_t IsBatch()
Bool_t IsRetained()
Bool_t OpaqueMoving() const
Bool_t OpaqueResizing() const
void ResizeOpaque(Int_t set = 1)
void SetWindowPosition(Int_t x, Int_t y)
void SetWindowSize(UInt_t ww, UInt_t wh)
void SetHighLightColor(Color_t col)
void SetSelected(TObject* obj)
void Show()
void SetRetained(Bool_t retained = kTRUE)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
Author: Rene Brun 12/12/94
Last update: 2.23/07 27/10/99 13.07.38 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *
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.