Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TEveBrowser.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveBrowser
0013 #define ROOT_TEveBrowser
0014 
0015 #include "TEveElement.h"
0016 
0017 #include "TContextMenu.h"
0018 #include "TGListTree.h"
0019 #include "TRootBrowser.h"
0020 #include "TString.h"
0021 
0022 
0023 class TGFileBrowser;
0024 class TGSplitter;
0025 
0026 class TEveGedEditor;
0027 
0028 
0029 class TEveListTreeItem : public TGListTreeItem
0030 {
0031 private:
0032    TEveListTreeItem(const TEveListTreeItem&);             // not implemented
0033    TEveListTreeItem& operator=(const TEveListTreeItem&);  // not implemented
0034 
0035 protected:
0036    TEveElement* fElement;
0037 
0038    void NotSupported(const char* func) const;
0039 
0040 public:
0041    TEveListTreeItem(TEveElement* el) : TGListTreeItem(), fElement(el) {}
0042    ~TEveListTreeItem() override {}
0043 
0044    Bool_t          IsActive()       const override { return fElement->GetSelectedLevel() != 0; }
0045    Pixel_t         GetActiveColor() const override;
0046    void            SetActive(Bool_t) override      { NotSupported("SetActive"); }
0047 
0048    const char     *GetText()          const override { return fElement->GetElementName(); }
0049    Int_t           GetTextLength()    const override { return strlen(fElement->GetElementName()); }
0050    const char     *GetTipText()       const override { return fElement->GetElementTitle(); }
0051    Int_t           GetTipTextLength() const override { return strlen(fElement->GetElementTitle()); }
0052    void            SetText(const char *) override    { NotSupported("SetText"); }
0053    void            SetTipText(const char *) override { NotSupported("SetTipText"); }
0054 
0055    void            SetUserData(void *, Bool_t=kFALSE) override { NotSupported("SetUserData"); }
0056    void           *GetUserData() const override { return fElement; }
0057 
0058    const TGPicture*GetPicture()         const override { return fElement->GetListTreeIcon(fOpen); }
0059    const TGPicture*GetCheckBoxPicture() const override { return fElement->GetListTreeCheckBoxIcon(); }
0060 
0061    void            SetPictures(const TGPicture*, const TGPicture*) override { NotSupported("SetUserData"); }
0062    void            SetCheckBoxPictures(const TGPicture*, const TGPicture*) override { NotSupported("SetUserData"); }
0063 
0064    void            SetCheckBox(Bool_t=kTRUE) override { NotSupported("SetCheckBox"); }
0065    Bool_t          HasCheckBox()       const override { return kTRUE; }
0066    void            CheckItem(Bool_t=kTRUE) override   { printf("TEveListTreeItem::CheckItem - to be ignored ... all done via signal Checked().\n"); }
0067    void            Toggle() override;
0068    Bool_t          IsChecked()         const override { return fElement->GetRnrState(); }
0069 
0070    // Propagation of checked-state form children to parents. Not needed, ignore.
0071 
0072    // Item coloration (underline + minibox)
0073    Bool_t          HasColor()  const override { return fElement->HasMainColor(); }
0074    Color_t         GetColor()  const override { return fElement->GetMainColor(); }
0075    void            SetColor(Color_t) override { NotSupported("SetColor"); }
0076    void            ClearColor() override      { NotSupported("ClearColor"); }
0077 
0078    ClassDefOverride(TEveListTreeItem,0); // Special llist-tree-item for Eve.
0079 };
0080 
0081 
0082 class TEveGListTreeEditorFrame : public TGMainFrame
0083 {
0084    TEveGListTreeEditorFrame(const TEveGListTreeEditorFrame&);            // Not implemented
0085    TEveGListTreeEditorFrame& operator=(const TEveGListTreeEditorFrame&); // Not implemented
0086 
0087    friend class TEveManager;
0088 
0089 protected:
0090    TGCompositeFrame *fFrame;
0091    TGCompositeFrame *fLTFrame;
0092 
0093    TGCanvas         *fLTCanvas;
0094    TGListTree       *fListTree;
0095    TGSplitter       *fSplitter;
0096    TEveGedEditor    *fEditor;
0097 
0098    TContextMenu     *fCtxMenu;
0099 
0100    Bool_t            fSignalsConnected;
0101 
0102    static TString    fgEditorClass;
0103 
0104 public:
0105    TEveGListTreeEditorFrame(const TGWindow *p = nullptr, Int_t width=250, Int_t height=700);
0106    ~TEveGListTreeEditorFrame() override;
0107 
0108    void ConnectSignals();
0109    void DisconnectSignals();
0110 
0111    void ReconfToHorizontal();
0112    void ReconfToVertical();
0113 
0114    TGListTree*    GetListTree() const { return fListTree; }
0115    TEveGedEditor* GetEditor()   const { return fEditor; }
0116 
0117    void ItemBelowMouse(TGListTreeItem *entry, UInt_t mask);
0118    void ItemClicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y);
0119    void ItemDblClicked(TGListTreeItem* item, Int_t btn);
0120    void ItemKeyPress(TGListTreeItem *entry, UInt_t keysym, UInt_t mask);
0121 
0122    static void SetEditorClass(const char* edclass);
0123 
0124    ClassDefOverride(TEveGListTreeEditorFrame, 0); // Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
0125 };
0126 
0127 // ----------------------------------------------------------------
0128 
0129 class TEveBrowser : public TRootBrowser
0130 {
0131    TEveBrowser(const TEveBrowser&);            // Not implemented
0132    TEveBrowser& operator=(const TEveBrowser&); // Not implemented
0133 
0134 protected:
0135    void SetupCintExport(TClass* cl);
0136    void CalculateReparentXY(TGObject* parent, Int_t& x, Int_t& y);
0137 
0138    TGFileBrowser    *fFileBrowser;
0139    TGPopupMenu      *fEvePopup;
0140    TGPopupMenu      *fSelPopup;
0141    TGPopupMenu      *fHilPopup;
0142 
0143 public:
0144    TEveBrowser(UInt_t w, UInt_t h);
0145    ~TEveBrowser() override { CloseTabs(); }
0146 
0147    void ReallyDelete() override;
0148    void CloseTab(Int_t id) override;
0149    void CloseWindow() override;
0150 
0151    void InitPlugins(Option_t *opt="FI");
0152 
0153    TGFileBrowser* MakeFileBrowser(Bool_t make_default=kFALSE);
0154    TGFileBrowser* GetFileBrowser() const;
0155    void           SetFileBrowser(TGFileBrowser* b);
0156 
0157    void EveMenu(Int_t id);
0158 
0159    // Some getters missing in TRootBrowser
0160    TGMenuBar*         GetMenuBar()      const { return fMenuBar; }
0161    TGHorizontalFrame* GetTopMenuFrame() const { return fTopMenuFrame; }
0162 
0163    void HideBottomTab();
0164 
0165    void SanitizeTabCounts();
0166 
0167    ClassDefOverride(TEveBrowser, 0); // Specialization of TRootBrowser for Eve.
0168 };
0169 
0170 #endif