00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TCanvas
00013 #define ROOT_TCanvas
00014
00015
00017
00018
00019
00020
00021
00023
00024 #ifndef ROOT_TPad
00025 #include "TPad.h"
00026 #endif
00027
00028 #ifndef ROOT_TAttCanvas
00029 #include "TAttCanvas.h"
00030 #endif
00031
00032 #ifndef ROOT_TVirtualX
00033 #include "TVirtualX.h"
00034 #endif
00035
00036 #ifndef ROOT_TString
00037 #include "TString.h"
00038 #endif
00039
00040 #ifndef ROOT_TCanvasImp
00041 #include "TCanvasImp.h"
00042 #endif
00043
00044 class TContextMenu;
00045 class TControlBar;
00046 class TBrowser;
00047
00048 class TCanvas : public TPad {
00049
00050 friend class TCanvasImp;
00051 friend class TThread;
00052
00053 protected:
00054 TAttCanvas fCatt;
00055 TString fDISPLAY;
00056 Size_t fXsizeUser;
00057 Size_t fYsizeUser;
00058 Size_t fXsizeReal;
00059 Size_t fYsizeReal;
00060 Color_t fHighLightColor;
00061 Int_t fDoubleBuffer;
00062 Int_t fWindowTopX;
00063 Int_t fWindowTopY;
00064 UInt_t fWindowWidth;
00065 UInt_t fWindowHeight;
00066 UInt_t fCw;
00067 UInt_t fCh;
00068 Int_t fEvent;
00069 Int_t fEventX;
00070 Int_t fEventY;
00071 Int_t fCanvasID;
00072 TObject *fSelected;
00073 TString fSelectedOpt;
00074 TPad *fSelectedPad;
00075 TPad *fPadSave;
00076 TControlBar *fEditorBar;
00077 TCanvasImp *fCanvasImp;
00078 TContextMenu *fContextMenu;
00079 Bool_t fBatch;
00080 Bool_t fRetained;
00081 Bool_t fShowEventStatus;
00082 Bool_t fAutoExec;
00083 Bool_t fMoveOpaque;
00084 Bool_t fResizeOpaque;
00085 Bool_t fMenuBar;
00086 static Bool_t fgIsFolder;
00087
00088 private:
00089 TCanvas(const TCanvas &canvas);
00090 TCanvas &operator=(const TCanvas &rhs);
00091 void Build();
00092 void CopyPixmaps();
00093 void DrawEventStatus(Int_t event, Int_t x, Int_t y, TObject *selected);
00094 void RunAutoExec();
00095
00096 protected:
00097 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
00098
00099 void Constructor();
00100 void Constructor(const char *name, const char *title, Int_t form);
00101 void Constructor(const char *name, const char *title, Int_t ww, Int_t wh);
00102 void Constructor(const char *name, const char *title,
00103 Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
00104 void Destructor();
00105
00106 void Init();
00107
00108 public:
00109 TCanvas(Bool_t build=kTRUE);
00110 TCanvas(const char *name, const char *title="", Int_t form=1);
00111 TCanvas(const char *name, const char *title, Int_t ww, Int_t wh);
00112 TCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy,
00113 Int_t ww, Int_t wh);
00114 TCanvas(const char *name, Int_t ww, Int_t wh, Int_t winid);
00115 virtual ~TCanvas();
00116
00117 void cd(Int_t subpadnumber=0);
00118 virtual void Browse(TBrowser *b);
00119 void Clear(Option_t *option="");
00120 void Close(Option_t *option="");
00121 virtual void Delete(Option_t * = "") { MayNotUse("Delete()"); }
00122 virtual void Draw(Option_t *option="");
00123 virtual TObject *DrawClone(Option_t *option="") const;
00124 virtual TObject *DrawClonePad();
00125 virtual void EditorBar();
00126 void EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
00127 void FeedbackMode(Bool_t set);
00128 void Flush();
00129 void UseCurrentStyle();
00130 void ForceUpdate() { fCanvasImp->ForceUpdate(); }
00131 const char *GetDISPLAY() const {return fDISPLAY.Data();}
00132 TContextMenu *GetContextMenu() const {return fContextMenu;};
00133 Int_t GetDoubleBuffer() const {return fDoubleBuffer;}
00134 TControlBar *GetEditorBar() const {return fEditorBar;}
00135 Int_t GetEvent() const { return fEvent; }
00136 Int_t GetEventX() const { return fEventX; }
00137 Int_t GetEventY() const { return fEventY; }
00138 Color_t GetHighLightColor() const { return fHighLightColor; }
00139 TVirtualPad *GetPadSave() const { return fPadSave; }
00140 TObject *GetSelected() const {return fSelected;}
00141 Option_t *GetSelectedOpt() const {return fSelectedOpt.Data();}
00142 TVirtualPad *GetSelectedPad() const { return fSelectedPad; }
00143 Bool_t GetShowEventStatus() { return fShowEventStatus; }
00144 Bool_t GetAutoExec() const { return fAutoExec; }
00145 Size_t GetXsizeUser() const {return fXsizeUser;}
00146 Size_t GetYsizeUser() const {return fYsizeUser;}
00147 Size_t GetXsizeReal() const {return fXsizeReal;}
00148 Size_t GetYsizeReal() const {return fYsizeReal;}
00149 Int_t GetCanvasID() const {return fCanvasID;}
00150 TCanvasImp *GetCanvasImp() const {return fCanvasImp;}
00151 Int_t GetWindowTopX();
00152 Int_t GetWindowTopY();
00153 UInt_t GetWindowWidth() const { return fWindowWidth; }
00154 UInt_t GetWindowHeight() const { return fWindowHeight; }
00155 UInt_t GetWw() const { return fCw; }
00156 UInt_t GetWh() const { return fCh; }
00157 virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh)
00158 {wtopx=GetWindowTopX(); wtopy=fWindowTopY; ww=fWindowWidth; wh=fWindowHeight;}
00159 virtual void HandleInput(EEventType button, Int_t x, Int_t y);
00160 Bool_t HasMenuBar() const { return fMenuBar; }
00161 void Iconify() { fCanvasImp->Iconify(); }
00162 Bool_t IsBatch() const { return fBatch; }
00163 Bool_t IsFolder() const;
00164 Bool_t IsRetained() const { return fRetained; }
00165 virtual void ls(Option_t *option="") const;
00166 void MoveOpaque(Int_t set=1);
00167 Bool_t OpaqueMoving() const { return fMoveOpaque; }
00168 Bool_t OpaqueResizing() const { return fResizeOpaque; }
00169 virtual void Paint(Option_t *option="");
00170 virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj) { return TPad::Pick(px, py, pickobj); }
00171 virtual TPad *Pick(Int_t px, Int_t py, TObject *prevSelObj);
00172 virtual void Picked(TPad *selpad, TObject *selected, Int_t event);
00173 virtual void ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
00174 virtual void Resize(Option_t *option="");
00175 void ResizeOpaque(Int_t set=1) { fResizeOpaque = set; }
00176 void SaveSource(const char *filename="", Option_t *option="");
00177 virtual void SetCursor(ECursor cursor);
00178 virtual void SetDoubleBuffer(Int_t mode=1);
00179 virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE);
00180 void SetWindowPosition(Int_t x, Int_t y) { fCanvasImp->SetWindowPosition(x, y); }
00181 void SetWindowSize(UInt_t ww, UInt_t wh) { fCanvasImp->SetWindowSize(ww, wh); }
00182 void SetCanvasSize(UInt_t ww, UInt_t wh);
00183 void SetHighLightColor(Color_t col) { fHighLightColor = col; }
00184 void SetSelected(TObject *obj);
00185 void SetSelectedPad(TPad *pad) { fSelectedPad = pad; }
00186 void Show() { fCanvasImp->Show(); }
00187 virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0);
00188 void SetBatch(Bool_t batch=kTRUE);
00189 static void SetFolder(Bool_t isfolder=kTRUE);
00190 void SetRetained(Bool_t retained=kTRUE) { fRetained=retained;}
00191 void SetTitle(const char *title="");
00192 virtual void ToggleEventStatus();
00193 virtual void ToggleAutoExec();
00194 virtual void Update();
00195
00196 static void MakeDefCanvas();
00197
00198 ClassDef(TCanvas,4)
00199 };
00200
00201 #endif