Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TRootCanvas.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   15/01/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 
0013 #ifndef ROOT_TRootCanvas
0014 #define ROOT_TRootCanvas
0015 
0016 
0017 #include "TCanvasImp.h"
0018 #include "TGFrame.h"
0019 
0020 class TGCanvas;
0021 class TGMenuBar;
0022 class TGPopupMenu;
0023 class TGLayoutHints;
0024 class TGStatusBar;
0025 class TRootContainer;
0026 class TGToolBar;
0027 class TGHorizontal3DLine;
0028 class TGVertical3DLine;
0029 class TVirtualPadEditor;
0030 class TGDockableFrame;
0031 class TGDNDManager;
0032 class TGToolTip;
0033 
0034 class TRootCanvas : public TGMainFrame, public TCanvasImp {
0035 
0036 friend class TRootContainer;
0037 
0038 private:
0039    TGCanvas            *fCanvasWindow;       ///< canvas widget
0040    TRootContainer      *fCanvasContainer;    ///< container in canvas widget
0041    TGMenuBar           *fMenuBar;            ///< menubar
0042    TGPopupMenu         *fFileMenu;           ///< file menu
0043    TGPopupMenu         *fFileSaveMenu;       ///< save cascade submenu
0044    TGPopupMenu         *fEditMenu;           ///< edit menu
0045    TGPopupMenu         *fEditClearMenu;      ///< clear cascade submenu
0046    TGPopupMenu         *fViewMenu;           ///< view menu
0047    TGPopupMenu         *fViewWithMenu;       ///< view with... cascade submenu
0048    TGPopupMenu         *fOptionMenu;         ///< option menu
0049    TGPopupMenu         *fToolsMenu;          ///< tools menu
0050    TGPopupMenu         *fHelpMenu;           ///< help menu
0051    TGLayoutHints       *fMenuBarLayout;      ///< menubar layout hints
0052    TGLayoutHints       *fMenuBarItemLayout;  ///< layout hints for menu in menubar
0053    TGLayoutHints       *fMenuBarHelpLayout;  ///< layout hint for help menu in menubar
0054    TGLayoutHints       *fCanvasLayout;       ///< layout for canvas widget
0055    TGStatusBar         *fStatusBar;          ///< statusbar widget
0056    TGLayoutHints       *fStatusBarLayout;    ///< layout hints for statusbar
0057 
0058    TGCompositeFrame    *fEditorFrame;        ///< side frame for current pad editor
0059    TGLayoutHints       *fEditorLayout;       ///< layout for editor frame
0060    TGCompositeFrame    *fMainFrame;          ///< main frame containing canvas and side frame
0061    TGLayoutHints       *fToolBarLayout;      ///< layout for toolbar widget
0062    TGToolBar           *fToolBar;            ///< icon button toolbar
0063    TGHorizontal3DLine  *fToolBarSep;         ///< toolbar separator
0064    TGLayoutHints       *fMainFrameLayout;    ///< layout for main frame
0065    TGVertical3DLine    *fVertical1;          ///< toolbar vertical separator
0066    TGVertical3DLine    *fVertical2;          ///< toolbar vertical separator
0067    TGHorizontal3DLine  *fHorizontal1;        ///< toolbar separator
0068    TGLayoutHints       *fVertical1Layout;    ///< layout hints for separator
0069    TGLayoutHints       *fVertical2Layout;    ///< layout hints for separator
0070    TGLayoutHints       *fHorizontal1Layout;  ///< layout hints for separator
0071    TGDockableFrame     *fToolDock;           ///< dockable frame holding the toolbar
0072    TGLayoutHints       *fDockLayout;         ///< layout hints for dockable frame widget
0073    const TGPicture     *fIconPic;            ///< icon picture
0074    TGToolTip           *fToolTip;            ///< tooltip for object info
0075 
0076    TVirtualPadEditor   *fEditor;     ///< pointer to currently loaded pad editor
0077    Bool_t               fEmbedded;   ///< true if embedded in any other frame (e.g. in the browser)
0078    Int_t                fCanvasID;   ///< index in fWindows array of TGX11
0079    Bool_t               fAutoFit;    ///< when true canvas container keeps same size as canvas
0080    Int_t                fButton;     ///< currently pressed button
0081 
0082    TRootCanvas(const TRootCanvas&) = delete;
0083    TRootCanvas& operator=(const TRootCanvas&) = delete;
0084 
0085    void     CreateCanvas(const char *name);
0086    void     CreateEditor();
0087 
0088    Bool_t   HandleContainerButton(Event_t *ev);
0089    Bool_t   HandleContainerDoubleClick(Event_t *ev);
0090    Bool_t   HandleContainerConfigure(Event_t *ev);
0091    Bool_t   HandleContainerKey(Event_t *ev);
0092    Bool_t   HandleContainerMotion(Event_t *ev);
0093    Bool_t   HandleContainerExpose(Event_t *ev);
0094    Bool_t   HandleContainerCrossing(Event_t *ev);
0095 
0096    Bool_t   HandleDNDDrop(TDNDData *data) override;
0097    Atom_t   HandleDNDPosition(Int_t x, Int_t y, Atom_t action,
0098                               Int_t xroot, Int_t yroot) override;
0099    Atom_t   HandleDNDEnter(Atom_t * typelist) override;
0100    Bool_t   HandleDNDLeave() override;
0101 
0102 public:
0103    TRootCanvas(TCanvas *c = nullptr, const char *name = "ROOT Canvas", UInt_t width = 500, UInt_t height = 300);
0104    TRootCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
0105    ~TRootCanvas() override;
0106 
0107    void     AdjustSize();
0108    void     Close() override;
0109    void     ForceUpdate() override { Layout(); }
0110    void     FitCanvas();
0111    void     EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
0112    UInt_t   GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override;
0113    UInt_t   GetCwidth() const;
0114    UInt_t   GetCheight() const;
0115    void     Iconify() override { IconifyWindow(); }
0116    Int_t    InitWindow() override;
0117    void     PrintCanvas();
0118    void     RaiseWindow() override;
0119    void     SetWindowPosition(Int_t x, Int_t y) override;
0120    void     SetWindowSize(UInt_t w, UInt_t h) override;
0121    void     SetWindowTitle(const char *newTitle) override;
0122    void     SetCanvasSize(UInt_t w, UInt_t h) override;
0123    void     SetStatusText(const char *txt = nullptr, Int_t partidx = 0) override;
0124 
0125    void     Show() override { MapRaised(); }
0126    void     ShowMenuBar(Bool_t show = kTRUE) override;
0127    void     ShowStatusBar(Bool_t show = kTRUE) override;
0128    void     ShowEditor(Bool_t show = kTRUE) override;
0129    void     ShowToolBar(Bool_t show = kTRUE) override;
0130    void     ShowToolTips(Bool_t show = kTRUE) override;
0131 
0132    Bool_t   HasEditor() const override;
0133    Bool_t   HasMenuBar() const override;
0134    Bool_t   HasStatusBar() const override;
0135    Bool_t   HasToolBar() const override;
0136    Bool_t   HasToolTips() const override;
0137 
0138    void     Activated(Int_t id);
0139 
0140    TGMenuBar     *GetMenuBar() const { return fMenuBar; }
0141    TGLayoutHints *GetMenuBarItemLayout() const { return fMenuBarItemLayout; }
0142    TGStatusBar   *GetStatusBar() const { return fStatusBar; }
0143    TGDockableFrame *GetToolDock() const { return fToolDock; }
0144 
0145    // overridden from TGMainFrame
0146    void     CloseWindow() override;
0147    Bool_t   ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0148    void     ReallyDelete() override;
0149 
0150    ClassDefOverride(TRootCanvas,0)  //ROOT native GUI version of main window with menubar and drawing area
0151 };
0152 
0153 #endif