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 210 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 221 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 273 def [](key) cget(key) end
[]=(key, val)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 277 def []=(key, val) configure(key, val) val end
cget(key)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 285 def cget(key) @listbox.itemcget(@id, key) end
cget_strict(key)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 288 def cget_strict(key) @listbox.itemcget_strict(@id, key) end
cget_tkstring(key)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 282 def cget_tkstring(key) @listbox.itemcget_tkstring(@id, key) end
configinfo(key=nil)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 296 def configinfo(key=nil) @listbox.itemconfiginfo(@id, key) end
configure(key, val=None)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 292 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 300 def current_configinfo(key=nil) @listbox.current_itemconfiginfo(@id, key) end
delete()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 304 def delete @listbox.delete(@id) self end
edit(*args)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 309 def edit(*args) @listbox.edit(@id, *args) self end
exist?()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 314 def exist? @listbox.exist?(@id) end
id()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 269 def id @id end
index()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 318 def index @listbox.index(@id) end
listbox()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 265 def listbox @listbox end
move(index)
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 322 def move(index) @listbox.move(@id, index) end
mutex()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 202 def mutex; @mutex; end
see()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 326 def see @listbox.see(@id) end
selection_add()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 330 def selection_add @listbox.selection_add(@id) end
selection_remove()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 334 def selection_remove @listbox.selection_remove(@id) end
selection_set()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 338 def selection_set @listbox.selection_set(@id) end
selection_toggle()
click to toggle source
# File lib/tkextlib/bwidget/listbox.rb, line 342 def selection_toggle @listbox.selection_toggle(@id) end