# File tk/lib/tkextlib/blt/tabset.rb, line 27
def self.id2obj(tabset, id)
tpath = tabset.path
TabID_TBL.mutex.synchronize{
if TabID_TBL[tpath]
TabID_TBL[tpath][id]? TabID_TBL[tpath][id]: id
else
id
end
}
end
# File tk/lib/tkextlib/blt/tabset.rb, line 71
def initialize(parent, pos, name, keys)
@t = parent
@tpath = parent.path
if name
@path = @id = name
unless (list(tk_call(@tpath, 'tab', 'names', @id)).empty?)
if pos
idx = tk_call(@tpath, 'index', '-name', @id)
if pos.to_s == 'end'
tk_call(@tpath, 'move', idx, 'after', 'end')
else
tk_call(@tpath, 'move', idx, 'before', pos)
end
end
tk_call(@tpath, 'tab', 'configure', @id, keys)
else
pos = 'end' unless pos
tk_call(@tpath, 'insert', pos, @id, keys)
end
else
pos = 'end' unless pos
TabsetTab_ID.mutex.synchronize{
@path = @id = TabsetTab_ID.join(TkCore::INTERP._ip_id_)
TabsetTab_ID[1].succ!
}
tk_call(@tpath, 'insert', pos, @id, keys)
end
end
# File tk/lib/tkextlib/blt/tabset.rb, line 38
def self.new(parent, pos=nil, name=nil, keys={})
if pos.kind_of?(Hash)
keys = pos
name = nil
pos = nil
end
if name.kind_of?(Hash)
keys = name
name = nil
end
obj = nil
TabID_TBL.mutex.synchronize{
if name && TabID_TBL[parent.path] && TabID_TBL[parent.path][name]
obj = TabID_TBL[parent.path][name]
if pos
if pos.to_s == 'end'
obj.move_after('end')
else
obj.move_before(pos)
end
end
obj.configure if keys && ! keys.empty?
else
(obj = self.allocate).instance_eval{
initialize(parent, pos, name, keys)
TabID_TBL[@tpath] = {} unless TabID_TBL[@tpath]
TabID_TBL[@tpath][@id] = self
}
end
}
obj
end
def bind(context, cmd=Proc.new, *args)
@t.tab_bind(@id, context, cmd, *args) self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 104
def bind(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
@t.tab_bind(@id, context, cmd, *args)
self
end
def #bind_append(context, cmd=Proc.new, *args)
@t.tab_bind_append(@id, context, cmd, *args) self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 118
def bind_append(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
@t.tab_bind_append(@id, context, cmd, *args)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 128
def bind_remove(context)
@t.tab_bind_remove(@id, context)
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 132
def bindinfo(context=nil)
@t.tab_bindinfo(@id, context)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 139
def cget(*args)
@t.tab_cget(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 142
def cget_strict(*args)
@t.tab_cget_strict(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 136
def cget_tkstring(*args)
@t.tab_cget_tkstring(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 148
def configinfo(*args)
@t.tab_configinfo(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 145
def configure(*args)
@t.tab_configure(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 151
def current_configinfo(*args)
@t.current_tab_configinfo(@id, *args)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 155
def delete()
@t.delete(@id)
TabID_TBL.mutex.synchronize{
TabID_TBL[@tpath].delete(@id)
}
self
end
# File tk/lib/tkextlib/blt/tabset.rb, line 167
def focus()
@t.focus(self.index)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 163
def get_name()
@id.dup
end
# File tk/lib/tkextlib/blt/tabset.rb, line 171
def index()
@t.index_name(@id)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 175
def invoke()
@t.invoke(self.index)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 182
def move_after(idx)
@t.move_after(self.index, idx)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 179
def move_before(idx)
@t.move_before(self.index, idx)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 186
def perforation_highlight(mode)
@t.perforation_highlight(self.index, mode)
end
# File tk/lib/tkextlib/blt/tabset.rb, line 189
def perforation_invoke()
@t.perforation_invoke(self.index)
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.