ROOT logo
// @(#)root/meta:$Id$
// Author: Damir Buskulic   23/11/2001

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TClassMenuItem
#define ROOT_TClassMenuItem


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TClassMenuItem                                                       //
//                                                                      //
// Describe one element of the context menu associated to a class       //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

class TList;
class TClass;


class TClassMenuItem : public TObject {

public:
   enum EClassMenuItemType {
      kPopupUserFunction, kPopupSeparator, kPopupStandardList
   };
   enum { kIsExternal, kIsSelf };

private:
   EClassMenuItemType  fType;          //type flag (EClassMenuItemType)
   Int_t               fSelfObjectPos; //rang in argument list corresponding to the object being clicked on
   Bool_t              fSelf;          //flag to indicate that object to be called is the selected one
   Bool_t              fToggle;        //flag toggle method
   TString             fTitle;         //title if not standard
   TObject            *fCalledObject;  //object to be called
   TString             fFunctionName;  //name of the function or method to be called
   TString             fArgs;          //arguments type list *** NOT CHECKED ***
   TList              *fSubMenu;       //list of submenu items
   TClass             *fParent;        //parent class

protected:
   TClassMenuItem(const TClassMenuItem&);
   TClassMenuItem& operator=(const TClassMenuItem&);

public:
   TClassMenuItem();
   TClassMenuItem(Int_t type, TClass *parent, const char *title="",
                  const char *functionname="", TObject *obj=0,
                  const char *args="", Int_t selfobjposition=-1,
                  Bool_t self=kFALSE);
   virtual        ~TClassMenuItem();
   virtual const char *GetTitle() const { return fTitle; }
   virtual const char *GetFunctionName() const { return fFunctionName; }
   virtual const char *GetArgs() const { return fArgs; }
   virtual TObject *GetCalledObject() const { return fCalledObject; }
   virtual Int_t    GetType() const { return fType; }
   virtual Int_t    GetSelfObjectPos() const { return fSelfObjectPos; }
   virtual Bool_t   IsCallSelf() const { return fSelf; }
   virtual Bool_t   IsSeparator() const { return fType==kPopupSeparator ? kTRUE : kFALSE; }
   virtual Bool_t   IsStandardList() const { return fType==kPopupStandardList ? kTRUE : kFALSE; }
   virtual Bool_t   IsToggle() const { return fToggle; }
   virtual void     SetType(Int_t type) { fType = (EClassMenuItemType) type; }
   virtual void     SetTitle(const char *title) { fTitle = title; }
   virtual void     SetSelf(Bool_t self) { fSelf = self; }
   virtual void     SetToggle(Bool_t toggle = kTRUE) { fToggle = toggle; }
   virtual void     SetCall(TObject *obj, const char *method,
                            const char *args="", Int_t selfobjposition = 0)
                       { fCalledObject = obj; fFunctionName = method;
                         fArgs = args; fSelfObjectPos = selfobjposition;}

   ClassDef(TClassMenuItem,0)  //One element of the class context menu
};

#endif
 TClassMenuItem.h:1
 TClassMenuItem.h:2
 TClassMenuItem.h:3
 TClassMenuItem.h:4
 TClassMenuItem.h:5
 TClassMenuItem.h:6
 TClassMenuItem.h:7
 TClassMenuItem.h:8
 TClassMenuItem.h:9
 TClassMenuItem.h:10
 TClassMenuItem.h:11
 TClassMenuItem.h:12
 TClassMenuItem.h:13
 TClassMenuItem.h:14
 TClassMenuItem.h:15
 TClassMenuItem.h:16
 TClassMenuItem.h:17
 TClassMenuItem.h:18
 TClassMenuItem.h:19
 TClassMenuItem.h:20
 TClassMenuItem.h:21
 TClassMenuItem.h:22
 TClassMenuItem.h:23
 TClassMenuItem.h:24
 TClassMenuItem.h:25
 TClassMenuItem.h:26
 TClassMenuItem.h:27
 TClassMenuItem.h:28
 TClassMenuItem.h:29
 TClassMenuItem.h:30
 TClassMenuItem.h:31
 TClassMenuItem.h:32
 TClassMenuItem.h:33
 TClassMenuItem.h:34
 TClassMenuItem.h:35
 TClassMenuItem.h:36
 TClassMenuItem.h:37
 TClassMenuItem.h:38
 TClassMenuItem.h:39
 TClassMenuItem.h:40
 TClassMenuItem.h:41
 TClassMenuItem.h:42
 TClassMenuItem.h:43
 TClassMenuItem.h:44
 TClassMenuItem.h:45
 TClassMenuItem.h:46
 TClassMenuItem.h:47
 TClassMenuItem.h:48
 TClassMenuItem.h:49
 TClassMenuItem.h:50
 TClassMenuItem.h:51
 TClassMenuItem.h:52
 TClassMenuItem.h:53
 TClassMenuItem.h:54
 TClassMenuItem.h:55
 TClassMenuItem.h:56
 TClassMenuItem.h:57
 TClassMenuItem.h:58
 TClassMenuItem.h:59
 TClassMenuItem.h:60
 TClassMenuItem.h:61
 TClassMenuItem.h:62
 TClassMenuItem.h:63
 TClassMenuItem.h:64
 TClassMenuItem.h:65
 TClassMenuItem.h:66
 TClassMenuItem.h:67
 TClassMenuItem.h:68
 TClassMenuItem.h:69
 TClassMenuItem.h:70
 TClassMenuItem.h:71
 TClassMenuItem.h:72
 TClassMenuItem.h:73
 TClassMenuItem.h:74
 TClassMenuItem.h:75
 TClassMenuItem.h:76
 TClassMenuItem.h:77
 TClassMenuItem.h:78
 TClassMenuItem.h:79
 TClassMenuItem.h:80
 TClassMenuItem.h:81
 TClassMenuItem.h:82
 TClassMenuItem.h:83
 TClassMenuItem.h:84
 TClassMenuItem.h:85
 TClassMenuItem.h:86
 TClassMenuItem.h:87
 TClassMenuItem.h:88