Class: Fox::FXTreeListBox
- Inherits:
-
FXPacker
- Object
- FXObject
- FXId
- FXDrawable
- FXWindow
- FXComposite
- FXPacker
- Fox::FXTreeListBox
- Includes:
- Enumerable
- Defined in:
- rdoc-sources/FXTreeListBox.rb,
lib/fox16/core.rb,
lib/fox16/iterators.rb
Overview
The Tree List Box behaves very much like a List Box, except that it supports a hierarchical, tree structured display of the items. When an item is selected it issues a SEL_COMMAND
message with the pointer to the item. While manipulating the tree list, it may send SEL_CHANGED
messages to indicate which item the cursor is hovering over.
Events
The following messages are sent by FXTreeListBox to its target:
SEL_CHANGED
-
sent when the current list item changes; the message data is a reference to the new tree item.
SEL_COMMAND
-
sent when the current list item changes; the message data is a reference to the new tree item.
Tree list box styles
TREELISTBOX_NORMAL
-
Normal style
Message identifiers
ID_TREE
-
x
ID_FIELD
-
x
Direct Known Subclasses
Instance Attribute Summary collapse
-
#currentItem ⇒ Object
Current item, if any FXTreeItem.
-
#firstItem ⇒ Object
readonly
First root-level item FXTreeItem.
-
#font ⇒ Object
Text font FXFont.
-
#helpText ⇒ Object
Status line help text for this tree list box [String].
-
#lastItem ⇒ Object
readonly
Last root-level item FXTreeItem.
-
#listStyle ⇒ Object
Tree list box style.
-
#numItems ⇒ Object
readonly
Number of items [Integer].
-
#numVisible ⇒ Object
Number of visible items [Integer].
-
#tipText ⇒ Object
Tool tip text for this tree list box [String].
Attributes inherited from FXPacker
#baseColor, #borderColor, #borderWidth, #frameStyle, #hSpacing, #hiliteColor, #packingHints, #padBottom, #padLeft, #padRight, #padTop, #shadowColor, #vSpacing
Attributes inherited from FXWindow
#accelTable, #backColor, #defaultCursor, #dragCursor, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y
Attributes inherited from FXDrawable
Attributes inherited from FXId
Instance Method Summary collapse
-
#addItemAfter(other, *args) ⇒ Object
:nodoc:.
-
#addItemBefore(other, *args) ⇒ Object
:nodoc:.
-
#addItemFirst(*args) ⇒ Object
:nodoc:.
-
#addItemLast(*args) ⇒ Object
:nodoc:.
-
#appendItem(father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Append item with given text and optional icons, and user-data pointer as last child of father.
-
#clearItems(notify = false) ⇒ Object
Remove all items from the list.
-
#each ⇒ Object
Calls block once for each root-level tree item, passing a reference to that item as a parameter.
-
#extractItem(item) ⇒ Object
Extract item from list and return a reference to the item.
-
#fillItems(father, strings, oi = nil, ci = nil, ptr = nil) ⇒ Object
Fill tree list box by appending items from array of strings and return the number of items added.
-
#findItem(text, start = nil, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object
Search items by text, beginning from item start.
-
#findItemByData(data, start = nil, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object
Search items by associated user data, beginning from item start.
-
#first ⇒ Object
Override Enumerable#first with FXWindow#first for backwards compatibility.
-
#getItemClosedIcon(item) ⇒ Object
Return item’s closed icon.
-
#getItemData(item) ⇒ Object
Return item’s user data.
-
#getItemOpenIcon(item) ⇒ Object
Return item’s open icon.
-
#getItemText(item) ⇒ Object
Return item’s text.
-
#initialize(p, target = nil, selector = 0, opts = FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXTreeListBox
constructor
Return an initially empty FXTreeListBox.
-
#insertItem(other, father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Insert item with given text and optional icons, and user-data pointer under father before other item.
-
#itemCurrent?(item) ⇒ Boolean
Return
true
if item is current. -
#itemLeaf?(item) ⇒ Boolean
Return
true
if item is a leaf-item, i.e. -
#moveItem(other, father, item) ⇒ Object
Move item under father before other item and return a reference to item.
-
#paneShown? ⇒ Boolean
Return
true
if the pane is shown. -
#prependItem(father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Prepend item with given text and optional icons, and user-data pointer as first child of father.
-
#removeItem(item, notify = false) ⇒ Object
Remove item.
-
#removeItems(fromItem, toItem, notify = false) ⇒ Object
Remove items in range [fromItem, toItem] inclusively.
-
#setCurrentItem(item, notify = false) ⇒ Object
Change current item.
-
#setItemClosedIcon(item, closedIcon) ⇒ Object
Change item’s closed icon.
-
#setItemData(item, data) ⇒ Object
Change item’s user data.
-
#setItemOpenIcon(item, openIcon) ⇒ Object
Change item’s open icon.
-
#setItemText(item, text) ⇒ Object
Change item’s text.
-
#sortChildItems(item) ⇒ Object
Sort children of item.
-
#sortItems ⇒ Object
Sort all items recursively.
-
#sortRootItems ⇒ Object
Sort root items.
Methods inherited from FXComposite
#maxChildHeight, #maxChildWidth
Methods inherited from FXWindow
#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, after?, #after?, before?, #before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=
Methods included from Responder2
Methods inherited from FXDrawable
Methods inherited from FXId
#create, #created?, #destroy, #detach, #runOnUiThread
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(p, target = nil, selector = 0, opts = FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXTreeListBox
Return an initially empty FXTreeListBox.
Parameters:
p
-
the parent window for this tree list box Fox::FXComposite
target
-
the message target, if any, for this tree list box Fox::FXObject
selector
-
the message identifier for this tree list box [Integer]
opts
-
tree list options [Integer]
x
-
initial x-position [Integer]
y
-
initial y-position [Integer]
width
-
initial width [Integer]
height
-
initial height [Integer]
padLeft
-
internal padding on the left side, in pixels [Integer]
padRight
-
internal padding on the right side, in pixels [Integer]
padTop
-
internal padding on the top side, in pixels [Integer]
padBottom
-
internal padding on the bottom side, in pixels [Integer]
74 75 |
# File 'rdoc-sources/FXTreeListBox.rb', line 74 def initialize(p, target=nil, selector=0, opts=FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theTreeListBox end |
Instance Attribute Details
#currentItem ⇒ Object
Current item, if any Fox::FXTreeItem
42 43 44 |
# File 'rdoc-sources/FXTreeListBox.rb', line 42 def currentItem @currentItem end |
#firstItem ⇒ Object (readonly)
First root-level item Fox::FXTreeItem
36 37 38 |
# File 'rdoc-sources/FXTreeListBox.rb', line 36 def firstItem @firstItem end |
#font ⇒ Object
Text font Fox::FXFont
45 46 47 |
# File 'rdoc-sources/FXTreeListBox.rb', line 45 def font @font end |
#helpText ⇒ Object
Status line help text for this tree list box [String]
51 52 53 |
# File 'rdoc-sources/FXTreeListBox.rb', line 51 def helpText @helpText end |
#lastItem ⇒ Object (readonly)
Last root-level item Fox::FXTreeItem
39 40 41 |
# File 'rdoc-sources/FXTreeListBox.rb', line 39 def lastItem @lastItem end |
#listStyle ⇒ Object
Tree list box style
48 49 50 |
# File 'rdoc-sources/FXTreeListBox.rb', line 48 def listStyle @listStyle end |
#numItems ⇒ Object (readonly)
Number of items [Integer]
30 31 32 |
# File 'rdoc-sources/FXTreeListBox.rb', line 30 def numItems @numItems end |
#numVisible ⇒ Object
Number of visible items [Integer]
33 34 35 |
# File 'rdoc-sources/FXTreeListBox.rb', line 33 def numVisible @numVisible end |
#tipText ⇒ Object
Tool tip text for this tree list box [String]
54 55 56 |
# File 'rdoc-sources/FXTreeListBox.rb', line 54 def tipText @tipText end |
Instance Method Details
#addItemAfter(other, *args) ⇒ Object
:nodoc:
67 68 69 70 |
# File 'lib/fox16/core.rb', line 67 def addItemAfter(other, *args) # :nodoc: warn "addItemAfter() is deprecated; use insertItem() instead" insertItem(other.next, other.parent, *args) end |
#addItemBefore(other, *args) ⇒ Object
:nodoc:
71 72 73 74 |
# File 'lib/fox16/core.rb', line 71 def addItemBefore(other, *args) # :nodoc: warn "addItemBefore() is deprecated; use insertItem() instead" insertItem(other, other.parent, *args) end |
#addItemFirst(*args) ⇒ Object
:nodoc:
59 60 61 62 |
# File 'lib/fox16/core.rb', line 59 def addItemFirst(*args) # :nodoc: warn "addItemFirst() is deprecated; use prependItem() instead" prependItem(*args) end |
#addItemLast(*args) ⇒ Object
:nodoc:
63 64 65 66 |
# File 'lib/fox16/core.rb', line 63 def addItemLast(*args) # :nodoc: warn "addItemLast() is deprecated; use appendItem() instead" appendItem(*args) end |
#appendItem(father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Append item with given text and optional icons, and user-data pointer as last child of father. 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.
101 |
# File 'rdoc-sources/FXTreeListBox.rb', line 101 def appendItem(father, item, notify=false); end |
#clearItems(notify = false) ⇒ Object
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.
134 |
# File 'rdoc-sources/FXTreeListBox.rb', line 134 def clearItems(notify=false); end |
#each ⇒ Object
Calls block once for each root-level tree item, passing a reference to that item as a parameter.
253 254 255 256 257 258 259 260 261 |
# File 'lib/fox16/iterators.rb', line 253 def each # :yields: aTreeItem current = firstItem while current != nil next_current = current.next yield current current = next_current end self end |
#extractItem(item) ⇒ Object
Extract item from list and return a reference to the item.
145 |
# File 'rdoc-sources/FXTreeListBox.rb', line 145 def extractItem(item); end |
#fillItems(father, strings, oi = nil, ci = nil, ptr = nil) ⇒ Object
Fill tree list box by appending items from array of strings and return the number of items added. If notify is true
, a SEL_INSERTED
message is sent to the list box’s message target after each item is added.
83 |
# File 'rdoc-sources/FXTreeListBox.rb', line 83 def fillItems(father, strings, oi=nil, ci=nil, ptr=nil); end |
#findItem(text, start = nil, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object
Search items by text, beginning from item start. If the start item is nil
the search will start at the first, top-most item in the list. Flags may be SEARCH_FORWARD
or SEARCH_BACKWARD
to control the search direction; this can be combined with SEARCH_NOWRAP
or SEARCH_WRAP
to control whether the search wraps at the start or end of the list. The option SEARCH_IGNORECASE
causes a case-insensitive match. Finally, passing SEARCH_PREFIX
causes searching for a prefix of the item text. Return nil
if no matching item is found.
157 |
# File 'rdoc-sources/FXTreeListBox.rb', line 157 def findItem(text, start=nil, flags=SEARCH_FORWARD|SEARCH_WRAP); end |
#findItemByData(data, start = nil, flags = SEARCH_FORWARD|SEARCH_WRAP) ⇒ Object
Search items by associated user data, beginning from item start. If the start item is nil
the search will start at the first, top-most item in the list. Flags may be SEARCH_FORWARD
or SEARCH_BACKWARD
to control the search direction; this can be combined with SEARCH_NOWRAP
or SEARCH_WRAP
to control whether the search wraps at the start or end of the list. Return nil
if no matching item is found.
167 |
# File 'rdoc-sources/FXTreeListBox.rb', line 167 def findItemByData(data, start=nil, flags=SEARCH_FORWARD|SEARCH_WRAP); end |
#first ⇒ Object
Override Enumerable#first with FXWindow#first for backwards compatibility.
245 246 247 |
# File 'lib/fox16/iterators.rb', line 245 def first getFirst end |
#getItemClosedIcon(item) ⇒ Object
Return item’s closed icon
207 |
# File 'rdoc-sources/FXTreeListBox.rb', line 207 def getItemClosedIcon(item); end |
#getItemData(item) ⇒ Object
Return item’s user data
213 |
# File 'rdoc-sources/FXTreeListBox.rb', line 213 def getItemData(item); end |
#getItemOpenIcon(item) ⇒ Object
Return item’s open icon
201 |
# File 'rdoc-sources/FXTreeListBox.rb', line 201 def getItemOpenIcon(item); end |
#getItemText(item) ⇒ Object
Return item’s text
195 |
# File 'rdoc-sources/FXTreeListBox.rb', line 195 def getItemText(item); end |
#insertItem(other, father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Insert item with given text and optional icons, and user-data pointer under father before other item. 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.
89 |
# File 'rdoc-sources/FXTreeListBox.rb', line 89 def insertItem(other, father, item, notify=false); end |
#itemCurrent?(item) ⇒ Boolean
Return true
if item is current
170 |
# File 'rdoc-sources/FXTreeListBox.rb', line 170 def itemCurrent?(item); end |
#itemLeaf?(item) ⇒ Boolean
Return true
if item is a leaf-item, i.e. has no children
173 |
# File 'rdoc-sources/FXTreeListBox.rb', line 173 def itemLeaf?(item); end |
#moveItem(other, father, item) ⇒ Object
Move item under father before other item and return a reference to item.
140 |
# File 'rdoc-sources/FXTreeListBox.rb', line 140 def moveItem(other, father, item); end |
#paneShown? ⇒ Boolean
Return true
if the pane is shown.
216 |
# File 'rdoc-sources/FXTreeListBox.rb', line 216 def paneShown?; end |
#prependItem(father, text, openIcon = nil, closedIcon = nil, data = nil, notify = false) ⇒ Object
Prepend item with given text and optional icons, and user-data pointer as first child of father. 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.
113 |
# File 'rdoc-sources/FXTreeListBox.rb', line 113 def prependItem(father, item, notify=false); end |
#removeItem(item, notify = false) ⇒ Object
Remove item. If notify is true
, a SEL_DELETED
message is sent to the list’s message target before the item is removed.
124 |
# File 'rdoc-sources/FXTreeListBox.rb', line 124 def removeItem(item, notify=false); end |
#removeItems(fromItem, toItem, notify = false) ⇒ Object
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.
129 |
# File 'rdoc-sources/FXTreeListBox.rb', line 129 def removeItems(fromItem, toItem, notify=false); end |
#setCurrentItem(item, notify = false) ⇒ Object
Change current item. If notify is true
, a SEL_CHANGED message is sent to the tree list box’s message target.
189 |
# File 'rdoc-sources/FXTreeListBox.rb', line 189 def setCurrentItem(item, notify=false); end |
#setItemClosedIcon(item, closedIcon) ⇒ Object
Change item’s closed icon
204 |
# File 'rdoc-sources/FXTreeListBox.rb', line 204 def setItemClosedIcon(item, closedIcon); end |
#setItemData(item, data) ⇒ Object
Change item’s user data
210 |
# File 'rdoc-sources/FXTreeListBox.rb', line 210 def setItemData(item, data); end |
#setItemOpenIcon(item, openIcon) ⇒ Object
Change item’s open icon
198 |
# File 'rdoc-sources/FXTreeListBox.rb', line 198 def setItemOpenIcon(item, openIcon); end |
#setItemText(item, text) ⇒ Object
Change item’s text
192 |
# File 'rdoc-sources/FXTreeListBox.rb', line 192 def setItemText(item, text); end |
#sortChildItems(item) ⇒ Object
Sort children of item
182 |
# File 'rdoc-sources/FXTreeListBox.rb', line 182 def sortChildItems(item); end |
#sortItems ⇒ Object
Sort all items recursively.
179 |
# File 'rdoc-sources/FXTreeListBox.rb', line 179 def sortItems(); end |
#sortRootItems ⇒ Object
Sort root items
176 |
# File 'rdoc-sources/FXTreeListBox.rb', line 176 def sortRootItems(); end |