#ifndef ROOT_TCanvas
#define ROOT_TCanvas
#ifndef ROOT_TPad
#include "TPad.h"
#endif
#ifndef ROOT_TAttCanvas
#include "TAttCanvas.h"
#endif
#ifndef ROOT_TVirtualX
#include "TVirtualX.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TCanvasImp
#include "TCanvasImp.h"
#endif
class TContextMenu;
class TControlBar;
class TBrowser;
class TCanvas : public TPad {
friend class TCanvasImp;
friend class TThread;
friend class TInterpreter;
protected:
TAttCanvas fCatt;
TString fDISPLAY;
Size_t fXsizeUser;
Size_t fYsizeUser;
Size_t fXsizeReal;
Size_t fYsizeReal;
Color_t fHighLightColor;
Int_t fDoubleBuffer;
Int_t fWindowTopX;
Int_t fWindowTopY;
UInt_t fWindowWidth;
UInt_t fWindowHeight;
UInt_t fCw;
UInt_t fCh;
Int_t fEvent;
Int_t fEventX;
Int_t fEventY;
Int_t fCanvasID;
TObject *fSelected;
TObject *fClickSelected;
Int_t fSelectedX;
Int_t fSelectedY;
TString fSelectedOpt;
TPad *fSelectedPad;
TPad *fClickSelectedPad;
TPad *fPadSave;
TCanvasImp *fCanvasImp;
TContextMenu *fContextMenu;
Bool_t fBatch;
Bool_t fUpdating;
Bool_t fRetained;
Bool_t fUseGL;
TVirtualPadPainter *fPainter;
static Bool_t fgIsFolder;
private:
TCanvas(const TCanvas &canvas);
TCanvas &operator=(const TCanvas &rhs);
void Build();
void CopyPixmaps();
void DrawEventStatus(Int_t event, Int_t x, Int_t y, TObject *selected);
void RunAutoExec();
void CreatePainter();
protected:
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
void Init();
public:
enum {
kShowEventStatus = BIT(15),
kAutoExec = BIT(16),
kMenuBar = BIT(17),
kShowToolBar = BIT(18),
kShowEditor = BIT(19),
kMoveOpaque = BIT(20),
kResizeOpaque = BIT(21),
kIsGrayscale = BIT(22),
kShowToolTips = BIT(23)
};
TCanvas(Bool_t build=kTRUE);
TCanvas(const char *name, const char *title="", Int_t form=1);
TCanvas(const char *name, const char *title, Int_t ww, Int_t wh);
TCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy,
Int_t ww, Int_t wh);
TCanvas(const char *name, Int_t ww, Int_t wh, Int_t winid);
virtual ~TCanvas();
void Constructor();
void Constructor(const char *name, const char *title, Int_t form);
void Constructor(const char *name, const char *title, Int_t ww, Int_t wh);
void Constructor(const char *name, const char *title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
void Destructor();
TVirtualPad *cd(Int_t subpadnumber=0);
virtual void Browse(TBrowser *b);
void Clear(Option_t *option="");
void Close(Option_t *option="");
virtual void Delete(Option_t * = "") { MayNotUse("Delete()"); }
void DisconnectWidget();
virtual void Draw(Option_t *option="");
virtual TObject *DrawClone(Option_t *option="") const;
virtual TObject *DrawClonePad();
virtual void EditorBar();
void EmbedInto(Int_t winid, Int_t ww, Int_t wh);
void EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
void FeedbackMode(Bool_t set);
void Flush();
void UseCurrentStyle();
void ForceUpdate() { fCanvasImp->ForceUpdate(); }
const char *GetDISPLAY() const {return fDISPLAY.Data();}
TContextMenu *GetContextMenu() const {return fContextMenu;};
Int_t GetDoubleBuffer() const {return fDoubleBuffer;}
Int_t GetEvent() const { return fEvent; }
Int_t GetEventX() const { return fEventX; }
Int_t GetEventY() const { return fEventY; }
Color_t GetHighLightColor() const { return fHighLightColor; }
TVirtualPad *GetPadSave() const { return fPadSave; }
void ClearPadSave() { fPadSave = 0; }
TObject *GetSelected() const {return fSelected;}
TObject *GetClickSelected() const {return fClickSelected;}
Int_t GetSelectedX() const {return fSelectedX;}
Int_t GetSelectedY() const {return fSelectedY;}
Option_t *GetSelectedOpt() const {return fSelectedOpt.Data();}
TVirtualPad *GetSelectedPad() const { return fSelectedPad; }
TVirtualPad *GetClickSelectedPad() const { return fClickSelectedPad; }
Bool_t GetShowEventStatus() const { return TestBit(kShowEventStatus); }
Bool_t GetShowToolBar() const { return TestBit(kShowToolBar); }
Bool_t GetShowEditor() const { return TestBit(kShowEditor); }
Bool_t GetShowToolTips() const { return TestBit(kShowToolTips); }
Bool_t GetAutoExec() const { return TestBit(kAutoExec); }
Size_t GetXsizeUser() const {return fXsizeUser;}
Size_t GetYsizeUser() const {return fYsizeUser;}
Size_t GetXsizeReal() const {return fXsizeReal;}
Size_t GetYsizeReal() const {return fYsizeReal;}
Int_t GetCanvasID() const {return fCanvasID;}
TCanvasImp *GetCanvasImp() const {return fCanvasImp;}
Int_t GetWindowTopX();
Int_t GetWindowTopY();
UInt_t GetWindowWidth() const { return fWindowWidth; }
UInt_t GetWindowHeight() const { return fWindowHeight; }
UInt_t GetWw() const { return fCw; }
UInt_t GetWh() const { return fCh; }
virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh)
{wtopx=GetWindowTopX(); wtopy=fWindowTopY; ww=fWindowWidth; wh=fWindowHeight;}
virtual void HandleInput(EEventType button, Int_t x, Int_t y);
Bool_t HasMenuBar() const { return TestBit(kMenuBar); }
void Iconify() { fCanvasImp->Iconify(); }
Bool_t IsBatch() const { return fBatch; }
Bool_t IsFolder() const;
Bool_t IsGrayscale();
Bool_t IsRetained() const { return fRetained; }
virtual void ls(Option_t *option="") const;
void MoveOpaque(Int_t set=1);
Bool_t OpaqueMoving() const { return TestBit(kMoveOpaque); }
Bool_t OpaqueResizing() const { return TestBit(kResizeOpaque); }
virtual void Paint(Option_t *option="");
virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj) { return TPad::Pick(px, py, pickobj); }
virtual TPad *Pick(Int_t px, Int_t py, TObject *prevSelObj);
virtual void Picked(TPad *selpad, TObject *selected, Int_t event);
virtual void ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event);
virtual void Cleared(TVirtualPad *pad);
virtual void Closed();
void RaiseWindow() { fCanvasImp->RaiseWindow(); }
virtual void Resize(Option_t *option="");
void ResizeOpaque(Int_t set=1);
void SaveSource(const char *filename="", Option_t *option="");
void SavePrimitive(std::ostream &out, Option_t *option = "");
virtual void SetCursor(ECursor cursor);
virtual void SetDoubleBuffer(Int_t mode=1);
virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE);
void SetGrayscale(Bool_t set = kTRUE);
void SetWindowPosition(Int_t x, Int_t y) { fCanvasImp->SetWindowPosition(x, y); }
void SetWindowSize(UInt_t ww, UInt_t wh) { fCanvasImp->SetWindowSize(ww, wh); }
void SetCanvasSize(UInt_t ww, UInt_t wh);
void SetHighLightColor(Color_t col) { fHighLightColor = col; }
void SetSelected(TObject *obj);
void SetClickSelected(TObject *obj) { fClickSelected = obj; }
void SetSelectedPad(TPad *pad) { fSelectedPad = pad; }
void SetClickSelectedPad(TPad *pad) { fClickSelectedPad = pad; }
void Show() { fCanvasImp->Show(); }
virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0);
void SetBatch(Bool_t batch=kTRUE);
static void SetFolder(Bool_t isfolder=kTRUE);
void SetPadSave(TPad *pad) {fPadSave = pad;}
void SetRetained(Bool_t retained=kTRUE) { fRetained=retained;}
void SetTitle(const char *title="");
virtual void ToggleEventStatus();
virtual void ToggleAutoExec();
virtual void ToggleToolBar();
virtual void ToggleEditor();
virtual void ToggleToolTips();
virtual void Update();
Bool_t UseGL() const { return fUseGL; }
void SetSupportGL(Bool_t support) {fUseGL = support;}
TVirtualPadPainter *GetCanvasPainter();
void DeleteCanvasPainter();
static TCanvas *MakeDefCanvas();
static Bool_t SupportAlpha();
ClassDef(TCanvas,8)
};
#endif