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 ~TGListTreeItemStd() override;
152
153 Pixel_t GetActiveColor() const override;
154 Bool_t IsActive() const override { return fActive; }
155 void SetActive(Bool_t a) override { fActive = a; }
156
157 const char *GetText() const override { return fText.Data(); }
158 Int_t GetTextLength() const override { return fText.Length(); }
159 const char *GetTipText() const override { return fTipText.Data(); }
160 Int_t GetTipTextLength() const override { return fTipText.Length(); }
161 void SetText(const char *text) override { fText = text; }
162 void SetTipText(const char *tip) override { fTipText = tip; }
163
164 void SetUserData(void *userData, Bool_t own = kFALSE) override { fUserData = userData; fOwnsData=own; }
165 void *GetUserData() const override { return fUserData; }
166
167 const TGPicture *GetPicture() const override { return fOpen ? fOpenPic : fClosedPic; }
168 const TGPicture *GetCheckBoxPicture() const override { return fCheckBox ? (fChecked ? fCheckedPic : fUncheckedPic) : nullptr; }
169 void SetPictures(const TGPicture *opened, const TGPicture *closed) override;
170 void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked) override;
171
172 void SetCheckBox(Bool_t on = kTRUE) override;
173 Bool_t HasCheckBox() const override { return fCheckBox; }
174 void CheckItem(Bool_t checked = kTRUE) override { fChecked = checked; }
175 void Toggle() override { fChecked = !fChecked; }
176 Bool_t IsChecked() const override { return fChecked; }
177
178 void CheckAllChildren(Bool_t state = kTRUE) override;
179 void CheckChildren(TGListTreeItem *item, Bool_t state) override;
182 void UpdateState() override;
183
184 Bool_t HasColor() const override { return fHasColor; }
185 Color_t GetColor() const override { return fColor; }
186 void SetColor(Color_t color) override { fHasColor = true;fColor = color; }
187 void ClearColor() override { fHasColor = false; }
188
189 void SavePrimitive(std::ostream &out, Option_t *option, Int_t n) override;
190
191 ClassDefOverride(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 * ="") override { 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) override
288 { return TGContainer::FindItem(name, direction, caseSensitive, beginWith); }
289
290 void Layout() override {}
291
292 void OnMouseOver(TGFrame*) override { }
293 void CurrentChanged(Int_t /*x*/, Int_t /*y*/) override { }
294 void CurrentChanged(TGFrame *) override { }
295 void ReturnPressed(TGFrame*) override { }
296 void Clicked(TGFrame *, Int_t /*btn*/) override { }
297 void Clicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) override { }
298 void DoubleClicked(TGFrame *, Int_t /*btn*/) override { }
299 void DoubleClicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) override { }
300 void KeyPressed(TGFrame *, UInt_t /*keysym*/, UInt_t /*mask*/) override { }
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 ~TGListTree() override;
312
313 Bool_t HandleButton(Event_t *event) override;
316 Bool_t HandleMotion(Event_t *event) override;
317 Bool_t HandleKey(Event_t *event) override;
318
319 virtual void SetCanvas(TGCanvas *canvas) { fCanvas = canvas; }
320 void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override;
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 = nullptr,
332 const TGPicture *closed = nullptr,
333 Bool_t checkbox = kFALSE);
334 TGListTreeItem *AddItem(TGListTreeItem *parent, const char *string,
335 void *userData, const TGPicture *open = nullptr,
336 const TGPicture *closed = nullptr,
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);
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);
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) override;
359 void End(Bool_t select = kFALSE) override;
360 void PageUp(Bool_t select = kFALSE) override;
361 void PageDown(Bool_t select = kFALSE) override;
362 void LineUp(Bool_t select = kFALSE) override;
363 void LineDown(Bool_t select = kFALSE) override;
364 void Search(Bool_t close = kTRUE) override;
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(nullptr, 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) override;
429 Bool_t HandleDNDLeave() override;
430
431 TDNDData *GetDNDData(Atom_t) override { return &fDNDData; }
432
434 void SetColorMode(EColorMarkupMode colorMode) { fColorMode = colorMode; }
435
438
439 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
440
441 ClassDefOverride(TGListTree,0) //Show items in a tree structured list
442};
443
444#endif
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:92
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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:168
#define gClient
Definition TGClient.h:157
@ kIsDNDTarget
Definition TGFrame.h:76
@ kIsDNDSource
Definition TGFrame.h:75
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t Atom_t typelist
Option_t Option_t TPoint TPoint const char text
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
TString fTipText
tooltip text
Definition TGListTree.h:134
const char * GetTipText() const override
Definition TGListTree.h:159
void * GetUserData() const override
Definition TGListTree.h:165
Bool_t fHasColor
true if item has assigned color
Definition TGListTree.h:141
void CheckItem(Bool_t checked=kTRUE) override
Definition TGListTree.h:174
TGListTreeItemStd & operator=(const TGListTreeItemStd &)=delete
void SetColor(Color_t color) override
Definition TGListTree.h:186
void SetCheckBox(Bool_t on=kTRUE) override
Set a check box on the tree node.
void CheckAllChildren(Bool_t state=kTRUE) override
Set all child items of this one checked if state=kTRUE, unchecked if state=kFALSE.
const TGPicture * GetCheckBoxPicture() const override
Definition TGListTree.h:168
Int_t GetTextLength() const override
Definition TGListTree.h:158
void SetPictures(const TGPicture *opened, const TGPicture *closed) override
Change list tree item icons.
void Toggle() override
Definition TGListTree.h:175
Bool_t IsActive() const override
Definition TGListTree.h:154
const TGPicture * fCheckedPic
icon for checked item
Definition TGListTree.h:137
void ClearColor() override
Definition TGListTree.h:187
const TGPicture * fClosedPic
icon for closed state
Definition TGListTree.h:136
const char * GetText() const override
Definition TGListTree.h:157
Bool_t IsChecked() const override
Definition TGListTree.h:176
Bool_t fActive
true if item is active
Definition TGListTree.h:129
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
Bool_t HasColor() const override
Definition TGListTree.h:184
void SavePrimitive(std::ostream &out, Option_t *option, Int_t n) override
Save a list tree item attributes as a C++ statements on output stream.
Pixel_t GetActiveColor() const override
Return color for marking items that are active or selected.
Bool_t HasCheckBox() const override
Definition TGListTree.h:173
const TGPicture * fUncheckedPic
icon for unchecked item
Definition TGListTree.h:138
Bool_t HasCheckedChild(Bool_t first=kFALSE) override
Add all child items of 'item' into the list 'checked'.
Bool_t fCheckBox
true if checkbox is visible
Definition TGListTree.h:130
void CheckChildren(TGListTreeItem *item, Bool_t state) override
Set all child items of 'item' checked if state=kTRUE; unchecked if state=kFALSE.
void * fUserData
pointer to user data structure
Definition TGListTree.h:139
void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked) override
Change list tree check item icons.
Bool_t fChecked
true if item is checked
Definition TGListTree.h:131
Bool_t HasUnCheckedChild(Bool_t first=kFALSE) override
Add all child items of 'item' into the list 'checked'.
Color_t GetColor() const override
Definition TGListTree.h:185
TGListTreeItemStd(const TGListTreeItemStd &)=delete
void SetText(const char *text) override
Definition TGListTree.h:161
TString fText
item text
Definition TGListTree.h:133
void SetTipText(const char *tip) override
Definition TGListTree.h:162
void UpdateState() override
Update the state of the node 'item' according to the children states.
Int_t GetTipTextLength() const override
Definition TGListTree.h:160
const TGPicture * fOpenPic
icon for open state
Definition TGListTree.h:135
~TGListTreeItemStd() override
Delete list tree item.
void SetUserData(void *userData, Bool_t own=kFALSE) override
Definition TGListTree.h:164
const TGPicture * GetPicture() const override
Definition TGListTree.h:167
void SetActive(Bool_t a) override
Definition TGListTree.h:155
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
GContext_t fColorGC
drawing context for main item color
Definition TGListTree.h:244
Bool_t HandleButton(Event_t *event) override
Handle button events in the list tree.
void DisableOpen(Bool_t disable=kTRUE)
Definition TGListTree.h:376
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
void OnMouseOver(TGFrame *) override
Signal emitted when pointer is over entry.
Definition TGListTree.h:292
Bool_t HandleKey(Event_t *event) override
The key press event handler converts a key press to some line editor action.
TGListTreeItem * fSelected
pointer to selected item in list
Definition TGListTree.h:212
Bool_t HandleDNDLeave() override
Handle drag leave events.
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 Clicked(TGFrame *, Int_t) override
Emit Clicked() signal.
Definition TGListTree.h:296
void RemoveReference(TGListTreeItem *item)
This function removes the specified item from the linked list.
UInt_t fDefw
default list width
Definition TGListTree.h:225
static Pixel_t fgGrayPixel
Definition TGListTree.h:246
void ClearHighlighted()
Un highlight items.
void PDeleteChildren(TGListTreeItem *item)
Recursively delete all children of an item.
void CurrentChanged(Int_t, Int_t) override
Emit signal when current position changed.
Definition TGListTree.h:293
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGListTree.h:326
void InsertChildren(TGListTreeItem *parent, TGListTreeItem *item)
Insert a list of ALREADY LINKED children into another list.
void Draw(Option_t *="") override
Default Draw method for all objects.
Definition TGListTree.h:267
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 UnselectAll(Bool_t draw)
Unselect all items.
Bool_t fDisableOpen
disable branch opening on double-clicks
Definition TGListTree.h:237
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
Atom_t HandleDNDEnter(Atom_t *typelist) override
Handle drag enter events.
void InsertChild(TGListTreeItem *parent, TGListTreeItem *item)
Insert child in list.
void Search(Bool_t close=kTRUE) override
Invokes search dialog. Looks for item with the entered name.
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:434
void PageUp(Bool_t select=kFALSE) override
Move content one page up.
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 AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
void KeyPressed(TGFrame *, UInt_t, UInt_t) override
Signal emitted when keyboard key pressed.
Definition TGListTree.h:300
void CurrentChanged(TGFrame *) override
Emit signal when current selected frame changed.
Definition TGListTree.h:294
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
Bool_t HasUserControl() const
Definition TGListTree.h:421
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event.
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 ReturnPressed(TGFrame *) override
Signal emitted when Return/Enter key pressed.
Definition TGListTree.h:295
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
void DoubleClicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit DoubleClicked() signal.
Definition TGListTree.h:299
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...
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
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).
void Layout() override
Layout container entries.
Definition TGListTree.h:290
virtual void DrawActive(Handle_t id, TGListTreeItem *item)
Draw active item with its active color.
TDNDData * GetDNDData(Atom_t) override
Definition TGListTree.h:431
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:437
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.
void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Redraw list tree.
TGListTreeItem * fTipItem
item for which tooltip is set
Definition TGListTree.h:230
Int_t FontAscent()
Returns ascent of currently used font.
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click event in the list tree (only for kButton1).
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:436
void DoubleClicked(TGFrame *, Int_t) override
Emit DoubleClicked() signal.
Definition TGListTree.h:298
static const TGPicture * fgCheckedPic
icon for checked item
Definition TGListTree.h:255
void End(Bool_t select=kFALSE) override
Move content to the bottom.
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
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
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a list tree widget as a C++ statements on output stream out.
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.
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 AdjustPosition() override
Move content to position of highlighted/activated frame.
Definition TGListTree.h:355
TBufferFile * fBuf
buffer used for Drag and Drop
Definition TGListTree.h:231
void Clicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit Clicked() signal.
Definition TGListTree.h:297
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
TGToolTip * fTip
tooltip shown when moving over list items
Definition TGListTree.h:229
TGListTreeItem * GetCurrent() const
Definition TGListTree.h:383
void DrawItemName(Handle_t id, TGListTreeItem *item)
Draw name of list tree item.
~TGListTree() override
Delete list tree widget.
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.
Int_t SearchChildren(TGListTreeItem *item, Int_t y, Int_t findy, TGListTreeItem **finditem)
Search child item.
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 Home(Bool_t select=kFALSE) override
Move content to the top.
void LineUp(Bool_t select=kFALSE) override
Move content one item-size up.
Int_t fVspacing
vertical spacing between items
Definition TGListTree.h:216
FontStruct_t fFont
font used to draw item text
Definition TGListTree.h:224
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.
void PDeleteItem(TGListTreeItem *item)
Delete given item.
void SetToolTipItem(TGListTreeItem *item, const char *string)
Set tooltip text for this item.
void PageDown(Bool_t select=kFALSE) override
Move content one page down.
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot) override
Handle dragging position events.
void LineDown(Bool_t select=kFALSE) override
Move content one item-size down.
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:433
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.
static const TGFont * fgDefaultFont
Definition TGListTree.h:247
GContext_t fActiveGC
activated (selected) drawing context
Definition TGListTree.h:220
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE) override
Definition TGListTree.h:284
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
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
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:139
Ssiz_t Length() const
Definition TString.h:421
const char * Data() const
Definition TString.h:380
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()