TRootCanvas.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TRootCanvas.h 29403 2009-07-09 07:17:16Z brun $
00002 // Author: Fons Rademakers   15/01/98
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 
00013 #ifndef ROOT_TRootCanvas
00014 #define ROOT_TRootCanvas
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TRootCanvas                                                          //
00019 //                                                                      //
00020 // This class creates a main window with menubar, scrollbars and a      //
00021 // drawing area. The widgets used are the new native ROOT GUI widgets.  //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TCanvasImp
00026 #include "TCanvasImp.h"
00027 #endif
00028 #ifndef ROOT_TGFrame
00029 #include "TGFrame.h"
00030 #endif
00031 
00032 class TGCanvas;
00033 class TGMenuBar;
00034 class TGPopupMenu;
00035 class TGLayoutHints;
00036 class TGStatusBar;
00037 class TRootContainer;
00038 class TGToolBar;
00039 class TGHorizontal3DLine;
00040 class TGVertical3DLine;
00041 class TVirtualPadEditor;
00042 class TGDockableFrame;
00043 class TGDNDManager;
00044 class TGToolTip;
00045 
00046 class TRootCanvas : public TGMainFrame, public TCanvasImp {
00047 
00048 friend class TRootContainer;
00049 
00050 private:
00051    TGCanvas            *fCanvasWindow;       // canvas widget
00052    TRootContainer      *fCanvasContainer;    // container in canvas widget
00053    TGMenuBar           *fMenuBar;            // menubar
00054    TGPopupMenu         *fFileMenu;           // file menu
00055    TGPopupMenu         *fFileSaveMenu;       // save cascade submenu
00056    TGPopupMenu         *fEditMenu;           // edit menu
00057    TGPopupMenu         *fEditClearMenu;      // clear cascade submenu
00058    TGPopupMenu         *fViewMenu;           // view menu
00059    TGPopupMenu         *fViewWithMenu;       // view with... cascade submenu
00060    TGPopupMenu         *fOptionMenu;         // option menu
00061    TGPopupMenu         *fToolsMenu;          // tools menu
00062    TGPopupMenu         *fHelpMenu;           // help menu
00063    TGLayoutHints       *fMenuBarLayout;      // menubar layout hints
00064    TGLayoutHints       *fMenuBarItemLayout;  // layout hints for menu in menubar
00065    TGLayoutHints       *fMenuBarHelpLayout;  // layout hint for help menu in menubar
00066    TGLayoutHints       *fCanvasLayout;       // layout for canvas widget
00067    TGStatusBar         *fStatusBar;          // statusbar widget
00068    TGLayoutHints       *fStatusBarLayout;    // layout hints for statusbar
00069 
00070    TGCompositeFrame    *fEditorFrame;        // side frame for current pad editor
00071    TGLayoutHints       *fEditorLayout;       // layout for editor frame
00072    TGCompositeFrame    *fMainFrame;          // main frame containing canvas and side frame
00073    TGLayoutHints       *fToolBarLayout;      // layout for toolbar widget
00074    TGToolBar           *fToolBar;            // icon button toolbar
00075    TGHorizontal3DLine  *fToolBarSep;         // toolbar separator
00076    TGLayoutHints       *fMainFrameLayout;    // layout for main frame
00077    TGVertical3DLine    *fVertical1;          // toolbar vertical separator
00078    TGVertical3DLine    *fVertical2;          // toolbar vertical separator
00079    TGHorizontal3DLine  *fHorizontal1;        // toolbar sepatator
00080    TGLayoutHints       *fVertical1Layout;    // layout hints for separator
00081    TGLayoutHints       *fVertical2Layout;    // layout hints for separator
00082    TGLayoutHints       *fHorizontal1Layout;  // layout hints for separator
00083    TGDockableFrame     *fToolDock;           // dockable frame holding the toolbar
00084    TGLayoutHints       *fDockLayout;         // layout hints for dockable frame widget
00085    const TGPicture     *fIconPic;            // icon picture
00086    TGToolTip           *fToolTip;            // tooltip for object info
00087 
00088    TVirtualPadEditor   *fEditor;     // pointer to currently loaded pad editor
00089    Int_t                fCanvasID;   // index in fWindows array of TGX11
00090    Bool_t               fAutoFit;    // when true canvas container keeps same size as canvas
00091    Int_t                fButton;     // currently pressed button
00092 
00093    TRootCanvas(const TRootCanvas&); // Not implemented
00094    TRootCanvas& operator=(const TRootCanvas&); // Not implemented
00095    void     CreateCanvas(const char *name);
00096    void     CreateEditor();
00097 
00098    Bool_t   HandleContainerButton(Event_t *ev);
00099    Bool_t   HandleContainerDoubleClick(Event_t *ev);
00100    Bool_t   HandleContainerConfigure(Event_t *ev);
00101    Bool_t   HandleContainerKey(Event_t *ev);
00102    Bool_t   HandleContainerMotion(Event_t *ev);
00103    Bool_t   HandleContainerExpose(Event_t *ev);
00104    Bool_t   HandleContainerCrossing(Event_t *ev);
00105 
00106    Bool_t   HandleDNDDrop(TDNDData *data);
00107    Atom_t   HandleDNDPosition(Int_t x, Int_t y, Atom_t action,
00108                               Int_t xroot, Int_t yroot);
00109    Atom_t   HandleDNDEnter(Atom_t * typelist);
00110    Bool_t   HandleDNDLeave();
00111 
00112 public:
00113    TRootCanvas(TCanvas *c = 0, const char *name = "ROOT Canvas", UInt_t width = 500, UInt_t height = 300);
00114    TRootCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
00115    virtual ~TRootCanvas();
00116 
00117    void     AdjustSize();
00118    void     Close();
00119    void     ForceUpdate() { Layout(); }
00120    void     FitCanvas();
00121    void     EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
00122    UInt_t   GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
00123    UInt_t   GetCwidth() const;
00124    UInt_t   GetCheight() const;
00125    void     Iconify() { IconifyWindow(); }
00126    Int_t    InitWindow();
00127    void     PrintCanvas();
00128    void     RaiseWindow();
00129    void     SetWindowPosition(Int_t x, Int_t y);
00130    void     SetWindowSize(UInt_t w, UInt_t h);
00131    void     SetWindowTitle(const char *newTitle);
00132    void     SetCanvasSize(UInt_t w, UInt_t h);
00133    void     SetStatusText(const char *txt = 0, Int_t partidx = 0);
00134 
00135    void     Show() { MapRaised(); }
00136    void     ShowMenuBar(Bool_t show = kTRUE);
00137    void     ShowStatusBar(Bool_t show = kTRUE);
00138    void     ShowEditor(Bool_t show = kTRUE);
00139    void     ShowToolBar(Bool_t show = kTRUE);
00140    void     ShowToolTips(Bool_t show = kTRUE);
00141 
00142    Bool_t   HasEditor() const;
00143    Bool_t   HasMenuBar() const;
00144    Bool_t   HasStatusBar() const;
00145    Bool_t   HasToolBar() const;
00146    Bool_t   HasToolTips() const;
00147 
00148    TGMenuBar     *GetMenuBar() const { return fMenuBar; }
00149    TGLayoutHints *GetMenuBarItemLayout() const { return fMenuBarItemLayout; }
00150    TGStatusBar   *GetStatusBar() const { return fStatusBar; }
00151    TGDockableFrame *GetToolDock() const { return fToolDock; }
00152 
00153    // overridden from TGMainFrame
00154    void     CloseWindow();
00155    Bool_t   ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00156    void     ReallyDelete();
00157 
00158    ClassDef(TRootCanvas,0)  //ROOT native GUI version of main window with menubar and drawing area
00159 };
00160 
00161 #endif

Generated on Tue Jul 5 14:20:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1