ROOT logo
// @(#)root/base:$Id: TBrowser.h 26615 2008-12-03 00:57:41Z pcanal $
// Author: Fons Rademakers   25/10/95

/*************************************************************************
 * 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_TBrowser
#define ROOT_TBrowser

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TBrowser                                                             //
//                                                                      //
// Using a TBrowser on can browse all ROOT objects. It shows in a list  //
// on the left side of the window all browsable ROOT classes. Selecting //
// one of the classes displays, in the iconbox on the right side, all   //
// objects in the class. Selecting one of the objects in the iconbox,   //
// will place all browsable objects in a new list and draws the         //
// contents of the selected class in the iconbox. And so on....         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TBrowserImp
#include "TBrowserImp.h"
#endif


class TContextMenu;
class TBrowserTimer;


class TBrowser : public TNamed {

private:
   TObject       *fLastSelectedObject; //!The last TObject selected by user
   
   TBrowser(const TBrowser&);             // TBrowser can not be copied since we do not know the type of the TBrowserImp (and it can not be 'Cloned')
   TBrowser& operator=(const TBrowser&);  // TBrowser can not be copied since we do not know the type of the TBrowserImp (and it can not be 'Cloned')
   
protected:
   TBrowserImp   *fImp;                //!Window system specific browser implementation
   TBrowserTimer *fTimer;              //!Browser's timer
   TContextMenu  *fContextMenu;        //!Context menu pointer
   Bool_t         fNeedRefresh;        //True if the browser needs refresh

public:
   enum {
      kNoHidden     = BIT(9)   // don't show '.' files and directories
   };

   TBrowser(const char *name="Browser", const char *title="ROOT Object Browser", TBrowserImp *extimp=0, Option_t *opt="");
   TBrowser(const char *name, const char *title, UInt_t width, UInt_t height, TBrowserImp *extimp=0, Option_t *opt="");
   TBrowser(const char *name, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, TBrowserImp *extimp=0, Option_t *opt="");

   TBrowser(const char *name, TObject *obj, const char *title="ROOT Object Browser", Option_t *opt="");
   TBrowser(const char *name, TObject *obj, const char *title, UInt_t width, UInt_t height, Option_t *opt="");
   TBrowser(const char *name, TObject *obj, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");

   TBrowser(const char *name, void *obj, TClass *cl, const char *objname="", const char *title="ROOT Foreign Browser", Option_t *opt="");
   TBrowser(const char *name, void *obj, TClass *cl, const char *objname, const char *title, UInt_t width, UInt_t height, Option_t *opt="");
   TBrowser(const char *name, void *obj, TClass *cl, const char *objname, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");

   // In a world with only standard C++ compliant compilers, we could also add:
   // template <class T>  TBrowser(const char *name, T *obj, const char *objname="", const char *title="ROOT Foreign Browser") :
   //       : TNamed(name, title), fLastSelectedObject(0), fTimer(0), fContextMenu(0),
   //            fNeedRefresh(kFALSE)
   // {
   //    Create a new browser with a name, title, width and height for TObject *obj.
   //
   //    fImp = gGuiFactory->CreateBrowserImp(this, title, width, height);
   //    Create(new TBrowserObject(obj,gROOT->GetClass(typeid(T)),objname));
   // }

   virtual ~TBrowser();

   void          Add(TObject *obj,             const char *name = 0, Int_t check = -1);
   void          Add(void    *obj, TClass *cl, const char *name = 0, Int_t check = -1);

   void          AddCheckBox(TObject *obj, Bool_t check = kFALSE);
   void          CheckObjectItem(TObject *obj, Bool_t check = kFALSE);
   void          RemoveCheckBox(TObject *obj);

   virtual void  Create(TObject *obj = 0);      // Create this Browser
   void          ExecuteDefaultAction(TObject *obj);
   TBrowserImp  *GetBrowserImp() const         { return fImp; }
   void          SetBrowserImp(TBrowserImp *i) { fImp = i; }
   TContextMenu *GetContextMenu() const        { return fContextMenu; }
   Bool_t        GetRefreshFlag() const        { return fNeedRefresh; }
   TObject      *GetSelected() const           { return fLastSelectedObject; }
   void          SetRefreshFlag(Bool_t flag)   { fNeedRefresh = flag; }
   void          Iconify()                     { fImp->Iconify(); }
   virtual void  RecursiveRemove(TObject *obj);
   void          Refresh();
   void          SetSelected(TObject *clickedObject);
   void          Show()                        { fImp->Show(); }
   void          SetDrawOption(Option_t *option="") { fImp->SetDrawOption(option); }
   Option_t     *GetDrawOption() const { return  fImp->GetDrawOption(); }

   Long_t        ExecPlugin(const char *name = 0, const char *fname = 0, 
                            const char *cmd = 0, Int_t pos = 1, Int_t subpos = -1) {
                    return fImp->ExecPlugin(name, fname, cmd, pos, subpos); 
                 }
   void          SetStatusText(const char *txt, Int_t col) {
                    fImp->SetStatusText(txt, col); 
                 }
   void          StartEmbedding(Int_t pos, Int_t subpos) {
                    fImp->StartEmbedding(pos, subpos); 
                 }
   void          StopEmbedding(const char *name = "") { fImp->StopEmbedding(name); }

   ClassDef(TBrowser,0)  //ROOT Object Browser
};

#endif
 TBrowser.h:1
 TBrowser.h:2
 TBrowser.h:3
 TBrowser.h:4
 TBrowser.h:5
 TBrowser.h:6
 TBrowser.h:7
 TBrowser.h:8
 TBrowser.h:9
 TBrowser.h:10
 TBrowser.h:11
 TBrowser.h:12
 TBrowser.h:13
 TBrowser.h:14
 TBrowser.h:15
 TBrowser.h:16
 TBrowser.h:17
 TBrowser.h:18
 TBrowser.h:19
 TBrowser.h:20
 TBrowser.h:21
 TBrowser.h:22
 TBrowser.h:23
 TBrowser.h:24
 TBrowser.h:25
 TBrowser.h:26
 TBrowser.h:27
 TBrowser.h:28
 TBrowser.h:29
 TBrowser.h:30
 TBrowser.h:31
 TBrowser.h:32
 TBrowser.h:33
 TBrowser.h:34
 TBrowser.h:35
 TBrowser.h:36
 TBrowser.h:37
 TBrowser.h:38
 TBrowser.h:39
 TBrowser.h:40
 TBrowser.h:41
 TBrowser.h:42
 TBrowser.h:43
 TBrowser.h:44
 TBrowser.h:45
 TBrowser.h:46
 TBrowser.h:47
 TBrowser.h:48
 TBrowser.h:49
 TBrowser.h:50
 TBrowser.h:51
 TBrowser.h:52
 TBrowser.h:53
 TBrowser.h:54
 TBrowser.h:55
 TBrowser.h:56
 TBrowser.h:57
 TBrowser.h:58
 TBrowser.h:59
 TBrowser.h:60
 TBrowser.h:61
 TBrowser.h:62
 TBrowser.h:63
 TBrowser.h:64
 TBrowser.h:65
 TBrowser.h:66
 TBrowser.h:67
 TBrowser.h:68
 TBrowser.h:69
 TBrowser.h:70
 TBrowser.h:71
 TBrowser.h:72
 TBrowser.h:73
 TBrowser.h:74
 TBrowser.h:75
 TBrowser.h:76
 TBrowser.h:77
 TBrowser.h:78
 TBrowser.h:79
 TBrowser.h:80
 TBrowser.h:81
 TBrowser.h:82
 TBrowser.h:83
 TBrowser.h:84
 TBrowser.h:85
 TBrowser.h:86
 TBrowser.h:87
 TBrowser.h:88
 TBrowser.h:89
 TBrowser.h:90
 TBrowser.h:91
 TBrowser.h:92
 TBrowser.h:93
 TBrowser.h:94
 TBrowser.h:95
 TBrowser.h:96
 TBrowser.h:97
 TBrowser.h:98
 TBrowser.h:99
 TBrowser.h:100
 TBrowser.h:101
 TBrowser.h:102
 TBrowser.h:103
 TBrowser.h:104
 TBrowser.h:105
 TBrowser.h:106
 TBrowser.h:107
 TBrowser.h:108
 TBrowser.h:109
 TBrowser.h:110
 TBrowser.h:111
 TBrowser.h:112
 TBrowser.h:113
 TBrowser.h:114
 TBrowser.h:115
 TBrowser.h:116
 TBrowser.h:117
 TBrowser.h:118
 TBrowser.h:119
 TBrowser.h:120
 TBrowser.h:121
 TBrowser.h:122
 TBrowser.h:123