00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TCanvas
00013 #define ROOT_TCanvas
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 friend class TInterpreter;
00053
00054 protected:
00055 TAttCanvas fCatt;
00056 TString fDISPLAY;
00057 Size_t fXsizeUser;
00058 Size_t fYsizeUser;
00059 Size_t fXsizeReal;
00060 Size_t fYsizeReal;
00061 Color_t fHighLightColor;
00062 Int_t fDoubleBuffer;
00063 Int_t fWindowTopX;
00064 Int_t fWindowTopY;
00065 UInt_t fWindowWidth;
00066 UInt_t fWindowHeight;
00067 UInt_t fCw;
00068 UInt_t fCh;
00069 Int_t fEvent;
00070 Int_t fEventX;
00071 Int_t fEventY;
00072 Int_t fCanvasID;
00073 TObject *fSelected;
00074 TObject *fClickSelected;
00075 Int_t fSelectedX;
00076 Int_t fSelectedY;
00077 TString fSelectedOpt;
00078 TPad *fSelectedPad;
00079 TPad *fClickSelectedPad;
00080 TPad *fPadSave;
00081 TCanvasImp *fCanvasImp;
00082 TContextMenu *fContextMenu;
00083 Bool_t fBatch;
00084 Bool_t fUpdating;
00085 Bool_t fRetained;
00086 Bool_t fUseGL;
00087
00088 TVirtualPadPainter *fPainter;
00089
00090 static Bool_t fgIsFolder;
00091
00092 private:
00093 TCanvas(const TCanvas &canvas);
00094 TCanvas &operator=(const TCanvas &rhs);
00095 void Build();
00096 void CopyPixmaps();
00097 void DrawEventStatus(Int_t event, Int_t x, Int_t y, TObject *selected);
00098 void RunAutoExec();
00099
00100
00101 void CreatePainter();
00102
00103 protected:
00104 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
00105
00106 void Init();
00107
00108 public:
00109
00110 enum {
00111 kShowEventStatus = BIT(15),
00112 kAutoExec = BIT(16),
00113 kMenuBar = BIT(17),
00114 kShowToolBar = BIT(18),
00115 kShowEditor = BIT(19),
00116 kMoveOpaque = BIT(20),
00117 kResizeOpaque = BIT(21),
00118 kIsGrayscale = BIT(22),
00119 kShowToolTips = BIT(23)
00120 };
00121
00122 TCanvas(Bool_t build=kTRUE);
00123 TCanvas(const char *name, const char *title="", Int_t form=1);
00124 TCanvas(const char *name, const char *title, Int_t ww, Int_t wh);
00125 TCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy,
00126 Int_t ww, Int_t wh);
00127 TCanvas(const char *name, Int_t ww, Int_t wh, Int_t winid);
00128 virtual ~TCanvas();
00129
00130
00131 void Constructor();
00132 void Constructor(const char *name, const char *title, Int_t form);
00133 void Constructor(const char *name, const char *title, Int_t ww, Int_t wh);
00134 void Constructor(const char *name, const char *title,
00135 Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
00136 void Destructor();
00137
00138 TVirtualPad *cd(Int_t subpadnumber=0);
00139 virtual void Browse(TBrowser *b);
00140 void Clear(Option_t *option="");
00141 void Close(Option_t *option="");
00142 virtual void Delete(Option_t * = "") { MayNotUse("Delete()"); }
00143 void DisconnectWidget();
00144 virtual void Draw(Option_t *option="");
00145 virtual TObject *DrawClone(Option_t *option="") const;
00146 virtual TObject *DrawClonePad();
00147 virtual void EditorBar();
00148 void EmbedInto(Int_t winid, Int_t ww, Int_t wh);
00149 void EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
00150 void FeedbackMode(Bool_t set);
00151 void Flush();
00152 void UseCurrentStyle();
00153 void ForceUpdate() { fCanvasImp->ForceUpdate(); }
00154 const char *GetDISPLAY() const {return fDISPLAY.Data();}
00155 TContextMenu *GetContextMenu() const {return fContextMenu;};
00156 Int_t GetDoubleBuffer() const {return fDoubleBuffer;}
00157 Int_t GetEvent() const { return fEvent; }
00158 Int_t GetEventX() const { return fEventX; }
00159 Int_t GetEventY() const { return fEventY; }
00160 Color_t GetHighLightColor() const { return fHighLightColor; }
00161 TVirtualPad *GetPadSave() const { return fPadSave; }
00162 void ClearPadSave() { fPadSave = 0; }
00163 TObject *GetSelected() const {return fSelected;}
00164 TObject *GetClickSelected() const {return fClickSelected;}
00165 Int_t GetSelectedX() const {return fSelectedX;}
00166 Int_t GetSelectedY() const {return fSelectedY;}
00167 Option_t *GetSelectedOpt() const {return fSelectedOpt.Data();}
00168 TVirtualPad *GetSelectedPad() const { return fSelectedPad; }
00169 TVirtualPad *GetClickSelectedPad() const { return fClickSelectedPad; }
00170 Bool_t GetShowEventStatus() const { return TestBit(kShowEventStatus); }
00171 Bool_t GetShowToolBar() const { return TestBit(kShowToolBar); }
00172 Bool_t GetShowEditor() const { return TestBit(kShowEditor); }
00173 Bool_t GetShowToolTips() const { return TestBit(kShowToolTips); }
00174 Bool_t GetAutoExec() const { return TestBit(kAutoExec); }
00175 Size_t GetXsizeUser() const {return fXsizeUser;}
00176 Size_t GetYsizeUser() const {return fYsizeUser;}
00177 Size_t GetXsizeReal() const {return fXsizeReal;}
00178 Size_t GetYsizeReal() const {return fYsizeReal;}
00179 Int_t GetCanvasID() const {return fCanvasID;}
00180 TCanvasImp *GetCanvasImp() const {return fCanvasImp;}
00181 Int_t GetWindowTopX();
00182 Int_t GetWindowTopY();
00183 UInt_t GetWindowWidth() const { return fWindowWidth; }
00184 UInt_t GetWindowHeight() const { return fWindowHeight; }
00185 UInt_t GetWw() const { return fCw; }
00186 UInt_t GetWh() const { return fCh; }
00187 virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh)
00188 {wtopx=GetWindowTopX(); wtopy=fWindowTopY; ww=fWindowWidth; wh=fWindowHeight;}
00189 virtual void HandleInput(EEventType button, Int_t x, Int_t y);
00190 Bool_t HasMenuBar() const { return TestBit(kMenuBar); }
00191 void Iconify() { fCanvasImp->Iconify(); }
00192 Bool_t IsBatch() const { return fBatch; }
00193 Bool_t IsFolder() const;
00194 Bool_t IsGrayscale();
00195 Bool_t IsRetained() const { return fRetained; }
00196 virtual void ls(Option_t *option="") const;
00197 void MoveOpaque(Int_t set=1);
00198 Bool_t OpaqueMoving() const { return TestBit(kMoveOpaque); }
00199 Bool_t OpaqueResizing() const { return TestBit(kResizeOpaque); }
00200 virtual void Paint(Option_t *option="");
00201 virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj) { return TPad::Pick(px, py, pickobj); }
00202 virtual TPad *Pick(Int_t px, Int_t py, TObject *prevSelObj);
00203 virtual void Picked(TPad *selpad, TObject *selected, Int_t event);
00204 virtual void ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected);
00205 virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event);
00206 virtual void Cleared(TVirtualPad *pad);
00207 virtual void Closed();
00208 void RaiseWindow() { fCanvasImp->RaiseWindow(); }
00209 virtual void Resize(Option_t *option="");
00210 void ResizeOpaque(Int_t set=1);
00211 void SaveSource(const char *filename="", Option_t *option="");
00212 void SavePrimitive(ostream &out, Option_t *option = "");
00213 virtual void SetCursor(ECursor cursor);
00214 virtual void SetDoubleBuffer(Int_t mode=1);
00215 virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE);
00216 void SetGrayscale(Bool_t set = kTRUE);
00217 void SetWindowPosition(Int_t x, Int_t y) { fCanvasImp->SetWindowPosition(x, y); }
00218 void SetWindowSize(UInt_t ww, UInt_t wh) { fCanvasImp->SetWindowSize(ww, wh); }
00219 void SetCanvasSize(UInt_t ww, UInt_t wh);
00220 void SetHighLightColor(Color_t col) { fHighLightColor = col; }
00221 void SetSelected(TObject *obj);
00222 void SetClickSelected(TObject *obj) { fClickSelected = obj; }
00223 void SetSelectedPad(TPad *pad) { fSelectedPad = pad; }
00224 void SetClickSelectedPad(TPad *pad) { fClickSelectedPad = pad; }
00225 void Show() { fCanvasImp->Show(); }
00226 virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0);
00227 void SetBatch(Bool_t batch=kTRUE);
00228 static void SetFolder(Bool_t isfolder=kTRUE);
00229 void SetPadSave(TPad *pad) {fPadSave = pad;}
00230 void SetRetained(Bool_t retained=kTRUE) { fRetained=retained;}
00231 void SetTitle(const char *title="");
00232 virtual void ToggleEventStatus();
00233 virtual void ToggleAutoExec();
00234 virtual void ToggleToolBar();
00235 virtual void ToggleEditor();
00236 virtual void ToggleToolTips();
00237 virtual void Update();
00238
00239 Bool_t UseGL() const { return fUseGL; }
00240 void SetSupportGL(Bool_t support) {fUseGL = support;}
00241
00242
00243
00244
00245 TVirtualPadPainter *GetCanvasPainter();
00246
00247 static TCanvas *MakeDefCanvas();
00248
00249 ClassDef(TCanvas,7)
00250 };
00251
00252 #endif