Logo ROOT   6.07/09
Reference Guide
TQRootCanvas.h
Go to the documentation of this file.
1 // @(#)root/qtgsi:$Id$
2 // Author: Denis Bertini, M. AL-Turany 01/11/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, 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 #ifndef ROOT_TQRootCanvas
13 #define ROOT_TQRootCanvas
14 
15 ///////////////////////////////////////////////////////////////////////
16 //
17 // TQRootCanvas
18 //
19 // This canvas uses Qt eventloop to handle user input.
20 //
21 // @short Graphic Qt Widget based Canvas
22 //
23 // @authors Denis Bertini <d.bertini@gsi.de>
24 // M. AL-Turany <m.al-turany@gsi.de>
25 //version 2.0
26 //////////////////////////////////////////////////////////////////////
27 
28 #ifndef __CINT__
29 #include "qwidget.h"
30 #include "qstring.h"
31 #if !(QT_VERSION > 0x039999) // Added by cholm@nbi.dk - for Qt 3
32 # include "qdragobject.h"
33 #endif
34 #endif
35 
36 #ifndef ROOT_TVirtualPad
37 #include "TVirtualPad.h"
38 #endif
39 
40 
41 class QAction;
42 class QMouseEvent;
43 class QResizeEvent;
44 class QPaintEvent;
45 
46 class TPad;
47 class TContextMenu;
48 class TControlBar;
49 class TCanvas;
50 class TQCanvasMenu;
51 class TBrowser;
52 class QWidget;
53 class QDropEvent;
54 class QDragEnterEvent;
55 class QCloseEvent;
56 class QEvent;
57 class QObject;
58 
59 class TQRootCanvas : public QWidget
60 {
61 #ifndef __CINT__
62  Q_OBJECT
63 #endif
64 private:
65  TQRootCanvas(const TQRootCanvas &);
67 
68 public:
69 
70  TQRootCanvas( QWidget *parent = 0, const char *name = 0 ,TCanvas *c=0);
71  TQRootCanvas( QWidget *parent, QWidget* tabWin , const char *name = 0 ,TCanvas *c=0);
72  virtual ~TQRootCanvas();
73  TCanvas* GetCanvas() { return fCanvas;}
74  Int_t GetRootWid() { return fWid;}
76  QWidget* GetParent() { return fParent;}
77  QWidget* GetTabWin() { return fTabWin;}
78  virtual void dropEvent( QDropEvent *Event );
79  virtual void dragEnterEvent( QDragEnterEvent *e );
80 
81 #ifndef __CINT__
82 signals:
83  void SelectedPadChanged(TPad *);
84 #endif
85 public slots:
86  void cd(Int_t subpadnumber=0);
87  virtual void Browse(TBrowser *b);
88  void Clear(Option_t *option="");
89  void Close(Option_t *option="");
90  virtual void Draw(Option_t *option="");
91  virtual TObject *DrawClone(Option_t *option="");
92  virtual TObject *DrawClonePad();
93  virtual void EditorBar();
94  void EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
95  void FeedbackMode(Bool_t set);
96  void Flush();
97  void UseCurrentStyle();
98  void ForceUpdate() ;
99  const char *GetDISPLAY();
102  Int_t GetEvent() ;
103  Int_t GetEventX() ;
104  Int_t GetEventY() ;
107  TObject *GetSelected() ;
111  Bool_t GetAutoExec() ;
112  Size_t GetXsizeUser() ;
113  Size_t GetYsizeUser() ;
114  Size_t GetXsizeReal() ;
115  Size_t GetYsizeReal() ;
116  Int_t GetCanvasID() ;
121  UInt_t GetWw() ;
122  UInt_t GetWh() ;
123  virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh);
124  virtual void HandleInput(EEventType button, Int_t x, Int_t y);
125  Bool_t HasMenuBar() ;
126  void Iconify() ;
127  Bool_t IsBatch() ;
128  Bool_t IsRetained() ;
129  virtual void ls(Option_t *option="") ;
130  void MoveOpaque(Int_t set=1);
131  Bool_t OpaqueMoving() ;
133  virtual void Paint(Option_t *option="");
134  virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj) ;
135  virtual TPad *Pick(Int_t px, Int_t py, TObject *prevSelObj);
136  virtual void Resize(Option_t *option="");
137  void ResizeOpaque(Int_t set=1) ;
138  void SaveSource(const char *filename="", Option_t *option="");
139  virtual void SetCursor(ECursor cursor);
140  virtual void SetDoubleBuffer(Int_t mode=1);
141  void SetWindowPosition(Int_t x, Int_t y) ;
142  void SetWindowSize(UInt_t ww, UInt_t wh) ;
143  void SetCanvasSize(UInt_t ww, UInt_t wh);
144  void SetHighLightColor(Color_t col);
145  void SetSelected(TObject *obj) ;
146  void SetSelectedPad(TPad *pad) ;
147  void Show() ;
148  virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0);
149  void SetBatch(Bool_t batch=kTRUE);
150  void SetRetained(Bool_t retained=kTRUE);
151  void SetTitle(const char *title="");
152  virtual void ToggleEventStatus();
153  virtual void ToggleAutoExec();
154  virtual void Update();
155  //////////////////////////////////////////////////////////////////////
158 
159 protected:
160  virtual bool eventFilter( QObject *, QEvent * );
161  virtual void mousePressEvent( QMouseEvent *e );
162  virtual void mouseReleaseEvent( QMouseEvent *e );
163  virtual void resizeEvent( QResizeEvent *e );
164  virtual void paintEvent( QPaintEvent *e );
165  virtual void mouseDoubleClickEvent(QMouseEvent* e );
166  virtual void mouseMoveEvent(QMouseEvent *e);
167  virtual void leaveEvent(QEvent *e);
168  virtual void closeEvent( QCloseEvent * e);
169  ////////////////////////////////////
170  TQCanvasMenu *fContextMenu; // Qt Context menu for this canvas
171  TCanvas *fCanvas; // Root Canvas
172  Int_t fWid; // Windows Id of the Canvas
173  Bool_t fNeedResize; // Resize flag
174  Bool_t fIsCanvasOwned; // Ownership flag
175  QWidget *fParent,*fTabWin; // parent widgets
176 
177  ClassDef(TQRootCanvas,1) //interface to Qt eventloop to handle user input
178 };
179 
180 #endif
181 
182 
183 
184 
185 
186 
void Close(Option_t *option="")
Just a wrapper.
virtual void SetDoubleBuffer(Int_t mode=1)
just a wrapper
Size_t GetXsizeReal()
just a wrapper
const char * GetDISPLAY()
just a wrapper
Int_t GetEvent()
just a wrapper
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:26
void SetSelected(TObject *obj)
just a wrapper
virtual void ToggleAutoExec()
just a wrapper
void Iconify()
just a wrapper
virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0)
just a wrapper
Int_t GetCanvasID()
just a wrapper
Color_t GetHighLightColor()
just a wrapper
Bool_t GetAutoExec()
just a wrapper
float Float_t
Definition: RtypesCore.h:53
float Size_t
Definition: RtypesCore.h:83
return c
const char Option_t
Definition: RtypesCore.h:62
void SetNeedsResize(Bool_t yes)
Definition: TQRootCanvas.h:157
Bool_t HasMenuBar()
just a wrapper
Bool_t GetCanvasOwner()
Definition: TQRootCanvas.h:75
UInt_t GetWw()
just a wrapper
QWidget * fParent
Definition: TQRootCanvas.h:175
EEventType
Definition: Buttons.h:15
virtual TObject * DrawClonePad()
Just a wrapper.
virtual void ls(Option_t *option="")
just a wrapper
void MoveOpaque(Int_t set=1)
just a wrapper
void Flush()
just a wrapper
virtual ~TQRootCanvas()
dtor
int Int_t
Definition: RtypesCore.h:41
QWidget * GetParent()
Definition: TQRootCanvas.h:76
bool Bool_t
Definition: RtypesCore.h:59
Size_t GetXsizeUser()
just a wrapper
TCanvas * fCanvas
Definition: TQRootCanvas.h:171
virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh)
just a wrapper
Int_t GetEventY()
just a wrapper
ECursor
Definition: TVirtualX.h:56
Size_t GetYsizeUser()
just a wrapper
void SetWindowPosition(Int_t x, Int_t y)
just a wrapper
virtual void mouseReleaseEvent(QMouseEvent *e)
Handle mouse button release event.
virtual void paintEvent(QPaintEvent *e)
Handle paint event of Qt.
QWidget * fTabWin
Definition: TQRootCanvas.h:175
Option_t * GetSelectedOpt()
just a wrapper
void SetWindowSize(UInt_t ww, UInt_t wh)
just a wrapper
virtual void EditorBar()
Just a wrapper.
virtual void mouseMoveEvent(QMouseEvent *e)
Handle mouse move event.
Bool_t fNeedResize
Definition: TQRootCanvas.h:173
Double_t x[n]
Definition: legend1.C:17
virtual void leaveEvent(QEvent *e)
Handle leave event.
virtual void Paint(Option_t *option="")
just a wrapper
virtual void Resize(Option_t *option="")
just a wrapper
#define ClassDef(name, id)
Definition: Rtypes.h:254
TQRootCanvas(const TQRootCanvas &)
Bool_t OpaqueMoving()
just a wrapper
void UseCurrentStyle()
just a wrapper
Size_t GetYsizeReal()
just a wrapper
Bool_t GetShowEventStatus()
just a wrapper
TContextMenu * GetContextMenu()
just a wrapper
virtual void dragEnterEvent(QDragEnterEvent *e)
Entering a drag event.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
TCanvas * GetCanvas()
Definition: TQRootCanvas.h:73
virtual void Update()
just a wrapper
short Color_t
Definition: RtypesCore.h:79
void SetRetained(Bool_t retained=kTRUE)
just a wrapper
Int_t GetWindowTopX()
just a wrapper
virtual TObject * DrawClone(Option_t *option="")
Just a wrapper.
void ForceUpdate()
just a wrapper
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
void FeedbackMode(Bool_t set)
just a wrapper
virtual TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj)
just a wrapper
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
void Clear(Option_t *option="")
Just a wrapper.
unsigned int UInt_t
Definition: RtypesCore.h:42
The most important graphics class in the ROOT system.
Definition: TPad.h:37
void SetTitle(const char *title="")
just a wrapper
void ResizeOpaque(Int_t set=1)
just a wrapper
void SetBatch(Bool_t batch=kTRUE)
just a wrapper
void SetCanvasSize(UInt_t ww, UInt_t wh)
just a wrapper
virtual void dropEvent(QDropEvent *Event)
Start a drop, for now only histogram objects can be drwon by droping.
void EnterLeave(TPad *prevSelPad, TObject *prevSelObj)
just a wrapper
void Show()
just a wrapper
TObject * GetSelected()
just a wrapper
Int_t GetWindowTopY()
just a wrapper
The Canvas class.
Definition: TCanvas.h:41
UInt_t GetWindowWidth()
just a wrapper
virtual void SetCursor(ECursor cursor)
just a wrapper
Bool_t IsBatch()
just a wrapper
virtual void Draw(Option_t *option="")
Just a wrapper.
Double_t y[n]
Definition: legend1.C:17
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
just a wrapper
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
QWidget * GetTabWin()
Definition: TQRootCanvas.h:77
Bool_t IsRetained()
just a wrapper
virtual void closeEvent(QCloseEvent *e)
Close.
Int_t GetRootWid()
Definition: TQRootCanvas.h:74
Mother of all ROOT objects.
Definition: TObject.h:44
virtual void mousePressEvent(QMouseEvent *e)
Handle mouse button press event.
void cd(Int_t subpadnumber=0)
Just a wrapper.
void SelectedPadChanged(TPad *)
Bool_t fIsCanvasOwned
Definition: TQRootCanvas.h:174
virtual void ToggleEventStatus()
just a wrapper
void SetHighLightColor(Color_t col)
just a wrapper
virtual void Browse(TBrowser *b)
Just a wrapper.
virtual bool eventFilter(QObject *, QEvent *)
Filtering of QWidget Events for ressource management.
Int_t GetEventX()
just a wrapper
void SetSelectedPad(TPad *pad)
just a wrapper
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Bool_t OpaqueResizing()
just a wrapper
TQRootCanvas & operator=(const TQRootCanvas &)
TQCanvasMenu * fContextMenu
Definition: TQRootCanvas.h:170
TVirtualPad * GetSelectedPad()
just a wrapper
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void mouseDoubleClickEvent(QMouseEvent *e)
Handle mouse double click event.
virtual void resizeEvent(QResizeEvent *e)
Call QWidget resize and inform the ROOT Canvas.
Int_t GetDoubleBuffer()
just a wrapper
TVirtualPad * GetPadSave()
just a wrapper
UInt_t GetWh()
just a wrapper
UInt_t GetWindowHeight()
just a wrapper
char name[80]
Definition: TGX11.cxx:109
Bool_t NeedsResize()
Definition: TQRootCanvas.h:156
void SaveSource(const char *filename="", Option_t *option="")
just a wrapper