Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
54 virtual TString SaveTreeItem(std::ostream &, const char *, const char *) { return ""; }
55
56public:
58 virtual ~TGListTreeItem() {}
59
60 TGListTreeItem *GetParent() const { return fParent; }
65
66 virtual Bool_t IsOpen() const { return fOpen; }
67 virtual void SetOpen(Bool_t o) { fOpen = o; }
68
69 virtual Bool_t IsActive() const = 0;
70 virtual Pixel_t GetActiveColor() const = 0;
71 virtual void SetActive(Bool_t) {}
72
73 void Rename(const char* new_name) { SetText(new_name); }
74 virtual const char *GetText() const = 0;
75 virtual Int_t GetTextLength() const = 0;
76 virtual const char *GetTipText() const = 0;
77 virtual Int_t GetTipTextLength() const = 0;
78 virtual void SetText(const char *) {}
79 virtual void SetTipText(const char *) {}
80
81 virtual void SetUserData(void *, Bool_t=kFALSE) {}
82 virtual void *GetUserData() const = 0;
83
84 virtual const TGPicture*GetPicture() const = 0;
85 virtual void SetPictures(const TGPicture*, const TGPicture*) {}
86 virtual const TGPicture*GetCheckBoxPicture() const = 0;
87 virtual void SetCheckBoxPictures(const TGPicture*, const TGPicture*) {}
88 virtual UInt_t GetPicWidth() const;
89
90 virtual void SetCheckBox(Bool_t=kTRUE) {}
91 virtual Bool_t HasCheckBox() const = 0;
92 virtual void CheckItem(Bool_t=kTRUE) = 0;
93 virtual void Toggle() { SetCheckBox( ! IsChecked()); }
94 virtual Bool_t IsChecked() const = 0;
95
96 // Propagation of checked-state form children to parents.
97 virtual void CheckAllChildren(Bool_t=kTRUE) {}
99 virtual Bool_t HasCheckedChild(Bool_t=kFALSE) { return kTRUE; } // !!!!
100 virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE) { return kTRUE; } // !!!!
101 virtual void UpdateState() {}
102
103 // Item coloration (underline + minibox)
104 virtual Bool_t HasColor() const = 0;
105 virtual Color_t GetColor() const = 0;
106 virtual void SetColor(Color_t) {}
107 virtual void ClearColor() {}
108
109 // Drag and drop.
116
117 // Allow handling by the items themselves ... NOT USED in TGListTree yet !!!!
118 virtual Bool_t HandlesDragAndDrop() const { return kFALSE; }
119 virtual void HandleDrag() {}
120 virtual void HandleDrop() {}
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
147protected:
148
149 TString SaveTreeItem(std::ostream &out, const char *treevarname, const char *parent_var_name) override;
150
151public:
152 TGListTreeItemStd(TGClient *fClient = gClient, const char *name = nullptr,
153 const TGPicture *opened = nullptr, const TGPicture *closed = nullptr,
155 ~TGListTreeItemStd() override;
156
157 Pixel_t GetActiveColor() const override;
158 Bool_t IsActive() const override { return fActive; }
159 void SetActive(Bool_t a) override { fActive = a; }
160
161 const char *GetText() const override { return fText.Data(); }
162 Int_t GetTextLength() const override { return fText.Length(); }
163 const char *GetTipText() const override { return fTipText.Data(); }
164 Int_t GetTipTextLength() const override { return fTipText.Length(); }
165 void SetText(const char *text) override { fText = text; }
166 void SetTipText(const char *tip) override { fTipText = tip; }
167
169 void *GetUserData() const override { return fUserData; }
170
171 const TGPicture *GetPicture() const override { return fOpen ? fOpenPic : fClosedPic; }
172 const TGPicture *GetCheckBoxPicture() const override { return fCheckBox ? (fChecked ? fCheckedPic : fUncheckedPic) : nullptr; }
173 void SetPictures(const TGPicture *opened, const TGPicture *closed) override;
174 void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked) override;
175
176 void SetCheckBox(Bool_t on = kTRUE) override;
177 Bool_t HasCheckBox() const override { return fCheckBox; }
178 void CheckItem(Bool_t checked = kTRUE) override { fChecked = checked; }
179 void Toggle() override { fChecked = !fChecked; }
180 Bool_t IsChecked() const override { return fChecked; }
181
182 void CheckAllChildren(Bool_t state = kTRUE) override;
183 void CheckChildren(TGListTreeItem *item, Bool_t state) override;
184 Bool_t HasCheckedChild(Bool_t first=kFALSE) override;
185 Bool_t HasUnCheckedChild(Bool_t first=kFALSE) override;
186 void UpdateState() override;
187
188 Bool_t HasColor() const override { return fHasColor; }
189 Color_t GetColor() const override { return fColor; }
190 void SetColor(Color_t color) override { fHasColor = true;fColor = color; }
191 void ClearColor() override { fHasColor = false; }
192
193 ClassDefOverride(TGListTreeItemStd,0) //Item that goes into a TGListTree container
194};
195
196
197class TGListTree : public TGContainer {
198
199public:
200 //---- color markup mode of tree items
208 kRecursive = BIT(3)
209 };
210
211protected:
212 TGListTreeItem *fFirst; ///< pointer to first item in list
213 TGListTreeItem *fLast; ///< pointer to last item in list
214 TGListTreeItem *fSelected; ///< pointer to selected item in list
215 TGListTreeItem *fCurrent; ///< pointer to current item in list
216 TGListTreeItem *fBelowMouse; ///< pointer to item below mouses cursor
217 Int_t fHspacing; ///< horizontal spacing between items
218 Int_t fVspacing; ///< vertical spacing between items
219 Int_t fIndent; ///< number of pixels indentation
220 Int_t fMargin; ///< number of pixels margin from left side
221 Pixel_t fGrayPixel; ///< gray draw color
222 GContext_t fActiveGC; ///< activated (selected) drawing context
223 GContext_t fDrawGC; ///< icon drawing context
224 GContext_t fLineGC; ///< dashed line drawing context
225 GContext_t fHighlightGC; ///< highlighted icon drawing context
226 FontStruct_t fFont; ///< font used to draw item text
227 UInt_t fDefw; ///< default list width
228 UInt_t fDefh; ///< default list height
229 Int_t fExposeTop; ///< top y postion of visible region
230 Int_t fExposeBottom; ///< bottom y position of visible region
231 TGToolTip *fTip; ///< tooltip shown when moving over list items
232 TGListTreeItem *fTipItem; ///< item for which tooltip is set
233 TBufferFile *fBuf; ///< buffer used for Drag and Drop
234 TDNDData fDNDData; ///< Drag and Drop data
235 Atom_t *fDNDTypeList; ///< handles DND types
236 TGListTreeItem *fDropItem; ///< item on which DND is over
237 Bool_t fAutoTips; ///< assume item->fUserData is TObject and use GetTitle() for tip text
238 Bool_t fAutoCheckBoxPic;///< change check box picture if parent and children have diffrent state
239 Bool_t fDisableOpen; ///< disable branch opening on double-clicks
240 Bool_t fUserControlled; ///< let user decides what is the behaviour on events
241 Bool_t fEventHandled; ///< flag used from user code to bypass standard event handling
242 UInt_t fLastEventState; ///< modifier state of the last keyboard event
243
244 EColorMarkupMode fColorMode; ///< if/how to render item's main color
245 ECheckMode fCheckMode; ///< how to propagate check properties through the tree
246 GContext_t fColorGC; ///< drawing context for main item color
247
249 static const TGFont *fgDefaultFont;
251 static TGGC *fgDrawGC;
252 static TGGC *fgLineGC;
255 static const TGPicture *fgOpenPic; ///< icon for open item
256 static const TGPicture *fgClosedPic; ///< icon for closed item
257 static const TGPicture *fgCheckedPic; ///< icon for checked item
258 static const TGPicture *fgUncheckedPic; ///< icon for unchecked item
259
260 static Pixel_t GetGrayPixel();
262 static const TGGC &GetActiveGC();
263 static const TGGC &GetDrawGC();
264 static const TGGC &GetLineGC();
265 static const TGGC &GetHighlightGC();
266 static const TGGC &GetColorGC();
267
269 void Draw(Option_t * ="") override { MayNotUse("Draw(Option_t*)"); }
276
277 void SaveChildren(std::ostream &out, const char *parent_var_name, TGListTreeItem *item);
291
292 void Layout() override {}
293
294 void OnMouseOver(TGFrame*) override { }
295 void CurrentChanged(Int_t /*x*/, Int_t /*y*/) override { }
296 void CurrentChanged(TGFrame *) override { }
297 void ReturnPressed(TGFrame*) override { }
298 void Clicked(TGFrame *, Int_t /*btn*/) override { }
299 void Clicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) override { }
300 void DoubleClicked(TGFrame *, Int_t /*btn*/) override { }
301 void DoubleClicked(TGFrame *, Int_t /*btn*/, Int_t /*x*/, Int_t /*y*/) override { }
302 void KeyPressed(TGFrame *, UInt_t /*keysym*/, UInt_t /*mask*/) override { }
303
304private:
305 TGListTree(const TGListTree&) = delete;
306 TGListTree& operator=(const TGListTree&) = delete;
307
308public:
309 TGListTree(TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
310 UInt_t options = 0, Pixel_t back = GetWhitePixel());
311 TGListTree(TGCanvas *p, UInt_t options, Pixel_t back = GetWhitePixel());
312
313 ~TGListTree() override;
314
315 Bool_t HandleButton(Event_t *event) override;
316 Bool_t HandleDoubleClick(Event_t *event) override;
317 Bool_t HandleCrossing(Event_t *event) override;
318 Bool_t HandleMotion(Event_t *event) override;
319 Bool_t HandleKey(Event_t *event) override;
320
321 virtual void SetCanvas(TGCanvas *canvas) { fCanvas = canvas; }
322 void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override;
323
324 virtual void DrawOutline(Handle_t id, TGListTreeItem *item, Pixel_t col=0xbbbbbb,
325 Bool_t clear=kFALSE);
326 virtual void DrawActive(Handle_t id, TGListTreeItem *item);
327
329 { return TGDimension(fDefw, fDefh); }
330
332 TGListTreeItem *AddItem(TGListTreeItem *parent, const char *string,
333 const TGPicture *open = nullptr,
334 const TGPicture *closed = nullptr,
336 TGListTreeItem *AddItem(TGListTreeItem *parent, const char *string,
337 void *userData, const TGPicture *open = nullptr,
338 const TGPicture *closed = nullptr,
340 void RenameItem(TGListTreeItem *item, const char *string);
348
352 void SetToolTipItem(TGListTreeItem *item, const char *string);
358
359 // overwrite TGContainer's methods
360 void Home(Bool_t select = kFALSE) override;
361 void End(Bool_t select = kFALSE) override;
362 void PageUp(Bool_t select = kFALSE) override;
363 void PageDown(Bool_t select = kFALSE) override;
364 void LineUp(Bool_t select = kFALSE) override;
365 void LineDown(Bool_t select = kFALSE) override;
366 void Search(Bool_t close = kTRUE) override;
367
372 void ClearHighlighted();
373 void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth = 0);
374 void UnselectAll(Bool_t draw);
375 void SetToolTipText(const char *text, Int_t x, Int_t y, Long_t delayms);
379 void GetChecked(TList *checked);
382
383 TGListTreeItem *GetFirstItem() const { return fFirst; }
385 TGListTreeItem *GetCurrent() const { return fCurrent; }
391 TGListTreeItem *FindItemByPathname(const char *path);
393
394 void AddItem(const char *string) { AddItem(fSelected, string); } //*MENU*
395 void AddRoot(const char *string) { AddItem(nullptr, string); } //*MENU*
396 Int_t DeleteSelected() { return fSelected ? DeleteItem(fSelected) : 0; } //*MENU*
397 void RenameSelected(const char *string) { if (fSelected) RenameItem(fSelected, string); } //*MENU*
398
399 virtual void MouseOver(TGListTreeItem *entry); //*SIGNAL*
400 virtual void MouseOver(TGListTreeItem *entry, UInt_t mask); //*SIGNAL*
401 virtual void KeyPressed(TGListTreeItem *entry, UInt_t keysym, UInt_t mask); //*SIGNAL*
402 virtual void ReturnPressed(TGListTreeItem *entry); //*SIGNAL*
403 virtual void Clicked(TGListTreeItem *entry, Int_t btn); //*SIGNAL*
404 virtual void Clicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
405 virtual void Clicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y); //*SIGNAL*
406 virtual void DoubleClicked(TGListTreeItem *entry, Int_t btn); //*SIGNAL*
407 virtual void DoubleClicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y); //*SIGNAL*
408 virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
409 virtual void DataDropped(TGListTreeItem *item, TDNDData *data); //*SIGNAL*
410
411 // Utility functions
414 Int_t TextWidth(const char *c);
415
416 static const TGPicture *GetOpenPic();
417 static const TGPicture *GetClosedPic();
418 static const TGPicture *GetCheckedPic();
419 static const TGPicture *GetUncheckedPic();
420
421 // User control
426
429 Int_t xroot, Int_t yroot) override;
431 Bool_t HandleDNDLeave() override;
432
433 TDNDData *GetDNDData(Atom_t) override { return &fDNDData; }
434
437
440
441 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
442
443 ClassDefOverride(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
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:85
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:342
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:163
void * GetUserData() const override
Definition TGListTree.h:169
Bool_t fHasColor
true if item has assigned color
Definition TGListTree.h:141
void CheckItem(Bool_t checked=kTRUE) override
Definition TGListTree.h:178
TGListTreeItemStd & operator=(const TGListTreeItemStd &)=delete
void SetColor(Color_t color) override
Definition TGListTree.h:190
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:172
Int_t GetTextLength() const override
Definition TGListTree.h:162
void SetPictures(const TGPicture *opened, const TGPicture *closed) override
Change list tree item icons.
void Toggle() override
Definition TGListTree.h:179
Bool_t IsActive() const override
Definition TGListTree.h:158
const TGPicture * fCheckedPic
icon for checked item
Definition TGListTree.h:137
void ClearColor() override
Definition TGListTree.h:191
const TGPicture * fClosedPic
icon for closed state
Definition TGListTree.h:136
const char * GetText() const override
Definition TGListTree.h:161
Bool_t IsChecked() const override
Definition TGListTree.h:180
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:188
Pixel_t GetActiveColor() const override
Return color for marking items that are active or selected.
Bool_t HasCheckBox() const override
Definition TGListTree.h:177
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:189
TGListTreeItemStd(const TGListTreeItemStd &)=delete
void SetText(const char *text) override
Definition TGListTree.h:165
TString fText
item text
Definition TGListTree.h:133
void SetTipText(const char *tip) override
Definition TGListTree.h:166
void UpdateState() override
Update the state of the node 'item' according to the children states.
Int_t GetTipTextLength() const override
Definition TGListTree.h:164
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:168
TString SaveTreeItem(std::ostream &out, const char *treevarname, const char *parent_var_name) override
Save a list tree item attributes as a C++ statements on output stream.
const TGPicture * GetPicture() const override
Definition TGListTree.h:171
void SetActive(Bool_t a) override
Definition TGListTree.h:159
TGListTreeItem * GetFirstChild() const
Definition TGListTree.h:61
TGListTreeItem & operator=(const TGListTreeItem &)=delete
void Rename(const char *new_name)
Definition TGListTree.h:73
virtual void CheckChildren(TGListTreeItem *, Bool_t)
Definition TGListTree.h:98
virtual void SetCheckBoxPictures(const TGPicture *, const TGPicture *)
Definition TGListTree.h:87
virtual Bool_t IsActive() const =0
virtual const char * GetText() const =0
virtual void CheckAllChildren(Bool_t=kTRUE)
Definition TGListTree.h:97
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:107
virtual void HandleDrag()
Definition TGListTree.h:119
TGListTreeItem * GetNextSibling() const
Definition TGListTree.h:64
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:115
TGListTreeItem * GetLastChild() const
Definition TGListTree.h:62
Bool_t IsDNDSource() const
Definition TGListTree.h:114
virtual Bool_t HasCheckedChild(Bool_t=kFALSE)
Definition TGListTree.h:99
TGClient * fClient
pointer to TGClient
Definition TGListTree.h:35
TGListTreeItem * GetParent() const
Definition TGListTree.h:60
Bool_t fOpen
true if item is open
Definition TGListTree.h:42
virtual TString SaveTreeItem(std::ostream &, const char *, const char *)
Definition TGListTree.h:54
void SetDNDTarget(Bool_t onoff)
Definition TGListTree.h:112
TGListTreeItem(const TGListTreeItem &)=delete
virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE)
Definition TGListTree.h:100
virtual void SetTipText(const char *)
Definition TGListTree.h:79
virtual void SetActive(Bool_t)
Definition TGListTree.h:71
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:66
void SetDNDSource(Bool_t onoff)
Definition TGListTree.h:110
virtual void SetPictures(const TGPicture *, const TGPicture *)
Definition TGListTree.h:85
TGListTreeItem * GetPrevSibling() const
Definition TGListTree.h:63
virtual void HandleDrop()
Definition TGListTree.h:120
virtual Color_t GetColor() const =0
virtual void SetText(const char *)
Definition TGListTree.h:78
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:67
virtual Pixel_t GetActiveColor() const =0
virtual void SetCheckBox(Bool_t=kTRUE)
Definition TGListTree.h:90
virtual void Toggle()
Definition TGListTree.h:93
virtual Bool_t HasCheckBox() const =0
virtual void UpdateState()
Definition TGListTree.h:101
virtual Bool_t HasColor() const =0
virtual void * GetUserData() const =0
virtual ~TGListTreeItem()
Definition TGListTree.h:58
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition TGListTree.h:81
virtual const char * GetTipText() const =0
TGListTreeItem * fNextsibling
pointer to next sibling
Definition TGListTree.h:40
virtual Bool_t HandlesDragAndDrop() const
Definition TGListTree.h:118
virtual void SetColor(Color_t)
Definition TGListTree.h:106
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:197
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:242
GContext_t fColorGC
drawing context for main item color
Definition TGListTree.h:246
Bool_t HandleButton(Event_t *event) override
Handle button events in the list tree.
void DisableOpen(Bool_t disable=kTRUE)
Definition TGListTree.h:378
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:294
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:214
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:224
static const TGPicture * GetUncheckedPic()
Returns the icon used for unchecked checkbox.
TGListTreeItem * GetBelowMouse() const
Definition TGListTree.h:386
void Clicked(TGFrame *, Int_t) override
Emit Clicked() signal.
Definition TGListTree.h:298
void RemoveReference(TGListTreeItem *item)
This function removes the specified item from the linked list.
UInt_t fDefw
default list width
Definition TGListTree.h:227
static Pixel_t fgGrayPixel
Definition TGListTree.h:248
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:295
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGListTree.h:328
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:269
ECheckMode fCheckMode
how to propagate check properties through the tree
Definition TGListTree.h:245
static const TGPicture * GetClosedPic()
Returns the icon used by items in closed state.
static TGGC * fgLineGC
Definition TGListTree.h:252
void UnselectAll(Bool_t draw)
Unselect all items.
Bool_t fDisableOpen
disable branch opening on double-clicks
Definition TGListTree.h:239
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:223
void SetColorMode(EColorMarkupMode colorMode)
Definition TGListTree.h:436
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:250
GContext_t fHighlightGC
highlighted icon drawing context
Definition TGListTree.h:225
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:302
void CurrentChanged(TGFrame *) override
Emit signal when current selected frame changed.
Definition TGListTree.h:296
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
Bool_t HasUserControl() const
Definition TGListTree.h:423
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:354
TGListTreeItem * fBelowMouse
pointer to item below mouses cursor
Definition TGListTree.h:216
Int_t FontHeight()
Returns height of currently used font.
void ReturnPressed(TGFrame *) override
Signal emitted when Return/Enter key pressed.
Definition TGListTree.h:297
void AddRoot(const char *string)
Definition TGListTree.h:395
TGListTreeItem * fLast
pointer to last item in list
Definition TGListTree.h:213
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:353
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:230
void DoubleClicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit DoubleClicked() signal.
Definition TGListTree.h:301
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:253
static const TGPicture * GetCheckedPic()
Returns the icon used for checked checkbox.
TDNDData fDNDData
Drag and Drop data.
Definition TGListTree.h:234
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:292
virtual void DrawActive(Handle_t id, TGListTreeItem *item)
Draw active item with its active color.
TDNDData * GetDNDData(Atom_t) override
Definition TGListTree.h:433
Pixel_t fGrayPixel
gray draw color
Definition TGListTree.h:221
Int_t Reparent(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of item.
TGListTreeItem * GetSelected() const
Definition TGListTree.h:384
void GetChecked(TList *checked)
Add all checked list tree items of this list tree into the list 'checked'.
static TGGC * fgColorGC
Definition TGListTree.h:254
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
void SetCheckMode(ECheckMode mode)
Definition TGListTree.h:439
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:236
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:232
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:397
TGListTree & operator=(const TGListTree &)=delete
virtual void DataDropped(TGListTreeItem *item, TDNDData *data)
Emit DataDropped() signal.
Bool_t IsEventHandled() const
Definition TGListTree.h:425
Int_t fHspacing
horizontal spacing between items
Definition TGListTree.h:217
static const TGPicture * fgClosedPic
icon for closed item
Definition TGListTree.h:256
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
static const TGPicture * fgUncheckedPic
icon for unchecked item
Definition TGListTree.h:258
Int_t fMargin
number of pixels margin from left side
Definition TGListTree.h:220
static const TGGC & GetHighlightGC()
Return graphics context for highlighted frame background.
UInt_t fDefh
default list height
Definition TGListTree.h:228
void GetCheckedChildren(TList *checked, TGListTreeItem *item)
Add all child items of 'item' into the list 'checked'.
ECheckMode GetCheckMode() const
Definition TGListTree.h:438
void DoubleClicked(TGFrame *, Int_t) override
Emit DoubleClicked() signal.
Definition TGListTree.h:300
static const TGPicture * fgCheckedPic
icon for checked item
Definition TGListTree.h:257
void End(Bool_t select=kFALSE) override
Move content to the bottom.
void SetSelected(TGListTreeItem *item)
Definition TGListTree.h:355
TGListTreeItem * GetFirstItem() const
Definition TGListTree.h:383
void SetEventHandled(Bool_t eh=kTRUE)
Definition TGListTree.h:424
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
virtual void SetCanvas(TGCanvas *canvas)
Definition TGListTree.h:321
void AddItem(const char *string)
Definition TGListTree.h:394
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:241
TGListTree(const TGListTree &)=delete
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
static const TGPicture * fgOpenPic
icon for open item
Definition TGListTree.h:255
EColorMarkupMode fColorMode
if/how to render item's main color
Definition TGListTree.h:244
Atom_t * fDNDTypeList
handles DND types
Definition TGListTree.h:235
static TGGC * fgDrawGC
Definition TGListTree.h:251
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:238
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:212
void AdjustPosition() override
Move content to position of highlighted/activated frame.
Definition TGListTree.h:357
TBufferFile * fBuf
buffer used for Drag and Drop
Definition TGListTree.h:233
void Clicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit Clicked() signal.
Definition TGListTree.h:299
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
TGToolTip * fTip
tooltip shown when moving over list items
Definition TGListTree.h:231
TGListTreeItem * GetCurrent() const
Definition TGListTree.h:385
void DrawItemName(Handle_t id, TGListTreeItem *item)
Draw name of list tree item.
~TGListTree() override
Delete list tree widget.
void SaveChildren(std::ostream &out, const char *parent_var_name, TGListTreeItem *item)
Save child items as a C++ statements on output stream out.
Bool_t fUserControlled
let user decides what is the behaviour on events
Definition TGListTree.h:240
TGListTreeItem * fCurrent
pointer to current item in list
Definition TGListTree.h:215
Int_t DeleteSelected()
Definition TGListTree.h:396
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:229
void SetUserControl(Bool_t ctrl=kTRUE)
Definition TGListTree.h:422
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:218
FontStruct_t fFont
font used to draw item text
Definition TGListTree.h:226
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:219
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:237
TGListTreeItem * FindSiblingByData(TGListTreeItem *item, void *userData)
Find sibling of item by userData.
static const TGFont * fgDefaultFont
Definition TGListTree.h:249
GContext_t fActiveGC
activated (selected) drawing context
Definition TGListTree.h:222
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE) override
Definition TGListTree.h:286
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:417
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
th1 Draw()