# class Tk::BWidget::ListBox::Item

is NOT a subclass of a listbox widget class. because it constructed on a canvas widget.

### Constants

ListItem_ID
ListItem_TBL

### Public Class Methods

id2obj(lbox, id) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 226
    def self.id2obj(lbox, id)
      lpath = lbox.path
      ListItem_TBL.mutex.synchronize{
        if ListItem_TBL[lpath]
          ListItem_TBL[lpath][id]? ListItem_TBL[lpath][id]: id
        else
          id
        end
      }
    end

new(lbox, *args) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 237
    def initialize(lbox, *args)
      if lbox.kind_of?(Tk::BWidget::ListBox)
        @listbox = lbox
      else
        fail RuntimeError,
          "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument"
      end

      if args[-1].kind_of?(Hash)
        keys = _symbolkey2str(args.pop)
      else
        keys = {}
      end

      index = keys.delete('index')
      unless args.empty?
        index = args.shift
      end
      index = 'end' unless index

      unless args.empty?
        fail RuntimeError, 'too much arguments'
      end

      @lpath = @listbox.path

      if keys.key?('itemname')
        @path = @id = keys.delete('itemname')
      else
        ListItem_ID.mutex.synchronize{
          @path = @id = ListItem_ID.join(TkCore::INTERP._ip_id_)
          ListItem_ID[1].succ!
        }
      end

      ListItem_TBL.mutex.synchronize{
        ListItem_TBL[@id] = self
        ListItem_TBL[@lpath] = {} unless ListItem_TBL[@lpath]
        ListItem_TBL[@lpath][@id] = self
      }

      @listbox.insert(index, @id, keys)
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 289
    def [](key)
      cget(key)
    end

[]=(key, val) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 293
    def []=(key, val)
      configure(key, val)
      val
    end

cget(key) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 301
    def cget(key)
      @listbox.itemcget(@id, key)
    end

cget_strict(key) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 304
    def cget_strict(key)
      @listbox.itemcget_strict(@id, key)
    end

cget_tkstring(key) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 298
    def cget_tkstring(key)
      @listbox.itemcget_tkstring(@id, key)
    end

configinfo(key=nil) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 312
    def configinfo(key=nil)
      @listbox.itemconfiginfo(@id, key)
    end

configure(key, val=None) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 308
    def configure(key, val=None)
      @listbox.itemconfigure(@id, key, val)
    end

current_configinfo(key=nil) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 316
    def current_configinfo(key=nil)
      @listbox.current_itemconfiginfo(@id, key)
    end

delete() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 320
    def delete
      @listbox.delete(@id)
      self
    end

edit(*args) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 325
    def edit(*args)
      @listbox.edit(@id, *args)
      self
    end

exist?() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 330
    def exist?
      @listbox.exist?(@id)
    end

id() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 285
    def id
      @id
    end

index() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 334
    def index
      @listbox.index(@id)
    end

listbox() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 281
    def listbox
      @listbox
    end

move(index) click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 338
    def move(index)
      @listbox.move(@id, index)
    end

mutex() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 218
    def mutex; @mutex; end

see() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 342
    def see
      @listbox.see(@id)
    end

selection_add() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 346
    def selection_add
      @listbox.selection_add(@id)
    end

selection_remove() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 350
    def selection_remove
      @listbox.selection_remove(@id)
    end

selection_set() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 354
    def selection_set
      @listbox.selection_set(@id)
    end

selection_toggle() click to toggle source

    # File lib/tkextlib/bwidget/listbox.rb, line 358
    def selection_toggle
      @listbox.selection_toggle(@id)
    end