class Tk::Tile::Treeview - tk-0.2.0 Documentation

# class Tk::Tile::Treeview

### Constants

TkCommandNames
WidgetClassName

### Public Class Methods

style(*args) click to toggle source

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

### Public Instance Methods

__destroy_hook__() click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1070
    def __destroy_hook__
      Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{
        Tk::Tile::Treeview::Item::ItemID_TBL.delete(@path)
      }
      Tk::Tile::Treeview::Tag::ItemID_TBL.mutex.synchronize{
        Tk::Tile::Treeview::Tag::ItemID_TBL.delete(@path)
      }
    end

bbox(item, column=None) click to toggle source

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

children(item) click to toggle source

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

column_identify(x, y) click to toggle source

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

Also aliased as: identify_column
delete(*items) click to toggle source

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

detach(*items) click to toggle source

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

exist?(item) click to toggle source

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

focus_item(item = nil) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1128
    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

get(item, col) click to toggle source

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

get_dictionary(item)
Alias for: get_directory
get_directory(item) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1252
    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

Also aliased as: get_dictionary
identify(x, y) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1138
    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

identify_column(x, y)
Alias for: column_identify
identify_element(x, y) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1161
    def identify_element(x, y)
      tk_send('identify', 'element', x, y)
    end

identify_item(x, y) click to toggle source

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

identify_region(x, y) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1152
    def identify_region(x, y)
      tk_send('identify', 'region', x, y)
    end

identify_row(x, y)
Alias for: row_identify
index(item) click to toggle source

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

insert(parent, idx='end', keys={}) click to toggle source

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

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

move(item, parent, idx) click to toggle source

def instate(spec, cmd=Proc.new)

    tk_send('instate', spec, cmd)

end def state(spec=None)

    tk_send('state', spec)

end

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

next_item(item) click to toggle source

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

parent_item(item) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1210
    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

prev_item(item) click to toggle source

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

root() click to toggle source

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

row_identify(x, y) click to toggle source

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

Also aliased as: identify_row
see(item) click to toggle source

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

selection() click to toggle source

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

Also aliased as: selection_get
selection_add(*items) click to toggle source

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

selection_get()
Alias for: selection
selection_remove(*items) click to toggle source

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

selection_set(*items) click to toggle source

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

selection_toggle(*items) click to toggle source

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

set(item, col, value) click to toggle source

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

set_children(item, *items) click to toggle source

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

tag_add(tag, *items) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1321
    def tag_add(tag, *items)
      fail ArgumentError, "no target items" if items.empty?
      tk_send('tag', 'add', tagid(tag), *(items.collect{|item| tagid(item)}))
      self
    end

tag_bind(tag, seq, *args) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1282
    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

Also aliased as: tagbind
tag_bind_append(tag, seq, *args) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1293
    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

Also aliased as: tagbind_append
tag_bind_remove(tag, seq) click to toggle source

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

Also aliased as: tagbind_remove
tag_bindinfo(tag, context=nil) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1310
    def tag_bindinfo(tag, context=nil)
      _bindinfo([@path, 'tag', 'bind', tag], context)
    end

Also aliased as: tagbindinfo
tag_has(tag) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1276
    def tag_has(tag)
      tk_split_simplelist(tk_send('tag', 'has', tagid(tag))).collect{|id|
        Tk::Tile::Treeview::Item.id2obj(self, id)
      }
    end

tag_has?(tag, item) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1273
    def tag_has?(tag, item)
      bool(tk_send('tag', 'has', tagid(tag), tagid(item)))
    end

tag_names() click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1315
    def tag_names
      tk_split_simplelist(tk_send('tag', 'names')).collect{|id|
        Tk::Tile::Treeview::Tag.id2obj(self, id)
      }
    end

tag_remove(tag, *items) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1327
    def tag_remove(tag, *items)
      tk_send('tag', 'remove', tagid(tag), *(items.collect{|item| tagid(item)}))
      self
    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
tagid(id) click to toggle source

    # File lib/tkextlib/tile/treeview.rb, line 1083
    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)
        # size is 2 or 3
        id[0..-2] << _get_eval_string(id[-1])
      else
        _get_eval_string(id)
      end
    end