ROOT
git-r3/HEAD
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
13
Describes one element of the context menu associated to a class
14
The 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
20
All the standard methods of the class are described by only
21
one item. Since a complete context menu is described by a TList of
22
TClassMenuItem elements, it is possible to customize the context
23
menu of a class by removing the element "standard methods" and
24
replacing 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
40
TClassMenuItem::TClassMenuItem
() :
TObject
()
41
{
42
fType
=
kPopupUserFunction
;
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
65
TClassMenuItem::TClassMenuItem
(
Int_t
type,
TClass
*parentcl,
66
const
char
*title,
const
char
*functionname,
TObject
*obj,
67
const
char
*args,
Int_t
selfobjposition,
Bool_t
self) :
TObject
()
68
{
69
fType
= (
EClassMenuItemType
) type;
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
87
TClassMenuItem::TClassMenuItem
(
const
TClassMenuItem
& cmi) :
88
TObject
(cmi),
89
fType
(cmi.
fType
),
90
fSelfObjectPos
(cmi.
fSelfObjectPos
),
91
fSelf
(cmi.
fSelf
),
92
fToggle
(cmi.
fToggle
),
93
fTitle
(cmi.
fTitle
),
94
fCalledObject
(cmi.
fCalledObject
),
95
fFunctionName
(cmi.
fFunctionName
),
96
fArgs
(cmi.
fArgs
),
97
fSubMenu
(cmi.
fSubMenu
),
98
fParent
(cmi.
fParent
)
99
{
100
}
101
102
////////////////////////////////////////////////////////////////////////////////
103
/// assignment operator
104
///
105
/// Note: It is the responsibility of the caller/creator to add to the
106
/// menu list.
107
108
TClassMenuItem
&
TClassMenuItem::operator=
(
const
TClassMenuItem
& cmi)
109
{
110
if
(
this
!=&cmi) {
111
TObject::operator=
(cmi);
112
fType
=cmi.
fType
;
113
fSelfObjectPos
=cmi.
fSelfObjectPos
;
114
fSelf
=cmi.
fSelf
;
115
fToggle
=cmi.
fToggle
;
116
fTitle
=cmi.
fTitle
;
117
fCalledObject
=cmi.
fCalledObject
;
118
fFunctionName
=cmi.
fFunctionName
;
119
fArgs
=cmi.
fArgs
;
120
fSubMenu
=cmi.
fSubMenu
;
121
fParent
=cmi.
fParent
;
122
}
123
return
*
this
;
124
}
125
126
////////////////////////////////////////////////////////////////////////////////
127
/// TClassMenuItem dtor.
128
129
TClassMenuItem::~TClassMenuItem
()
130
{
131
if
(
fParent
)
fParent
->GetMenuList()->Remove(
this
);
132
}
Int_t
int Int_t
Signed integer 4 bytes (int).
Definition
RtypesCore.h:59
Bool_t
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition
RtypesCore.h:77
TClassMenuItem.h
TClass.h
TList.h
TClassMenuItem::fCalledObject
TObject * fCalledObject
Definition
TClassMenuItem.h:45
TClassMenuItem::fParent
TClass * fParent
Definition
TClassMenuItem.h:49
TClassMenuItem::fSelf
Bool_t fSelf
Definition
TClassMenuItem.h:42
TClassMenuItem::fFunctionName
TString fFunctionName
Definition
TClassMenuItem.h:46
TClassMenuItem::fTitle
TString fTitle
Definition
TClassMenuItem.h:44
TClassMenuItem::fArgs
TString fArgs
Definition
TClassMenuItem.h:47
TClassMenuItem::fType
EClassMenuItemType fType
Definition
TClassMenuItem.h:40
TClassMenuItem::fToggle
Bool_t fToggle
Definition
TClassMenuItem.h:43
TClassMenuItem::TClassMenuItem
TClassMenuItem()
Default TClassMenuItem ctor.
Definition
TClassMenuItem.cxx:40
TClassMenuItem::~TClassMenuItem
virtual ~TClassMenuItem()
TClassMenuItem dtor.
Definition
TClassMenuItem.cxx:129
TClassMenuItem::EClassMenuItemType
EClassMenuItemType
Definition
TClassMenuItem.h:34
TClassMenuItem::kPopupUserFunction
@ kPopupUserFunction
Definition
TClassMenuItem.h:35
TClassMenuItem::TClassMenuItem
TClassMenuItem(const TClassMenuItem &)
copy constructor
Definition
TClassMenuItem.cxx:87
TClassMenuItem::fSubMenu
TList * fSubMenu
Definition
TClassMenuItem.h:48
TClassMenuItem::fSelfObjectPos
Int_t fSelfObjectPos
Definition
TClassMenuItem.h:41
TClassMenuItem::operator=
TClassMenuItem & operator=(const TClassMenuItem &)
assignment operator
Definition
TClassMenuItem.cxx:108
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition
TClass.h:84
TObject::operator=
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition
TObject.h:305
TObject::TObject
TObject()
TObject constructor.
Definition
TObject.h:259
core
gui
src
TClassMenuItem.cxx
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1