Class: Tk::BLT::Treeview::Tag

Class | Tk::BLT::Treeview::Tag
In: | tk/lib/tkextlib/blt/treeview.rb
Parent: | TkObject

### Methods

add forget id id2obj new new new_by_name nodes remove

### Included Modules

Tk::BLT::Treeview::TagOrID_Methods

### Constants

TreeTagID_TBL | = | TkCore::INTERP.create_table
TreeTag_ID | = | ['blt_treeview_tag'.freeze, '00000'.taint].freeze

### Public Class methods

id2obj(tree, id)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1058
      def self.id2obj(tree, id)
        tpath = tree.path
        return id unless TreeTagID_TBL[tpath]
        if TreeTagID_TBL[tpath][id]
          TreeTagID_TBL[tpath][id]
        else
          begin
            self.new(tree, nil, nil, 'name'=>Integer(id))
          rescue
            id
          end
        end
      end

new(tree, name, ids)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1087
      def initialize(tree, name, ids)
        @parent = @tree = tree
        @tpath = @parent.path

        if name
          @path = @id = name
        else
          @path = @id = TreeTag_ID.join(TkCore::INTERP._ip_id_).freeze
          TreeTag_ID[1].succ!
        end

        TreeTagID_TBL[@tpath] = {} unless TreeTagID_TBL[@tpath]
        TreeTagID_TBL[@tpath][@id] = self

        unless ids.empty?
          tk_call(@tpath, 'tag', 'add', @id, *(ids.collect{|id| tagid(id)}))
        end
      end

new(tree, *ids)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1079
      def self.new(tree, *ids)
        if tree.kind_of?(Array)
          super(tree[0], tree[1], ids)
        else
          super(tree, nil, ids)
        end
      end

new_by_name(tree, name, *ids)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1072
      def self.new_by_name(tree, name, *ids)
        if (obj = TreeTagID_TBL[tree.path][name])
          return obj
        end
        new([tree, name], ids)
      end

### Public Instance methods

add(*ids)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1120
      def add(*ids)
        tk_call(@tpath, 'tag', 'add', @id, *(ids{|id| tagid(id)}))
        self
      end

forget()

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1130
      def forget
        tk_call(@tpath, 'tag', 'forget', @id)
        self
      end

id()

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1116
      def id
        @id
      end

nodes()

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1135
      def nodes
        simplelist(tk_call(@tpath, 'tag', 'nodes', @id)).collect{|id|
          Tk::BLT::Treeview::Node.id2obj(@tree, id)
        }
      end

remove(*ids)

[Source]

    # File tk/lib/tkextlib/blt/treeview.rb, line 1125
      def remove(*ids)
        tk_call(@tpath, 'tag', 'delete', @id, *(ids{|id| tagid(id)}))
        self
      end

[Validate]