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;
75 fArgs = args;
76 fSubMenu = nullptr;
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
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
109{
110 if(this!=&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
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Describes one element of the context menu associated to a class The menu item may describe.
TObject * fCalledObject
TString fFunctionName
EClassMenuItemType fType
TClassMenuItem()
Default TClassMenuItem ctor.
virtual ~TClassMenuItem()
TClassMenuItem dtor.
TClassMenuItem & operator=(const TClassMenuItem &)
assignment operator
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TList * GetMenuList() const
Return the list of menu items associated with the class.
Definition TClass.cxx:4368
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:819
Mother of all ROOT objects.
Definition TObject.h:41
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:299