// @(#)root/gui:$Id$
// Author: Fons Rademakers   12/02/98

/*************************************************************************
 * 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_TRootContextMenu
#define ROOT_TRootContextMenu


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRootContextMenu                                                     //
//                                                                      //
// 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.                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TContextMenuImp
#include "TContextMenuImp.h"
#endif
#ifndef ROOT_TGMenu
#include "TGMenu.h"
#endif

class TRootDialog;


class TRootContextMenu : public TGPopupMenu, public TContextMenuImp {

private:
   TRootDialog *fDialog;    // dialog prompting for command line arguments
   TList       *fTrash;     // list of objects to be deleted before refilling menu

   TRootContextMenu(const TRootContextMenu&);
   TRootContextMenu& operator=(const TRootContextMenu&);
   void CreateMenu(TObject *object);

public:
   TRootContextMenu(TContextMenu *c = 0, const char *name = "ROOT Context Menu");
   virtual ~TRootContextMenu();

   virtual void   DisplayPopup(Int_t x, Int_t y);
   virtual void   Dialog(TObject *object, TMethod *method);
   virtual void   Dialog(TObject *object, TFunction *function);
   virtual void   DrawEntry(TGMenuEntry *entry);
   TRootDialog   *GetDialog() const { return fDialog; };
   virtual Bool_t HandleButton(Event_t *event);
   virtual Bool_t HandleCrossing(Event_t *event);
   virtual Bool_t HandleMotion(Event_t *event);
   virtual void   OnlineHelp();
   virtual void   RecursiveRemove(TObject *obj);

   Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);

protected:
   TGPopupMenu * FindHierarchy(const char *commentstring, TString &last_component);
   void AddEntrySorted(TGPopupMenu *current, const char *s, Int_t id, void *ud = 0,
                       const TGPicture *p = 0, Bool_t sorted = kTRUE);

   ClassDef(TRootContextMenu,0)  //ROOT native GUI context sensitive popup menu
};

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