Class: Wx::TreeCtrl
- Inherits:
-
Object
- Object
- Wx::TreeCtrl
- Includes:
- Enumerable
- Defined in:
- lib/wx/classes/treectrl.rb
Overview
Hierarchical control with items
Instance Method Summary collapse
-
#get_children(parent) ⇒ Object
Return the children of
parent
as an array of TreeItemIDs. -
#get_item_rect(tree_item_id) ⇒ Object
Returns a Wx::Rect corresponding to the edges of an individual tree item, including the button, identified by id.
-
#get_label_rect(tree_item_id) ⇒ Object
Returns a Wx::Rect corresponding to the edges of an individual tree item’s text label.
Instance Method Details
#get_children(parent) ⇒ Object
Return the children of parent
as an array of TreeItemIDs.
9 10 11 12 13 14 15 16 17 |
# File 'lib/wx/classes/treectrl.rb', line 9 def get_children(parent) kids = [ get_first_child(parent) ] return [] if kids[0].zero? while kid = get_next_sibling(kids.last) and not kid.zero? kids << kid end kids end |
#get_item_rect(tree_item_id) ⇒ Object
Returns a Wx::Rect corresponding to the edges of an individual tree item, including the button, identified by id. The standard wxWidgets API for getting the pixel location of an item is unrubyish, using an input/output parameter. But since the underlying get_bounding_rect method works, it’s easier to fix the API in Ruby than adding more to the already-toxic swig interface TreeCtrl.i file.
25 26 27 28 29 30 31 32 |
# File 'lib/wx/classes/treectrl.rb', line 25 def get_item_rect(tree_item_id) rect = Wx::Rect.new if get_bounding_rect(tree_item_id, rect, false) return rect else return nil end end |
#get_label_rect(tree_item_id) ⇒ Object
Returns a Wx::Rect corresponding to the edges of an individual tree item’s text label. See above.
36 37 38 39 40 41 42 43 |
# File 'lib/wx/classes/treectrl.rb', line 36 def get_label_rect(tree_item_id) rect = Wx::Rect.new if get_bounding_rect(tree_item_id, rect, true) return rect else nil end end |