TEveBrowser.h

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveBrowser.h 36955 2010-11-25 21:23:09Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, 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 #ifndef ROOT_TEveBrowser
00013 #define ROOT_TEveBrowser
00014 
00015 #include "TEveElement.h"
00016 
00017 #include "TRootBrowser.h"
00018 #include "TGListTree.h"
00019 
00020 #include "TContextMenu.h"
00021 
00022 class TGFileBrowser;
00023 class TGSplitter;
00024 
00025 class TEveGedEditor;
00026 
00027 
00028 class TEveListTreeItem : public TGListTreeItem
00029 {
00030 private:
00031    TEveListTreeItem(const TEveListTreeItem&);             // not implemented
00032    TEveListTreeItem& operator=(const TEveListTreeItem&);  // not implemented
00033 
00034 protected:
00035    TEveElement* fElement;
00036 
00037    void NotSupported(const char* func) const;
00038 
00039 public:
00040    TEveListTreeItem(TEveElement* el) : TGListTreeItem(), fElement(el) {}
00041    virtual ~TEveListTreeItem() {}
00042 
00043    virtual Bool_t          IsActive()       const { return fElement->GetSelectedLevel() != 0; }
00044    virtual Pixel_t         GetActiveColor() const;
00045    virtual void            SetActive(Bool_t)      { NotSupported("SetActive"); }
00046 
00047    virtual const char     *GetText()          const { return fElement->GetElementName(); }
00048    virtual Int_t           GetTextLength()    const { return strlen(fElement->GetElementName()); }
00049    virtual const char     *GetTipText()       const { return fElement->GetElementTitle(); }
00050    virtual Int_t           GetTipTextLength() const { return strlen(fElement->GetElementTitle()); }
00051    virtual void            SetText(const char *)    { NotSupported("SetText"); }
00052    virtual void            SetTipText(const char *) { NotSupported("SetTipText"); }
00053 
00054    virtual void            SetUserData(void *, Bool_t=kFALSE) { NotSupported("SetUserData"); }
00055    virtual void           *GetUserData() const { return fElement; }
00056 
00057    virtual const TGPicture*GetPicture()         const { return fElement->GetListTreeIcon(fOpen); }
00058    virtual const TGPicture*GetCheckBoxPicture() const { return fElement->GetListTreeCheckBoxIcon(); }
00059 
00060    virtual void            SetPictures(const TGPicture*, const TGPicture*) { NotSupported("SetUserData"); }
00061    virtual void            SetCheckBoxPictures(const TGPicture*, const TGPicture*) { NotSupported("SetUserData"); }
00062 
00063    virtual void            SetCheckBox(Bool_t=kTRUE) { NotSupported("SetCheckBox"); }
00064    virtual Bool_t          HasCheckBox()       const { return kTRUE; }
00065    virtual void            CheckItem(Bool_t=kTRUE)   { printf("TEveListTreeItem::CheckItem - to be ignored ... all done via signal Checked().\n"); }
00066    virtual void            Toggle();
00067    virtual Bool_t          IsChecked()         const { return fElement->GetRnrState(); }
00068 
00069    // Propagation of checked-state form children to parents. Not needed, ignore.
00070 
00071    // Item coloration (underline + minibox)
00072    virtual Bool_t          HasColor()  const { return fElement->HasMainColor(); }
00073    virtual Color_t         GetColor()  const { return fElement->GetMainColor(); }
00074    virtual void            SetColor(Color_t) { NotSupported("SetColor"); }
00075    virtual void            ClearColor()      { NotSupported("ClearColor"); }
00076 
00077    ClassDef(TEveListTreeItem,0); // Special llist-tree-item for Eve.
00078 };
00079 
00080 
00081 class TEveGListTreeEditorFrame : public TGMainFrame
00082 {
00083    TEveGListTreeEditorFrame(const TEveGListTreeEditorFrame&);            // Not implemented
00084    TEveGListTreeEditorFrame& operator=(const TEveGListTreeEditorFrame&); // Not implemented
00085 
00086    friend class TEveManager;
00087 
00088 protected:
00089    TGCompositeFrame *fFrame;
00090    TGCompositeFrame *fLTFrame;
00091 
00092    TGCanvas         *fLTCanvas;
00093    TGListTree       *fListTree;
00094    TGSplitter       *fSplitter;
00095    TEveGedEditor    *fEditor;
00096 
00097    TContextMenu     *fCtxMenu;
00098 
00099    Bool_t            fSignalsConnected;
00100 
00101    static TString    fgEditorClass;
00102 
00103 public:
00104    TEveGListTreeEditorFrame(const TGWindow* p=0, Int_t width=250, Int_t height=700);
00105    virtual ~TEveGListTreeEditorFrame();
00106 
00107    void ConnectSignals();
00108    void DisconnectSignals();
00109 
00110    void ReconfToHorizontal();
00111    void ReconfToVertical();
00112 
00113    TGListTree*    GetListTree() const { return fListTree; }
00114    TEveGedEditor* GetEditor()   const { return fEditor; }
00115 
00116    void ItemBelowMouse(TGListTreeItem *entry, UInt_t mask);
00117    void ItemClicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y);
00118    void ItemDblClicked(TGListTreeItem* item, Int_t btn);
00119    void ItemKeyPress(TGListTreeItem *entry, UInt_t keysym, UInt_t mask);
00120 
00121    static void SetEditorClass(const char* edclass);
00122 
00123    ClassDef(TEveGListTreeEditorFrame, 0); // Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
00124 };
00125 
00126 // ----------------------------------------------------------------
00127 
00128 class TEveBrowser : public TRootBrowser
00129 {
00130    TEveBrowser(const TEveBrowser&);            // Not implemented
00131    TEveBrowser& operator=(const TEveBrowser&); // Not implemented
00132 
00133 protected:
00134    void SetupCintExport(TClass* cl);
00135    void CalculateReparentXY(TGObject* parent, Int_t& x, Int_t& y);
00136 
00137    TGFileBrowser    *fFileBrowser;
00138    TGPopupMenu      *fEvePopup;
00139    TGPopupMenu      *fSelPopup;
00140    TGPopupMenu      *fHilPopup;
00141 
00142 public:
00143    TEveBrowser(UInt_t w, UInt_t h);
00144    virtual ~TEveBrowser() {}
00145 
00146    void ReallyDelete();
00147 
00148    void InitPlugins(Option_t *opt="FI");
00149 
00150    TGFileBrowser* MakeFileBrowser();
00151    TGFileBrowser* GetFileBrowser() const { return fFileBrowser; }
00152 
00153    void EveMenu(Int_t id);
00154 
00155    // Some getters missing in TRootBrowser
00156    TGMenuBar*         GetMenuBar()      const { return fMenuBar; }
00157    TGHorizontalFrame* GetTopMenuFrame() const { return fTopMenuFrame; }
00158 
00159    void HideBottomTab();
00160 
00161    ClassDef(TEveBrowser, 0); // Specialization of TRootBrowser for Eve.
00162 };
00163 
00164 #endif

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