12#ifndef ROOT_TGListTree
13#define ROOT_TGListTree
149 TString SaveTreeItem(std::ostream &out,
const char *treevarname,
const char *parent_var_name)
override;
203#if defined(__clang__) && __clang_major__ < 20
204#pragma clang diagnostic push
205#pragma clang diagnostic ignored "-Wshadow"
208#if defined(__clang__) && __clang_major__ < 20
209#pragma clang diagnostic pop
345 void *userData,
const TGPicture *open =
nullptr,
Handle_t GContext_t
Graphics context handle.
Handle_t FontStruct_t
Pointer to font structure.
ULong_t Pixel_t
Pixel value.
ULongptr_t Handle_t
Generic resource handle.
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Color_t
Color number (short).
const char Option_t
Option string (const char).
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Drag and drop data container.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
TGCanvas * fCanvas
pointer to canvas
virtual void AdjustPosition()
Move content to position of highlighted/activated frame.
TGContainer(const TGContainer &)=delete
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.
TGFrame(const TGFrame &)=delete
static Pixel_t GetWhitePixel()
Get white pixel value.
Encapsulate a graphics context used in the low level graphics.
TString fTipText
tooltip text
const char * GetTipText() const override
void * GetUserData() const override
Bool_t fHasColor
true if item has assigned color
void CheckItem(Bool_t checked=kTRUE) override
TGListTreeItemStd & operator=(const TGListTreeItemStd &)=delete
void SetColor(Color_t color) override
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
Int_t GetTextLength() const override
void SetPictures(const TGPicture *opened, const TGPicture *closed) override
Change list tree item icons.
Bool_t IsActive() const override
const TGPicture * fCheckedPic
icon for checked item
void ClearColor() override
const TGPicture * fClosedPic
icon for closed state
const char * GetText() const override
Bool_t IsChecked() const override
Bool_t fActive
true if item is active
Color_t fColor
item's color
Bool_t fOwnsData
true if user data has to be deleted
Bool_t HasColor() const override
Pixel_t GetActiveColor() const override
Return color for marking items that are active or selected.
Bool_t HasCheckBox() const override
const TGPicture * fUncheckedPic
icon for unchecked item
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
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
void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked) override
Change list tree check item icons.
Bool_t fChecked
true if item is checked
Bool_t HasUnCheckedChild(Bool_t first=kFALSE) override
Add all child items of 'item' into the list 'checked'.
Color_t GetColor() const override
TGListTreeItemStd(const TGListTreeItemStd &)=delete
void SetText(const char *text) override
void SetTipText(const char *tip) override
void UpdateState() override
Update the state of the node 'item' according to the children states.
Int_t GetTipTextLength() const override
const TGPicture * fOpenPic
icon for open state
~TGListTreeItemStd() override
Delete list tree item.
void SetUserData(void *userData, Bool_t own=kFALSE) override
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
void SetActive(Bool_t a) override
TGListTreeItem * GetFirstChild() const
TGListTreeItem & operator=(const TGListTreeItem &)=delete
void Rename(const char *new_name)
virtual void CheckChildren(TGListTreeItem *, Bool_t)
virtual void SetCheckBoxPictures(const TGPicture *, const TGPicture *)
virtual Bool_t IsActive() const =0
virtual const char * GetText() const =0
virtual void CheckAllChildren(Bool_t=kTRUE)
TGListTreeItem * fLastchild
pointer to last child item
TGListTreeItem * fFirstchild
pointer to first child item
virtual void ClearColor()
virtual void HandleDrag()
TGListTreeItem * GetNextSibling() const
virtual void CheckItem(Bool_t=kTRUE)=0
TGListTreeItem * fParent
pointer to parent
TGListTreeItem * fPrevsibling
pointer to previous sibling
Bool_t IsDNDTarget() const
TGListTreeItem * GetLastChild() const
Bool_t IsDNDSource() const
virtual Bool_t HasCheckedChild(Bool_t=kFALSE)
TGClient * fClient
pointer to TGClient
TGListTreeItem * GetParent() const
Bool_t fOpen
true if item is open
virtual TString SaveTreeItem(std::ostream &, const char *, const char *)
void SetDNDTarget(Bool_t onoff)
TGListTreeItem(const TGListTreeItem &)=delete
virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE)
virtual void SetTipText(const char *)
virtual void SetActive(Bool_t)
virtual Int_t GetTextLength() const =0
virtual const TGPicture * GetCheckBoxPicture() const =0
Int_t fDNDState
EDNDFlags.
virtual Bool_t IsOpen() const
void SetDNDSource(Bool_t onoff)
virtual void SetPictures(const TGPicture *, const TGPicture *)
TGListTreeItem * GetPrevSibling() const
virtual void HandleDrop()
virtual Color_t GetColor() const =0
virtual void SetText(const char *)
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)
virtual Pixel_t GetActiveColor() const =0
virtual void SetCheckBox(Bool_t=kTRUE)
virtual Bool_t HasCheckBox() const =0
virtual void UpdateState()
virtual Bool_t HasColor() const =0
virtual void * GetUserData() const =0
virtual ~TGListTreeItem()
virtual void SetUserData(void *, Bool_t=kFALSE)
virtual const char * GetTipText() const =0
TGListTreeItem * fNextsibling
pointer to next sibling
virtual Bool_t HandlesDragAndDrop() const
virtual void SetColor(Color_t)
virtual Int_t GetTipTextLength() const =0
static const TGPicture * GetOpenPic()
Returns the icon used by items in open state.
UInt_t fLastEventState
modifier state of the last keyboard event
GContext_t fColorGC
drawing context for main item color
Bool_t HandleButton(Event_t *event) override
Handle button events in the list tree.
void DisableOpen(Bool_t disable=kTRUE)
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
void OnMouseOver(TGFrame *) override
Signal emitted when pointer is over entry.
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
Bool_t HandleDNDLeave() override
Handle drag leave events.
Int_t SortSiblings(TGListTreeItem *item)
Sort siblings of item.
GContext_t fLineGC
dashed line drawing context
static const TGPicture * GetUncheckedPic()
Returns the icon used for unchecked checkbox.
TGListTreeItem * GetBelowMouse() const
void Clicked(TGFrame *, Int_t) override
Emit Clicked() signal.
void RemoveReference(TGListTreeItem *item)
This function removes the specified item from the linked list.
UInt_t fDefw
default list width
static Pixel_t fgGrayPixel
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.
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
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.
ECheckMode fCheckMode
how to propagate check properties through the tree
static const TGPicture * GetClosedPic()
Returns the icon used by items in closed state.
void UnselectAll(Bool_t draw)
Unselect all items.
Bool_t fDisableOpen
disable branch opening on double-clicks
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
void SetColorMode(EColorMarkupMode colorMode)
void PageUp(Bool_t select=kFALSE) override
Move content one page up.
void RenameItem(TGListTreeItem *item, const char *string)
Rename item in list tree.
GContext_t fHighlightGC
highlighted icon drawing context
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.
void CurrentChanged(TGFrame *) override
Emit signal when current selected frame changed.
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
Bool_t HasUserControl() const
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)
TGListTreeItem * fBelowMouse
pointer to item below mouses cursor
Int_t FontHeight()
Returns height of currently used font.
void ReturnPressed(TGFrame *) override
Signal emitted when Return/Enter key pressed.
void AddRoot(const char *string)
TGListTreeItem * fLast
pointer to last item in list
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)
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
void DoubleClicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit DoubleClicked() signal.
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
static const TGPicture * GetCheckedPic()
Returns the icon used for checked checkbox.
TDNDData fDNDData
Drag and Drop data.
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.
virtual void DrawActive(Handle_t id, TGListTreeItem *item)
Draw active item with its active color.
TDNDData * GetDNDData(Atom_t) override
Pixel_t fGrayPixel
gray draw color
Int_t Reparent(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of item.
TGListTreeItem * GetSelected() const
void GetChecked(TList *checked)
Add all checked list tree items of this list tree into the list 'checked'.
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
void SetCheckMode(ECheckMode mode)
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
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
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)
TGListTree & operator=(const TGListTree &)=delete
virtual void DataDropped(TGListTreeItem *item, TDNDData *data)
Emit DataDropped() signal.
Bool_t IsEventHandled() const
Int_t fHspacing
horizontal spacing between items
static const TGPicture * fgClosedPic
icon for closed item
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
static const TGPicture * fgUncheckedPic
icon for unchecked item
Int_t fMargin
number of pixels margin from left side
static const TGGC & GetHighlightGC()
Return graphics context for highlighted frame background.
UInt_t fDefh
default list height
void GetCheckedChildren(TList *checked, TGListTreeItem *item)
Add all child items of 'item' into the list 'checked'.
ECheckMode GetCheckMode() const
void DoubleClicked(TGFrame *, Int_t) override
Emit DoubleClicked() signal.
static const TGPicture * fgCheckedPic
icon for checked item
void End(Bool_t select=kFALSE) override
Move content to the bottom.
void SetSelected(TGListTreeItem *item)
TGListTreeItem * GetFirstItem() const
void SetEventHandled(Bool_t eh=kTRUE)
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
virtual void SetCanvas(TGCanvas *canvas)
void AddItem(const char *string)
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
TGListTree(const TGListTree &)=delete
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
static const TGPicture * fgOpenPic
icon for open item
EColorMarkupMode fColorMode
if/how to render item's main color
Atom_t * fDNDTypeList
handles DND types
Int_t Sort(TGListTreeItem *item)
Sort items starting with item.
Bool_t fAutoCheckBoxPic
change check box picture if parent and children have diffrent state
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
void AdjustPosition() override
Move content to position of highlighted/activated frame.
TBufferFile * fBuf
buffer used for Drag and Drop
void Clicked(TGFrame *, Int_t, Int_t, Int_t) override
Emit Clicked() signal.
Bool_t HandleDNDDrop(TDNDData *data) override
Handle drop events.
TGToolTip * fTip
tooltip shown when moving over list items
TGListTreeItem * GetCurrent() const
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
TGListTreeItem * fCurrent
pointer to current item in list
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
void SetUserControl(Bool_t ctrl=kTRUE)
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
FontStruct_t fFont
font used to draw item text
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
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
Bool_t fAutoTips
assume item->fUserData is TObject and use GetTitle() for tip text
TGListTreeItem * FindSiblingByData(TGListTreeItem *item, void *userData)
Find sibling of item by userData.
static const TGFont * fgDefaultFont
GContext_t fActiveGC
activated (selected) drawing context
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE) override
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.
ROOT GUI Window base class.
Mother of all ROOT objects.