#ifndef ROOT_TGListView
#define ROOT_TGListView
#ifndef ROOT_TGCanvas
#include "TGCanvas.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
#ifndef ROOT_TGSplitter
#include "TGSplitter.h"
#endif
enum EListViewMode {
kLVLargeIcons,
kLVSmallIcons,
kLVList,
kLVDetails
};
class TGSelectedPicture;
class TGTextButton;
class TGListView;
class TGLVContainer;
class TGHeaderFrame;
class TGLVEntry : public TGFrame {
private:
TGLVEntry(const TGLVEntry&);
TGLVEntry& operator=(const TGLVEntry&);
protected:
TGString *fItemName;
TGString **fSubnames;
Int_t *fCpos;
Int_t *fJmode;
Int_t *fCtw;
UInt_t fTWidth;
UInt_t fTHeight;
Bool_t fActive;
Bool_t fChecked;
EListViewMode fViewMode;
const TGPicture *fBigPic;
const TGPicture *fSmallPic;
const TGPicture *fCurrent;
const TGPicture *fCheckMark;
TGSelectedPicture *fSelPic;
GContext_t fNormGC;
FontStruct_t fFontStruct;
void *fUserData;
static const TGFont *fgDefaultFont;
static TGGC *fgDefaultGC;
virtual void DoRedraw();
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
public:
TGLVEntry(const TGWindow *p = 0,
const TGPicture *bigpic = 0, const TGPicture *smallpic = 0,
TGString *name = 0, TGString **subnames = 0,
EListViewMode ViewMode = kLVDetails,
UInt_t options = kChildFrame,
Pixel_t back = GetWhitePixel());
TGLVEntry(const TGLVContainer *p,
const TString& name, const TString& cname, TGString **subnames = 0,
UInt_t options = kChildFrame, Pixel_t back = GetWhitePixel());
virtual ~TGLVEntry();
virtual void SetViewMode(EListViewMode viewMode);
virtual void Activate(Bool_t a);
Bool_t IsActive() const { return fActive; }
TGString *GetItemName() const { return fItemName; }
virtual const char *GetTitle() const { return fItemName->GetString(); }
virtual void SetTitle(const char *text) { *fItemName = text; }
void SetItemName(const char *name) { *fItemName = name; }
const TGPicture *GetPicture() const { return fCurrent; }
EListViewMode GetViewMode() const { return fViewMode; }
void SetUserData(void *userData) { fUserData = userData; }
void *GetUserData() const { return fUserData; }
virtual void SetSubnames(const char* n1="",const char* n2="",const char* n3="",
const char* n4="",const char* n5="",const char* n6="",
const char* n7="",const char* n8="",const char* n9="",
const char* n10="",const char* n11="",const char* n12="");
virtual void SetPictures(const TGPicture *bigpic = 0, const TGPicture *smallpic = 0);
virtual void SetColumns(Int_t *cpos, Int_t *jmode) { fCpos = cpos; fJmode = jmode; }
virtual void SetCheckedEntry(Bool_t check = kTRUE) { fChecked = check; }
virtual TGDimension GetDefaultSize() const;
virtual Int_t GetSubnameWidth(Int_t idx) const { return fCtw[idx]; }
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y);
ClassDef(TGLVEntry,0)
};
class TGListView : public TGCanvas {
private:
TGListView(const TGListView&);
TGListView& operator=(const TGListView&);
protected:
Int_t fNColumns;
Int_t *fColumns;
Int_t *fJmode;
EListViewMode fViewMode;
TGDimension fMaxSize;
TGTextButton **fColHeader;
TString *fColNames;
TGVFileSplitter **fSplitHeader;
GContext_t fNormGC;
FontStruct_t fFontStruct;
TGHeaderFrame *fHeader;
Bool_t fJustChanged;
UInt_t fMinColumnSize;
static const TGFont *fgDefaultFont;
static TGGC *fgDefaultGC;
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
public:
TGListView(const TGWindow *p, UInt_t w, UInt_t h,
UInt_t options = kSunkenFrame | kDoubleBorder,
Pixel_t back = GetDefaultFrameBackground());
virtual ~TGListView();
virtual void ResizeColumns();
virtual void Layout();
virtual void LayoutHeader(TGFrame *head);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
virtual void ScrollHeader(Int_t pos);
virtual void SetContainer(TGFrame *f);
virtual void AdjustHeaders() { fJustChanged = kTRUE; LayoutHeader(0); }
virtual void SetHeaders(Int_t ncolumns);
virtual void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx);
virtual void SetDefaultHeaders();
virtual void SetViewMode(EListViewMode viewMode);
TGTextButton** GetHeaderButtons() { return fColHeader; }
UInt_t GetNumColumns() { return fNColumns; }
EListViewMode GetViewMode() const { return fViewMode; }
virtual const char *GetHeader(Int_t idx) const;
virtual void SavePrimitive(ostream &out, Option_t *option = "");
virtual void SetIncrements(Int_t hInc, Int_t vInc);
virtual void SetDefaultColumnWidth(TGVFileSplitter* splitter);
TGDimension GetMaxItemSize() const { return fMaxSize; }
virtual void SelectionChanged() { Emit("SelectionChanged()"); }
virtual void Clicked(TGLVEntry *entry, Int_t btn);
virtual void Clicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y);
virtual void DoubleClicked(TGLVEntry *entry, Int_t btn);
virtual void DoubleClicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y);
ClassDef(TGListView,0)
};
class TGLVContainer : public TGContainer {
private:
TGLVContainer(const TGLVContainer&);
TGLVContainer& operator=(const TGLVContainer&);
protected:
TGLayoutHints *fItemLayout;
EListViewMode fViewMode;
Int_t *fCpos;
Int_t *fJmode;
Bool_t fMultiSelect;
TGListView *fListView;
TGLVEntry *fLastActive;
virtual void ActivateItem(TGFrameElement* el);
virtual void DeActivateItem(TGFrameElement* el);
public:
TGLVContainer(const TGWindow *p, UInt_t w, UInt_t h,
UInt_t options = kSunkenFrame,
Pixel_t back = GetDefaultFrameBackground());
TGLVContainer(TGCanvas *p, UInt_t options = kSunkenFrame,
Pixel_t back = GetDefaultFrameBackground());
virtual ~TGLVContainer();
TGListView *GetListView() const { return fListView; }
virtual void AddItem(TGLVEntry *item)
{ AddFrame(item, fItemLayout); item->SetColumns(fCpos, fJmode); fTotal++; }
virtual void SetListView(TGListView *lv) { fListView = lv; }
virtual void RemoveItemWithData(void *userData);
virtual void SetViewMode(EListViewMode viewMode);
EListViewMode GetViewMode() const { return fViewMode; }
virtual void SetColumns(Int_t *cpos, Int_t *jmode);
virtual TGDimension GetPageDimension() const;
virtual TGDimension GetMaxItemSize() const;
virtual Int_t GetMaxSubnameWidth(Int_t idx) const;
virtual void SetColHeaders(const char* n1="",const char* n2="",const char* n3="",
const char* n4="",const char* n5="",const char* n6="",
const char* n7="",const char* n8="",const char* n9="",
const char* n10="",const char* n11="",const char* n12="");
virtual void LineUp(Bool_t select = kFALSE);
virtual void LineDown(Bool_t select = kFALSE);
virtual void LineLeft(Bool_t select = kFALSE);
virtual void LineRight(Bool_t select = kFALSE);
virtual Bool_t HandleButton(Event_t* event);
TList* GetSelectedItems();
Bool_t GetMultipleSelection() const { return fMultiSelect; };
void SetMultipleSelection(Bool_t multi = kTRUE) { fMultiSelect = multi; };
void SetHeaders(Int_t ncolumns) { fListView->SetHeaders(ncolumns); }
void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
{ fListView->SetHeader(s,hmode,cmode,idx); }
void SetDefaultHeaders() { fListView->SetDefaultHeaders(); }
const char *GetHeader(Int_t idx) const { return fListView->GetHeader(idx); }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGLVContainer,0)
};
#endif
Last change: Tue Nov 11 12:37:24 2008
Last generated: 2008-11-11 12:37
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.