Class | Tk::BWidget::ListBox::Item
In: | tk/lib/tkextlib/bwidget/listbox.rb
Parent: | TkObject

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

### Methods

[] []= cget configinfo configure current_configinfo delete edit exist? id id2obj index listbox move new see selection_add selection_remove selection_set selection_toggle

### Included Modules

TkTreatTagFont

### Constants

ListItem_TBL | = | TkCore::INTERP.create_table
ListItem_ID | = | ['bw:item'.freeze, '00000'.taint].freeze

### Public Class methods

id2obj(lbox, id)

[Source]

    # File tk/lib/tkextlib/bwidget/listbox.rb, line 218
      def self.id2obj(lbox, id)
        lpath = lbox.path
        return id unless ListItem_TBL[lpath]
        ListItem_TBL[lpath][id]? ListItem_TBL[lpath][id]: id
      end

new(lbox, *args)

[Source]

    # File tk/lib/tkextlib/bwidget/listbox.rb, line 224
      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
          @path = @id = ListItem_ID.join(TkCore::INTERP._ip_id_)
          ListItem_ID[1].succ!
        end

        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)

[Source]

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

[]=(key, val)

[Source]

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

cget(key)

[Source]

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

configinfo(key=nil)

[Source]

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

configure(key, val=None)

[Source]

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

current_configinfo(key=nil)

[Source]

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

delete()

[Source]

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

edit(*args)

[Source]

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

exist?()

[Source]

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

id()

[Source]

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

index()

[Source]

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

listbox()

[Source]

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

move(index)

[Source]

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

see()

[Source]

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

selection_add()

[Source]

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

selection_remove()

[Source]

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

selection_set()

[Source]

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

selection_toggle()

[Source]

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

[Validate]