Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGListTree.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 25/02/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGListTree
13#define ROOT_TGListTree
14
15
16#include "TGCanvas.h"
17#include "TGWidget.h"
18#include "TGDNDManager.h"
19
20class TGPicture;
21class TGToolTip;
22class TGCanvas;
23class TList;
24class TBufferFile;
25
27{
28 friend class TGListTree;
29
30private:
33
34protected:
35 TGClient *fClient; ///< pointer to TGClient
36 TGListTreeItem *fParent; ///< pointer to parent
37 TGListTreeItem *fFirstchild; ///< pointer to first child item
38 TGListTreeItem *fLastchild; ///< pointer to last child item
39 TGListTreeItem *fPrevsibling; ///< pointer to previous sibling
40 TGListTreeItem *fNextsibling; ///< pointer to next sibling
41
42 Bool_t fOpen; ///< true if item is open
43
44 Int_t fDNDState; ///< EDNDFlags
45
46 ///@{
47 ///@name State managed by TGListTree during drawing.
48 Int_t fY; // y position of item
49 Int_t fXtext; // x position of item text
50 Int_t fYtext; // y position of item text
51 UInt_t fHeight; // item height
52 ///@}
53
54public:
56 virtual ~TGListTreeItem() {}
57
58 TGListTreeItem *GetParent() const { return fParent; }
63
64 virtual Bool_t IsOpen() const { return fOpen; }
65 virtual void SetOpen(Bool_t o) { fOpen = o; }
66
67 virtual Bool_t IsActive() const = 0;
68 virtual Pixel_t GetActiveColor() const = 0;
69 virtual void SetActive(Bool_t) {}
70
71 void Rename(const char* new_name) { SetText(new_name); }
72 virtual const char *GetText() const = 0;
73 virtual Int_t GetTextLength() const = 0;
74 virtual const char *GetTipText() const = 0;
75 virtual Int_t GetTipTextLength() const = 0;
76 virtual void SetText(const char *) {}
77 virtual void SetTipText(const char *) {}
78
79 virtual void SetUserData(void *, Bool_t=kFALSE) {}
80 virtual void *GetUserData() const = 0;
81
82 virtual const TGPicture*GetPicture() const = 0;
83 virtual void SetPictures(const TGPicture*, const TGPicture*) {}
84 virtual const TGPicture*GetCheckBoxPicture() const = 0;
85 virtual void SetCheckBoxPictures(const TGPicture*, const TGPicture*) {}
86 virtual UInt_t GetPicWidth() const;
87
88 virtual void SetCheckBox(Bool_t=kTRUE) {}
89 virtual Bool_t HasCheckBox() const = 0;
90 virtual void CheckItem(Bool_t=kTRUE) = 0;
91 virtual void Toggle() { SetCheckBox( ! IsChecked()); }
92 virtual Bool_t IsChecked() const = 0;
93
94 // Propagation of checked-state form children to parents.
95 virtual void CheckAllChildren(Bool_t=kTRUE) {}
97 virtual Bool_t HasCheckedChild(Bool_t=kFALSE) { return kTRUE; } // !!!!
98 virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE) { return kTRUE; } // !!!!
99 virtual void UpdateState() {}
100
101 // Item coloration (underline + minibox)
102 virtual Bool_t HasColor() const = 0;
103 virtual Color_t GetColor() const = 0;
104 virtual void SetColor(Color_t) {}
105 virtual void ClearColor() {}
106
107 // Drag and drop.
109 { if (onoff) fDNDState |= kIsDNDSource; else fDNDState &= ~kIsDNDSource; }
111 { if (onoff) fDNDState |= kIsDNDTarget; else fDNDState &= ~kIsDNDTarget; }
114
115 // Allow handling by the items themselves ... NOT USED in TGListTree yet !!!!
116 virtual Bool_t HandlesDragAndDrop() const { return kFALSE; }
117 virtual void HandleDrag() {}
118 virtual void HandleDrop() {}
119
120 virtual void SavePrimitive(std::ostream&, Option_t*, Int_t) {}
121
122 ClassDef(TGListTreeItem,0) // Abstract base-class for items that go into a TGListTree container.
123};
124
125
127{
128private:
129 Bool_t fActive; ///< true if item is active
130 Bool_t fCheckBox; ///< true if checkbox is visible
131 Bool_t fChecked; ///< true if item is checked
132 Bool_t fOwnsData; ///< true if user data has to be deleted
133 TString fText; ///< item text
134 TString fTipText; ///< tooltip text
135 const TGPicture *fOpenPic; ///< icon for open state
136 const TGPicture *fClosedPic; ///< icon for closed state
137 const TGPicture *fCheckedPic; ///< icon for checked item
138 const TGPicture *fUncheckedPic; ///< icon for unchecked item
139 void *fUserData; ///< pointer to user data structure
140
141 Bool_t fHasColor; ///< true if item has assigned color
142 Color_t fColor; ///< item's color
143
146
147public:
148 TGListTreeItemStd(TGClient *fClient = gClient, const char *name = nullptr,
149 const TGPicture *opened = nullptr, const TGPicture *closed = nullptr,
150 Bool_t checkbox = kFALSE);
151 virtual ~TGListTreeItemStd();
152
153 virtual Pixel_t GetActiveColor() const;
154 virtual Bool_t IsActive() const { return fActive; }
155 virtual void SetActive(Bool_t a) { fActive = a; }
156
157 virtual const char *GetText() const { return fText.Data(); }
158 virtual Int_t GetTextLength() const { return fText.Length(); }
159 virtual const char *GetTipText() const { return fTipText.Data(); }
160 virtual Int_t GetTipTextLength() const { return fTipText.Length(); }
161 virtual void SetText(const char *text) { fText = text; }
162 virtual void SetTipText(const char *tip) { fTipText = tip; }
163
164 virtual void SetUserData(void *userData, Bool_t own=kFALSE) { fUserData = userData; fOwnsData=own; }
165 virtual void *GetUserData() const { return fUserData; }
166
167 virtual const TGPicture*GetPicture() const { return fOpen ? fOpenPic : fClosedPic; }
168 virtual const TGPicture*GetCheckBoxPicture() const { return fCheckBox ? (fChecked ? fCheckedPic : fUncheckedPic) : 0; }
169 virtual void SetPictures(const TGPicture *opened, const TGPicture *closed);
170 virtual void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked);
171
172 virtual void SetCheckBox(Bool_t on = kTRUE);
173 virtual Bool_t HasCheckBox() const { return fCheckBox; }
174 virtual void CheckItem(Bool_t checked = kTRUE) { fChecked = checked; }
175 virtual void Toggle() { fChecked = !fChecked; }
176 virtual Bool_t IsChecked() const { return fChecked; }
177
178 virtual void CheckAllChildren(Bool_t state = kTRUE);
179 virtual void CheckChildren(TGListTreeItem *item, Bool_t state);
182 virtual void UpdateState();
183
184 virtual Bool_t HasColor() const { return fHasColor; }
185 virtual Color_t GetColor() const { return fColor; }
186 virtual void SetColor(Color_t color) { fHasColor = true;fColor = color; }
187 virtual void ClearColor() { fHasColor = false; }
188
189 virtual void SavePrimitive(std::ostream &out, Option_t *option, Int_t n);
190
191 ClassDef(TGListTreeItemStd,0) //Item that goes into a TGListTree container
192};
193
194
195class TGListTree : public TGContainer {
196
197public:
198 //---- color markup mode of tree items
202 kColorBox = BIT(1)
203 };
206 kRecursive = BIT(3)
207 };
208
209protected:
210 TGListTreeItem *fFirst; ///< pointer to first item in list
211 TGListTreeItem *fLast; ///< pointer to last item in list
212 TGListTreeItem *fSelected; ///< pointer to selected item in list
213 TGListTreeItem *fCurrent; ///< pointer to current item in list
214 TGListTreeItem *fBelowMouse; ///< pointer to item below mouses cursor
215 Int_t fHspacing; ///< horizontal spacing between items
216 Int_t fVspacing; ///< vertical spacing between items
217 Int_t fIndent; ///< number of pixels indentation
218 Int_t fMargin; ///< number of pixels margin from left side
219 Pixel_t fGrayPixel; ///< gray draw color
220 GContext_t fActiveGC; ///< activated (selected) drawing context
221 GContext_t fDrawGC; ///< icon drawing context
222 GContext_t fLineGC; ///< dashed line drawing context
223 GContext_t fHighlightGC; ///< highlighted icon drawing context
224 FontStruct_t fFont; ///< font used to draw item text
225 UInt_t fDefw; ///< default list width
226 UInt_t fDefh; ///< default list height
227 Int_t fExposeTop; ///< top y postion of visible region
228 Int_t fExposeBottom; ///< bottom y position of visible region
229 TGToolTip *fTip; ///< tooltip shown when moving over list items
230 TGListTreeItem *fTipItem; ///< item for which tooltip is set
231 TBufferFile *fBuf; ///< buffer used for Drag and Drop
232 TDNDData fDNDData; ///< Drag and Drop data
233 Atom_t *fDNDTypeList; ///< handles DND types
234 TGListTreeItem *fDropItem; ///< item on which DND is over
235 Bool_t fAutoTips; ///< assume item->fUserData is TObject and use GetTitle() for tip text
236 Bool_t fAutoCheckBoxPic;///< change check box picture if parent and children have diffrent state
237 Bool_t fDisableOpen; ///< disable branch opening on double-clicks
238 Bool_t fUserControlled; ///< let user decides what is the behaviour on events
239 Bool_t fEventHandled; ///< flag used from user code to bypass standard event handling
240 UInt_t fLastEventState; ///< modifier state of the last keyboard event
241
242 EColorMarkupMode fColorMode; ///< if/how to render item's main color
243 ECheckMode fCheckMode; ///< how to propagate check properties through the tree
244 GContext_t fColorGC; ///< drawing context for main item color
245
247 static const TGFont *fgDefaultFont;
249 static TGGC *fgDrawGC;
250 static TGGC *fgLineGC;
253 static const TGPicture *fgOpenPic; ///< icon for open item
254 static const TGPicture *fgClosedPic; ///< icon for closed item
255 static const TGPicture *fgCheckedPic; ///< icon for checked item
256 static const TGPicture *fgUncheckedPic; ///< icon for unchecked item
257
258 static Pixel_t GetGrayPixel();
260 static const TGGC &GetActiveGC();
261 static const TGGC &GetDrawGC();
262 static const TGGC &GetLineGC();
263 static const TGGC &GetHighlightGC();
264 static const TGGC &GetColorGC();
265
266 void Draw(Handle_t id, Int_t yevent, Int_t hevent);
267 void Draw(Option_t * ="") { MayNotUse("Draw(Option_t*)"); }
269 void DrawItem(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y, Int_t *xroot,
270 UInt_t *retwidth, UInt_t *retheight);
271 void DrawItemName(Handle_t id, TGListTreeItem *item);
272 void DrawNode(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y);
273 virtual void UpdateChecked(TGListTreeItem *item, Bool_t redraw = kFALSE);
274
275 void SaveChildren(std::ostream &out, TGListTreeItem *item, Int_t &n);
277 void PDeleteItem(TGListTreeItem *item);
279 void InsertChild(TGListTreeItem *parent, TGListTreeItem *item);
280 void InsertChildren(TGListTreeItem *parent, TGListTreeItem *item);
282 TGListTreeItem **finditem);
284 void *FindItem(const TString& name,
285 Bool_t direction = kTRUE,
286 Bool_t caseSensitive = kTRUE,
287 Bool_t beginWith = kFALSE)
288 { return TGContainer::FindItem(name, direction, caseSensitive, beginWith); }
289
290 virtual void Layout() {}
291
293 void CurrentChanged(Int_t /*x*/, Int_t /*y*/) { }
296 void Clicked(TGFrame *, Int_t /*btn*/) { }
297 void Clicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) { }
298 void DoubleClicked(TGFrame *, Int_t /*btn*/) { }
299 void DoubleClicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) { }
300 void KeyPressed(TGFrame *, UInt_t /*keysym*/, UInt_t /*mask*/) { }
301
302private:
303 TGListTree(const TGListTree&) = delete;
304 TGListTree& operator=(const TGListTree&) = delete;
305
306public:
307 TGListTree(TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
308 UInt_t options = 0, Pixel_t back = GetWhitePixel());
309 TGListTree(TGCanvas *p, UInt_t options, Pixel_t back = GetWhitePixel());
310
311 virtual ~TGListTree();
312
317 virtual Bool_t HandleKey(Event_t *event);
318
319 virtual void SetCanvas(TGCanvas *canvas) { fCanvas = canvas; }
320 virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
321
322 virtual void DrawOutline(Handle_t id, TGListTreeItem *item, Pixel_t col=0xbbbbbb,
323 Bool_t clear=kFALSE);
324 virtual void DrawActive(Handle_t id, TGListTreeItem *item);
325
327 { return TGDimension(fDefw, fDefh); }
328
329 void AddItem(TGListTreeItem *parent, TGListTreeItem *item);
330 TGListTreeItem *AddItem(TGListTreeItem *parent, const char *string,
331 const TGPicture *open = 0,
332 const TGPicture *closed = 0,
333 Bool_t checkbox = kFALSE);
334 TGListTreeItem *AddItem(TGListTreeItem *parent, const char *string,
335 void *userData, const TGPicture *open = 0,
336 const TGPicture *closed = 0,
337 Bool_t checkbox = kFALSE);
338 void RenameItem(TGListTreeItem *item, const char *string);
340 void OpenItem(TGListTreeItem *item);
341 void CloseItem(TGListTreeItem *item);
342 void CheckItem(TGListTreeItem *item, Bool_t check = kTRUE);
343 void SetCheckBox(TGListTreeItem *item, Bool_t on = kTRUE);
344 void ToggleItem(TGListTreeItem *item);
345 Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData);
346
348 Int_t Reparent(TGListTreeItem *item, TGListTreeItem *newparent);
350 void SetToolTipItem(TGListTreeItem *item, const char *string);
351 void SetAutoTips(Bool_t on = kTRUE) { fAutoTips = on; }
353 void SetSelected(TGListTreeItem *item) { fSelected = item; }
354 void AdjustPosition(TGListTreeItem *item);
356
357 // overwrite TGContainer's methods
358 void Home(Bool_t select = kFALSE);
359 void End(Bool_t select = kFALSE);
360 void PageUp(Bool_t select = kFALSE);
361 void PageDown(Bool_t select = kFALSE);
362 void LineUp(Bool_t select = kFALSE);
363 void LineDown(Bool_t select = kFALSE);
364 void Search(Bool_t close = kTRUE);
365
369 void HighlightItem(TGListTreeItem *item);
370 void ClearHighlighted();
371 void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth = 0);
372 void UnselectAll(Bool_t draw);
373 void SetToolTipText(const char *text, Int_t x, Int_t y, Long_t delayms);
374 void HighlightItem(TGListTreeItem *item, Bool_t state, Bool_t draw);
375 void HighlightChildren(TGListTreeItem *item, Bool_t state, Bool_t draw);
376 void DisableOpen(Bool_t disable = kTRUE) { fDisableOpen = disable;}
377 void GetChecked(TList *checked);
378 void GetCheckedChildren(TList *checked, TGListTreeItem *item);
379 void CheckAllChildren(TGListTreeItem *item, Bool_t state);
380
381 TGListTreeItem *GetFirstItem() const { return fFirst; }
383 TGListTreeItem *GetCurrent() const { return fCurrent; }
386 TGListTreeItem *FindSiblingByData(TGListTreeItem *item, void *userData);
388 TGListTreeItem *FindChildByData(TGListTreeItem *item, void *userData);
389 TGListTreeItem *FindItemByPathname(const char *path);
391
392 void AddItem(const char *string) { AddItem(fSelected, string); } //*MENU*
393 void AddRoot(const char *string) { AddItem(0, string); } //*MENU*
394 Int_t DeleteSelected() { return (fSelected ? DeleteItem(fSelected) : 0); } //*MENU*
395 void RenameSelected(const char *string) { if (fSelected) RenameItem(fSelected, string); } //*MENU*
396
397 virtual void MouseOver(TGListTreeItem *entry); //*SIGNAL*
398 virtual void MouseOver(TGListTreeItem *entry, UInt_t mask); //*SIGNAL*
399 virtual void KeyPressed(TGListTreeItem *entry, UInt_t keysym, UInt_t mask); //*SIGNAL*
400 virtual void ReturnPressed(TGListTreeItem *entry); //*SIGNAL*
401 virtual void Clicked(TGListTreeItem *entry, Int_t btn); //*SIGNAL*
402 virtual void Clicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
403 virtual void Clicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y); //*SIGNAL*
404 virtual void DoubleClicked(TGListTreeItem *entry, Int_t btn); //*SIGNAL*
405 virtual void DoubleClicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
406 virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
407 virtual void DataDropped(TGListTreeItem *item, TDNDData *data); //*SIGNAL*
408
409 // Utility functions
412 Int_t TextWidth(const char *c);
413
414 static const TGPicture *GetOpenPic();
415 static const TGPicture *GetClosedPic();
416 static const TGPicture *GetCheckedPic();
417 static const TGPicture *GetUncheckedPic();
418
419 // User control
424
427 Int_t xroot, Int_t yroot);
428 Atom_t HandleDNDEnter(Atom_t * typelist);
430
432 return &fDNDData;
433 }
434
436 void SetColorMode(EColorMarkupMode colorMode) { fColorMode = colorMode; }
437
439 void SetCheckMode(ECheckMode mode) { fCheckMode = mode; }
440
441 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
442
443 ClassDef(TGListTree,0) //Show items in a tree structured list
444};
445
446#endif
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:101
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:92
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
Definition TError.cxx:170
#define gClient
Definition TGClient.h:157
@ kIsDNDTarget
Definition TGFrame.h:76
@ kIsDNDSource
Definition TGFrame.h:75
char name[80]
Definition TGX11.cxx:110
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
Drag and drop data container.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
Window client.
Definition TGClient.h:37
Manages a content area.
Definition TGCanvas.h:31
TGCanvas * fCanvas
pointer to canvas
Definition TGCanvas.h:41
virtual void AdjustPosition()
Move content to position of highlighted/activated frame.
virtual void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t subString=kFALSE)
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
virtual void SetUserData(void *userData, Bool_t own=kFALSE)
Definition TGListTree.h:164
TString fTipText
tooltip text
Definition TGListTree.h:134
virtual void ClearColor()
Definition TGListTree.h:187
Bool_t fHasColor
true if item has assigned color
Definition TGListTree.h:141
virtual void SetColor(Color_t color)
Definition TGListTree.h:186
TGListTreeItemStd & operator=(const TGListTreeItemStd &)=delete
virtual void Toggle()
Definition TGListTree.h:175
virtual Int_t GetTipTextLength() const
Definition TGListTree.h:160
virtual const TGPicture * GetPicture() const
Definition TGListTree.h:167
virtual const char * GetTipText() const
Definition TGListTree.h:159
virtual void SetText(const char *text)
Definition TGListTree.h:161
virtual Bool_t IsChecked() const
Definition TGListTree.h:176
virtual Bool_t HasCheckedChild(Bool_t first=kFALSE)
Add all child items of 'item' into the list 'checked'.
virtual void SetPictures(const TGPicture *opened, const TGPicture *closed)
Change list tree item icons.
const TGPicture * fCheckedPic
icon for checked item
Definition TGListTree.h:137
virtual Bool_t HasUnCheckedChild(Bool_t first=kFALSE)
Add all child items of 'item' into the list 'checked'.
const TGPicture * fClosedPic
icon for closed state
Definition TGListTree.h:136
Bool_t fActive
true if item is active
Definition TGListTree.h:129
virtual void SavePrimitive(std::ostream &out, Option_t *option, Int_t n)
Save a list tree item attributes as a C++ statements on output stream.
virtual Pixel_t GetActiveColor() const
Return color for marking items that are active or selected.
Color_t fColor
item's color
Definition TGListTree.h:142
Bool_t fOwnsData
true if user data has to be deleted
Definition TGListTree.h:132
virtual const TGPicture * GetCheckBoxPicture() const
Definition TGListTree.h:168
virtual void SetCheckBox(Bool_t on=kTRUE)
Set a check box on the tree node.
virtual void CheckChildren(TGListTreeItem *item, Bool_t state)
Set all child items of 'item' checked if state=kTRUE; unchecked if state=kFALSE.
const TGPicture * fUncheckedPic
icon for unchecked item
Definition TGListTree.h:138
virtual void UpdateState()
Update the state of the node 'item' according to the children states.
virtual void SetActive(Bool_t a)
Definition TGListTree.h:155
Bool_t fCheckBox
true if checkbox is visible
Definition TGListTree.h:130
virtual void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked)
Change list tree check item icons.
void * fUserData
pointer to user data structure
Definition TGListTree.h:139
Bool_t fChecked
true if item is checked
Definition TGListTree.h:131
virtual Bool_t HasColor() const
Definition TGListTree.h:184
virtual Bool_t HasCheckBox() const
Definition TGListTree.h:173
TGListTreeItemStd(const TGListTreeItemStd &)=delete
TString fText
item text
Definition TGListTree.h:133
virtual void CheckItem(Bool_t checked=kTRUE)
Definition TGListTree.h:174
virtual void SetTipText(const char *tip)
Definition TGListTree.h:162
virtual void * GetUserData() const
Definition TGListTree.h:165
const TGPicture * fOpenPic
icon for open state
Definition TGListTree.h:135
virtual const char * GetText() const
Definition TGListTree.h:157
virtual Int_t GetTextLength() const
Definition TGListTree.h:158
virtual Color_t GetColor() const
Definition TGListTree.h:185
virtual void CheckAllChildren(Bool_t state=kTRUE)
Set all child items of this one checked if state=kTRUE, unchecked if state=kFALSE.
virtual ~TGListTreeItemStd()
Delete list tree item.
virtual Bool_t IsActive() const
Definition TGListTree.h:154
TGListTreeItem * GetFirstChild() const
Definition TGListTree.h:59
TGListTreeItem & operator=(const TGListTreeItem &)=delete
void Rename(const char *new_name)
Definition TGListTree.h:71
virtual void CheckChildren(TGListTreeItem *, Bool_t)
Definition TGListTree.h:96
virtual void SetCheckBoxPictures(const TGPicture *, const TGPicture *)
Definition TGListTree.h:85
virtual Bool_t IsActive() const =0
virtual const char * GetText() const =0
virtual void CheckAllChildren(Bool_t=kTRUE)
Definition TGListTree.h:95
TGListTreeItem * fLastchild
pointer to last child item
Definition TGListTree.h:38
TGListTreeItem * fFirstchild
pointer to first child item
Definition TGListTree.h:37
virtual void ClearColor()
Definition TGListTree.h:105
virtual void HandleDrag()
Definition TGListTree.h:117
TGListTreeItem * GetNextSibling() const
Definition TGListTree.h:62
virtual void CheckItem(Bool_t=kTRUE)=0
TGListTreeItem * fParent
pointer to parent
Definition TGListTree.h:36
TGListTreeItem * fPrevsibling
pointer to previous sibling
Definition TGListTree.h:39
Bool_t IsDNDTarget() const
Definition TGListTree.h:113
TGListTreeItem * GetLastChild() const
Definition TGListTree.h:60
Bool_t IsDNDSource() const
Definition TGListTree.h:112
virtual Bool_t HasCheckedChild(Bool_t=kFALSE)
Definition TGListTree.h:97
TGClient * fClient
pointer to TGClient
Definition TGListTree.h:35
TGListTreeItem * GetParent() const
Definition TGListTree.h:58
Bool_t fOpen
true if item is open
Definition TGListTree.h:42
void SetDNDTarget(Bool_t onoff)
Definition TGListTree.h:110
virtual void SavePrimitive(std::ostream &, Option_t *, Int_t)
Definition TGListTree.h:120
TGListTreeItem(const TGListTreeItem &)=delete
virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE)
Definition TGListTree.h:98
virtual void SetTipText(const char *)
Definition TGListTree.h:77
virtual void SetActive(Bool_t)
Definition TGListTree.h:69
virtual Int_t GetTextLength() const =0
virtual const TGPicture * GetCheckBoxPicture() const =0
Int_t fDNDState
EDNDFlags.
Definition TGListTree.h:44
virtual Bool_t IsOpen() const
Definition TGListTree.h:64
void SetDNDSource(Bool_t onoff)
Definition TGListTree.h:108
virtual void SetPictures(const TGPicture *, const TGPicture *)
Definition TGListTree.h:83
TGListTreeItem * GetPrevSibling() const
Definition TGListTree.h:61
virtual void HandleDrop()
Definition TGListTree.h:118
virtual Color_t GetColor() const =0
virtual void SetText(const char *)
Definition TGListTree.h:76
virtual UInt_t GetPicWidth() const
Return width of item's icon.
virtual Bool_t IsChecked() const =0
virtual const TGPicture * GetPicture() const =0
virtual void SetOpen(Bool_t o)
Definition TGListTree.h:65
virtual Pixel_t GetActiveColor() const =0
virtual void SetCheckBox(Bool_t=kTRUE)
Definition TGListTree.h:88
virtual void Toggle()
Definition TGListTree.h:91
virtual Bool_t HasCheckBox() const =0
virtual void UpdateState()
Definition TGListTree.h:99
virtual Bool_t HasColor() const =0
virtual void * GetUserData() const =0
virtual ~TGListTreeItem()
Definition TGListTree.h:56
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition TGListTree.h:79
virtual const char * GetTipText() const =0
TGListTreeItem * fNextsibling
pointer to next sibling
Definition TGListTree.h:40
virtual Bool_t HandlesDragAndDrop() const
Definition TGListTree.h:116
virtual void SetColor(Color_t)
Definition TGListTree.h:104
virtual Int_t GetTipTextLength() const =0
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:195
static const TGPicture * GetOpenPic()
Returns the icon used by items in open state.
UInt_t fLastEventState
modifier state of the last keyboard event
Definition TGListTree.h:240
void Clicked(TGFrame *, Int_t)
Emit Clicked() signal.
Definition TGListTree.h:296
GContext_t fColorGC
drawing context for main item color
Definition TGListTree.h:244
void DisableOpen(Bool_t disable=kTRUE)
Definition TGListTree.h:376
void PageUp(Bool_t select=kFALSE)
Move content one page up.
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
TGListTreeItem * fSelected
pointer to selected item in list
Definition TGListTree.h:212
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE)
Definition TGListTree.h:284
Int_t SortSiblings(TGListTreeItem *item)
Sort siblings of item.
GContext_t fLineGC
dashed line drawing context
Definition TGListTree.h:222
static const TGPicture * GetUncheckedPic()
Returns the icon used for unchecked checkbox.
TGListTreeItem * GetBelowMouse() const
Definition TGListTree.h:384
void RemoveReference(TGListTreeItem *item)
This function removes the specified item from the linked list.
UInt_t fDefw
default list width
Definition TGListTree.h:225
void LineUp(Bool_t select=kFALSE)
Move content one item-size up.
static Pixel_t fgGrayPixel
Definition TGListTree.h:246
void ClearHighlighted()
Un highlight items.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGListTree.h:326
void PDeleteChildren(TGListTreeItem *item)
Recursively delete all children of an item.
void InsertChildren(TGListTreeItem *parent, TGListTreeItem *item)
Insert a list of ALREADY LINKED children into another list.
Atom_t HandleDNDEnter(Atom_t *typelist)
Handle drag enter events.
ECheckMode fCheckMode
how to propagate check properties through the tree
Definition TGListTree.h:243
static const TGPicture * GetClosedPic()
Returns the icon used by items in closed state.
static TGGC * fgLineGC
Definition TGListTree.h:250
void Draw(Option_t *="")
Default Draw method for all objects.
Definition TGListTree.h:267
virtual Bool_t HandleButton(Event_t *event)
Handle button events in the list tree.
void Home(Bool_t select=kFALSE)
Move content to the top.
void UnselectAll(Bool_t draw)
Unselect all items.
Bool_t fDisableOpen
disable branch opening on double-clicks
Definition TGListTree.h:237
virtual void Layout()
Layout container entries.
Definition TGListTree.h:290
void InsertChild(TGListTreeItem *parent, TGListTreeItem *item)
Insert child in list.
void ToggleItem(TGListTreeItem *item)
Toggle check button state of the node 'item'.
GContext_t fDrawGC
icon drawing context
Definition TGListTree.h:221
void SetColorMode(EColorMarkupMode colorMode)
Definition TGListTree.h:436
virtual ~TGListTree()
Delete list tree widget.
void RenameItem(TGListTreeItem *item, const char *string)
Rename item in list tree.
static TGGC * fgActiveGC
Definition TGListTree.h:248
GContext_t fHighlightGC
highlighted icon drawing context
Definition TGListTree.h:223
void LineDown(Bool_t select=kFALSE)
Move content one item-size down.
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
Bool_t HasUserControl() const
Definition TGListTree.h:421
TGListTreeItem * FindItem(Int_t findy)
Find item at postion findy.
void SetAutoCheckBoxPic(Bool_t on)
Definition TGListTree.h:352
TGListTreeItem * fBelowMouse
pointer to item below mouses cursor
Definition TGListTree.h:214
Int_t FontHeight()
Returns height of currently used font.
void AddRoot(const char *string)
Definition TGListTree.h:393
TGListTreeItem * fLast
pointer to last item in list
Definition TGListTree.h:211
Int_t ReparentChildren(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of the children of item.
void CheckItem(TGListTreeItem *item, Bool_t check=kTRUE)
Set check button state for the node 'item'.
void SetAutoTips(Bool_t on=kTRUE)
Definition TGListTree.h:351
Int_t DrawChildren(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y, Int_t xroot)
Draw children of item in list tree.
Int_t fExposeBottom
bottom y position of visible region
Definition TGListTree.h:228
static const TGGC & GetLineGC()
Return graphics context in use for line drawing.
void CheckAllChildren(TGListTreeItem *item, Bool_t state)
Check all child items of 'item' and 'item' itself according to the state value: kTRUE means check all...
void Clicked(TGFrame *, Int_t, Int_t, Int_t)
Emit Clicked() signal.
Definition TGListTree.h:297
static TGGC * fgHighlightGC
Definition TGListTree.h:251
static const TGPicture * GetCheckedPic()
Returns the icon used for checked checkbox.
TDNDData fDNDData
Drag and Drop data.
Definition TGListTree.h:232
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot)
Handle dragging position events.
void CurrentChanged(Int_t, Int_t)
Emit signal when current position changed.
Definition TGListTree.h:293
void SetCheckBox(TGListTreeItem *item, Bool_t on=kTRUE)
Set check button state for the node 'item'.
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
virtual void DrawActive(Handle_t id, TGListTreeItem *item)
Draw active item with its active color.
Pixel_t fGrayPixel
gray draw color
Definition TGListTree.h:219
Int_t Reparent(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of item.
TGListTreeItem * GetSelected() const
Definition TGListTree.h:382
void GetChecked(TList *checked)
Add all checked list tree items of this list tree into the list 'checked'.
static TGGC * fgColorGC
Definition TGListTree.h:252
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
void SetCheckMode(ECheckMode mode)
Definition TGListTree.h:439
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Int_t TextWidth(const char *c)
Returns text width relative to currently used font.
void DrawItem(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y, Int_t *xroot, UInt_t *retwidth, UInt_t *retheight)
Draw list tree item.
TGListTreeItem * fDropItem
item on which DND is over
Definition TGListTree.h:234
void SetToolTipText(const char *text, Int_t x, Int_t y, Long_t delayms)
Set tool tip text associated with this item.
TGListTreeItem * fTipItem
item for which tooltip is set
Definition TGListTree.h:230
Int_t FontAscent()
Returns ascent of currently used font.
void End(Bool_t select=kFALSE)
Move content to the bottom.
static const TGGC & GetColorGC()
Return graphics context for highlighted frame background.
virtual void Checked(TObject *obj, Bool_t check)
Emit Checked() signal.
static const TGGC & GetDrawGC()
Return default graphics context in use.
void HighlightChildren(TGListTreeItem *item, Bool_t state, Bool_t draw)
Highlight item children.
void RenameSelected(const char *string)
Definition TGListTree.h:395
TGListTree & operator=(const TGListTree &)=delete
virtual void DataDropped(TGListTreeItem *item, TDNDData *data)
Emit DataDropped() signal.
Bool_t IsEventHandled() const
Definition TGListTree.h:423
Int_t fHspacing
horizontal spacing between items
Definition TGListTree.h:215
static const TGPicture * fgClosedPic
icon for closed item
Definition TGListTree.h:254
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
static const TGPicture * fgUncheckedPic
icon for unchecked item
Definition TGListTree.h:256
Int_t fMargin
number of pixels margin from left side
Definition TGListTree.h:218
static const TGGC & GetHighlightGC()
Return graphics context for highlighted frame background.
UInt_t fDefh
default list height
Definition TGListTree.h:226
void GetCheckedChildren(TList *checked, TGListTreeItem *item)
Add all child items of 'item' into the list 'checked'.
ECheckMode GetCheckMode() const
Definition TGListTree.h:438
static const TGPicture * fgCheckedPic
icon for checked item
Definition TGListTree.h:255
void SetSelected(TGListTreeItem *item)
Definition TGListTree.h:353
TGListTreeItem * GetFirstItem() const
Definition TGListTree.h:381
void SetEventHandled(Bool_t eh=kTRUE)
Definition TGListTree.h:422
Bool_t HandleDNDLeave()
Handle drag leave events.
void DoubleClicked(TGFrame *, Int_t, Int_t, Int_t)
Emit DoubleClicked() signal.
Definition TGListTree.h:299
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
void SaveChildren(std::ostream &out, TGListTreeItem *item, Int_t &n)
Save child items as a C++ statements on output stream out.
virtual void SetCanvas(TGCanvas *canvas)
Definition TGListTree.h:319
void AddItem(const char *string)
Definition TGListTree.h:392
static const TGGC & GetActiveGC()
Return default graphics context in use.
Bool_t fEventHandled
flag used from user code to bypass standard event handling
Definition TGListTree.h:239
TGListTree(const TGListTree &)=delete
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
static const TGPicture * fgOpenPic
icon for open item
Definition TGListTree.h:253
EColorMarkupMode fColorMode
if/how to render item's main color
Definition TGListTree.h:242
Atom_t * fDNDTypeList
handles DND types
Definition TGListTree.h:233
static TGGC * fgDrawGC
Definition TGListTree.h:249
Int_t Sort(TGListTreeItem *item)
Sort items starting with item.
void KeyPressed(TGFrame *, UInt_t, UInt_t)
Signal emitted when keyboard key pressed.
Definition TGListTree.h:300
Bool_t fAutoCheckBoxPic
change check box picture if parent and children have diffrent state
Definition TGListTree.h:236
void DrawNode(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y)
Draw node (little + in box).
TGListTreeItem * fFirst
pointer to first item in list
Definition TGListTree.h:210
void Search(Bool_t close=kTRUE)
Invokes search dialog. Looks for item with the entered name.
TBufferFile * fBuf
buffer used for Drag and Drop
Definition TGListTree.h:231
TGToolTip * fTip
tooltip shown when moving over list items
Definition TGListTree.h:229
virtual Bool_t HandleKey(Event_t *event)
The key press event handler converts a key press to some line editor action.
TGListTreeItem * GetCurrent() const
Definition TGListTree.h:383
void DrawItemName(Handle_t id, TGListTreeItem *item)
Draw name of list tree item.
Bool_t fUserControlled
let user decides what is the behaviour on events
Definition TGListTree.h:238
TGListTreeItem * fCurrent
pointer to current item in list
Definition TGListTree.h:213
Int_t DeleteSelected()
Definition TGListTree.h:394
virtual void UpdateChecked(TGListTreeItem *item, Bool_t redraw=kFALSE)
Update the state of the node 'item' according to the children states.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event.
Int_t SearchChildren(TGListTreeItem *item, Int_t y, Int_t findy, TGListTreeItem **finditem)
Search child item.
virtual TDNDData * GetDNDData(Atom_t)
Definition TGListTree.h:431
virtual void MouseOver(TGListTreeItem *entry)
Signal emitted when pointer is over entry.
void HighlightItem(TGListTreeItem *item)
Highlight item.
Int_t fExposeTop
top y postion of visible region
Definition TGListTree.h:227
void SetUserControl(Bool_t ctrl=kTRUE)
Definition TGListTree.h:420
TGListTreeItem * FindSiblingByName(TGListTreeItem *item, const char *name)
Find sibling of item by name.
TGListTreeItem * FindItemByPathname(const char *path)
Find item by pathname.
void ReturnPressed(TGFrame *)
Signal emitted when Return/Enter key pressed.
Definition TGListTree.h:295
void AdjustPosition()
Move content to position of highlighted/activated frame.
Definition TGListTree.h:355
Int_t fVspacing
vertical spacing between items
Definition TGListTree.h:216
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a list tree widget as a C++ statements on output stream out.
FontStruct_t fFont
font used to draw item text
Definition TGListTree.h:224
void OnMouseOver(TGFrame *)
Signal emitted when pointer is over entry.
Definition TGListTree.h:292
TGListTreeItem * FindChildByData(TGListTreeItem *item, void *userData)
Find child of item by userData.
void CloseItem(TGListTreeItem *item)
Close item in list tree (i.e. hide child items).
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Redraw list tree.
void PDeleteItem(TGListTreeItem *item)
Delete given item.
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click event in the list tree (only for kButton1).
void SetToolTipItem(TGListTreeItem *item, const char *string)
Set tooltip text for this item.
Bool_t HandleDNDDrop(TDNDData *data)
Handle drop events.
void DoubleClicked(TGFrame *, Int_t)
Emit DoubleClicked() signal.
Definition TGListTree.h:298
Int_t fIndent
number of pixels indentation
Definition TGListTree.h:217
virtual void DrawOutline(Handle_t id, TGListTreeItem *item, Pixel_t col=0xbbbbbb, Bool_t clear=kFALSE)
Draw a outline of color 'col' around an item.
EColorMarkupMode GetColorMode() const
Definition TGListTree.h:435
Bool_t fAutoTips
assume item->fUserData is TObject and use GetTitle() for tip text
Definition TGListTree.h:235
TGListTreeItem * FindSiblingByData(TGListTreeItem *item, void *userData)
Find sibling of item by userData.
void CurrentChanged(TGFrame *)
Emit signal when current selected frame changed.
Definition TGListTree.h:294
static const TGFont * fgDefaultFont
Definition TGListTree.h:247
GContext_t fActiveGC
activated (selected) drawing context
Definition TGListTree.h:220
void PageDown(Bool_t select=kFALSE)
Move content one page down.
static Pixel_t GetGrayPixel()
Return gray draw color in use.
void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth=0)
Get pathname from item.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
ROOT GUI Window base class.
Definition TGWindow.h:23
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Definition first.py:1
Event structure.
Definition GuiTypes.h:174
th1 Draw()