In Files

  • tk/lib/tkextlib/bwidget/listbox.rb

Class/Module Index [+]

Quicksearch

Tk::BWidget::ListBox::Item

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

Public Class Methods

id2obj(lbox, id) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 225
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 tk/lib/tkextlib/bwidget/listbox.rb, line 236
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 tk/lib/tkextlib/bwidget/listbox.rb, line 288
def [](key)
  cget(key)
end
            
[]=(key, val) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 292
def []=(key, val)
  configure(key, val)
  val
end
            
cget(key) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 300
def cget(key)
  @listbox.itemcget(@id, key)
end
            
cget_strict(key) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 303
def cget_strict(key)
  @listbox.itemcget_strict(@id, key)
end
            
cget_tkstring(key) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 297
def cget_tkstring(key)
  @listbox.itemcget_tkstring(@id, key)
end
            
configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 311
def configinfo(key=nil)
  @listbox.itemconfiginfo(@id, key)
end
            
configure(key, val=None) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 307
def configure(key, val=None)
  @listbox.itemconfigure(@id, key, val)
end
            
current_configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 315
def current_configinfo(key=nil)
  @listbox.current_itemconfiginfo(@id, key)
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 319
def delete
  @listbox.delete(@id)
  self
end
            
edit(*args) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 324
def edit(*args)
  @listbox.edit(@id, *args)
  self
end
            
exist?() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 329
def exist?
  @listbox.exist?(@id)
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 284
def id
  @id
end
            
index() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 333
def index
  @listbox.index(@id)
end
            
listbox() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 280
def listbox
  @listbox
end
            
move(index) click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 337
def move(index)
  @listbox.move(@id, index)
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 217
def mutex; @mutex; end
            
see() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 341
def see
  @listbox.see(@id)
end
            
selection_add() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 345
def selection_add
  @listbox.selection_add(@id)
end
            
selection_remove() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 349
def selection_remove
  @listbox.selection_remove(@id)
end
            
selection_set() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 353
def selection_set
  @listbox.selection_set(@id)
end
            
selection_toggle() click to toggle source
 
               # File tk/lib/tkextlib/bwidget/listbox.rb, line 357
def selection_toggle
  @listbox.selection_toggle(@id)
end