Sha256: 25d9a1fa06689fe0f1b29c08b60821b7f35c0d1de87cc775663a99fbdb5942e1
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
# Copyright (c) 2023 M.J.N. Corino, The Netherlands # # This software is released under the MIT license. # # Some parts are # Copyright 2004-2007, wxRuby development team # released under the MIT-like wxRuby2 license # Hierarchical control with items class Wx::TreeCtrl # Make these ruby enumerables so find, find_all, map etc are available include Enumerable # Iterate over all items alias :each :traverse # Return the children of +parent+ as an array of TreeItemIDs. def get_children(parent) kids = [] kid, _ = get_first_child(parent) return [] unless kid.ok? kids << kid while kid = get_next_sibling(kids.last) and kid.ok? kids << kid end kids end # 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. 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 # Returns a Wx::Rect corresponding to the edges of an individual tree # item's text label. See above. 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wxruby3-0.9.1-x64-mingw-ucrt | lib/wx/core/treectrl.rb |
wxruby3-0.9.0-x64-mingw-ucrt | lib/wx/core/treectrl.rb |