Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRootCanvas.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 15/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13#ifndef ROOT_TRootCanvas
14#define ROOT_TRootCanvas
15
16
17#include "TCanvasImp.h"
18#include "TGFrame.h"
19
20class TGCanvas;
21class TGMenuBar;
22class TGPopupMenu;
23class TGLayoutHints;
24class TGStatusBar;
25class TRootContainer;
26class TGToolBar;
30class TGDockableFrame;
31class TGDNDManager;
32class TGToolTip;
33
34class TRootCanvas : public TGMainFrame, public TCanvasImp {
35
36friend class TRootContainer;
37
38private:
39 TGCanvas *fCanvasWindow; ///< canvas widget
40 TRootContainer *fCanvasContainer; ///< container in canvas widget
41 TGMenuBar *fMenuBar; ///< menubar
42 TGPopupMenu *fFileMenu; ///< file menu
43 TGPopupMenu *fFileSaveMenu; ///< save cascade submenu
44 TGPopupMenu *fEditMenu; ///< edit menu
45 TGPopupMenu *fEditClearMenu; ///< clear cascade submenu
46 TGPopupMenu *fViewMenu; ///< view menu
47 TGPopupMenu *fViewWithMenu; ///< view with... cascade submenu
48 TGPopupMenu *fOptionMenu; ///< option menu
49 TGPopupMenu *fToolsMenu; ///< tools menu
50 TGPopupMenu *fHelpMenu; ///< help menu
51 TGLayoutHints *fMenuBarLayout; ///< menubar layout hints
52 TGLayoutHints *fMenuBarItemLayout; ///< layout hints for menu in menubar
53 TGLayoutHints *fMenuBarHelpLayout; ///< layout hint for help menu in menubar
54 TGLayoutHints *fCanvasLayout; ///< layout for canvas widget
55 TGStatusBar *fStatusBar; ///< statusbar widget
56 TGLayoutHints *fStatusBarLayout; ///< layout hints for statusbar
57
58 TGCompositeFrame *fEditorFrame; ///< side frame for current pad editor
59 TGLayoutHints *fEditorLayout; ///< layout for editor frame
60 TGCompositeFrame *fMainFrame; ///< main frame containing canvas and side frame
61 TGLayoutHints *fToolBarLayout; ///< layout for toolbar widget
62 TGToolBar *fToolBar; ///< icon button toolbar
63 TGHorizontal3DLine *fToolBarSep; ///< toolbar separator
64 TGLayoutHints *fMainFrameLayout; ///< layout for main frame
65 TGVertical3DLine *fVertical1; ///< toolbar vertical separator
66 TGVertical3DLine *fVertical2; ///< toolbar vertical separator
67 TGHorizontal3DLine *fHorizontal1; ///< toolbar separator
68 TGLayoutHints *fVertical1Layout; ///< layout hints for separator
69 TGLayoutHints *fVertical2Layout; ///< layout hints for separator
70 TGLayoutHints *fHorizontal1Layout; ///< layout hints for separator
71 TGDockableFrame *fToolDock; ///< dockable frame holding the toolbar
72 TGLayoutHints *fDockLayout; ///< layout hints for dockable frame widget
73 const TGPicture *fIconPic; ///< icon picture
74 TGToolTip *fToolTip; ///< tooltip for object info
75
76 TVirtualPadEditor *fEditor; ///< pointer to currently loaded pad editor
77 Bool_t fEmbedded; ///< true if embedded in any other frame (e.g. in the browser)
78 Int_t fCanvasID; ///< index in fWindows array of TGX11
79 Bool_t fAutoFit; ///< when true canvas container keeps same size as canvas
80 Int_t fButton; ///< currently pressed button
81
82 TRootCanvas(const TRootCanvas&) = delete;
84
85 void CreateCanvas(const char *name);
86 void CreateEditor();
87
95
98 Int_t xroot, Int_t yroot) override;
100 Bool_t HandleDNDLeave() override;
101
102public:
103 TRootCanvas(TCanvas *c = nullptr, const char *name = "ROOT Canvas", UInt_t width = 500, UInt_t height = 300);
105 ~TRootCanvas() override;
106
107 void AdjustSize();
108 void Close() override;
109 void ForceUpdate() override { Layout(); }
110 void FitCanvas();
111 void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
113 UInt_t GetCwidth() const;
114 UInt_t GetCheight() const;
115 void Iconify() override { IconifyWindow(); }
116 Int_t InitWindow() override;
117 void PrintCanvas();
118 void RaiseWindow() override;
119 void SetWindowPosition(Int_t x, Int_t y) override;
120 void SetWindowSize(UInt_t w, UInt_t h) override;
121 void SetWindowTitle(const char *newTitle) override;
122 void SetCanvasSize(UInt_t w, UInt_t h) override;
123 void SetStatusText(const char *txt = nullptr, Int_t partidx = 0) override;
124
125 void Show() override { MapRaised(); }
126 void ShowMenuBar(Bool_t show = kTRUE) override;
127 void ShowStatusBar(Bool_t show = kTRUE) override;
128 void ShowEditor(Bool_t show = kTRUE) override;
129 void ShowToolBar(Bool_t show = kTRUE) override;
130 void ShowToolTips(Bool_t show = kTRUE) override;
131
132 Bool_t HasEditor() const override;
133 Bool_t HasMenuBar() const override;
134 Bool_t HasStatusBar() const override;
135 Bool_t HasToolBar() const override;
136 Bool_t HasToolTips() const override;
137
138 void Activated(Int_t id);
139
140 TGMenuBar *GetMenuBar() const { return fMenuBar; }
144
145 // overridden from TGMainFrame
146 void CloseWindow() override;
147 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
148 void ReallyDelete() override;
149
150 ClassDefOverride(TRootCanvas,0) //ROOT native GUI version of main window with menubar and drawing area
151};
152
153#endif
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:75
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void IconifyWindow
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t Atom_t typelist
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition TCanvasImp.h:30
The Canvas class.
Definition TCanvas.h:23
Drag and drop data container.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
A frame with handles that allow it to be undocked (i.e.
void MapRaised() override
map raised
Definition TGFrame.h:205
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
This class creates a popup menu object.
Definition TGMenu.h:110
Provides a StatusBar widget.
Definition TGStatusBar.h:21
A toolbar is a composite frame that contains TGPictureButtons.
Definition TGToolBar.h:33
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition TG3DLine.h:33
Mother of all ROOT objects.
Definition TObject.h:41
This class creates a main window with menubar, scrollbars and a drawing area.
Definition TRootCanvas.h:34
TGToolBar * fToolBar
icon button toolbar
Definition TRootCanvas.h:62
UInt_t GetCwidth() const
Return width of canvas container.
void AdjustSize()
Keep the same canvas size while docking/undocking toolbar.
Bool_t fAutoFit
when true canvas container keeps same size as canvas
Definition TRootCanvas.h:79
TGPopupMenu * fEditMenu
edit menu
Definition TRootCanvas.h:44
void CreateEditor()
Create embedded editor.
Bool_t HasEditor() const override
Returns kTRUE if the editor is shown.
Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Gets the size and position of the window containing the canvas.
void Close() override
Called via TCanvasImp interface by TCanvas.
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
void ForceUpdate() override
void Iconify() override
void SetStatusText(const char *txt=nullptr, Int_t partidx=0) override
Set text in status bar.
TGLayoutHints * fMainFrameLayout
layout for main frame
Definition TRootCanvas.h:64
Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
TGDockableFrame * GetToolDock() const
UInt_t GetCheight() const
Return height of canvas container.
TGDockableFrame * fToolDock
dockable frame holding the toolbar
Definition TRootCanvas.h:71
void RaiseWindow() override
Put canvas window on top of the window stack.
void ShowEditor(Bool_t show=kTRUE) override
Show or hide side frame.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
void ReallyDelete() override
Really delete the canvas and this GUI.
void ShowMenuBar(Bool_t show=kTRUE) override
Show or hide menubar.
Atom_t HandleDNDEnter(Atom_t *typelist) override
Handle drag enter events.
void ShowStatusBar(Bool_t show=kTRUE) override
Show or hide statusbar.
TGHorizontal3DLine * fHorizontal1
toolbar separator
Definition TRootCanvas.h:67
TGStatusBar * GetStatusBar() const
TGLayoutHints * fEditorLayout
layout for editor frame
Definition TRootCanvas.h:59
TGPopupMenu * fToolsMenu
tools menu
Definition TRootCanvas.h:49
TGLayoutHints * fMenuBarItemLayout
layout hints for menu in menubar
Definition TRootCanvas.h:52
Int_t fCanvasID
index in fWindows array of TGX11
Definition TRootCanvas.h:78
const TGPicture * fIconPic
icon picture
Definition TRootCanvas.h:73
void SetCanvasSize(UInt_t w, UInt_t h) override
Set size of canvas container.
void SetWindowSize(UInt_t w, UInt_t h) override
Set size of canvas (units in pixels).
void PrintCanvas()
Print the canvas.
TRootCanvas(const TRootCanvas &)=delete
void ShowToolBar(Bool_t show=kTRUE) override
Show or hide toolbar.
Bool_t HasToolBar() const override
Returns kTRUE if the tool bar is shown.
void Activated(Int_t id)
Slot handling tab switching in the browser, to properly set the canvas and the model to the editor.
TGHorizontal3DLine * fToolBarSep
toolbar separator
Definition TRootCanvas.h:63
TRootCanvas & operator=(const TRootCanvas &)=delete
TGPopupMenu * fViewWithMenu
view with... cascade submenu
Definition TRootCanvas.h:47
TGPopupMenu * fEditClearMenu
clear cascade submenu
Definition TRootCanvas.h:45
void ShowToolTips(Bool_t show=kTRUE) override
Enable or disable tooltip info.
Bool_t HasToolTips() const override
Returns kTRUE if the tooltips are enabled.
TRootContainer * fCanvasContainer
container in canvas widget
Definition TRootCanvas.h:40
Bool_t fEmbedded
true if embedded in any other frame (e.g. in the browser)
Definition TRootCanvas.h:77
Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
TGLayoutHints * fHorizontal1Layout
layout hints for separator
Definition TRootCanvas.h:70
TGVertical3DLine * fVertical2
toolbar vertical separator
Definition TRootCanvas.h:66
TGLayoutHints * fMenuBarLayout
menubar layout hints
Definition TRootCanvas.h:51
void FitCanvas()
Fit canvas container to current window size.
Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.
TGCanvas * fCanvasWindow
canvas widget
Definition TRootCanvas.h:39
TGLayoutHints * fMenuBarHelpLayout
layout hint for help menu in menubar
Definition TRootCanvas.h:53
TGPopupMenu * fViewMenu
view menu
Definition TRootCanvas.h:46
TGLayoutHints * GetMenuBarItemLayout() const
TGStatusBar * fStatusBar
statusbar widget
Definition TRootCanvas.h:55
TGPopupMenu * fOptionMenu
option menu
Definition TRootCanvas.h:48
TGLayoutHints * fDockLayout
layout hints for dockable frame widget
Definition TRootCanvas.h:72
TGPopupMenu * fHelpMenu
help menu
Definition TRootCanvas.h:50
void Show() override
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
void CreateCanvas(const char *name)
Create the actual canvas.
TGLayoutHints * fVertical1Layout
layout hints for separator
Definition TRootCanvas.h:68
Bool_t HasStatusBar() const override
Returns kTRUE if the status bar is shown.
Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
Bool_t HasMenuBar() const override
Returns kTRUE if the menu bar is shown.
TGCompositeFrame * fMainFrame
main frame containing canvas and side frame
Definition TRootCanvas.h:60
Int_t InitWindow() override
Called by TCanvas ctor to get window indetifier.
TGLayoutHints * fVertical2Layout
layout hints for separator
Definition TRootCanvas.h:69
TVirtualPadEditor * fEditor
pointer to currently loaded pad editor
Definition TRootCanvas.h:76
TGMenuBar * fMenuBar
menubar
Definition TRootCanvas.h:41
void SetWindowPosition(Int_t x, Int_t y) override
Set canvas position (units in pixels).
Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
TGLayoutHints * fCanvasLayout
layout for canvas widget
Definition TRootCanvas.h:54
TGMenuBar * GetMenuBar() const
TGLayoutHints * fToolBarLayout
layout for toolbar widget
Definition TRootCanvas.h:61
Bool_t HandleDNDLeave() override
Handle drag leave events.
TGCompositeFrame * fEditorFrame
side frame for current pad editor
Definition TRootCanvas.h:58
~TRootCanvas() override
Delete ROOT basic canvas.
TGToolTip * fToolTip
tooltip for object info
Definition TRootCanvas.h:74
TGPopupMenu * fFileMenu
file menu
Definition TRootCanvas.h:42
TGPopupMenu * fFileSaveMenu
save cascade submenu
Definition TRootCanvas.h:43
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot) override
Handle dragging position events.
void SetWindowTitle(const char *newTitle) override
Change title on window.
void CloseWindow() override
In case window is closed via WM we get here.
Int_t fButton
currently pressed button
Definition TRootCanvas.h:80
TGLayoutHints * fStatusBarLayout
layout hints for statusbar
Definition TRootCanvas.h:56
TGVertical3DLine * fVertical1
toolbar vertical separator
Definition TRootCanvas.h:65
Abstract base class used by ROOT graphics editor.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174