Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

TCanvas.h

Go to the documentation of this file.
00001 // @(#)root/gpad:$Name:  $:$Id: TCanvas.h,v 1.19 2003/04/04 17:06:07 brun Exp $
00002 // Author: Rene Brun   12/12/94
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TCanvas
00013 #define ROOT_TCanvas
00014 
00015 
00017 //                                                                      //
00018 // TCanvas                                                              //
00019 //                                                                      //
00020 // Graphics canvas.                                                     //
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;            //Canvas attributes
00055    TString       fDISPLAY;         //Name of destination screen
00056    Size_t        fXsizeUser;       //User specified size of canvas along X in CM
00057    Size_t        fYsizeUser;       //User specified size of canvas along Y in CM
00058    Size_t        fXsizeReal;       //Current size of canvas along X in CM
00059    Size_t        fYsizeReal;       //Current size of canvas along Y in CM
00060    Color_t       fHighLightColor;  //Highlight color of active pad
00061    Int_t         fDoubleBuffer;    //Double buffer flag (0=off, 1=on)
00062    Int_t         fWindowTopX;      //Top X position of window (in pixels)
00063    Int_t         fWindowTopY;      //Top Y position of window (in pixels)
00064    UInt_t        fWindowWidth;     //Width of window (including borders, etc.)
00065    UInt_t        fWindowHeight;    //Height of window (including menubar, borders, etc.)
00066    UInt_t        fCw;              //Width of the canvas along X (pixels)
00067    UInt_t        fCh;              //Height of the canvas along Y (pixels)
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;        //Retain structure flag
00081    Bool_t        fShowEventStatus; //Show event status panel
00082    Bool_t        fAutoExec;        //To auto exec the list of pad TExecs
00083    Bool_t        fMoveOpaque;      //Move objects in opaque mode
00084    Bool_t        fResizeOpaque;    //Resize objects in opaque mode
00085    Bool_t        fMenuBar;         //False if no menubar is displayed
00086    static Bool_t fgIsFolder;       //Indicates if canvas can be browsed as a folder
00087    
00088 private:
00089    TCanvas(const TCanvas &canvas);  // cannot copy canvas, use TObject::Clone
00090    TCanvas &operator=(const TCanvas &rhs);  // idem
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    //-- used by friend TThread class
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    //-- used by friend TThread class
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; // *MENU*
00124    virtual TObject  *DrawClonePad(); // *MENU*
00125    virtual void      EditorBar();
00126    void              EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
00127    void              FeedbackMode(Bool_t set);
00128    void              Flush();
00129    void              UseCurrentStyle(); // *MENU*
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); // *SIGNAL*
00173    virtual void      ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected); // *SIGNAL*
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);  // *TOGGLE*
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); // *MENU*
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)  //Graphics canvas
00199 };
00200 
00201 #endif

Generated on Thu Dec 18 14:52:17 2003 for ROOT by doxygen1.2.16