Class Fox::FXTreeList |
|
Tree list
The following messages are sent by FXTreeList to its target:
SEL_KEYPRESS: | sent when a key goes down; the message data is an FXEvent instance. |
SEL_KEYRELEASE: | sent when a key goes up; the message data is an FXEvent instance. |
SEL_LEFTBUTTONPRESS: | sent when the left mouse button goes down; the message data is an FXEvent instance. |
SEL_LEFTBUTTONRELEASE: | sent when the left mouse button goes up; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONPRESS: | sent when the right mouse button goes down; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONRELEASE: | sent when the right mouse button goes up; the message data is an FXEvent instance. |
SEL_COMMAND: | sent when a list item is clicked on; the message data is a reference to the item (an FXTreeItem instance). |
SEL_CLICKED: | sent when the left mouse button is single-clicked in the list; the message data is a reference to the item clicked (an FXTreeItem instance) or nil if no item was clicked. |
SEL_DOUBLECLICKED: | sent when the left mouse button is double-clicked in the list; the message data is a reference to the item clicked (an FXTreeItem instance) or nil if no item was clicked. |
SEL_TRIPLECLICKED: | sent when the left mouse button is triple-clicked in the list; the message data is a reference to the item clicked (an FXTreeItem instance) or nil if no item was clicked. |
SEL_OPENED: | sent when an item is opened; the message data is a reference to the item (an FXTreeItem instance). |
SEL_CLOSED: | sent when an item is closed; the message data is a reference to the item (an FXTreeItem instance). |
SEL_EXPANDED: | sent when a sub-tree is expanded; the message data is a reference to the root item for the sub-tree (an FXTreeItem instance). |
SEL_COLLAPSED: | sent when a sub-tree is collapsed; the message data is a reference to the root item for the sub-tree (an FXTreeItem instance). |
SEL_SELECTED: | sent when an item is selected; the message data is a reference to the item (an FXTreeItem instance). |
SEL_DESELECTED: | sent when an item is deselected; the message data is a reference to the item (an FXTreeItem instance). |
SEL_CHANGED: | sent when the current item changes; the message data is a reference to the current item (an FXTreeItem instance). |
SEL_INSERTED: | sent after an item is added to the list; the message data is a reference to the item (an FXTreeItem instance). |
SEL_DELETED: | sent before an item is removed from the list; the message data is a reference to the item (an FXTreeItem instance). |
TREELIST_EXTENDEDSELECT: | Extended selection mode allows for drag-selection of ranges of items |
TREELIST_SINGLESELECT: | Single selection mode allows up to one item to be selected |
TREELIST_BROWSESELECT: | Browse selection mode enforces one single item to be selected at all times |
TREELIST_MULTIPLESELECT: | Multiple selection mode is used for selection of individual items |
TREELIST_AUTOSELECT: | Automatically select under cursor |
TREELIST_SHOWS_LINES: | Lines shown |
TREELIST_SHOWS_BOXES: | Boxes to expand shown |
TREELIST_ROOT_BOXES: | Display root boxes also |
TREELIST_NORMAL: | same as TREELIST_EXTENDEDLIST |
Methods |
Attributes |
anchorItem | [RW] | Anchor item, if any [FXTreeItem] |
currentItem | [RW] | Current item, if any [FXTreeItem] |
cursorItem | [R] | Item under the cursor, if any [FXTreeItem] |
firstItem | [R] | First root-level item [FXTreeItem] |
font | [RW] | Text font [FXFont] |
helpText | [RW] | Status line help text for this list [String] |
indent | [RW] | Parent-child indent amount, in pixels [Integer] |
lastItem | [R] | Last root-level item [FXTreeItem] |
lineColor | [RW] | Line color [FXColor] |
listStyle | [RW] | List style [Integer] |
numItems | [R] | Number of items [Integer] |
numVisible | [RW] | Number of visible items [Integer] |
selBackColor | [RW] | Selected text background color [FXColor] |
selTextColor | [RW] | Selected text color [FXColor] |
textColor | [RW] | Normal text color [FXColor] |
Included modules |
Public Class methods |
new(aComposite, numVisible, target=nil, selector=0, opts=TREELIST_NORMAL, x=0, y=0, w=0, h=0) {|theTreeList| ...} |
Construct a tree list with numVisible visible items; the tree list is initially empty.
Public Instance methods |
addItemFirst(parentItem, item, notify=false) |
Prepend a new (possibly subclassed) item as first child of parentItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemFirst(parentItem, text, openIcon=nil, closedIcon=nil, data=nil, notify=false) |
Prepend a new item with given text and optional openIcon, closedIcon and user data, as first child of parentItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemLast(parentItem, item, notify=false) |
Append a new (possibly subclassed) item as last child of parentItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemLast(parentItem, text, openIcon=nil, closedIcon=nil, data=nil, notify=false) |
Append a new item with given text and optional openIcon, closedIcon and user data, as last child of parentItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemAfter(otherItem, item, notify=false) |
Append a new (possibly subclassed) item after otherItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemAfter(otherItem, text, openIcon=nil, closedIcon=nil, data=nil, notify=false) |
Append a new item with given text and optional openIcon, closedIcon and user data after otherItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemBefore(otherItem, item, notify=false) |
Prepend a new (possibly subclassed) item prior to otherItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
addItemBefore(otherItem, text, openIcon=nil, closedIcon=nil, data=nil, notify=false) |
Prepend a new item with given text and optional openIcon, closedIcon and user data prior to otherItem. Returns a reference to the newly added item (an FXTreeItem instance). If notify is true, a SEL_INSERTED message is sent to the list’s message target after the item is added.
removeItem(item, notify=false) |
Remove item. If notify is true, a SEL_DELETED message is sent to the list’s message target before the item is removed.
removeItems(fromItem, toItem, notify=false) |
Remove items in range [fromItem, toItem] inclusively. If notify is true, a SEL_DELETED message is sent to the list’s message target before each item is removed.
clearItems(notify=false) |
Remove all items from the list. If notify is true, a SEL_DELETED message is sent to the list’s message target before each item is removed.
getItemWidth(item) |
Return item width
getItemHeight(item) |
Return item height
findItem(text, startItem=nil, flags=SEARCH_FORWARD|SEARCH_WRAP) |
Search items for item by text, starting from startItem; the flags argument controls the search direction, and case sensitivity. Returns a reference to the matching item, or nil if no match is found.
makeItemVisible(item) |
Scroll the list to make item visible
setItemText(item, text) |
Change item’s text
getItemText(item) |
Return item’s text
setItemOpenIcon(item, openIcon) |
Change item’s open icon
getItemOpenIcon(item) |
Return item’s open icon
setItemClosedIcon(item, closedIcon) |
Change item’s closed icon
getItemClosedIcon(item) |
Return item’s closed icon
setItemData(item, data) |
Change item’s user data
getItemData(item) |
Return item’s user data
itemSelected?(item) |
Return true if item is selected
itemCurrent?(item) |
Return true if item is current
itemVisible?(item) |
Return true if item is visible
itemOpened?(item) |
Return true if item opened
itemExpanded?(item) |
Return true if item expanded
itemLeaf?(item) |
Return true if item is a leaf-item, i.e. has no children
itemEnabled?(item) |
Return true if item is enabled
hitItem(item, x, y) |
Return item hit code: 0 outside, 1 icon, 2 text, 3 box
updateItem(item) |
Repaint item
enableItem(item) |
Enable item
disableItem(item) |
Disable item
selectItem(item, notify=false) |
Select item. If notify is true, a SEL_SELECTED message is sent to the list’s message target after the item is selected.
deselectItem(item, notify=false) |
Deselect item. If notify is true, a SEL_DESELECTED message is sent to the list’s message target after the item is deselected.
toggleItem(item, notify=false) |
Toggle item selection. If notify is true, a SEL_SELECTED or SEL_DESELECTED message is sent to the list’s message target to indicate the change.
openItem(item, notify=false) |
Open item. If notify is true, a SEL_OPENED message is sent to the list’s message target after the item is opened.
closeItem(item, notify=false) |
Close item. If notify is true, a SEL_CLOSED message is sent to the list’s message target after the item is closed.
collapseTree(tree, notify=false) |
Collapse sub-tree rooted at tree. If notify is true, a SEL_COLLAPSED message is sent to the list’s message target after the sub-tree is collapsed.
expandTree(tree, notify=false) |
Expand sub-tree rooted at tree. If notify is true, a SEL_EXPANDED message is sent to the list’s message target after the sub-tree is expanded.
reparentItem(item, parentItem) |
Reparent item under parentItem.
setCurrentItem(item, notify=false) |
Change current item. If notify is true, a SEL_CHANGED message is sent to the list’s message target after the current item changes.
extendSelection(item, notify=false) |
Extend selection from anchor item to item. If notify is true, a series of SEL_SELECTED and SEL_DESELECTED messages may be sent to the list’s message target, indicating the changes.
killSelection(notify=false) |
Deselect all items. If notify is true, SEL_DESELECTED messages will be sent to the list’s message target indicating the affected items.
sortItems() |
Sort root items
sortChildItems(item) |
Sort children of item
each() {|aTreeItem| ...} |
Calls block once for each root-level tree item, passing a reference to that item as a parameter.