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