Logo ROOT   6.08/07
Reference Guide
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-2000, 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 // //
18 // TRootCanvas //
19 // //
20 // This class creates a main window with menubar, scrollbars and a //
21 // drawing area. The widgets used are the new native ROOT GUI widgets. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TCanvasImp
26 #include "TCanvasImp.h"
27 #endif
28 #ifndef ROOT_TGFrame
29 #include "TGFrame.h"
30 #endif
31 
32 class TGCanvas;
33 class TGMenuBar;
34 class TGPopupMenu;
35 class TGLayoutHints;
36 class TGStatusBar;
37 class TRootContainer;
38 class TGToolBar;
39 class TGHorizontal3DLine;
40 class TGVertical3DLine;
41 class TVirtualPadEditor;
42 class TGDockableFrame;
43 class TGDNDManager;
44 class TGToolTip;
45 
46 class TRootCanvas : public TGMainFrame, public TCanvasImp {
47 
48 friend class TRootContainer;
49 
50 private:
51  TGCanvas *fCanvasWindow; // canvas widget
52  TRootContainer *fCanvasContainer; // container in canvas widget
53  TGMenuBar *fMenuBar; // menubar
54  TGPopupMenu *fFileMenu; // file menu
55  TGPopupMenu *fFileSaveMenu; // save cascade submenu
56  TGPopupMenu *fEditMenu; // edit menu
57  TGPopupMenu *fEditClearMenu; // clear cascade submenu
58  TGPopupMenu *fViewMenu; // view menu
59  TGPopupMenu *fViewWithMenu; // view with... cascade submenu
60  TGPopupMenu *fOptionMenu; // option menu
61  TGPopupMenu *fToolsMenu; // tools menu
62  TGPopupMenu *fHelpMenu; // help menu
63  TGLayoutHints *fMenuBarLayout; // menubar layout hints
64  TGLayoutHints *fMenuBarItemLayout; // layout hints for menu in menubar
65  TGLayoutHints *fMenuBarHelpLayout; // layout hint for help menu in menubar
66  TGLayoutHints *fCanvasLayout; // layout for canvas widget
67  TGStatusBar *fStatusBar; // statusbar widget
68  TGLayoutHints *fStatusBarLayout; // layout hints for statusbar
69 
70  TGCompositeFrame *fEditorFrame; // side frame for current pad editor
71  TGLayoutHints *fEditorLayout; // layout for editor frame
72  TGCompositeFrame *fMainFrame; // main frame containing canvas and side frame
73  TGLayoutHints *fToolBarLayout; // layout for toolbar widget
74  TGToolBar *fToolBar; // icon button toolbar
75  TGHorizontal3DLine *fToolBarSep; // toolbar separator
76  TGLayoutHints *fMainFrameLayout; // layout for main frame
77  TGVertical3DLine *fVertical1; // toolbar vertical separator
78  TGVertical3DLine *fVertical2; // toolbar vertical separator
79  TGHorizontal3DLine *fHorizontal1; // toolbar sepatator
80  TGLayoutHints *fVertical1Layout; // layout hints for separator
81  TGLayoutHints *fVertical2Layout; // layout hints for separator
82  TGLayoutHints *fHorizontal1Layout; // layout hints for separator
83  TGDockableFrame *fToolDock; // dockable frame holding the toolbar
84  TGLayoutHints *fDockLayout; // layout hints for dockable frame widget
85  const TGPicture *fIconPic; // icon picture
86  TGToolTip *fToolTip; // tooltip for object info
87 
88  TVirtualPadEditor *fEditor; // pointer to currently loaded pad editor
89  Bool_t fEmbedded; // true if embedded in any other frame (e.g. in the browser)
90  Int_t fCanvasID; // index in fWindows array of TGX11
91  Bool_t fAutoFit; // when true canvas container keeps same size as canvas
92  Int_t fButton; // currently pressed button
93 
94  TRootCanvas(const TRootCanvas&); // Not implemented
95  TRootCanvas& operator=(const TRootCanvas&); // Not implemented
96  void CreateCanvas(const char *name);
97  void CreateEditor();
98 
106 
109  Int_t xroot, Int_t yroot);
110  Atom_t HandleDNDEnter(Atom_t * typelist);
112 
113 public:
114  TRootCanvas(TCanvas *c = 0, const char *name = "ROOT Canvas", UInt_t width = 500, UInt_t height = 300);
115  TRootCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
116  virtual ~TRootCanvas();
117 
118  void AdjustSize();
119  void Close();
120  void ForceUpdate() { Layout(); }
121  void FitCanvas();
122  void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
124  UInt_t GetCwidth() const;
125  UInt_t GetCheight() const;
126  void Iconify() { IconifyWindow(); }
127  Int_t InitWindow();
128  void PrintCanvas();
129  void RaiseWindow();
130  void SetWindowPosition(Int_t x, Int_t y);
131  void SetWindowSize(UInt_t w, UInt_t h);
132  void SetWindowTitle(const char *newTitle);
133  void SetCanvasSize(UInt_t w, UInt_t h);
134  void SetStatusText(const char *txt = 0, Int_t partidx = 0);
135 
136  void Show() { MapRaised(); }
137  void ShowMenuBar(Bool_t show = kTRUE);
138  void ShowStatusBar(Bool_t show = kTRUE);
139  void ShowEditor(Bool_t show = kTRUE);
140  void ShowToolBar(Bool_t show = kTRUE);
141  void ShowToolTips(Bool_t show = kTRUE);
142 
143  Bool_t HasEditor() const;
144  Bool_t HasMenuBar() const;
145  Bool_t HasStatusBar() const;
146  Bool_t HasToolBar() const;
147  Bool_t HasToolTips() const;
148 
149  void Activated(Int_t id);
150 
151  TGMenuBar *GetMenuBar() const { return fMenuBar; }
153  TGStatusBar *GetStatusBar() const { return fStatusBar; }
154  TGDockableFrame *GetToolDock() const { return fToolDock; }
155 
156  // overridden from TGMainFrame
157  void CloseWindow();
158  Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
159  void ReallyDelete();
160 
161  ClassDef(TRootCanvas,0) //ROOT native GUI version of main window with menubar and drawing area
162 };
163 
164 #endif
TGLayoutHints * fMenuBarLayout
Definition: TRootCanvas.h:63
TGLayoutHints * fEditorLayout
Definition: TRootCanvas.h:71
void CreateEditor()
Create embedded editor.
TGPopupMenu * fFileMenu
Definition: TRootCanvas.h:54
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area)...
Definition: TCanvasImp.h:32
Int_t fCanvasID
Definition: TRootCanvas.h:90
TGMenuBar * fMenuBar
Definition: TRootCanvas.h:53
void ShowStatusBar(Bool_t show=kTRUE)
Show or hide statusbar.
TGToolTip * fToolTip
Definition: TRootCanvas.h:86
Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
TGLayoutHints * fVertical2Layout
Definition: TRootCanvas.h:81
return c
Int_t fButton
Definition: TRootCanvas.h:92
Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
void ShowToolBar(Bool_t show=kTRUE)
Show or hide toolbar.
TH1 * h
Definition: legend2.C:5
Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.
TGStatusBar * GetStatusBar() const
Definition: TRootCanvas.h:153
Bool_t HasMenuBar() const
Returns kTRUE if the menu bar is shown.
TGHorizontal3DLine * fHorizontal1
Definition: TRootCanvas.h:79
TGStatusBar * fStatusBar
Definition: TRootCanvas.h:67
void ForceUpdate()
Definition: TRootCanvas.h:120
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void MapRaised()
Definition: TGFrame.h:268
TGPopupMenu * fToolsMenu
Definition: TRootCanvas.h:61
TGHorizontal3DLine * fToolBarSep
Definition: TRootCanvas.h:75
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
void Iconify()
Definition: TRootCanvas.h:126
TGPopupMenu * fViewMenu
Definition: TRootCanvas.h:58
TGLayoutHints * fHorizontal1Layout
Definition: TRootCanvas.h:82
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Gets the size and position of the window containing the canvas.
Double_t x[n]
Definition: legend1.C:17
TGMenuBar * GetMenuBar() const
Definition: TRootCanvas.h:151
#define ClassDef(name, id)
Definition: Rtypes.h:254
TGPopupMenu * fEditMenu
Definition: TRootCanvas.h:56
TGPopupMenu * fEditClearMenu
Definition: TRootCanvas.h:57
TGDockableFrame * fToolDock
Definition: TRootCanvas.h:83
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot)
Handle dragging position events.
Handle_t Atom_t
Definition: GuiTypes.h:38
Bool_t fAutoFit
Definition: TRootCanvas.h:91
Bool_t HasToolTips() const
Returns kTRUE if the tooltips are enabled.
TGLayoutHints * fDockLayout
Definition: TRootCanvas.h:84
TGPopupMenu * fFileSaveMenu
Definition: TRootCanvas.h:55
TGVertical3DLine * fVertical1
Definition: TRootCanvas.h:77
void ReallyDelete()
Really delete the canvas and this GUI.
void AdjustSize()
Keep the same canvas size while docking/undocking toolbar.
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
TGPopupMenu * fViewWithMenu
Definition: TRootCanvas.h:59
void Show()
Definition: TRootCanvas.h:136
TGLayoutHints * fMenuBarItemLayout
Definition: TRootCanvas.h:64
void RaiseWindow()
Put canvas window on top of the window stack.
friend class TRootContainer
Definition: TRootCanvas.h:48
TGCompositeFrame * fMainFrame
Definition: TRootCanvas.h:72
TRootCanvas(const TRootCanvas &)
void ShowEditor(Bool_t show=kTRUE)
Show or hide side frame.
void CreateCanvas(const char *name)
Create the actual canvas.
void ShowMenuBar(Bool_t show=kTRUE)
Show or hide menubar.
TGCanvas * fCanvasWindow
Definition: TRootCanvas.h:51
Int_t InitWindow()
Called by TCanvas ctor to get window indetifier.
Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
unsigned int UInt_t
Definition: RtypesCore.h:42
void ShowToolTips(Bool_t show=kTRUE)
Enable or disable tooltip info.
TVirtualPadEditor * fEditor
Definition: TRootCanvas.h:88
void SetWindowPosition(Int_t x, Int_t y)
Set canvas position (units in pixels).
Bool_t HandleDNDLeave()
Handle drag leave events.
Bool_t HandleDNDDrop(TDNDData *data)
Handle drop events.
UInt_t GetCheight() const
Return height of canvas container.
TGPopupMenu * fHelpMenu
Definition: TRootCanvas.h:62
long Long_t
Definition: RtypesCore.h:50
The Canvas class.
Definition: TCanvas.h:41
virtual void IconifyWindow()
Definition: TGWindow.h:98
Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
Bool_t HasEditor() const
Returns kTRUE if the editor is shown.
TGLayoutHints * fVertical1Layout
Definition: TRootCanvas.h:80
TGVertical3DLine * fVertical2
Definition: TRootCanvas.h:78
TGLayoutHints * fStatusBarLayout
Definition: TRootCanvas.h:68
Double_t y[n]
Definition: legend1.C:17
Abstract base class used by ROOT graphics editor.
const TGPicture * fIconPic
Definition: TRootCanvas.h:85
TGLayoutHints * GetMenuBarItemLayout() const
Definition: TRootCanvas.h:152
Mother of all ROOT objects.
Definition: TObject.h:37
Atom_t HandleDNDEnter(Atom_t *typelist)
Handle drag enter events.
TGPopupMenu * fOptionMenu
Definition: TRootCanvas.h:60
void Activated(Int_t id)
Slot handling tab switching in the browser, to properly set the canvas and the model to the editor...
void SetStatusText(const char *txt=0, Int_t partidx=0)
Set text in status bar.
void Close()
Called via TCanvasImp interface by TCanvas.
void FitCanvas()
Fit canvas container to current window size.
TRootCanvas & operator=(const TRootCanvas &)
UInt_t GetCwidth() const
Return width of canvas container.
void SetWindowSize(UInt_t w, UInt_t h)
Set size of canvas (units in pixels).
TGToolBar * fToolBar
Definition: TRootCanvas.h:74
void PrintCanvas()
Print the canvas.
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
TGLayoutHints * fMainFrameLayout
Definition: TRootCanvas.h:76
TGLayoutHints * fMenuBarHelpLayout
Definition: TRootCanvas.h:65
Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
TGDockableFrame * GetToolDock() const
Definition: TRootCanvas.h:154
TGCompositeFrame * fEditorFrame
Definition: TRootCanvas.h:70
TRootContainer * fCanvasContainer
Definition: TRootCanvas.h:52
const Bool_t kTRUE
Definition: Rtypes.h:91
TGLayoutHints * fToolBarLayout
Definition: TRootCanvas.h:73
void SetCanvasSize(UInt_t w, UInt_t h)
Set size of canvas container. Units in pixels.
Bool_t HasStatusBar() const
Returns kTRUE if the status bar is shown.
void CloseWindow()
In case window is closed via WM we get here.
virtual ~TRootCanvas()
Delete ROOT basic canvas.
Bool_t HasToolBar() const
Returns kTRUE if the tool bar is shown.
char name[80]
Definition: TGX11.cxx:109
void SetWindowTitle(const char *newTitle)
Change title on window.
Bool_t fEmbedded
Definition: TRootCanvas.h:89
TGLayoutHints * fCanvasLayout
Definition: TRootCanvas.h:66