# File tk/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
# File tk/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
# File tk/lib/tkextlib/bwidget/listbox.rb, line 289
def [](key)
cget(key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 293
def []=(key, val)
configure(key, val)
val
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 301
def cget(key)
@listbox.itemcget(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 304
def cget_strict(key)
@listbox.itemcget_strict(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 298
def cget_tkstring(key)
@listbox.itemcget_tkstring(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 312
def configinfo(key=nil)
@listbox.itemconfiginfo(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 308
def configure(key, val=None)
@listbox.itemconfigure(@id, key, val)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 316
def current_configinfo(key=nil)
@listbox.current_itemconfiginfo(@id, key)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 320
def delete
@listbox.delete(@id)
self
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 325
def edit(*args)
@listbox.edit(@id, *args)
self
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 330
def exist?
@listbox.exist?(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 334
def index
@listbox.index(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 281
def listbox
@listbox
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 338
def move(index)
@listbox.move(@id, index)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 218
def mutex; @mutex; end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 342
def see
@listbox.see(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 346
def selection_add
@listbox.selection_add(@id)
end
# File tk/lib/tkextlib/bwidget/listbox.rb, line 350
def selection_remove
@listbox.selection_remove(@id)
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.