JG ROOT Tools libraries  version 5.0 - august 2014
RGItemTreeSelector Class Reference

#include <RGItemTreeSelector.hh>

Inheritance diagram for RGItemTreeSelector:

Public Types

enum  TreeContextMenu {
  menuFoldersOpen = 0x00010000, menuFoldersOpenAll = 0x00020000, menuFoldersClose = 0x00030000, menuFoldersCloseAll = 0x00040000,
  menuMoveTop = 0x00100000, menuMoveUp = 0x00200000, menuMoveDown = 0x00300000, menuMoveBottom = 0x00400000,
  menuMoveToFolder = 0x00500000, menuMoveToParent = 0x00600000, menuFolderCreate = 0x00700000, menuFolderNewItem = 0x00800000,
  menuItemEdit = 0x00900000, menuItemDelete = 0x00A00000, menuDummy = 0x00000000
}
 

Public Member Functions

Sub-widgets functions
virtual TGListTree * GetListTree () const
 
virtual TGTextButton * GetAllButton () const
 
virtual TGTextButton * GetNoneButton () const
 
virtual TGTextButton * GetInvertButton () const
 
virtual TGVerticalFrame * GetSideButtonsFrame () const
 
virtual TGVerticalFrame * GetFoldersButtonsFrame () const
 
virtual TGTextButton * GetFoldersOpenButton () const
 
virtual TGTextButton * GetFoldersCloseButton () const
 
virtual TGVerticalFrame * GetMoveButtonsFrame () const
 
virtual TGTextButton * GetMoveUpButton () const
 
virtual TGTextButton * GetMoveDownButton () const
 
virtual TGTextButton * GetMoveTopButton () const
 
virtual TGTextButton * GetMoveBottomButton () const
 
virtual TGTextButton * GetMoveParentButton () const
 
virtual TGTextButton * GetMoveFolderButton () const
 
virtual TGVerticalFrame * GetEditButtonsFrame () const
 
virtual TGTextButton * GetNewFolderButton () const
 
virtual TGTextButton * GetNewItemButton () const
 
virtual TGTextButton * GetEditItemButton () const
 
virtual TGTextButton * GetDeleteButton () const
 
virtual TGVerticalFrame * GetCustomButtonsFrame () const
 
virtual TGButton * AddSideButton (const char *text, const Int_t id, TGLayoutHints *l, const char *tooltip=NULL)
 
virtual TGButton * AddSideButton (TGButton *but, const Int_t id, TGLayoutHints *l)
 
virtual TGFrame * AddSideFrame (TGFrame *f, TGLayoutHints *l=NULL)
 
virtual TGFrame * AddBottomFrame (TGFrame *f, TGLayoutHints *l=NULL)
 
virtual void AddMenuItemSeparator ()
 
virtual void AddMenuItemEntry (const string &title, Int_t id)
 
virtual void AddMenuItemEntry (const string &title, TGPopupMenu *submenu)
 
virtual void AddMenuFolderSeparator ()
 
virtual void AddMenuFolderEntry (const string &title, Int_t id)
 
virtual void AddMenuFolderEntry (const string &title, TGPopupMenu *submenu)
 
Internal functions (no need to be protected)
virtual void UpdateItemSelection (GItemTreeBranch *branch=NULL)
 
virtual void RecreateTreeDisplay ()
 
virtual void RecreateTreeSubDisplay (GItemTreeBranch *branch)
 
virtual void UpdateTreeDisplay ()
 
virtual void UpdateButtonsState ()
 
virtual void UpdateMenuItem (GItemTreeLeaf *leaf)
 
virtual void UpdateMenuFolder (GItemTreeBranch *branch)
 
Tree structure functions
const GItemTreeBranch * GetTreeRoot () const
 
void SetDefaultPicture (const string &pic_name)
 
GItemTreeBranch * AddFolder (const string &name)
 
GItemTreeBranch * AddFolder (GItemTreeBranch *parent, const string &name)
 
GItemTreeLeaf * AddElement (const string &name, void *data, const TGPicture *pic=NULL)
 
GItemTreeLeaf * AddElement (GItemTreeBranch *parent, const string &name, void *data, const TGPicture *pic=NULL)
 
GItemTreeBranch * SetRootNode (GItemTreeBranch *root, bool adopt=false)
 
virtual TGListTreeItem * SelectItem (GItemTreeNode *node)
 
virtual TGListTreeItem * SelectItem (TGListTreeItem *elem)
 
GItemTreeNode * GetSelected () const
 
GItemTreeLeaf * GetSelectedLeaf () const
 
Buttons / menu related actions
virtual void OpenSelectedSubFolders ()
 
virtual void CloseSelectedSubFolders ()
 
virtual void OpenSubFolders (TGListTreeItem *item)
 
virtual void CloseSubFolders (TGListTreeItem *item)
 
virtual void OpenAllFolders ()
 
virtual void CloseAllFolders ()
 
virtual void MoveSelectedMoveTop (Bool_t emit=kTRUE)
 
virtual void MoveSelectedMoveUp (Bool_t emit=kTRUE)
 
virtual void MoveSelectedMoveDown (Bool_t emit=kTRUE)
 
virtual void MoveSelectedMoveBottom (Bool_t emit=kTRUE)
 
virtual void MoveSelectedToParent (Bool_t emit=kTRUE)
 
virtual void MoveSelectedToFolder (Bool_t emit=kTRUE)
 
virtual void CreateNewFolder ()
 
virtual void CreateSubFolder (GItemTreeBranch *parent)
 
virtual void CreateNewItem ()
 
virtual void EditSelectedItem ()
 
virtual void DeleteSelectedItem ()
 
virtual void DeleteItem (GItemTreeLeaf *item, bool update=true)
 
virtual void DeleteFolder (GItemTreeBranch *branch, bool update=true)
 
virtual void CancelAction (const Bool_t cancel=kTRUE)
 
virtual Bool_t GetCancelActionState () const
 
Slots from sub-widgets
virtual void SelectAll ()
 
virtual void SelectNone ()
 
virtual void SelectInvert ()
 
virtual void TreeClicked (TGListTreeItem *item, Int_t btn)
 
virtual void TreeDoubleClicked (TGListTreeItem *item, Int_t btn)
 
virtual void TreeReturnPressed (TGListTreeItem *item)
 
virtual void ItemChecked (TObject *obj, Bool_t check)
 
virtual void ProcessedEvent (Event_t *event)
 
virtual void MenuActivated (Int_t id)
 
Signals
virtual void SelectAllClicked ()
 
virtual void SelectNoneClicked ()
 
virtual void SelectInvertClicked ()
 
virtual void SelectionChanged ()
 
virtual void MoveUpClicked ()
 
virtual void MoveDownClicked ()
 
virtual void MoveTopClicked ()
 
virtual void MoveBottomClicked ()
 
virtual void MoveToParentClicked ()
 
virtual void MoveToFolderClicked ()
 
virtual void SelectionMoved ()
 
virtual void NewFolderClicked ()
 
virtual void NewItemClicked ()
 
virtual void EditItemClicked ()
 
virtual void DeleteClicked ()
 
virtual void NewFolderCreated (TGListTreeItem *item)
 
virtual void CreateItem (GItemTreeBranch *parent)
 
virtual void EditItem (GItemTreeLeaf *item)
 
virtual void ItemRemoved (void *data)
 
virtual void CustomClicked (Int_t id)
 
virtual void CustomMenuActivated (Int_t id)
 
virtual void SingleSelected (ULong64_t leaf_ptr)
 
ROOT related functions
 ClassDef (RGItemTreeSelector, 0)
 

Protected Attributes

string default_element_pic
 Default picture name for elements.
 
UInt_t tree_w_min
 Tree widget minimum width.
 
UInt_t tree_h_min
 Tree widget minimum height.
 
UInt_t options
 Widget options.
 
GItemTreeBranch * root_node
 Root tree node of GItems.
 
bool local_tree
 Indicates if the tree is created internally and should be deleted with the widget.
 
TGHorizontalFrame * w_widgets_frame
 Main frame.
 
TGVerticalFrame * w_tree_frame
 Tree and side buttons frame.
 
TGCanvas * w_tree_canvas
 Canvas holding the tree widget.
 
TGListTree * w_tree
 Tree (list-tree) widget.
 
TGHorizontalFrame * w_button_frame
 List buttons frame.
 
TGTextButton * w_all_button
 All elements selection button.
 
TGTextButton * w_none_button
 None elements selection button.
 
TGTextButton * w_invert_button
 Invert selection button.
 
TGVerticalFrame * w_side_frame
 Side buttons frame.
 
TGVerticalFrame * w_folder_buttons_frame
 Frame for folder buttons.
 
TGTextButton * w_open_all_button
 Open all folders button.
 
TGTextButton * w_close_all_button
 Close all folders button.
 
TGVerticalFrame * w_move_buttons_frame
 Frame for move buttons.
 
TGTextButton * w_move_up_button
 In-folder selected item move button.
 
TGTextButton * w_move_down_button
 In-folder selected item move button.
 
TGTextButton * w_move_top_button
 In-folder selected item move button.
 
TGTextButton * w_move_bottom_button
 In-folder selected item move button.
 
TGTextButton * w_move_parent_button
 Button to move selected item to its parent folder.
 
TGTextButton * w_move_folder_button
 Button to move selected item to another folder.
 
TGVerticalFrame * w_edit_buttons_frame
 Frame for edit buttons.
 
TGTextButton * w_new_folder_button
 New folder creation button.
 
TGTextButton * w_new_item_button
 New element definition button.
 
TGTextButton * w_edit_item_button
 Edit element button.
 
TGTextButton * w_delete_button
 Delete button.
 
TGVerticalFrame * w_custom_buttons_frame
 Frame for additional buttons.
 
TGPopupMenu * w_menu_item
 Define the context menu for item selected.
 
TGPopupMenu * w_menu_folder
 Define the context menu for folder selected.
 
TGListTreeItem * prev_selected
 Previously selected item.
 
Bool_t cancel_action
 Flag for cancellation of default requested action.
 

Private Member Functions

 GObject (RGItemTreeSelector)
 

Constructors, affectation, destructor

 RGItemTreeSelector (TGWindow *p, const char *label=NULL, const UInt_t opts=0, const UInt_t w_min=160, const UInt_t h_min=200)
 
virtual ~RGItemTreeSelector ()
 
 RGItemTreeSelector (const RGItemTreeSelector &original)
 

Widget functions

Bool_t MultipleSelection () const
 
virtual void MapSubwindows ()
 
virtual void RefreshTreeView ()
 
virtual void Construct ()
 

Detailed Description

This class defines a widget containing a tree of items for selection of elements. The elements are pointers on user objects, referred to by GItem objects.

In case of a single selection widget, no check-box is associated to the items in the tree view.

Objects in the tree are referred to using RGItem objects to refer to to them (RGItem is the class for the tree structure template). The user data of the tree nodes is used for the connection between the tree structure nodes and the tree view elements.

When selecting or unselecting a folder, all elements in that folder are selected or unselected.

The widget also provides also options for pre-defined actions (see option flags defined in RGItemTreeSelectorOptions) from buttons and context menu for tree elements. For these actions, a signal is emitted before the corresponding action is performed, so that, depending on the context, the calling object (embbeding the RGItemTreeSelector) can cancel the predefined action in a slot if it calls the CancelAction() function.

The optional button actions are

  • a set of move buttons to move elements up and down in their own folder
  • a set of move buttons (new folder creation, new item creation, selected item edit or delete)
  • buttons to open / close all folders (these actions do not check the action cancellation, since they do not alter the tree structure)

The optional context menus can be defined for folder elements or for item elements of the tree structure. The optional menu actions are:

  • menus to open / close all sub-folders
  • menus to move current element one level up (to parent folder) in the tree structure
Adding custum buttons and menus

If the rgITSCustomButtons option is selected, a frame is added in the side buttons area to add extra user buttons. It is possible to add buttons in this frame with the AddSideButton functions. Such buttons will then emit the CustomClicked signal.

If the context menus have been defined for items and/or for folders, it is possible to add entries to these menus, with the AddMenuItemEntry and the AddMenuFolderEntry functions. Note that item and folder menus share the same processing function (MenuActivated) and signal (CustomMenuActivated), and entries identifiers should then be different for items and folders menus. Nevertheless, this does not need to the case if a menu may be defined for both items and folders (but the entry has to be defined explicitely for both). For custom menu entries identifiers, use values below 65536, since values above are used for predefined menus.

Note
  • the user data of the TGListTreeItem elements of the tree view contain the pointer to the GItemTreeNote nodes of the tree structure
  • the user data of the nodes contain the pointer to the the TGListTreeItem elements
  • the user data of the RGItem (for tree leaves) is supposed to point on the program objects.
Options defined in the RGItemTreeSelectorOptions enumeration
  • Label options (related to TGGroupFrame base class)
    • rgITSLabelCenterAligned: label is centered (default)
    • rgITSLabelLeftAligned: label at left position
    • rgITSLabelRightAligned: label at right position
    • rgITSLabelAboveList: label is located above the list (default)
    • rgITSLabelBelowList: label is located below the list
  • Side buttons position options
    • rgITSSideButtonsRight: side buttons on the right side (default)
    • rgITSSideButtonsLeft: side buttons on the left side
    • rgITSSideButtonsCenter: side buttons vertically centered (default)
    • rgITSSideButtonsUp: side buttons vertically placed up
    • rgITSSideButtonsUpRight: side buttons placed up and right
    • rgITSSideButtonsUpLeft: side buttons placed up and left
    • rgITSSideButtonsDown: side buttons vertically placed down
    • rgITSSideButtonsDownRight: side buttons placed down and right
    • rgITSSideButtonsDownLeft: side buttons placed down and left
  • Side buttons actions options
    • rgITSFolderButtons: include buttons for open / close of all folders
    • rgITSMoveButtons: include default move buttons (move up, down, top, bottom)
    • rgITSEditButtons: include default edition buttons (new folder, new item, edit and delete)
    • rgITSCustomButtons: custom side buttons will be added (for derived classes)
  • Context menu options
    • rgITSMenuItem: create the context menu for items (empty menu)
    • rgITSMenuItemMove: define items context menu entries to move element top or to another folder
    • rgITSMenuItemEdit: define items context menu entries to edit elements
    • rgITSMenuFolder: create the context menu for folders (empty menu)
    • rgITSMenuFolderOpen: define folders context menu entries for open / close of all folders (same as corresponding buttons)
    • rgITSMenuFolderEdit: define folders context menu entries create a new sub-folder
    • rgITSMenuFolderMove: define folders context menu entries to move element top or to another folder
    • rgITSMenuDefault: create all predefined entries for context menus
  • Tree structure and selection options
    • rgITSSingleSelection: single selection only (default)
    • rgITSMultipleSelection: multiple selection
    • rgITSAutoCreateFolder: automatically create folders if needed when adding elements
Tree structure organisation
RGItemTreeSelector.png

Member Enumeration Documentation

Values associated to default context menus. If a menu is defined for both folders and items, the menu identification value is the same.

Constructor & Destructor Documentation

RGItemTreeSelector::RGItemTreeSelector ( TGWindow *  p,
const char *  label = NULL,
const UInt_t  opts = 0,
const UInt_t  w_min = 160,
const UInt_t  h_min = 200 
)
RGItemTreeSelector::RGItemTreeSelector ( const RGItemTreeSelector original)
protected

Copy constructor, not implemented.

Parameters
originalobject to copy
RGItemTreeSelector::~RGItemTreeSelector ( )
virtual

Destructor.

References local_tree, root_node, w_menu_folder, and w_menu_item.

Member Function Documentation

RGItemTreeSelector::GObject ( RGItemTreeSelector  )
private

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
TGListTree * RGItemTreeSelector::GetListTree ( ) const
inlinevirtual

Get TGListBox widget pointer.

References w_tree.

TGTextButton * RGItemTreeSelector::GetAllButton ( ) const
inlinevirtual

Get "All" button pointer.

References w_all_button.

TGTextButton * RGItemTreeSelector::GetNoneButton ( ) const
inlinevirtual

Get "None" button pointer.

References w_none_button.

TGTextButton * RGItemTreeSelector::GetInvertButton ( ) const
inlinevirtual

Get "Invert" button pointer.

References w_invert_button.

TGVerticalFrame * RGItemTreeSelector::GetSideButtonsFrame ( ) const
inlinevirtual

Get pointer to move buttons frame.

References w_side_frame.

TGVerticalFrame * RGItemTreeSelector::GetFoldersButtonsFrame ( ) const
inlinevirtual

Get pointer to "folders" side buttons frame.

References w_folder_buttons_frame.

TGTextButton * RGItemTreeSelector::GetFoldersOpenButton ( ) const
inlinevirtual

Get "Open all folders" button pointer.

References w_open_all_button.

TGTextButton * RGItemTreeSelector::GetFoldersCloseButton ( ) const
inlinevirtual

Get "Close all folders" button pointer.

References w_close_all_button.

TGVerticalFrame * RGItemTreeSelector::GetMoveButtonsFrame ( ) const
inlinevirtual

Get pointer to "move" side buttons frame.

References w_move_buttons_frame.

TGTextButton * RGItemTreeSelector::GetMoveUpButton ( ) const
inlinevirtual

Get "Move up" button pointer.

References w_move_up_button.

TGTextButton * RGItemTreeSelector::GetMoveDownButton ( ) const
inlinevirtual

Get "Move down" button pointer.

References w_move_down_button.

TGTextButton * RGItemTreeSelector::GetMoveTopButton ( ) const
inlinevirtual

Get "Move top" button pointer.

References w_move_top_button.

TGTextButton * RGItemTreeSelector::GetMoveBottomButton ( ) const
inlinevirtual

Get "Move bottom" button pointer.

References w_move_bottom_button.

TGTextButton * RGItemTreeSelector::GetMoveParentButton ( ) const
inlinevirtual

Get "Move to parent" button pointer.

References w_move_parent_button.

TGTextButton * RGItemTreeSelector::GetMoveFolderButton ( ) const
inlinevirtual

Get "Move to another folder" button pointer.

References w_move_folder_button.

TGVerticalFrame * RGItemTreeSelector::GetEditButtonsFrame ( ) const
inlinevirtual

Get pointer to "edit" side buttons frame.

References w_edit_buttons_frame.

TGTextButton * RGItemTreeSelector::GetNewFolderButton ( ) const
inlinevirtual

Get "New folder" button pointer.

References w_new_folder_button.

TGTextButton * RGItemTreeSelector::GetNewItemButton ( ) const
inlinevirtual

Get "New item" button pointer.

References w_new_item_button.

TGTextButton * RGItemTreeSelector::GetEditItemButton ( ) const
inlinevirtual

Get "Edit item" button pointer.

References w_edit_item_button.

TGTextButton * RGItemTreeSelector::GetDeleteButton ( ) const
inlinevirtual

Get "Delete" button pointer.

References w_delete_button.

TGVerticalFrame * RGItemTreeSelector::GetCustomButtonsFrame ( ) const
inlinevirtual

Get pointer to "custom" side buttons frame.

References w_custom_buttons_frame.

TGButton * RGItemTreeSelector::AddSideButton ( const char *  text,
const Int_t  id,
TGLayoutHints *  l,
const char *  tooltip = NULL 
)
virtual

Add a button to side buttons. The button emits a signal CustomClicked(Int_t id).

Parameters
textbutton text
idbutton identification number
lframe layout
tooltipinformation message
TGButton * RGItemTreeSelector::AddSideButton ( TGButton *  but,
const Int_t  id,
TGLayoutHints *  l 
)
virtual

Add a button to side buttons. The button emits a signal CustomClicked(Int_t id).

Parameters
butbutton pointer
idbutton identification number
lframe layout

References MapSubwindows(), and w_custom_buttons_frame.

TGFrame * RGItemTreeSelector::AddSideFrame ( TGFrame *  f,
TGLayoutHints *  l = NULL 
)
virtual

Add a frame to side panel (buttons list).

Parameters
fframe pointer
lframe layout

References MapSubwindows(), and w_side_frame.

TGFrame * RGItemTreeSelector::AddBottomFrame ( TGFrame *  f,
TGLayoutHints *  l = NULL 
)
virtual

Add a frame below selection list.

Parameters
fframe pointer
lframe layout

References MapSubwindows().

void RGItemTreeSelector::AddMenuItemSeparator ( )
virtual

Add a new separator to the items context menu.

References w_menu_item.

void RGItemTreeSelector::AddMenuItemEntry ( const string &  title,
Int_t  id 
)
virtual

Add a new menu entry to the items context menu.

Parameters
titlemenu title
idassociated identifier

References w_menu_item.

void RGItemTreeSelector::AddMenuItemEntry ( const string &  title,
TGPopupMenu *  submenu 
)
virtual

Add a new sub-menu to the items context menu.

Parameters
titlemenu title
submenupopup menu to be added

References w_menu_item.

void RGItemTreeSelector::AddMenuFolderSeparator ( )
virtual

Add a new separator to the folders context menu.

References w_menu_folder.

void RGItemTreeSelector::AddMenuFolderEntry ( const string &  title,
Int_t  id 
)
virtual

Add a new menu entry to the folders context menu.

Parameters
titlemenu title
idassociated identifier

References w_menu_folder.

void RGItemTreeSelector::AddMenuFolderEntry ( const string &  title,
TGPopupMenu *  submenu 
)
virtual

Add a new sub-menu to the folders context menu.

Parameters
titlemenu title
submenupopup menu to be added

References w_menu_folder.

Bool_t RGItemTreeSelector::MultipleSelection ( ) const
inline
void RGItemTreeSelector::MapSubwindows ( )
virtual
void RGItemTreeSelector::RefreshTreeView ( )
virtual

Refresh the display of the tree view.

References w_tree.

Referenced by CloseAllFolders(), OpenAllFolders(), SelectInvert(), TreeDoubleClicked(), and UpdateTreeDisplay().

void RGItemTreeSelector::UpdateItemSelection ( GItemTreeBranch *  branch = NULL)
virtual

Function that updates the tree structure selection from the tree-list widget.

Parameters
branchsub-tree structure to update (root if NULL)

References MultipleSelection(), and root_node.

Referenced by ItemChecked().

void RGItemTreeSelector::RecreateTreeDisplay ( )
virtual
void RGItemTreeSelector::RecreateTreeSubDisplay ( GItemTreeBranch *  branch)
virtual

Function that recreates the tree view elements for the children of the branch given as argument.

Parameters
branchtree structure branch for which the children tree view elements have to be recreated

References default_element_pic, RGItem::GetIcon(), MultipleSelection(), and w_tree.

Referenced by RecreateTreeDisplay().

void RGItemTreeSelector::UpdateTreeDisplay ( )
virtual

Function that updates the tree-list widget from the content of the tree structure.

References MultipleSelection(), RefreshTreeView(), root_node, and w_tree.

Referenced by MapSubwindows(), RecreateTreeDisplay(), SelectAll(), SelectInvert(), SelectNone(), and TreeDoubleClicked().

void RGItemTreeSelector::UpdateMenuItem ( GItemTreeLeaf *  leaf)
virtual

Update the context menu for items, according to argument leaf.

Parameters
leafselected leaf

References w_menu_item.

Referenced by ProcessedEvent().

void RGItemTreeSelector::UpdateMenuFolder ( GItemTreeBranch *  branch)
virtual

Update the context menu for folders, according to argument branch.

Parameters
branchselected branch

References w_menu_folder, and w_menu_item.

Referenced by ProcessedEvent().

const GItemTreeBranch * RGItemTreeSelector::GetTreeRoot ( ) const
inline

Return the pointer to the tree root node.

References root_node.

void RGItemTreeSelector::SetDefaultPicture ( const string &  pic_name)

Modify the default picture name for tree view elements.

Parameters
pic_namepicture name

References default_element_pic, and RG_ITL_DEFAULT_TREE_PICT.

GItemTreeBranch * RGItemTreeSelector::AddFolder ( const string &  name)

Add a new folder in the tree structure.

Parameters
namefolder name

References options, and root_node.

Referenced by AddElement(), and CreateSubFolder().

GItemTreeBranch * RGItemTreeSelector::AddFolder ( GItemTreeBranch *  parent,
const string &  name 
)

Add a new folder in the tree structure. Since the parent folder is given explicitely, the item name should not contain any subfolder.

Parameters
parentparent folder in the tree structure
namefolder name

References MultipleSelection(), root_node, and w_tree.

GItemTreeLeaf * RGItemTreeSelector::AddElement ( const string &  name,
void *  data,
const TGPicture *  pic = NULL 
)

Add a new element in the tree structure. The name is given relatively to the tree structure root, and may contain the sub-folder where the element should be placed.

Parameters
nameelement name
datapointer to the object referred by the element
picpointer to the picture for the element

References AddFolder(), options, and root_node.

GItemTreeLeaf * RGItemTreeSelector::AddElement ( GItemTreeBranch *  parent,
const string &  name,
void *  data,
const TGPicture *  pic = NULL 
)

Add a new element in the tree structure. Since the parent folder is given explicitely, the item name should not contain any subfolder.

Parameters
parentparent folder in the tree structure
nameelement name
datapointer to the object referred by the element
picpointer to the picture for the element

References default_element_pic, MultipleSelection(), root_node, and w_tree.

GItemTreeBranch * RGItemTreeSelector::SetRootNode ( GItemTreeBranch *  root,
bool  adopt = false 
)

Define the item tree from arguments. This function completely removes the current tree if it is defined: if it is defined locally (adopted), the tree structure is deleted, without any signal emission.

Parameters
rootnew tree root (main branch)
adoptwhether the tree is defined locally and will be deleted by the widget

References local_tree, RecreateTreeDisplay(), and root_node.

Referenced by RGTreeRequester::Construct().

TGListTreeItem * RGItemTreeSelector::SelectItem ( GItemTreeNode *  node)
virtual

Set the argument node as selected item in the tree.

Parameters
nodetree structure node to set as selected

Referenced by CreateSubFolder(), MoveSelectedMoveBottom(), MoveSelectedMoveDown(), MoveSelectedMoveTop(), MoveSelectedMoveUp(), MoveSelectedToFolder(), MoveSelectedToParent(), TreeDoubleClicked(), and TreeReturnPressed().

TGListTreeItem * RGItemTreeSelector::SelectItem ( TGListTreeItem *  elem)
virtual

Set the argument element as selected item in the tree.

Parameters
elemtree view element to set as selected

References prev_selected, and w_tree.

GItemTreeNode * RGItemTreeSelector::GetSelected ( ) const

Return a pointer to the currently selected (highlighted) node, or NULL if no element (item or folder) is selected.

References w_tree.

Referenced by GetSelectedLeaf(), and RGTreeRequester::ProcessButton().

GItemTreeLeaf * RGItemTreeSelector::GetSelectedLeaf ( ) const

Return a pointer to the currently selected (highlighted) item, or NULL if no item is selected or if a folder is selected.

References GetSelected().

Referenced by RGTreeRequester::ProcessButton().

void RGItemTreeSelector::OpenSelectedSubFolders ( )
virtual

Open currently selected folder and all its sub-folders.

References OpenSubFolders(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::CloseSelectedSubFolders ( )
virtual

Close currently selected folder and all its sub-folders.

References CloseSubFolders(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::OpenSubFolders ( TGListTreeItem *  item)
virtual

Open folder and all its sub-folders.

Parameters
itemtree item to open

References w_tree.

Referenced by OpenAllFolders(), and OpenSelectedSubFolders().

void RGItemTreeSelector::CloseSubFolders ( TGListTreeItem *  item)
virtual

Close folder and all its sub-folders.

Parameters
itemtree item to open

References w_tree.

Referenced by CloseAllFolders(), and CloseSelectedSubFolders().

void RGItemTreeSelector::OpenAllFolders ( )
virtual

Open all tree folders.

References OpenSubFolders(), RefreshTreeView(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::CloseAllFolders ( )
virtual

Close all tree folders.

References CloseSubFolders(), RefreshTreeView(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedMoveTop ( Bool_t  emit = kTRUE)
virtual

Move selected elements to top of the list. This function is effective only if the list is not always sorted. If emit is true (which is the default case when called from the move button), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References cancel_action, RecreateTreeDisplay(), SelectionMoved(), SelectItem(), UpdateButtonsState(), w_tree, and w_tree_canvas.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedMoveUp ( Bool_t  emit = kTRUE)
virtual

Move selected elements one step up. This function is effective only if the list is not always sorted. If emit is true (which is the default case when called from the move button), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References cancel_action, RecreateTreeDisplay(), SelectionMoved(), SelectItem(), UpdateButtonsState(), w_tree, and w_tree_canvas.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedMoveDown ( Bool_t  emit = kTRUE)
virtual

Move selected elements one step down. This function is effective only if the list is not always sorted. If emit is true (which is the default case when called from the move button), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References cancel_action, RecreateTreeDisplay(), SelectionMoved(), SelectItem(), UpdateButtonsState(), w_tree, and w_tree_canvas.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedMoveBottom ( Bool_t  emit = kTRUE)
virtual

Move selected elements to the bottom of the list. This function is effective only if the list is not always sorted. If emit is true (which is the default case when called from the move button), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References cancel_action, RecreateTreeDisplay(), SelectionMoved(), SelectItem(), UpdateButtonsState(), w_tree, and w_tree_canvas.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedToParent ( Bool_t  emit = kTRUE)
virtual

Function moving the currently selected item to its parent folder. The element is placed after its current parent in the grand-parent list. If emit is true (which is the default case when called from the move menu), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References cancel_action, RecreateTreeDisplay(), SelectionMoved(), SelectItem(), UpdateButtonsState(), w_tree, and w_tree_canvas.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveSelectedToFolder ( Bool_t  emit = kTRUE)
virtual

Function moving the currently selected item to another folder. The folder is selected using a requester. If emit is true (which is the default case when called from the move menu), the SelectionMoved signal is emitted.

Parameters
emitflag for move signal emission

References RDico::brq_continue, RDico::brq_ok_cancel, RDico::brq_warning, cancel_action, RGTreeRequester::GetItemTreeSelector(), RDico::its_existing_warning, RDico::its_folder_itself_warning, RDico::its_move_to_folder_title, rDico, RecreateTreeDisplay(), RGBaseRequester::Request(), root_node, SelectionMoved(), SelectItem(), UpdateButtonsState(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::CreateNewFolder ( )
virtual

This function is called by the new folder creation button. Create a new folder in currently selected folder (or at tree root if no folder is selected).

References cancel_action, CreateSubFolder(), root_node, and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::CreateSubFolder ( GItemTreeBranch *  parent)
virtual

This function is called by the new folder creation button, via the CreateNewFolder function. Create a sub-folder of argument branch.

Parameters
parentbranch in which creating a sub-folder (if NULL, the folder will be created at tree root)

References AddFolder(), RDico::brq_continue, RDico::brq_ok_cancel, RDico::brq_warning, RDico::its_existing_warning, RDico::its_new_folder_req_message, RDico::its_new_folder_req_root, RDico::its_new_folder_req_title, NewFolderCreated(), rDico, RecreateTreeDisplay(), root_node, and SelectItem().

Referenced by CreateNewFolder().

void RGItemTreeSelector::CreateNewItem ( )
virtual

This function is called when the "New item" button is clicked (after the emission of NewItemClicked signal, so that the action may be cancelled in a previously called slot). It does not create any item: it just emits a signal (CreateItem(GItemTreeBranch *)) indicating in which folder a new item should be created.

A slot should be connected to this signal for the effective creation of the item. The slot should may add the item using AddElement function, and then update the tree with the UpdateTreeDisplay function.

References cancel_action, CreateItem(), root_node, and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::EditSelectedItem ( )
virtual

This function is called when the "Edit item" button is clicked (after the emission of EditItemClicked signal, so that the action may be cancelled in a previously called slot). It does not edit any item: it just emits a signal (EditItem(GItemTreeLeaf *)) indicating in the item that should be edited.

A slot should be connected to this signal for the effective edition of the item. The slot should may update the tree with the UpdateTreeDisplay function if needed after edition.

References cancel_action, EditItem(), and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::DeleteSelectedItem ( )
virtual

This function is called when the "Delete" button is clicked (after the emission of DeleteClicked signal, so that the action may be cancelled in a previously called slot).

If the selected item is a folder, a confirmation that all its content should be deleted is requested.

References RDico::brq_ok_cancel, cancel_action, DeleteFolder(), DeleteItem(), RDico::its_delete_confirm_title, RDico::its_delete_folder_confirm, rDico, and w_tree.

Referenced by MenuActivated().

void RGItemTreeSelector::DeleteItem ( GItemTreeLeaf *  item,
bool  update = true 
)
virtual

Function called to delete an item (leaf) in the tree structure.

Parameters
itempointer to the tree leaf
updateindicates whether the tree display should be updated

References ItemRemoved(), and RecreateTreeDisplay().

Referenced by DeleteFolder(), and DeleteSelectedItem().

void RGItemTreeSelector::DeleteFolder ( GItemTreeBranch *  branch,
bool  update = true 
)
virtual

Function called to delete a folder (branch) in the tree structure. This function recursively removes the content of the folder

Parameters
branchpointer to the tree branch
updateindicates whether the tree display should be updated

References DeleteItem(), and RecreateTreeDisplay().

Referenced by DeleteSelectedItem().

void RGItemTreeSelector::CancelAction ( const Bool_t  cancel = kTRUE)
inlinevirtual

Set the move cancellation flag.

Parameters
cancelflag status (on/off)

References cancel_action.

Bool_t RGItemTreeSelector::GetCancelActionState ( ) const
inlinevirtual

Get the move cancellation flag.

References cancel_action.

void RGItemTreeSelector::SelectAll ( )
virtual

Slot called by "select all" button (multiple selection). Select all elements (only valid if multiple selection is set).

References MultipleSelection(), root_node, SelectionChanged(), and UpdateTreeDisplay().

void RGItemTreeSelector::SelectNone ( )
virtual

Slot called by "select non" button (multiple selection). Unselect all elements (only valid if multiple selection is set).

References MultipleSelection(), root_node, SelectionChanged(), and UpdateTreeDisplay().

void RGItemTreeSelector::SelectInvert ( )
virtual

Slot called by "select invert" button (multiple selection). Invert elements selection (only valid if multiple selection is set).

References MultipleSelection(), RefreshTreeView(), root_node, SelectionChanged(), and UpdateTreeDisplay().

void RGItemTreeSelector::TreeClicked ( TGListTreeItem *  item,
Int_t  btn 
)
virtual

Slot called when the tree view is clicked.

Parameters
itempointer to the tree item clicked
btnbutton identifier

References prev_selected, UpdateButtonsState(), and w_tree.

Referenced by TreeReturnPressed().

void RGItemTreeSelector::TreeDoubleClicked ( TGListTreeItem *  item,
Int_t  btn 
)
virtual

Slot called when the tree view is double-clicked.

Parameters
itempointer to the tree item clicked
btnbutton identifier

References MultipleSelection(), RefreshTreeView(), SelectionChanged(), SelectItem(), SingleSelected(), and UpdateTreeDisplay().

void RGItemTreeSelector::TreeReturnPressed ( TGListTreeItem *  item)
virtual

Slot called when the return key is pressed in the tree view.

Parameters
itempointer to the tree item

References MultipleSelection(), SelectItem(), SingleSelected(), and TreeClicked().

void RGItemTreeSelector::ItemChecked ( TObject *  obj,
Bool_t  check 
)
virtual

Slot called when the check-button of an item is modified.

Parameters
objuser data object (in fact, a GItemTreeNode pointer)
checkcheck state of the item

References SelectionChanged(), and UpdateItemSelection().

void RGItemTreeSelector::ProcessedEvent ( Event_t *  event)
virtual

Slot called when an event is processed in the tree view. It is used to check if the context menu must popup.

Parameters
eventtype of event

References UpdateMenuFolder(), UpdateMenuItem(), w_menu_folder, w_menu_item, and w_tree.

void RGItemTreeSelector::SelectAllClicked ( )
inlinevirtual

Signal sent when "all" selection button is clicked.

void RGItemTreeSelector::SelectNoneClicked ( )
inlinevirtual

Signal sent when "none" selection button is clicked.

void RGItemTreeSelector::SelectInvertClicked ( )
inlinevirtual

Signal sent when "invert" selection button is clicked.

void RGItemTreeSelector::SelectionChanged ( )
inlinevirtual

Signal sent when selection is changed.

References UpdateButtonsState().

Referenced by ItemChecked(), SelectAll(), SelectInvert(), SelectNone(), and TreeDoubleClicked().

void RGItemTreeSelector::MoveUpClicked ( )
inlinevirtual

Signal sent when Move Up button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveDownClicked ( )
inlinevirtual

Signal sent when Move Down button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveTopClicked ( )
inlinevirtual

Signal sent when Move Top button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveBottomClicked ( )
inlinevirtual

Signal sent when Move Bottom button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveToParentClicked ( )
inlinevirtual

Signal sent when Move to parent button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::MoveToFolderClicked ( )
inlinevirtual

Signal sent when Move to folder button is clicked (or the corresponding context menu selected). The signal is emitted before moving elements, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::SelectionMoved ( )
inlinevirtual

Signal sent after elements have been moved, due to the move buttons.

Referenced by MoveSelectedMoveBottom(), MoveSelectedMoveDown(), MoveSelectedMoveTop(), MoveSelectedMoveUp(), MoveSelectedToFolder(), and MoveSelectedToParent().

void RGItemTreeSelector::NewFolderClicked ( )
inlinevirtual

Signal sent when New Folder button is clicked. The signal is emitted before calling the effective editing function, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::NewItemClicked ( )
inlinevirtual

Signal sent when New (item) button is clicked. The signal is emitted before calling the effective editing function, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::EditItemClicked ( )
inlinevirtual

Signal sent when Edit (item) button is clicked. The signal is emitted before calling the effective editing function, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::DeleteClicked ( )
inlinevirtual

Signal sent when New (item) button is clicked. The signal is emitted before calling the effective editing function, so that the action can be cancelled in a slot if needed, with CancelAction() function.

Referenced by MenuActivated().

void RGItemTreeSelector::NewFolderCreated ( TGListTreeItem *  item)
inlinevirtual

Signal sent after a new folder has been created (from button/ menu action, not from the AddFolder function).

Parameters
itempointer to folder item

Referenced by CreateSubFolder().

void RGItemTreeSelector::CreateItem ( GItemTreeBranch *  parent)
inlinevirtual

Signal sent for creation of a new item in selected folder.

Parameters
parentpointer to the folder where item should be created

Referenced by CreateNewItem().

void RGItemTreeSelector::EditItem ( GItemTreeLeaf *  item)
inlinevirtual

Signal sent for edition of selected item.

Parameters
itempointer to folder item

Referenced by EditSelectedItem().

void RGItemTreeSelector::ItemRemoved ( void *  data)
inlinevirtual

Signal sent for when an item (leaf) has been deleted from the tree. The argument pointer refers to the user data associated to the RGItem object of the leaf.

Parameters
datapointer item user data

Referenced by DeleteItem().

void RGItemTreeSelector::CustomClicked ( Int_t  id)
inlinevirtual

Signal sent when a user button is clicked.

Parameters
ididentification number of the button
void RGItemTreeSelector::CustomMenuActivated ( Int_t  id)
inlinevirtual

Signal sent when a user button is clicked.

Parameters
ididentification number of the button

Referenced by MenuActivated().

void RGItemTreeSelector::SingleSelected ( ULong64_t  leaf_ptr)
inlinevirtual

Signal sent when an item (leaf, not a folder) is double-clicked or return pressed in single selection mode.

Parameters
leaf_ptrpointer to the leaf of selected item

Referenced by TreeDoubleClicked(), and TreeReturnPressed().

RGItemTreeSelector::ClassDef ( RGItemTreeSelector  ,
 
)

For ROOT dictionary.


The documentation for this class was generated from the following files: