library: libCore #include "TContextMenu.h"

# TContextMenu

class description - source file - inheritance tree (.pdf)

## class TContextMenu : public TNamed

| Inheritance Chart:

`TObject`

<-

`TNamed`

<-

`TContextMenu`

        private:

                       TContextMenu()

        protected:

          virtual void DisplayPopUp(Int_t x, Int_t y)

        public:

                                   TContextMenu(const char* name, const char* title = "Context sensitive popup menu")
                                   TContextMenu(const TContextMenu&)
                           virtual ~TContextMenu()
                      virtual void Action(TObject* object, TMethod* method)
                      virtual void Action(TObject* object, TToggle* toggle)
                      virtual void Action(TClassMenuItem* classmenuitem)
                              void Action(TMethod* method)
                              void Action(TToggle* toggle)
                    static TClass* Class()
                     virtual char* CreateArgumentTitle(TMethodArg* argument)
                     virtual char* CreateDialogTitle(TObject* object, TFunction* method)
                     virtual char* CreatePopupTitle(TObject* object)
                      virtual void Execute(const char* method, const char* params, Int_t* error = 0)
                      virtual void Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
                      virtual void Execute(TObject* object, TFunction* method, const char* params)
                      virtual void Execute(TObject* object, TFunction* method, TObjArray* params)
                              void Execute(const char* params)
                              void Execute(TObjArray* params)
                 virtual TBrowser* GetBrowser()
                  virtual TObject* GetCalledObject()
          virtual TContextMenuImp* GetContextMenuImp()
              virtual TVirtualPad* GetSelectedCanvas()
           virtual TClassMenuItem* GetSelectedMenuItem()
                virtual TFunction* GetSelectedMethod()
                  virtual TObject* GetSelectedObject()
              virtual TVirtualPad* GetSelectedPad()
                   virtual TClass* IsA() const
                     TContextMenu& operator=(const TContextMenu&)
                      virtual void Popup(Int_t x, Int_t y, TObject* obj, TVirtualPad* c = 0, TVirtualPad* p = 0)
                      virtual void Popup(Int_t x, Int_t y, TObject* obj, TBrowser* b)
                      virtual void SetBrowser(TBrowser* b)
                      virtual void SetCalledObject(TObject* o)
                      virtual void SetCanvas(TVirtualPad* c)
                      virtual void SetMethod(TFunction* m)
                      virtual void SetNameTitle(const char* name, const char* title)
                      virtual void SetObject(TObject* o)
                      virtual void SetPad(TVirtualPad* p)
                      virtual void SetSelectedMenuItem(TClassMenuItem* mi)
                      virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      virtual void Streamer(TBuffer& b)
                              void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          TContextMenuImp* fContextMenuImp    !Context menu system specific implementation
                TFunction* fSelectedMethod    selected method
                  TObject* fSelectedObject    selected object
                  TObject* fCalledObject      object to call
           TClassMenuItem* fSelectedMenuItem  selected class menu item
              TVirtualPad* fSelectedCanvas    selected canvas (if exist)
              TVirtualPad* fSelectedPad       selected pad (if exist)
                 TBrowser* fBrowser           selected browser (if exist)

## Class Description

     TContextMenu

     This class provides an interface to  context sensitive popup menus.
     These menus pop up when the user hits the right mouse button, and
     are destroyed when the menu pops downs.

     Context Menus are automatically generated by ROOT using the
     following convention: if the string // *MENU* is found in the
     comment field of a member function. This function will be added to
     the list of items in the menu.

     The picture below shows a canvas with a pop-up menu.

     The picture below shows a canvas with a pop-up menu and a dialog box.

TContextMenu(const char *name, const char *title) : TNamed(name, title)

     Create a context menu.

~TContextMenu()

     Destroy a context menu.

void Action(TObject *object, TMethod *method)

     Action to be performed when this menu item is selected.
     If the selected method requires arguments we popup an
     automatically generated dialog, otherwise the method is
     directly executed.

void Action(TClassMenuItem *menuitem)

     Action to be performed when this menu item is selected.
     If the selected method requires arguments we popup an
     automatically generated dialog, otherwise the method is
     directly executed.

void Action(TObject *object, TToggle *toggle)

     Action to be performed when this toggle menu item is selected.

char* CreateArgumentTitle(TMethodArg *argument)

     Create string describing argument (for use in dialog box).

char* CreateDialogTitle(TObject *object, TFunction *method)

     Create title for dialog box retrieving argument values.

char* CreatePopupTitle(TObject *object)

     Create title for popup menu.

void Execute(TObject *object, TFunction *method, const char *params)

     Execute method with specified arguments for specified object.

void Execute(TObject *object, TFunction *method, TObjArray *params)

     Execute method with specified arguments for specified object.

void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c, TVirtualPad *p)

     Popup context menu at given location in canvas c and pad p for selected
     object.

void Popup(Int_t x, Int_t y, TObject *obj, TBrowser *b)

     Popup context menu at given location in browser b for selected object.

### Inline Functions

                        void DisplayPopUp(Int_t x, Int_t y)
                TContextMenu TContextMenu(const char* name, const char* title = "Context sensitive popup menu")
                        void Action(TMethod* method)
                        void Action(TToggle* toggle)
                        void Execute(TObject* object, TFunction* method, const char* params)
                        void Execute(TObject* object, TFunction* method, TObjArray* params)
                        void Execute(const char* params)
                        void Execute(TObjArray* params)
                   TBrowser* GetBrowser()
            TContextMenuImp* GetContextMenuImp()
                TVirtualPad* GetSelectedCanvas()
                  TFunction* GetSelectedMethod()
                    TObject* GetSelectedObject()
                    TObject* GetCalledObject()
             TClassMenuItem* GetSelectedMenuItem()
                TVirtualPad* GetSelectedPad()
                        void SetCanvas(TVirtualPad* c)
                        void SetBrowser(TBrowser* b)
                        void SetMethod(TFunction* m)
                        void SetCalledObject(TObject* o)
                        void SetSelectedMenuItem(TClassMenuItem* mi)
                        void SetNameTitle(const char* name, const char* title)
                        void SetObject(TObject* o)
                        void SetPad(TVirtualPad* p)
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
                TContextMenu TContextMenu(const TContextMenu&)
               TContextMenu& operator=(const TContextMenu&)

Author: Nenad Buncic 08/02/96
Last update: root/base:$Name: $:$Id: TContextMenu.cxx,v 1.8 2005/05/30 10:21:14 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *