Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TClassMenuItem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/meta:$Id$
0002 // Author: Damir Buskulic   23/11/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TClassMenuItem
0013 #define ROOT_TClassMenuItem
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TClassMenuItem                                                       //
0019 //                                                                      //
0020 // Describe one element of the context menu associated to a class       //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TObject.h"
0025 #include "TString.h"
0026 
0027 class TList;
0028 class TClass;
0029 
0030 
0031 class TClassMenuItem : public TObject {
0032 
0033 public:
0034    enum EClassMenuItemType {
0035       kPopupUserFunction, kPopupSeparator, kPopupStandardList
0036    };
0037    enum { kIsExternal, kIsSelf };
0038 
0039 private:
0040    EClassMenuItemType  fType;          //type flag (EClassMenuItemType)
0041    Int_t               fSelfObjectPos; //rang in argument list corresponding to the object being clicked on
0042    Bool_t              fSelf;          //flag to indicate that object to be called is the selected one
0043    Bool_t              fToggle;        //flag toggle method
0044    TString             fTitle;         //title if not standard
0045    TObject            *fCalledObject;  //object to be called
0046    TString             fFunctionName;  //name of the function or method to be called
0047    TString             fArgs;          //arguments type list *** NOT CHECKED ***
0048    TList              *fSubMenu;       //list of submenu items
0049    TClass             *fParent;        //parent class
0050 
0051 protected:
0052    TClassMenuItem(const TClassMenuItem&);
0053    TClassMenuItem& operator=(const TClassMenuItem&);
0054 
0055 public:
0056    TClassMenuItem();
0057    TClassMenuItem(Int_t type, TClass *parent, const char *title="",
0058                   const char *functionname="", TObject *obj=nullptr,
0059                   const char *args="", Int_t selfobjposition=-1,
0060                   Bool_t self=kFALSE);
0061    virtual        ~TClassMenuItem();
0062    const char    *GetTitle() const override { return fTitle.Data(); }
0063    virtual const char *GetFunctionName() const { return fFunctionName; }
0064    virtual const char *GetArgs() const { return fArgs; }
0065    virtual TObject *GetCalledObject() const { return fCalledObject; }
0066    virtual Int_t    GetType() const { return fType; }
0067    virtual Int_t    GetSelfObjectPos() const { return fSelfObjectPos; }
0068    virtual Bool_t   IsCallSelf() const { return fSelf; }
0069    virtual Bool_t   IsSeparator() const { return fType==kPopupSeparator ? kTRUE : kFALSE; }
0070    virtual Bool_t   IsStandardList() const { return fType==kPopupStandardList ? kTRUE : kFALSE; }
0071    virtual Bool_t   IsToggle() const { return fToggle; }
0072    virtual void     SetType(Int_t type) { fType = (EClassMenuItemType) type; }
0073    virtual void     SetTitle(const char *title) { fTitle = title; }
0074    virtual void     SetSelf(Bool_t self) { fSelf = self; }
0075    virtual void     SetToggle(Bool_t toggle = kTRUE) { fToggle = toggle; }
0076    virtual void     SetCall(TObject *obj, const char *method,
0077                             const char *args="", Int_t selfobjposition = 0)
0078                        { fCalledObject = obj; fFunctionName = method;
0079                          fArgs = args; fSelfObjectPos = selfobjposition;}
0080 
0081    ClassDefOverride(TClassMenuItem,0)  //One element of the class context menu
0082 };
0083 
0084 #endif