Logo ROOT  
Reference Guide
TClassMenuItem.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Damir Buskulic 23/11/2001
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_TClassMenuItem
13 #define ROOT_TClassMenuItem
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TClassMenuItem //
19 // //
20 // Describe one element of the context menu associated to a class //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TObject.h"
25 #include "TString.h"
26 
27 class TList;
28 class TClass;
29 
30 
31 class TClassMenuItem : public TObject {
32 
33 public:
36  };
37  enum { kIsExternal, kIsSelf };
38 
39 private:
40  EClassMenuItemType fType; //type flag (EClassMenuItemType)
41  Int_t fSelfObjectPos; //rang in argument list corresponding to the object being clicked on
42  Bool_t fSelf; //flag to indicate that object to be called is the selected one
43  Bool_t fToggle; //flag toggle method
44  TString fTitle; //title if not standard
45  TObject *fCalledObject; //object to be called
46  TString fFunctionName; //name of the function or method to be called
47  TString fArgs; //arguments type list *** NOT CHECKED ***
48  TList *fSubMenu; //list of submenu items
49  TClass *fParent; //parent class
50 
51 protected:
54 
55 public:
57  TClassMenuItem(Int_t type, TClass *parent, const char *title="",
58  const char *functionname="", TObject *obj=0,
59  const char *args="", Int_t selfobjposition=-1,
60  Bool_t self=kFALSE);
61  virtual ~TClassMenuItem();
62  virtual const char *GetTitle() const { return fTitle; }
63  virtual const char *GetFunctionName() const { return fFunctionName; }
64  virtual const char *GetArgs() const { return fArgs; }
65  virtual TObject *GetCalledObject() const { return fCalledObject; }
66  virtual Int_t GetType() const { return fType; }
67  virtual Int_t GetSelfObjectPos() const { return fSelfObjectPos; }
68  virtual Bool_t IsCallSelf() const { return fSelf; }
69  virtual Bool_t IsSeparator() const { return fType==kPopupSeparator ? kTRUE : kFALSE; }
70  virtual Bool_t IsStandardList() const { return fType==kPopupStandardList ? kTRUE : kFALSE; }
71  virtual Bool_t IsToggle() const { return fToggle; }
72  virtual void SetType(Int_t type) { fType = (EClassMenuItemType) type; }
73  virtual void SetTitle(const char *title) { fTitle = title; }
74  virtual void SetSelf(Bool_t self) { fSelf = self; }
75  virtual void SetToggle(Bool_t toggle = kTRUE) { fToggle = toggle; }
76  virtual void SetCall(TObject *obj, const char *method,
77  const char *args="", Int_t selfobjposition = 0)
78  { fCalledObject = obj; fFunctionName = method;
79  fArgs = args; fSelfObjectPos = selfobjposition;}
80 
81  ClassDef(TClassMenuItem,0) //One element of the class context menu
82 };
83 
84 #endif
TClassMenuItem::SetSelf
virtual void SetSelf(Bool_t self)
Definition: TClassMenuItem.h:74
TClassMenuItem::GetSelfObjectPos
virtual Int_t GetSelfObjectPos() const
Definition: TClassMenuItem.h:67
TClassMenuItem::fType
EClassMenuItemType fType
Definition: TClassMenuItem.h:40
TClassMenuItem::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TClassMenuItem.h:62
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TClassMenuItem::kPopupSeparator
@ kPopupSeparator
Definition: TClassMenuItem.h:35
TClassMenuItem::~TClassMenuItem
virtual ~TClassMenuItem()
TClassMenuItem dtor.
Definition: TClassMenuItem.cxx:130
TClassMenuItem::fFunctionName
TString fFunctionName
Definition: TClassMenuItem.h:46
TClassMenuItem::IsCallSelf
virtual Bool_t IsCallSelf() const
Definition: TClassMenuItem.h:68
TClassMenuItem::fSelf
Bool_t fSelf
Definition: TClassMenuItem.h:42
TClassMenuItem::SetType
virtual void SetType(Int_t type)
Definition: TClassMenuItem.h:72
TClassMenuItem::fParent
TClass * fParent
Definition: TClassMenuItem.h:49
TClassMenuItem::fCalledObject
TObject * fCalledObject
Definition: TClassMenuItem.h:45
TClassMenuItem::kIsExternal
@ kIsExternal
Definition: TClassMenuItem.h:37
TClassMenuItem::GetFunctionName
virtual const char * GetFunctionName() const
Definition: TClassMenuItem.h:63
TClassMenuItem::fSubMenu
TList * fSubMenu
Definition: TClassMenuItem.h:48
TString
Basic string class.
Definition: TString.h:136
TClassMenuItem::fTitle
TString fTitle
Definition: TClassMenuItem.h:44
TClassMenuItem::fArgs
TString fArgs
Definition: TClassMenuItem.h:47
TString.h
TClassMenuItem::kPopupStandardList
@ kPopupStandardList
Definition: TClassMenuItem.h:35
bool
TClassMenuItem::SetCall
virtual void SetCall(TObject *obj, const char *method, const char *args="", Int_t selfobjposition=0)
Definition: TClassMenuItem.h:76
TClassMenuItem::kIsSelf
@ kIsSelf
Definition: TClassMenuItem.h:37
TClassMenuItem
Describes one element of the context menu associated to a class The menu item may describe.
Definition: TClassMenuItem.h:31
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TClassMenuItem::kPopupUserFunction
@ kPopupUserFunction
Definition: TClassMenuItem.h:35
TClassMenuItem::IsToggle
virtual Bool_t IsToggle() const
Definition: TClassMenuItem.h:71
TClassMenuItem::operator=
TClassMenuItem & operator=(const TClassMenuItem &)
assignment operator
Definition: TClassMenuItem.cxx:109
TClassMenuItem::IsSeparator
virtual Bool_t IsSeparator() const
Definition: TClassMenuItem.h:69
TClassMenuItem::TClassMenuItem
TClassMenuItem()
Default TClassMenuItem ctor.
Definition: TClassMenuItem.cxx:41
TClassMenuItem::SetTitle
virtual void SetTitle(const char *title)
Definition: TClassMenuItem.h:73
TClassMenuItem::EClassMenuItemType
EClassMenuItemType
Definition: TClassMenuItem.h:34
TObject.h
TClassMenuItem::SetToggle
virtual void SetToggle(Bool_t toggle=kTRUE)
Definition: TClassMenuItem.h:75
TClassMenuItem::GetType
virtual Int_t GetType() const
Definition: TClassMenuItem.h:66
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TClassMenuItem::GetCalledObject
virtual TObject * GetCalledObject() const
Definition: TClassMenuItem.h:65
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TClassMenuItem::IsStandardList
virtual Bool_t IsStandardList() const
Definition: TClassMenuItem.h:70
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TClassMenuItem::GetArgs
virtual const char * GetArgs() const
Definition: TClassMenuItem.h:64
TClassMenuItem::fSelfObjectPos
Int_t fSelfObjectPos
Definition: TClassMenuItem.h:41
type
int type
Definition: TGX11.cxx:121
TClassMenuItem::fToggle
Bool_t fToggle
Definition: TClassMenuItem.h:43
TList
A doubly linked list.
Definition: TList.h:44
int