ROOT  6.06/09
Reference Guide
TQCanvasMenu.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_TQCanvasMenu
13 #define ROOT_TQCanvasMenu
14 
15 ////////////////////////////////////////////////////////////////////////////////
16 //
17 // TQCanvasMenu
18 //
19 // This class provides an interface to Qt based context sensitive popup menus.
20 // These menus pop up when the user hits the right mouse button, and
21 // are destroyed when the menu pops downs.
22 //
23 ////////////////////////////////////////////////////////////////////////////////
24 
25 #include "qobject.h"
26 
27 #ifndef ROOT_TList
28 #include "TList.h"
29 #endif
30 
31 class TCanvas;
32 class TObject;
33 class TMethodArg;
34 class TQRootDialog;
35 
36 #if (QT_VERSION > 0x039999) // Added by cholm@nbi.dk - for Qt 4
37 class Q3PopupMenu;
38 typedef Q3PopupMenu QPopupMenu;
39 #else
40 class QPopupMenu;
41 #endif
42 
43 class QAction;
44 class QMouseEvent;
45 class QObject;
46 class QPaintEvent;
47 class QResizeEvent;
48 class QWidget;
49 
50 class TQCanvasMenu : public QObject {
51 #ifndef __CINT__
52  Q_OBJECT
53 #endif
54 private:
55  TQCanvasMenu(const TQCanvasMenu &c);
56  TQCanvasMenu& operator=(const TQCanvasMenu&) {return *this;}
57 
58 public:
59  TQCanvasMenu(QWidget* parent = 0, TCanvas *canvas = 0);
60  TQCanvasMenu(QWidget* parent, QWidget *tabWin, TCanvas *canvas) ;
61  virtual ~TQCanvasMenu();
62  void Popup(TObject *obj, double x, double y, QMouseEvent *e);
63  void Dialog(TObject *obj, TMethod* method);
64  char* CreateDialogTitle( TObject *object, TMethod *method );
65  char* CreateArgumentTitle(TMethodArg *argument);
66 
67 public slots:
68  void Execute(int id);
69 
70 protected:
71  TObject* fCurrObj; // current selected object
72  QPopupMenu *fPopup; // Qt popup menu
73  TList fMethods; // list of Root metheds associated with the selected object
74  TCanvas *fc; // pointer to the ROOT canvas
75  TQRootDialog *fDialog; // the TQRootDialog which is used to prompt for
76  //the arguments of an object's member function.
77  QWidget *fParent,*fTabWin; //parents widgets
78  double fMousePosX; // mouse position in user coordinate
79  double fMousePosY; // mouse position in user coordinate
80 
81  ClassDef(TQCanvasMenu,1) //interface to Qt based context sensitive popup menus
82 };
83 
84 #endif
double fMousePosX
Definition: TQCanvasMenu.h:78
TList fMethods
Definition: TQCanvasMenu.h:73
double fMousePosY
Definition: TQCanvasMenu.h:79
char * CreateArgumentTitle(TMethodArg *argument)
Create string describing argument (for use in dialog box).
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:33
virtual ~TQCanvasMenu()
dtor
TQCanvasMenu(const TQCanvasMenu &c)
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Popup(TObject *obj, double x, double y, QMouseEvent *e)
Perform the corresponding selected TObject popup in the position defined by x, y coordinates (in user...
QWidget * fParent
Definition: TQCanvasMenu.h:77
TQCanvasMenu & operator=(const TQCanvasMenu &)
Definition: TQCanvasMenu.h:56
QWidget * fTabWin
Definition: TQCanvasMenu.h:77
A doubly linked list.
Definition: TList.h:47
void Execute(int id)
Slot defined to execute a method from a selected TObject using TObject::Execute() function...
TObject * fCurrObj
Definition: TQCanvasMenu.h:71
The Canvas class.
Definition: TCanvas.h:48
TQRootDialog * fDialog
Definition: TQCanvasMenu.h:75
Double_t y[n]
Definition: legend1.C:17
Mother of all ROOT objects.
Definition: TObject.h:58
QPopupMenu Q3PopupMenu
Definition: qtroot.cpp:33
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:40
TCanvas * fc
Definition: TQCanvasMenu.h:74
void Dialog(TObject *obj, TMethod *method)
Create dialog object with OK and Cancel buttons.
TObject * obj
QPopupMenu * fPopup
Definition: TQCanvasMenu.h:72
char * CreateDialogTitle(TObject *object, TMethod *method)
Create title for dialog box retrieving argument values.