Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TClassMenuItem.cxx
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/** \class TClassMenuItem
13Describes one element of the context menu associated to a class
14The menu item may describe
15 - a separator,
16 - standard list of methods i.e. the methods defined in
17 the described class by a *MENU* in the comment field
18 of the header,
19 - a method of an external class or a global function
20All the standard methods of the class are described by only
21one item. Since a complete context menu is described by a TList of
22TClassMenuItem elements, it is possible to customize the context
23menu of a class by removing the element "standard methods" and
24replacing it by whatever one wants.
25*/
26
27#include "TClassMenuItem.h"
28#include "TList.h"
29#include "TClass.h"
30
31
32
33////////////////////////////////////////////////////////////////////////////////
34/// Default TClassMenuItem ctor. TClassMenuItems are constructed in TClass
35/// with a standard content but may be customized later
36/// - fType = 0 : external method/function
37/// - fType = 1 : separator
38/// - fType = 2 : standard methods list
39
41{
43 fSelf = 0;
44 fToggle = 0;
45 fCalledObject = nullptr;
46 fSubMenu = nullptr;
47 fParent = nullptr;
48 fSelfObjectPos = -1;
49}
50
51////////////////////////////////////////////////////////////////////////////////
52/// TClassMenuItem ctor. TClassMenuItems are constructed in TClass
53/// with a standard content but may be customized later
54/// - type = 0 : external method/function
55/// - type = 1 : separator
56/// - type = 2 : standard methods list
57/// self indicates if the object to be called is the one selected
58/// by the popup menu
59/// selfobjposition, if non zero, indicates the position in the arguments
60/// list of the argument corresponding to the selected (clicked) object.
61/// This argument in the calling method should be a TObject*
62/// Note: It is the responsibility of the caller/creator to add to the
63/// menu list.
64
66 const char *title, const char *functionname, TObject *obj,
67 const char *args, Int_t selfobjposition, Bool_t self) : TObject()
68{
70 fSelf = self;
71 fToggle = 0;
72 fTitle = title;
73 fCalledObject = obj;
74 fFunctionName = functionname;
75 fArgs = args;
76 fSubMenu = nullptr;
77 fParent = parentcl;
78 fSelfObjectPos = selfobjposition;
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// copy constructor
83///
84/// Note: It is the responsibility of the caller/creator to add to the
85/// menu list.
86
101
102////////////////////////////////////////////////////////////////////////////////
103/// assignment operator
104///
105/// Note: It is the responsibility of the caller/creator to add to the
106/// menu list.
107
109{
110 if(this!=&cmi) {
112 fType=cmi.fType;
114 fSelf=cmi.fSelf;
115 fToggle=cmi.fToggle;
116 fTitle=cmi.fTitle;
119 fArgs=cmi.fArgs;
120 fSubMenu=cmi.fSubMenu;
121 fParent=cmi.fParent;
122 }
123 return *this;
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// TClassMenuItem dtor.
128
130{
131 if (fParent) fParent->GetMenuList()->Remove(this);
132}
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
TObject * fCalledObject
TString fFunctionName
EClassMenuItemType fType
TClassMenuItem()
Default TClassMenuItem ctor.
virtual ~TClassMenuItem()
TClassMenuItem dtor.
TClassMenuItem(const TClassMenuItem &)
copy constructor
TClassMenuItem & operator=(const TClassMenuItem &)
assignment operator
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:305
TObject()
TObject constructor.
Definition TObject.h:259