/usr/include/root/TGListView.h is in libroot-gui-dev 5.34.30-0ubuntu8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | // @(#)root/gui:$Id$
// Author: Fons Rademakers 17/01/98
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGListView
#define ROOT_TGListView
//////////////////////////////////////////////////////////////////////////
// //
// TGListView, TGLVContainer and TGLVEntry //
// //
// A list view is a widget that can contain a number of items //
// arranged in a grid or list. The items can be represented either //
// by a string or by an icon. //
// //
// The TGListView is user callable. The other classes are service //
// classes of the list view. //
// //
// A list view can generate the following events: //
// kC_CONTAINER, kCT_SELCHANGED, total items, selected items. //
// kC_CONTAINER, kCT_ITEMCLICK, which button, location (y<<16|x). //
// kC_CONTAINER, kCT_ITEMDBLCLICK, which button, location (y<<16|x). //
// //
//////////////////////////////////////////////////////////////////////////
#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&); // Not implemented
TGLVEntry& operator=(const TGLVEntry&); // Not implemented
protected:
TGString *fItemName; // name of item
TGString **fSubnames; // sub names of item (details)
Int_t *fCpos; // position of sub names
Int_t *fJmode; // alignment for sub names
Int_t *fCtw; // width of sub names
UInt_t fTWidth; // width of name
UInt_t fTHeight; // height of name
Bool_t fActive; // true if item is active
Bool_t fChecked; // true if item is checked
EListViewMode fViewMode; // list view viewing mode
const TGPicture *fBigPic; // big icon
const TGPicture *fSmallPic; // small icon
const TGPicture *fCurrent; // current icon
const TGPicture *fCheckMark; // checkmark
TGSelectedPicture *fSelPic; // selected icon
GContext_t fNormGC; // drawing graphics context
FontStruct_t fFontStruct; // text font
void *fUserData; // pointer to user data structure
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 TGString **GetSubnames() const { return fSubnames; }
virtual TGString *GetSubname(Int_t idx) const { if (fSubnames) return fSubnames[idx]; else return 0; }
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) // Item that goes into a TGListView container
};
class TGListView : public TGCanvas {
private:
TGListView(const TGListView&); // Not implemented
TGListView& operator=(const TGListView&); // Not implemented
protected:
Int_t fNColumns; // number of columns
Int_t *fColumns; // column width
Int_t *fJmode; // column text alignment
EListViewMode fViewMode; // view mode if list view widget
TGDimension fMaxSize; // maximum item size
TGTextButton **fColHeader; // column headers for in detailed mode
TString *fColNames; // column titles for in detailed mode
TGVFileSplitter **fSplitHeader; // column splitters
GContext_t fNormGC; // drawing graphics context
FontStruct_t fFontStruct; // text font
TGHeaderFrame *fHeader; // frame used as container for column headers
Bool_t fJustChanged; // Indicate whether the view mode was just changed to Detail
UInt_t fMinColumnSize; // Minimun column size
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()"); } //*SIGNAL*
virtual void Clicked(TGLVEntry *entry, Int_t btn); //*SIGNAL*
virtual void Clicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
virtual void DoubleClicked(TGLVEntry *entry, Int_t btn); //*SIGNAL*
virtual void DoubleClicked(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
ClassDef(TGListView,0) // List view widget (iconbox, small icons or tabular view)
};
class TGLVContainer : public TGContainer {
private:
TGLVContainer(const TGLVContainer&); // Not implemented
TGLVContainer& operator=(const TGLVContainer&); // Not implemented
protected:
TGLayoutHints *fItemLayout; // item layout hints
EListViewMode fViewMode; // list view viewing mode
Int_t *fCpos; // position of sub names
Int_t *fJmode; // alignment of sub names
Bool_t fMultiSelect; // true = multiple file selection
TGListView *fListView; // listview which contains this container
TGLVEntry *fLastActive; // last active item
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 SelectEntry(TGLVEntry *item)
{ ActivateItem(item->GetFrameElement()); }
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();
TList *GetSelectedEntries();
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) // Listview container
};
#endif
|