# File tk/lib/tkextlib/blt/tabset.rb, line 226
def __boolval_optkeys
super() << 'samewidth' << 'tearoff'
end
# File tk/lib/tkextlib/blt/tabset.rb, line 218
def __destroy_hook__
Tk::BLT::Tabset::Tab::TabID_TBL.mutex.synchronize{
Tk::BLT::Tabset::Tab::TabID_TBL.delete(@path)
}
end
# File tk/lib/tkextlib/blt/tabset.rb, line 285
def activate(index)
tk_send('activate', tagindex(index))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 327
def delete(first, last=None)
tk_send('delete', tagindex(first), tagindex(last))
if first.kind_of?(Tk::BLT::Tabset::Tab)
TabID_TBL.mutex.synchronize{
TabID_TBL[@path].delete(first.id)
}
end
# middle tabs of the range are unknown
if last.kind_of?(Tk::BLT::Tabset::Tab)
TabID_TBL.mutex.synchronize{
TabID_TBL[@path].delete(last.id)
}
end
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 343
def focus(index)
tk_send('focus', tagindex(index))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 348
def get_tab(index)
if (idx = tk_send_without_enc('get', tagindex(index))).empty?
nil
else
Tk::BLT::Tabset::Tab.id2obj(self, idx)
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 355
def get_tabobj(index)
if (idx = tk_send_without_enc('get', tagindex(index))).empty?
nil
else
Tk::BLT::Tabset::Tab.new(self, nil, name, {})
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 363
def index(str)
num_or_str(tk_send('index', str))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 366
def index_name(tab)
num_or_str(tk_send('index', '-name', tagid(tab)))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 370
def insert(pos, tab, keys={})
pos = 'end' if pos.nil?
Tk::BLT::Tabset::Tab.new(self, tagindex(pos), tagid(tab), keys)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 374
def insert_tabs(pos, *tabs)
pos = 'end' if pos.nil?
if tabs[-1].kind_of?(Hash)
keys = tabs.pop
else
keys = {}
end
fail ArgumentError, 'no tabs is given' if tabs.empty?
tabs.map!{|tab| tagid(tab)}
tk_send('insert', tagindex(pos), *(tabs + [keys]))
tabs.collect{|tab| Tk::BLT::Tabset::Tab.new(self, nil, tagid(tab))}
end
# File tk/lib/tkextlib/blt/tabset.rb, line 387
def invoke(index)
tk_send('invoke', tagindex(index))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 395
def move_after(index, base_idx)
tk_send('move', tagindex(index), 'after', tagindex(base_idx))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 391
def move_before(index, base_idx)
tk_send('move', tagindex(index), 'before', tagindex(base_idx))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 400
def nearest(x, y)
Tk::BLT::Tabset::Tab.id2obj(self, num_or_str(tk_send_without_enc('nearest', x, y)))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 404
def perforation_activate(mode)
tk_send('perforation', 'activate', mode)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 408
def perforation_highlight(index, *args)
if args.empty?
# index --> mode
tk_send('perforation', 'highlight', index)
elsif args.size == 1
# args[0] --> mode
tk_send('perforation', 'highlight', tagindex(index), args[0])
else # Error: call to get Tcl's error message
tk_send('perforation', 'highlight', tagindex(index), *args)
end
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 420
def perforation_invoke(index=nil)
if index
tk_send('perforation', 'invoke', tagindex(index))
else
tk_send('perforation', 'invoke')
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 432
def scan_dragto(x, y)
tk_send_without_enc('scan', 'dragto', x, y)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 428
def scan_mark(x, y)
tk_send_without_enc('scan', 'mark', x, y)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 437
def see(index)
tk_send('see', tagindex(index))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 446
def select(index)
tk_send('select', tagindex(index))
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 442
def size()
number(tk_send_without_enc('size'))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 451
def tab_dockall
tk_send('tab', 'dockall')
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 468
def tab_ids(pat=None)
simplelist(tk_send('tab', 'names', pat))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 456
def tab_names(pat=None)
simplelist(tk_send('tab', 'names', pat)).collect{|name|
Tk::BLT::Tabset::Tab.id2obj(self, name)
}
end
# File tk/lib/tkextlib/blt/tabset.rb, line 462
def tab_objs(pat=None)
simplelist(tk_send('tab', 'names', pat)).collect{|name|
Tk::BLT::Tabset::Tab.new(self, nil, name, {})
}
end
# File tk/lib/tkextlib/blt/tabset.rb, line 472
def tab_pageheight
number(tk_send('tab', 'pageheight'))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 476
def tab_pagewidth
number(tk_send('tab', 'pagewidth'))
end
# File tk/lib/tkextlib/blt/tabset.rb, line 480
def tab_tearoff(index, parent=None)
window(tk_send('tab', 'tearoff', tagindex(index), parent))
end
def tabbind(tag, context, cmd=Proc.new, *args)
_bind([path, "bind", tagid(tag)], context, cmd, *args) self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 295
def tabbind(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
_bind([path, "bind", tagid(tag)], context, cmd, *args)
self
end
def tabbind_append(tag, context, cmd=Proc.new, *args)
_bind_append([path, "bind", tagid(tag)], context, cmd, *args) self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 309
def tabbind_append(tag, context, *args)
# if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
if TkComm._callback_entry?(args[0]) || !block_given?
cmd = args.shift
else
cmd = Proc.new
end
_bind_append([path, "bind", tagid(tag)], context, cmd, *args)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 319
def tabbind_remove(tag, context)
_bind_remove([path, "bind", tagid(tag)], context)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 323
def tabbindinfo(tag, context=nil)
_bindinfo([path, "bind", tagid(tag)], context)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 267
def tagid(tab)
if tab.kind_of?(Tk::BLT::Tabset::Tab)
tab.id
else
tab
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 275
def tagindex(tab)
if tab.kind_of?(Tk::BLT::Tabset::Tab)
tab.index
else
tab
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 484
def xscrollcommand(cmd=Proc.new)
configure_cmd 'scrollcommand', cmd
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 490
def xview(*index)
if index.empty?
list(tk_send_without_enc('view'))
else
tk_send_without_enc('view', *index)
self
end
end