Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TContextMenu.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Nenad Buncic 08/02/96
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#ifndef ROOT_TContextMenu
13#define ROOT_TContextMenu
14
15
16#include "TNamed.h"
17
18#ifdef R__LESS_INCLUDES
19class TContextMenuImp;
20#else
21#include "TContextMenuImp.h"
22#endif
23
24class TMethod;
25class TFunction;
26class TMethodArg;
27class TVirtualPad;
28class TObjArray;
29class TBrowser;
30class TToggle;
31class TClassMenuItem;
32
33
34class TContextMenu : public TNamed {
35
36friend class TContextMenuImp;
37
38private:
39 TContextMenu(const TContextMenu&) = delete; // TContextMenu can not be copied since we do not know the actual type of the TContextMenuImp (and it can not be 'Cloned')
40 TContextMenu& operator=(const TContextMenu&) = delete; // TContextMenu can not be copied since we do not know the actual type of the TContextMenuImp (and it can not be 'Cloned')
41
42protected:
43 TContextMenuImp *fContextMenuImp; //!Context menu system specific implementation
44 TFunction *fSelectedMethod; //selected method
45 TObject *fSelectedObject; //selected object
46 TObject *fCalledObject; //object to call
47 TClassMenuItem *fSelectedMenuItem; //selected class menu item
48 TVirtualPad *fSelectedCanvas; //selected canvas (if exist)
49 TVirtualPad *fSelectedPad; //selected pad (if exist)
50 TBrowser *fBrowser; //selected browser (if exist)
51
52 virtual void DisplayPopUp(Int_t x, Int_t y);
53
54private:
56
57public:
58 TContextMenu(const char *name, const char *title = "Context sensitive popup menu");
59 virtual ~TContextMenu();
60
61 virtual void Action(TObject *object, TMethod *method);
62 virtual void Action(TObject *object, TToggle *toggle);
63 virtual void Action(TClassMenuItem *classmenuitem);
66 virtual const char *CreateArgumentTitle(TMethodArg *argument);
67 virtual const char *CreateDialogTitle(TObject *object, TFunction *method);
68 virtual const char *CreatePopupTitle(TObject *object );
69 void Execute(const char *method, const char *params, Int_t *error=nullptr) override { TObject::Execute(method, params, error); }
70 void Execute(TMethod *method, TObjArray *params, Int_t *error=nullptr) override { TObject::Execute(method, params, error); }
71 virtual void Execute(TObject *object, TFunction *method, const char *params);
72 virtual void Execute(TObject *object, TFunction *method, TObjArray *params);
73 void Execute(const char *params) { Execute(fCalledObject, fSelectedMethod, params); }
75 virtual TBrowser *GetBrowser() { return fBrowser; }
80 virtual TObject *GetCalledObject() { return fCalledObject; }
83 virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr); // Create menu from canvas
84 virtual void Popup(Int_t x, Int_t y, TObject *obj, TBrowser *b); // Create menu from Browser
85 virtual void SetCanvas(TVirtualPad *c) { fSelectedCanvas = c; }
86 virtual void SetBrowser(TBrowser *b) { fBrowser = b; }
87 virtual void SetMethod(TFunction *m) { fSelectedMethod = m; }
88 virtual void SetCalledObject(TObject *o) { fCalledObject = o; }
90 void SetNameTitle(const char *name, const char *title) override { TNamed::SetNameTitle(name, title); }
91 virtual void SetObject(TObject *o) { fSelectedObject = o; }
92 virtual void SetPad(TVirtualPad *p) { fSelectedPad = p; }
93
94 ClassDefOverride(TContextMenu,0) //Context sensitive popup menu
95};
96
97#endif
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
int Int_t
Definition RtypesCore.h:45
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
char name[80]
Definition TGX11.cxx:110
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Describes one element of the context menu associated to a class The menu item may describe.
This class provides an interface to GUI independent context sensitive popup menus.
This class provides an interface to context sensitive popup menus.
virtual void SetCanvas(TVirtualPad *c)
TContextMenuImp * fContextMenuImp
virtual TVirtualPad * GetSelectedCanvas()
virtual void SetCalledObject(TObject *o)
virtual ~TContextMenu()
Destroy a context menu.
virtual void Action(TObject *object, TMethod *method)
Action to be performed when this menu item is selected.
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr)
Popup context menu at given location in canvas c and pad p for selected object.
virtual TFunction * GetSelectedMethod()
void Execute(TObjArray *params)
TBrowser * fBrowser
virtual TVirtualPad * GetSelectedPad()
virtual void SetPad(TVirtualPad *p)
TFunction * fSelectedMethod
Context menu system specific implementation.
virtual TClassMenuItem * GetSelectedMenuItem()
virtual void SetMethod(TFunction *m)
void Action(TMethod *method)
virtual void SetObject(TObject *o)
virtual TObject * GetSelectedObject()
virtual const char * CreateArgumentTitle(TMethodArg *argument)
Create string describing argument (for use in dialog box).
virtual void DisplayPopUp(Int_t x, Int_t y)
Display popup.
TVirtualPad * fSelectedPad
TObject * fSelectedObject
void SetNameTitle(const char *name, const char *title) override
Set all the TNamed parameters (name and title).
TContextMenu(const TContextMenu &)=delete
void Execute(const char *params)
virtual TObject * GetCalledObject()
virtual TBrowser * GetBrowser()
virtual TContextMenuImp * GetContextMenuImp()
TVirtualPad * fSelectedCanvas
virtual const char * CreateDialogTitle(TObject *object, TFunction *method)
Create title for dialog box retrieving argument values.
TContextMenu & operator=(const TContextMenu &)=delete
TObject * fCalledObject
void Execute(TMethod *method, TObjArray *params, Int_t *error=nullptr) override
Execute method on this object with parameters stored in the TObjArray.
virtual const char * CreatePopupTitle(TObject *object)
Create title for popup menu.
void Action(TToggle *toggle)
void Execute(const char *method, const char *params, Int_t *error=nullptr) override
Execute method on this object with the given parameter string, e.g.
virtual void SetSelectedMenuItem(TClassMenuItem *mi)
virtual void SetBrowser(TBrowser *b)
TClassMenuItem * fSelectedMenuItem
Global functions class (global functions are obtained from CINT).
Definition TFunction.h:30
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition TMethodArg.h:36
Each ROOT class (see TClass) has a linked list of methods.
Definition TMethod.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Definition TNamed.cxx:164
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Execute(const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g.
Definition TObject.cxx:377
This class defines toggling facility for both - object's method or variables.
Definition TToggle.h:47
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TMarker m
Definition textangle.C:8