TBrowser.h

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TBrowser.h 29411 2009-07-09 12:11:09Z brun $
00002 // Author: Fons Rademakers   25/10/95
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 
00013 #ifndef ROOT_TBrowser
00014 #define ROOT_TBrowser
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TBrowser                                                             //
00019 //                                                                      //
00020 // Using a TBrowser on can browse all ROOT objects. It shows in a list  //
00021 // on the left side of the window all browsable ROOT classes. Selecting //
00022 // one of the classes displays, in the iconbox on the right side, all   //
00023 // objects in the class. Selecting one of the objects in the iconbox,   //
00024 // will place all browsable objects in a new list and draws the         //
00025 // contents of the selected class in the iconbox. And so on....         //
00026 //                                                                      //
00027 //////////////////////////////////////////////////////////////////////////
00028 
00029 #ifndef ROOT_TNamed
00030 #include "TNamed.h"
00031 #endif
00032 #ifndef ROOT_TBrowserImp
00033 #include "TBrowserImp.h"
00034 #endif
00035 
00036 
00037 class TContextMenu;
00038 class TBrowserTimer;
00039 
00040 
00041 class TBrowser : public TNamed {
00042 
00043 private:
00044    TObject       *fLastSelectedObject; //!The last TObject selected by user
00045    
00046    TBrowser(const TBrowser&);             // TBrowser can not be copied since we do not know the type of the TBrowserImp (and it can not be 'Cloned')
00047    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')
00048    
00049 protected:
00050    TBrowserImp   *fImp;                //!Window system specific browser implementation
00051    TBrowserTimer *fTimer;              //!Browser's timer
00052    TContextMenu  *fContextMenu;        //!Context menu pointer
00053    Bool_t         fNeedRefresh;        //True if the browser needs refresh
00054 
00055 public:
00056    enum {
00057       kNoHidden     = BIT(9)   // don't show '.' files and directories
00058    };
00059 
00060    TBrowser(const char *name="Browser", const char *title="ROOT Object Browser", TBrowserImp *extimp=0, Option_t *opt="");
00061    TBrowser(const char *name, const char *title, UInt_t width, UInt_t height, TBrowserImp *extimp=0, Option_t *opt="");
00062    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="");
00063 
00064    TBrowser(const char *name, TObject *obj, const char *title="ROOT Object Browser", Option_t *opt="");
00065    TBrowser(const char *name, TObject *obj, const char *title, UInt_t width, UInt_t height, Option_t *opt="");
00066    TBrowser(const char *name, TObject *obj, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
00067 
00068    TBrowser(const char *name, void *obj, TClass *cl, const char *objname="", const char *title="ROOT Foreign Browser", Option_t *opt="");
00069    TBrowser(const char *name, void *obj, TClass *cl, const char *objname, const char *title, UInt_t width, UInt_t height, Option_t *opt="");
00070    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="");
00071 
00072    // In a world with only standard C++ compliant compilers, we could also add:
00073    // template <class T>  TBrowser(const char *name, T *obj, const char *objname="", const char *title="ROOT Foreign Browser") :
00074    //       : TNamed(name, title), fLastSelectedObject(0), fTimer(0), fContextMenu(0),
00075    //            fNeedRefresh(kFALSE)
00076    // {
00077    //    Create a new browser with a name, title, width and height for TObject *obj.
00078    //
00079    //    fImp = gGuiFactory->CreateBrowserImp(this, title, width, height);
00080    //    Create(new TBrowserObject(obj,gROOT->GetClass(typeid(T)),objname));
00081    // }
00082 
00083    virtual ~TBrowser();
00084 
00085    void          Add(TObject *obj,             const char *name = 0, Int_t check = -1);
00086    void          Add(void    *obj, TClass *cl, const char *name = 0, Int_t check = -1);
00087 
00088    void          AddCheckBox(TObject *obj, Bool_t check = kFALSE);
00089    void          CheckObjectItem(TObject *obj, Bool_t check = kFALSE);
00090    void          RemoveCheckBox(TObject *obj);
00091 
00092    virtual void  Create(TObject *obj = 0);      // Create this Browser
00093    void          BrowseObject(TObject *obj)    { fImp->BrowseObj(obj); }
00094    void          ExecuteDefaultAction(TObject *obj);
00095    TBrowserImp  *GetBrowserImp() const         { return fImp; }
00096    void          SetBrowserImp(TBrowserImp *i) { fImp = i; }
00097    TContextMenu *GetContextMenu() const        { return fContextMenu; }
00098    Bool_t        GetRefreshFlag() const        { return fNeedRefresh; }
00099    TObject      *GetSelected() const           { return fLastSelectedObject; }
00100    void          SetRefreshFlag(Bool_t flag)   { fNeedRefresh = flag; }
00101    void          Iconify()                     { fImp->Iconify(); }
00102    virtual void  RecursiveRemove(TObject *obj);
00103    void          Refresh();
00104    void          SetSelected(TObject *clickedObject);
00105    void          Show()                        { fImp->Show(); }
00106    void          SetDrawOption(Option_t *option="") { fImp->SetDrawOption(option); }
00107    Option_t     *GetDrawOption() const { return  fImp->GetDrawOption(); }
00108 
00109    Long_t        ExecPlugin(const char *name = 0, const char *fname = 0, 
00110                             const char *cmd = 0, Int_t pos = 1, Int_t subpos = -1) {
00111                     return fImp->ExecPlugin(name, fname, cmd, pos, subpos); 
00112                  }
00113    void          SetStatusText(const char *txt, Int_t col) {
00114                     fImp->SetStatusText(txt, col); 
00115                  }
00116    void          StartEmbedding(Int_t pos, Int_t subpos) {
00117                     fImp->StartEmbedding(pos, subpos); 
00118                  }
00119    void          StopEmbedding(const char *name = "") { fImp->StopEmbedding(name); }
00120 
00121    ClassDef(TBrowser,0)  //ROOT Object Browser
00122 };
00123 
00124 #endif

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