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

# class Tk::BLT::Treeview

### Constants

TkCommandNames
WidgetClassName

### Public Instance Methods

__destroy_hook__() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 328
    def __destroy_hook__
      Tk::BLT::Treeview::Node::TreeNodeID_TBL.mutex.synchronize{
        Tk::BLT::Treeview::Node::TreeNodeID_TBL.delete(@path)
      }
      Tk::BLT::Treeview::Tag::TreeTagID_TBL.mutex.synchronize{
        Tk::BLT::Treeview::Tag::TreeTagID_TBL.delete(@path)
      }
    end

__item_validation_class_list(id) click to toggle source
Calls superclass method

    # File lib/tkextlib/blt/treeview.rb, line 315
    def __item_validation_class_list(id)
      case id
      when 'entry'
        super(id) << OpenCloseCommand
      else
        super(id)
      end
    end

__validation_class_list() click to toggle source
Calls superclass method

    # File lib/tkextlib/blt/treeview.rb, line 307
    def __validation_class_list
      super() << OpenCloseCommand
    end

_find_exec_flag_value(val) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 562
    def _find_exec_flag_value(val)
      if val.kind_of?(Array)
        cmd, *args = val
        #FindExecFlagValue.new(cmd, args.join(' '))
        FindExecFlagValue.new(cmd, *args)
      elsif TkComm._callback_entry?(val)
        FindExecFlagValue.new(val)
      else
        val
      end
    end

bbox(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 361
    def bbox(*tags)
      list(tk_send('bbox', *(tags.collect{|tag| tagid(tag)})))
    end

button_activate(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 395
    def button_activate(tag)
      tk_send('button', 'activate', tagid(tag))
      self
    end

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

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

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

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

button_bind_remove(tag, seq) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 418
    def button_bind_remove(tag, seq)
      _bind_remove([@path, 'button', 'bind', tagid(tag)], seq)
      self
    end

button_bindinfo(tag, seq=nil) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 422
    def button_bindinfo(tag, seq=nil)
      _bindinfo([@path, 'button', 'bind', tagid(tag)], seq)
    end

close(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 426
    def close(*tags)
      tk_send('close', *(tags.collect{|tag| tagid(tag)}))
      self
    end

close_recurse(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 430
    def close_recurse(*tags)
      tk_send('close', '-recurse', *(tags.collect{|tag| tagid(tag)}))
      self
    end

column_activate(column=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 435
    def column_activate(column=None)
      if column == None
        tk_send('column', 'activate')
      else
        tk_send('column', 'activate', column)
        self
      end
    end

column_delete(*fields) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 444
    def column_delete(*fields)
      tk_send('column', 'delete', *fields)
      self
    end

column_insert(pos, field, *opts) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 448
    def column_insert(pos, field, *opts)
      tk_send('column', 'insert', pos, field, *opts)
      self
    end

column_invoke(field) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 452
    def column_invoke(field)
      tk_send('column', 'invoke', field)
      self
    end

column_move(name, dest) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 456
    def column_move(name, dest)
      tk_send('column', 'move', name, dest)
      self
    end

column_names() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 460
    def column_names()
      simplelist(tk_send('column', 'names'))
    end

column_nearest(x, y=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 463
    def column_nearest(x, y=None)
      tk_send('column', 'nearest', x, y)
    end

curselection() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 467
    def curselection
      simplelist(tk_send('curselection')).collect{|id| tagid2obj(id)}
    end

delete(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 471
    def delete(*tags)
      tk_send('delete', *(tags.collect{|tag| tagid(tag)}))
      self
    end

entry_activate(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 476
    def entry_activate(tag)
      tk_send('entry', 'activate', tagid(tag))
      self
    end

entry_before?(tag1, tag2) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 487
    def entry_before?(tag1, tag2)
      bool(tk_send('entry', 'isbefore', tagid(tag1), tagid(tag2)))
    end

entry_children(tag, first=None, last=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 480
    def entry_children(tag, first=None, last=None)
      simplelist(tk_send('entry', 'children', tagid(tag),
                         first, last)).collect{|id| tagid2obj(id)}
    end

entry_delete(tag, first=None, last=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 484
    def entry_delete(tag, first=None, last=None)
      tk_send('entry', 'delete', tagid(tag), first, last)
    end

entry_hidden?(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 490
    def entry_hidden?(tag)
      bool(tk_send('entry', 'ishidden', tagid(tag)))
    end

entry_open?(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 493
    def entry_open?(tag)
      bool(tk_send('entry', 'isopen', tagid(tag)))
    end

entry_size(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 497
    def entry_size(tag)
      number(tk_send('entry', 'size', tagid(tag)))
    end

entry_size_recurse(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 500
    def entry_size_recurse(tag)
      number(tk_send('entry', 'size', '-recurse', tagid(tag)))
    end

find(first, last, keys={}) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 576
    def find(first, last, keys={})
      keys = _search_flags(keys)
      keys['exec'] = _find_exec_flag_value(keys['exec']) if keys.key?('exec')
      args = hash_kv(keys) << '--' << tagid(first) << tagid(last)
      simplelist(tk_send('find', *args)).collect{|id| tagid2obj(id)}
    end

get(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 587
    def get(*tags)
      simplelist(tk_send('get', *(tags.collect{|tag| tagid(tag)})))
    end

get_full(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 590
    def get_full(*tags)
      simplelist(tk_send('get', '-full', *(tags.collect{|tag| tagid(tag)})))
    end

hide(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 594
    def hide(*tags)
      if tags[-1].kind_of?(Hash)
        keys = tags.pop
      else
        keys = {}
      end
      keys = _search_flags(keys)
      args = hash_kv(keys) << '--'
      args.concat(tags.collect{|t| tagid(t)})
      tk_send('hide', *args)
      self
    end

index(str) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 607
    def index(str)
      tagid2obj(tk_send('index', str))
    end

index_at(tag, str) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 610
    def index_at(tag, str)
      tagid2obj(tk_send('index', '-at', tagid(tag), str))
    end

index_at_path(tag, str) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 613
    def index_at_path(tag, str)
      tagid2obj(tk_send('index', '-at', tagid(tag), '-path', str))
    end

insert(pos, parent=nil, keys={}) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 617
    def insert(pos, parent=nil, keys={})
      Tk::BLT::Treeview::Node.new(pos, parent, keys)
    end

insert_at(tag, pos, parent=nil, keys={}) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 620
    def insert_at(tag, pos, parent=nil, keys={})
      if parent.kind_of?(Hash)
        keys = parent
        parent = nil
      end

      keys = _symbolkey2str(keys)
      keys['at'] = tagid(tag)

      Tk::BLT::Treeview::Node.new(pos, parent, keys)
    end

move_after(tag, dest) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 636
    def move_after(tag, dest)
      tk_send('move', tagid(tag), 'after', tagid(dest))
      self
    end

move_before(tag, dest) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 632
    def move_before(tag, dest)
      tk_send('move', tagid(tag), 'before', tagid(dest))
      self
    end

move_into(tag, dest) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 640
    def move_into(tag, dest)
      tk_send('move', tagid(tag), 'into', tagid(dest))
      self
    end

nearest(x, y, var=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 645
    def nearest(x, y, var=None)
      tagid2obj(tk_send('nearest', x, y, var))
    end

open(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 649
    def open(*tags)
      tk_send('open', *(tags.collect{|tag| tagid(tag)}))
      self
    end

open_recurse(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 653
    def open_recurse(*tags)
      tk_send('open', '-recurse', *(tags.collect{|tag| tagid(tag)}))
      self
    end

range(first, last) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 658
    def range(first, last)
      simplelist(tk_send('range', tagid(first), tagid(last))).collect{|id|
        tagid2obj(id)
      }
    end

range_open(first, last) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 663
    def range_open(first, last)
      simplelist(tk_send('range', '-open',
                         tagid(first), tagid(last))).collect{|id|
        tagid2obj(id)
      }
    end

scan_dragto(x, y) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 674
    def scan_dragto(x, y)
      tk_send_without_enc('scan', 'dragto', x, y)
      self
    end

scan_mark(x, y) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 670
    def scan_mark(x, y)
      tk_send_without_enc('scan', 'mark', x, y)
      self
    end

screen_bbox(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 365
    def screen_bbox(*tags)
      list(tk_send('bbox', '-screen', *(tags.collect{|tag| tagid(tag)})))
    end

see(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 679
    def see(tag)
      tk_send_without_enc('see', tagid(tag))
      self
    end

see_anchor(anchor, tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 683
    def see_anchor(anchor, tag)
      tk_send_without_enc('see', '-anchor', anchor, tagid(tag))
      self
    end

selection_anchor(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 688
    def selection_anchor(tag)
      tk_send_without_enc('selection', 'anchor', tagid(tag))
      self
    end

selection_cancel() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 692
    def selection_cancel()
      tk_send_without_enc('selection', 'cancel')
      self
    end

selection_clear(first, last=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 696
    def selection_clear(first, last=None)
      tk_send_without_enc('selection', 'clear', tagid(first), tagid(last))
      self
    end

selection_clear_all() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 700
    def selection_clear_all()
      tk_send_without_enc('selection', 'clearall')
      self
    end

selection_include?(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 708
    def selection_include?(tag)
      bool(tk_send('selection', 'include', tagid(tag)))
    end

selection_mark(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 704
    def selection_mark(tag)
      tk_send_without_enc('selection', 'mark', tagid(tag))
      self
    end

selection_present?() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 711
    def selection_present?()
      bool(tk_send('selection', 'present'))
    end

selection_set(first, last=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 714
    def selection_set(first, last=None)
      tk_send_without_enc('selection', 'set', tagid(first), tagid(last))
      self
    end

selection_toggle(first, last=None) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 718
    def selection_toggle(first, last=None)
      tk_send_without_enc('selection', 'toggle', tagid(first), tagid(last))
      self
    end

show(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 723
    def show(*tags)
      if tags[-1].kind_of?(Hash)
        keys = tags.pop
      else
        keys = {}
      end
      keys = _search_flags(keys)
      args = hash_kv(keys) << '--'
      args.concat(tags.collect{|t| tagid(t)})
      tk_send('show', *args)
      self
    end

sort_auto(mode) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 736
    def sort_auto(mode)
      tk_send('sort', 'auto', mode)
      self
    end

sort_auto=(mode) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 740
    def sort_auto=(mode)
      tk_send('sort', 'auto', mode)
      mode
    end

sort_auto?() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 744
    def sort_auto?
      bool(tk_send('sort', 'auto'))
    end

sort_once(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 747
    def sort_once(*tags)
      tk_send('sort', 'once', *(tags.collect{|tag| tagid(tag)}))
      self
    end

sort_once_recurse(*tags) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 751
    def sort_once_recurse(*tags)
      tk_send('sort', 'once', '-recurse', *(tags.collect{|tag| tagid(tag)}))
      self
    end

tag_add(tag, *ids) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 756
    def tag_add(tag, *ids)
      tk_send('tag', 'add', tagid(tag), *ids)
      self
    end

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

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

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

    # File lib/tkextlib/blt/treeview.rb, line 378
    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, 'bind', tagid(tag)], seq, cmd, *args)
      self
    end

tag_bind_remove(tag, seq) click to toggle source

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

tag_bindinfo(tag, seq=nil) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 391
    def tag_bindinfo(tag, seq=nil)
      _bindinfo([@path, 'bind', tagid(tag)], seq)
    end

tag_delete(tag, *ids) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 760
    def tag_delete(tag, *ids)
      tk_send('tag', 'delete', tagid(tag), *ids)
      self
    end

tag_focus(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 583
    def tag_focus(tag)
      tk_send('focus', tagid(tag))
      self
    end

tag_forget(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 764
    def tag_forget(tag)
      tk_send('tag', 'forget', tagid(tag))
      self
    end

tag_names(id=nil) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 768
    def tag_names(id=nil)
      id = (id)? tagid(id): None

      simplelist(tk_send('tag', 'nodes', id)).collect{|tag|
        Tk::BLT::Treeview::Tag.id2obj(self, tag)
      }
    end

tag_nodes(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 775
    def tag_nodes(tag)
      simplelist(tk_send('tag', 'nodes', tagid(tag))).collect{|id|
        Tk::BLT::Treeview::Node.id2obj(self, id)
      }
    end

tagid2obj(tagid) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 347
    def tagid2obj(tagid)
      if tagid.kind_of?(Integer)
        Tk::BLT::Treeview::Node.id2obj(self, tagid.to_s)
      elsif tagid.kind_of?(String)
        if tagid =~ /^\d+$/
          Tk::BLT::Treeview::Node.id2obj(self, tagid)
        else
          Tk::BLT::Treeview::Tag.id2obj(self, tagid)
        end
      else
        tagid
      end
    end

text_apply() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 781
    def text_apply
      tk_send('text', 'apply')
      self
    end

text_cancel() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 785
    def text_cancel
      tk_send('text', 'cancel')
      self
    end

text_delete(first, last) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 790
    def text_delete(first, last)
      tk_send('text', 'delete', first, last)
      self
    end

text_get(x, y) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 794
    def text_get(x, y)
      tk_send('text', 'get', x, y)
    end

text_get_root(x, y) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 797
    def text_get_root(x, y)
      tk_send('text', 'get', '-root', x, y)
    end

text_icursor(idx) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 800
    def text_icursor(idx)
      tk_send('text', 'icursor', idx)
      self
    end

text_index(idx) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 804
    def text_index(idx)
      num_or_str(tk_send('text', 'index', idx))
    end

text_insert(idx, str) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 807
    def text_insert(idx, str)
      tk_send('text', 'insert', idx, str)
      self
    end

text_selection_adjust(idx) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 812
    def text_selection_adjust(idx)
      tk_send('text', 'selection', 'adjust', idx)
      self
    end

text_selection_clear() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 816
    def text_selection_clear
      tk_send('text', 'selection', 'clear')
      self
    end

text_selection_from(idx) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 820
    def text_selection_from(idx)
      tk_send('text', 'selection', 'from', idx)
      self
    end

text_selection_present() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 824
    def text_selection_present
      num_or_str(tk_send('text', 'selection', 'present'))
    end

text_selection_range(start, last) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 827
    def text_selection_range(start, last)
      tk_send('text', 'selection', 'range', start, last)
      self
    end

text_selection_to(idx) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 831
    def text_selection_to(idx)
      tk_send('text', 'selection', 'to', idx)
      self
    end

toggle(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 836
    def toggle(tag)
      tk_send('toggle', tagid(tag))
      self
    end

### Private Instance Methods

__boolval_optkeys() click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 247
    def __boolval_optkeys
      ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot',
        'newtags', 'showtitles', 'sortselection']
    end

__strval_optkeys() click to toggle source
Calls superclass method

    # File lib/tkextlib/blt/treeview.rb, line 253
    def __strval_optkeys
      super() + ['focusforeground', 'linecolor', 'separator', 'trim']
    end

_search_flags(keys) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 504
    def _search_flags(keys)
      keys = _symbolkey2str(keys)
      keys['exact'] = None if keys.delete('exact')
      keys['glob'] = None if keys.delete('glob')
      keys['regexp'] = None if keys.delete('regexp')
      keys['nonmatching'] = None if keys.delete('nonmatching')
    end

tagid(tag) click to toggle source

    # File lib/tkextlib/blt/treeview.rb, line 337
    def tagid(tag)
      if tag.kind_of?(Tk::BLT::Treeview::Node)        || tag.kind_of?(Tk::BLT::Treeview::Tag)
        tag.id
      else
        tag  # maybe an Array of configure parameters
      end
    end