TClassMenuItem.h

Go to the documentation of this file.
00001 // @(#)root/meta:$Id: TClassMenuItem.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Damir Buskulic   23/11/2001
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TClassMenuItem
00013 #define ROOT_TClassMenuItem
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TClassMenuItem                                                       //
00019 //                                                                      //
00020 // Describe one element of the context menu associated to a class       //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TObject
00025 #include "TObject.h"
00026 #endif
00027 #ifndef ROOT_TString
00028 #include "TString.h"
00029 #endif
00030 
00031 class TList;
00032 class TClass;
00033 
00034 
00035 class TClassMenuItem : public TObject {
00036 
00037 public:
00038    enum EClassMenuItemType {
00039       kPopupUserFunction, kPopupSeparator, kPopupStandardList
00040    };
00041    enum { kIsExternal, kIsSelf };
00042 
00043 private:
00044    EClassMenuItemType  fType;          //type flag (EClassMenuItemType)
00045    Int_t               fSelfObjectPos; //rang in argument list corresponding to the object being clicked on
00046    Bool_t              fSelf;          //flag to indicate that object to be called is the selected one
00047    Bool_t              fToggle;        //flag toggle method
00048    TString             fTitle;         //title if not standard
00049    TObject            *fCalledObject;  //object to be called
00050    TString             fFunctionName;  //name of the function or method to be called
00051    TString             fArgs;          //arguments type list *** NOT CHECKED ***
00052    TList              *fSubMenu;       //list of submenu items
00053    TClass             *fParent;        //parent class
00054 
00055 protected:
00056    TClassMenuItem(const TClassMenuItem&);
00057    TClassMenuItem& operator=(const TClassMenuItem&);
00058 
00059 public:
00060    TClassMenuItem();
00061    TClassMenuItem(Int_t type, TClass *parent, const char *title="",
00062                   const char *functionname="", TObject *obj=0,
00063                   const char *args="", Int_t selfobjposition=-1,
00064                   Bool_t self=kFALSE);
00065    virtual        ~TClassMenuItem();
00066    virtual const char *GetTitle() const { return fTitle; }
00067    virtual const char *GetFunctionName() const { return fFunctionName; }
00068    virtual const char *GetArgs() const { return fArgs; }
00069    virtual TObject *GetCalledObject() const { return fCalledObject; }
00070    virtual Int_t    GetType() const { return fType; }
00071    virtual Int_t    GetSelfObjectPos() const { return fSelfObjectPos; }
00072    virtual Bool_t   IsCallSelf() const { return fSelf; }
00073    virtual Bool_t   IsSeparator() const { return fType==kPopupSeparator ? kTRUE : kFALSE; }
00074    virtual Bool_t   IsStandardList() const { return fType==kPopupStandardList ? kTRUE : kFALSE; }
00075    virtual Bool_t   IsToggle() const { return fToggle; }
00076    virtual void     SetType(Int_t type) { fType = (EClassMenuItemType) type; }
00077    virtual void     SetTitle(const char *title) { fTitle = title; }
00078    virtual void     SetSelf(Bool_t self) { fSelf = self; }
00079    virtual void     SetToggle(Bool_t toggle = kTRUE) { fToggle = toggle; }
00080    virtual void     SetCall(TObject *obj, const char *method,
00081                             const char *args="", Int_t selfobjposition = 0)
00082                        { fCalledObject = obj; fFunctionName = method;
00083                          fArgs = args; fSelfObjectPos = selfobjposition;}
00084 
00085    ClassDef(TClassMenuItem,0)  //One element of the class context menu
00086 };
00087 
00088 #endif

Generated on Tue Jul 5 14:11:39 2011 for ROOT_528-00b_version by  doxygen 1.5.1