Class Tk::Tile::Treeview
In: tk/lib/tkextlib/tile/treeview.rb
Parent: TkWindow

Methods

Included Modules

Tk::Tile::TileWidget Scrollable Tk::Tile::TreeviewConfig

Classes and Modules

Class Tk::Tile::Treeview::Item
Class Tk::Tile::Treeview::Root
Class Tk::Tile::Treeview::Tag

Constants

TkCommandNames = ['::ttk::treeview'.freeze].freeze
TkCommandNames = ['::treeview'.freeze].freeze
WidgetClassName = 'Treeview'.freeze

Public Class methods

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 923
  def self.style(*args)
    [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
  end

Public Instance methods

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 918
  def __destroy_hook__
    Tk::Tile::Treeview::Item::ItemID_TBL.delete(@path)
    Tk::Tile::Treeview::Tag::ItemID_TBL.delete(@path)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 942
  def bbox(item, column=None)
    list(tk_send('item', 'bbox', item, column))
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 946
  def children(item)
    simplelist(tk_send_without_enc('children', item)).collect{|id|
      Tk::Tile::Treeview::Item.id2obj(self, id)
    }
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1000
  def column_identify(x, y)
    tk_send('identify', 'column', x, y)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 957
  def delete(*items)
    tk_send_without_enc('delete', array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 962
  def detach(*items)
    tk_send_without_enc('detach', array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 967
  def exist?(item)
    bool(tk_send_without_enc('exists', _get_eval_enc_str(item)))
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 971
  def focus_item(item = nil)
    if item
      tk_send('focus', item)
      item
    else
      id = tk_send('focus')
      (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
    end
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1093
  def get(item, col)
    tk_send('set', item, col)
  end
get_dictionary(item)

Alias for get_directory

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1080
  def get_directory(item)
    # tile-0.7+
    ret = []
    lst = simplelist(tk_send('set', item))
    until lst.empty?
      col = lst.shift
      val = lst.shift
      ret << [col, val]
    end
    ret
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 981
  def identify(x, y)
    # tile-0.7.2 or previous
    ret = simplelist(tk_send('identify', x, y))
    case ret[0]
    when 'heading', 'separator'
      ret[-1] = num_or_str(ret[-1])
    when 'cell'
      ret[1] = Tk::Tile::Treeview::Item.id2obj(self, ret[1])
      ret[-1] = num_or_str(ret[-1])
    when 'item', 'row'
      ret[1] = Tk::Tile::Treeview::Item.id2obj(self, ret[1])
    end
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1004
  def index(item)
    number(tk_send('index', item))
  end

def insert(parent, idx=‘end’, keys={})

  keys = _symbolkey2str(keys)
  id = keys.delete('id')
  if id
    num_or_str(tk_send('insert', parent, idx, '-id', id, *hash_kv(keys)))
  else
    num_or_str(tk_send('insert', parent, idx, *hash_kv(keys)))
  end

end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1017
  def insert(parent, idx='end', keys={})
    Tk::Tile::Treeview::Item.new(self, parent, idx, keys)
  end

def instate(spec, cmd=Proc.new)

  tk_send('instate', spec, cmd)

end def state(spec=None)

  tk_send('state', spec)

end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1028
  def move(item, parent, idx)
    tk_send('move', item, parent, idx)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1033
  def next_item(item)
    id = tk_send('next', item)
    (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1038
  def parent_item(item)
    if (id = tk_send('parent', item)).empty?
      Tk::Tile::Treeview::Root.new(self)
    else
      Tk::Tile::Treeview::Item.id2obj(self, id)
    end
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1046
  def prev_item(item)
    id = tk_send('prev', item)
    (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 938
  def root
    Tk::Tile::Treeview::Root.new(self)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 995
  def row_identify(x, y)
    id = tk_send('identify', 'row', x, y)
    (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id)
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1051
  def see(item)
    tk_send('see', item)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1056
  def selection
    simplelist(tk_send('selection')).collect{|id|
      Tk::Tile::Treeview::Item.id2obj(self, id)
    }
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1063
  def selection_add(*items)
    tk_send('selection', 'add', array2tk_list(items.flatten, true))
    self
  end
selection_get()

Alias for selection

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1067
  def selection_remove(*items)
    tk_send('selection', 'remove', array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1071
  def selection_set(*items)
    tk_send('selection', 'set', array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1075
  def selection_toggle(*items)
    tk_send('selection', 'toggle', array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1096
  def set(item, col, value)
    tk_send('set', item, col, value)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 951
  def set_children(item, *items)
    tk_send_without_enc('children', item, 
                        array2tk_list(items.flatten, true))
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1101
  def tag_bind(tag, seq, *args)
    if TkComm._callback_entry?(args[0]) || !block_given?
      cmd = args.shift
    else
      cmd = Proc.new
    end
    _bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1112
  def tag_bind_append(tag, seq, *args)
    if TkComm._callback_entry?(args[0]) || !block_given?
      cmd = args.shift
    else
      cmd = Proc.new
    end
    _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1123
  def tag_bind_remove(tag, seq)
    _bind_remove([@path, 'tag', 'bind', tag], seq)
    self
  end

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 1129
  def tag_bindinfo(tag, context=nil)
    _bindinfo([@path, 'tag', 'bind', tag], context)
  end
tagbind(tag, seq, *args)

Alias for tag_bind

tagbind_append(tag, seq, *args)

Alias for tag_bind_append

tagbind_remove(tag, seq)

Alias for tag_bind_remove

tagbindinfo(tag, context=nil)

Alias for tag_bindinfo

[Source]

# File tk/lib/tkextlib/tile/treeview.rb, line 927
  def tagid(id)
    if id.kind_of?(Tk::Tile::Treeview::Item) || 
        id.kind_of?(Tk::Tile::Treeview::Tag)
      id.id
    elsif id.kind_of?(Array)
      [id[0], _get_eval_string(id[1])]
    else
      _get_eval_string(id)
    end
  end

[Validate]

ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.