TTVLVContainer.h

Go to the documentation of this file.
00001 // @(#)root/treeviewer:$Id: TTVLVContainer.h 20882 2007-11-19 11:31:26Z rdm $
00002 //Author : Andrei Gheata   16/08/00
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 #ifndef ROOT_TTVLVContainer
00013 #define ROOT_TTVLVContainer
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TTVLVEntry                                                           //
00019 //                                                                      //
00020 // This class represent entries that goes into the TreeViewer           //
00021 // listview container. It subclasses TGLVEntry and adds 2               //
00022 // data members: the item true name and the alias                       //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TGListView
00027 #include "TGListView.h"
00028 #endif
00029 
00030 
00031 class TGLabel;
00032 class TGTextEntry;
00033 class TTreeViewer;
00034 class TGToolTip;
00035 class TTVLVEntry;
00036 class TTVLVContainer;
00037 
00038 class TGItemContext : public TObject {
00039 
00040 protected:
00041    TTVLVEntry *fItem;       // pointer to associated item
00042 public:
00043    TGItemContext();
00044    virtual     ~TGItemContext() { }
00045    void         Associate(TTVLVEntry *item) { fItem = item; }
00046    virtual void Delete(Option_t *) { }           // *MENU*
00047    void         Draw(Option_t *option="");       // *MENU*
00048    void         EditExpression();                // *MENU*
00049    void         Empty();                         // *MENU*
00050    void         RemoveItem();                    // *MENU*
00051    void         Scan();                          // *MENU*
00052    void         SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE); // *MENU*
00053 
00054    ClassDef(TGItemContext, 0)  // Context menu for TTVLVEntry
00055 };
00056 
00057 
00058 class TTVLVEntry : public TGLVEntry {
00059 
00060 protected:
00061    TTVLVContainer *fContainer;  // container to whom this item belongs
00062    TString         fTrueName;   // name for this entry
00063    TString         fAlias;      // alias for this entry
00064    TString         fConvName;   // name converted into true expressions
00065    TGToolTip      *fTip;        // tool tip associated with item
00066    Bool_t          fIsCut;      // flag for cut type items
00067    TGItemContext  *fContext;    // associated context menu
00068 
00069 protected:
00070    Bool_t         FullConverted();
00071 
00072 public:
00073    TTVLVEntry(const TGWindow *p,
00074               const TGPicture *bigpic, const TGPicture *smallpic,
00075               TGString *name, TGString **subnames, EListViewMode ViewMode);
00076    virtual ~TTVLVEntry();
00077    const char     *ConvertAliases();
00078    void            CopyItem(TTVLVEntry *dest);
00079    const char     *GetAlias() {return fAlias.Data();}
00080    TTVLVContainer *GetContainer() {return fContainer;}
00081    TGItemContext  *GetContext() {return fContext;}
00082    const char     *GetConvName() {return fConvName;}
00083    const char     *GetTrueName() {return fTrueName.Data();}
00084    TGToolTip      *GetTip() {return fTip;}
00085    virtual Bool_t  HandleCrossing(Event_t *event);
00086    Bool_t          HasAlias();
00087    Bool_t          IsCut() {return fIsCut;}
00088    void            PrependTilde();
00089    void            SetCutType(Bool_t type=kFALSE);
00090    void            SetItemName(const char* name);
00091    void            SetAlias(const char* alias) {fAlias = alias;}
00092    void            SetExpression(const char* name, const char* alias, Bool_t cutType=kFALSE);
00093    void            SetTrueName(const char* name) {fTrueName = name;}
00094    void            SetToolTipText(const char *text, Long_t delayms = 1000);
00095    void            SetSmallPic(const TGPicture *spic);
00096    void            Empty();
00097 
00098    ClassDef(TTVLVEntry,0)  // Item that goes into the tree list view widget
00099 };
00100 
00101 
00102 //////////////////////////////////////////////////////////////////////////
00103 //                                                                      //
00104 //   TTVLVContainer                                                     //
00105 //                                                                      //
00106 // This class represent the list view container for the                 //
00107 // TreeView class. It is a TGLVContainer with item dragging             //
00108 // capabilities for the TTVLVEntry objects inside                       //
00109 //                                                                      //
00110 //////////////////////////////////////////////////////////////////////////
00111 
00112 class TTVLVContainer : public TGLVContainer {
00113 
00114 friend class TGClient;
00115 
00116 private:
00117    Cursor_t     fCursor;             // current cursor
00118    Cursor_t     fDefaultCursor;      // default cursor
00119    TGListView  *fListView;           // associated list view
00120    TTreeViewer *fViewer;             // pointer to tree viewer
00121    TList       *fExpressionList;     // list of user defined expression widgets
00122 public:
00123    TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame);
00124    virtual ~TTVLVContainer();
00125    virtual void AddThisItem(TTVLVEntry *item)
00126                   { AddFrame(item, fItemLayout); item->SetColumns(fCpos, fJmode); }
00127    const char    *Cut();
00128    void           EmptyAll();     // empty all items of expression type
00129    TTVLVEntry    *ExpressionItem(Int_t index);
00130    TList         *ExpressionList();
00131    const char    *Ex();
00132    const char    *Ey();
00133    const char    *Ez();
00134    TTreeViewer   *GetViewer() {return fViewer;}
00135    void           SetListView(TGListView *lv) {fListView = lv;}
00136    void           SetViewer(TTreeViewer *viewer) {fViewer = viewer;}
00137    void           RemoveNonStatic();
00138    const char    *ScanList();
00139    void           SelectItem(const char* name);
00140    virtual Bool_t HandleButton(Event_t *event);
00141    virtual Bool_t HandleMotion(Event_t *event);
00142 
00143    ClassDef(TTVLVContainer,0)  // A dragging-capable LVContainer
00144 };
00145 
00146 
00147 //////////////////////////////////////////////////////////////////////////
00148 //                                                                      //
00149 // TGSelectBox                                                          //
00150 //                                                                      //
00151 // This class represent a specialized expression editor for             //
00152 // TTVLVEntry 'true name' and 'alias' data members.                     //
00153 // It is a singleton in order to be able to use it for several          //
00154 // expressions.                                                         //
00155 //                                                                      //
00156 //////////////////////////////////////////////////////////////////////////
00157 
00158 class TGSelectBox : public TGTransientFrame {
00159 
00160 private:
00161    TTreeViewer       *fViewer;        // pointer to tree viewer
00162    TGLabel           *fLabel;         // label
00163    TTVLVEntry        *fEntry;         // edited expression entry
00164    TGTextEntry       *fTe;            // text entry box
00165    TGLabel           *fLabelAlias;    // alias label
00166    TGTextEntry       *fTeAlias;       // alias text entry
00167    TString            fOldAlias;      // old alias for edited entry
00168    TGLayoutHints     *fLayout;        // layout hints for widgets inside
00169    TGLayoutHints     *fBLayout;       // layout for cancel button
00170    TGLayoutHints     *fBLayout1;      // layout for close button
00171    TGHorizontalFrame *fBf;            // buttons frame
00172    TGTextButton      *fDONE;          // close button
00173    TGTextButton      *fCANCEL;        // cancel button
00174 
00175 protected:
00176    static TGSelectBox *fgInstance;// pointer to this select box
00177 
00178 public:
00179    TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w = 10, UInt_t h = 10);
00180    virtual ~TGSelectBox();
00181    virtual void   CloseWindow();
00182    TTVLVEntry    *EditedEntry() {return fEntry;}
00183    void           GrabPointer();
00184    void           SetLabel(const char* title);
00185    void           SetEntry(TTVLVEntry *entry);
00186    void           SaveText();
00187    void           InsertText(const char* text);
00188    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00189    Bool_t         ValidateAlias();
00190 
00191    static TGSelectBox *GetInstance();
00192 
00193    ClassDef(TGSelectBox,0)  // TreeView dialog widget
00194 };
00195 
00196 #endif

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