Namespace
- MODULE Tk::Text::IndexModMethods
- CLASS Tk::Text::IndexString
Methods
- #
- A
- B
- C
- D
- E
- G
- I
- M
- N
- P
- R
- S
- T
- U
- V
- X
- Y
Included Modules
- TkTextTagConfig
- Scrollable
Constants
| ItemConfCMD | = | ['tag'.freeze, 'configure'.freeze].freeze |
| TkCommandNames | = | ['text'.freeze].freeze |
| WidgetClassName | = | 'Text'.freeze |
Class Public methods
at(x, y)
Link
new(*args, &block)
Link
Instance Public methods
__destroy_hook__()
Link
_addcmd(cmd)
Link
_addtag(name, obj)
Link
at(x, y)
Link
backspace()
Link
bbox(index)
Link
compare(idx1, op, idx2)
Link
count(idx1, idx2, *opts)
Link
# File ext/tk/lib/tk/text.rb, line 634 def count(idx1, idx2, *opts) # opts are Tk8.5 feature cnt = 0 args = opts.collect{|opt| str = opt.to_s cnt += 1 if str != 'update' '-' + str } args << _get_eval_enc_str(idx1) << _get_eval_enc_str(idx2) if cnt <= 1 number(tk_send_without_enc('count', *opts)) else list(tk_send_without_enc('count', *opts)) end end
count_info(idx1, idx2, update=true)
Link
# File ext/tk/lib/tk/text.rb, line 650 def count_info(idx1, idx2, update=true) # Tk8.5 feature opts = [ :chars, :displaychars, :displayindices, :displaylines, :indices, :lines, :xpixels, :ypixels ] if update lst = count(idx1, idx2, :update, *opts) else lst = count(idx1, idx2, *opts) end info = {} opts.each_with_index{|key, idx| info[key] = lst[idx]} info end
current_image_configinfo(index, slot = nil)
Link
# File ext/tk/lib/tk/text.rb, line 556 def current_image_configinfo(index, slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY if slot conf = image_configinfo(index, slot) {conf[0] => conf[4]} else ret = {} image_configinfo(index).each{|conf| ret[conf[0]] = conf[4] if conf.size > 2 } ret end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY ret = {} image_configinfo(index, slot).each{|k, conf| ret[k] = conf[-1] if conf.kind_of?(Array) } ret end end
debug()
Link
debug=(boolean)
Link
destroy()
Link
dlineinfo(index)
Link
edit_redo()
Link
edit_reset()
Link
edit_separator()
Link
edit_undo()
Link
get_displaychars(*index)
Link
image_cget(index, slot)
Link
# File ext/tk/lib/tk/text.rb, line 431 def image_cget(index, slot) unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ image_cget_strict(index, slot) else begin image_cget_strict(index, slot) rescue => e begin if current_image_configinfo(index).has_key?(slot.to_s) # not tag error & option is known -> error on known option fail e else # not tag error & option is unknown nil end rescue fail e # tag error end end end end
image_cget_strict(index, slot)
Link
# File ext/tk/lib/tk/text.rb, line 419 def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' _fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}")) else tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}"))) end end
image_configinfo(index, slot = nil)
Link
# File ext/tk/lib/tk/text.rb, line 467 def image_configinfo(index, slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY if slot case slot.to_s when 'text', 'label', 'show', 'data', 'file' #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true) else #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true) end conf[0] = conf[0][1..-1] conf else # tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist| # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) conf[0] = conf[0][1..-1] case conf[0] when 'text', 'label', 'show', 'data', 'file' else if conf[3] if conf[3].index('{') conf[3] = tk_split_list(conf[3]) else conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') conf[4] = tk_split_list(conf[4]) else conf[4] = tk_tcl2ruby(conf[4]) end end end conf[1] = conf[1][1..-1] if conf.size == 2 # alias info conf } end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY if slot case slot.to_s when 'text', 'label', 'show', 'data', 'file' #conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true) else #conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true) end key = conf.shift[1..-1] { key => conf } else ret = {} #tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist| # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) key = conf.shift[1..-1] case key when 'text', 'label', 'show', 'data', 'file' else if conf[2] if conf[2].index('{') conf[2] = tk_split_list(conf[2]) else conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') conf[3] = tk_split_list(conf[3]) else conf[3] = tk_tcl2ruby(conf[3]) end end end if conf.size == 1 ret[key] = conf[0][1..-1] # alias info else ret[key] = conf end } ret end end end
image_configure(index, slot, value=None)
Link
# File ext/tk/lib/tk/text.rb, line 453 def image_configure(index, slot, value=None) if slot.kind_of?(Hash) _fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), *hash_kv(slot, true))) else _fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}", _get_eval_enc_str(value))) end self end
image_names()
Link
index(idx)
Link
init_instance_variable()
Link
insert(index, chars, *tags)
Link
# File ext/tk/lib/tk/text.rb, line 594 def insert(index, chars, *tags) if tags[0].kind_of?(Array) # multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ... args = [chars] while tags.size > 0 args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist args << tags.shift if tags.size > 0 # chars end super(index, *args) else # single chars-taglist argument :: str, tag, tag, ... if tags.size == 0 super(index, chars) else super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')) end end end
mark_gravity(mark, direction=nil)
Link
mark_names()
Link
modified(mode)
Link
modified=(mode)
Link
modified?()
Link
peer_names()
Link
replace(idx1, idx2, *opts)
Link
set_current(index)
Link
set_insert(index)
Link
tag_add(tag, index1, index2=None)
Link
tag_bind(tag, seq, *args)
Link
def #tag_bind(tag, seq, cmd=Proc.new, *args)
_bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
self
end
# File ext/tk/lib/tk/text.rb, line 778 def tag_bind(tag, seq, *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, 'tag', 'bind', tag], seq, cmd, *args) self end
tag_bind_append(tag, seq, *args)
Link
def #tag_bind_append(tag, seq, cmd=Proc.new, *args)
_bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
self
end
# File ext/tk/lib/tk/text.rb, line 793 def tag_bind_append(tag, seq, *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, 'tag', 'bind', tag], seq, cmd, *args) self end
tag_bind_remove(tag, seq)
Link
tag_bindinfo(tag, context=nil)
Link
tag_delete(*tags)
Link
Also aliased as: deltag, delete_tag
# File ext/tk/lib/tk/text.rb, line 755 def tag_delete(*tags) tk_send_without_enc('tag', 'delete', *(tags.collect{|tag| _get_eval_enc_str(tag)})) TkTextTag::TTagID_TBL.mutex.synchronize{ if TkTextTag::TTagID_TBL[@path] tags.each{|tag| if tag.kind_of?(TkTextTag) TkTextTag::TTagID_TBL[@path].delete(tag.id) else TkTextTag::TTagID_TBL[@path].delete(tag) end } end } self end
tag_lower(tag, below=None)
Link
tag_names(index=None)
Link
# File ext/tk/lib/tk/text.rb, line 369 def tag_names(index=None) #tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)))).collect{|elt| tk_split_simplelist(tk_send_without_enc('tag', 'names', _get_eval_enc_str(index)), false, true).collect{|elt| tagid2obj(elt) } end
tag_nextrange(tag, first, last=None)
Link
tag_prevrange(tag, first, last=None)
Link
tag_raise(tag, above=None)
Link
def tag_cget(tag, key)
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
tk_call_without_enc(@path, 'tag', 'cget',
_get_eval_enc_str(tag), "-#{key}")
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('tag', 'cget', tag, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('tag','cget',_get_eval_enc_str(tag),'-font')))
unless fnt.kind_of?(TkFont)
fnt = tagfontobj(tag, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
# obsolete; just for compatibility
fnt.kanji_font
else
fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@path,'tag','cget',_get_eval_enc_str(tag),"-#{key}")))
end
end
def tag_configure(tag, key, val=None)
if key.kind_of?(Hash)
key = _symbolkey2str(key)
if ( key['font'] || key['kanjifont'] \
|| key['latinfont'] || key['asciifont'] )
tagfont_configure(tag, key)
else
tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
*hash_kv(key, true))
end
else
if key == 'font' || key == :font ||
key == 'kanjifont' || key == :kanjifont ||
key == 'latinfont' || key == :latinfont ||
key == 'asciifont' || key == :asciifont
if val == None
tagfontobj(tag)
else
tagfont_configure(tag, {key=>val})
end
else
tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
"-#{key}", _get_eval_enc_str(val))
end
end
self
end
def tag_configinfo(tag, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
when 'font', 'kanjifont'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
conf[4] = tagfont_configinfo(tag, conf[4])
else
conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
end
conf[0] = conf[0][1..-1]
conf
else
ret = tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).collect{|conflist|
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
if conf[4]
if conf[4].index('{')
conf[4] = tk_split_list(conf[4])
else
conf[4] = tk_tcl2ruby(conf[4])
end
end
end
conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
conf
}
fontconf = ret.assoc('font')
if fontconf
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
fontconf[4] = tagfont_configinfo(tag, fontconf[4])
ret.push(fontconf)
else
ret
end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
when 'font', 'kanjifont'
conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
conf[4] = tagfont_configinfo(tag, conf[4])
else
conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
end
key = conf.shift[1..-1]
{ key => conf }
else
ret = {}
tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).each{|conflist|
conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
case key
when 'text', 'label', 'show', 'data', 'file'
else
if conf[2]
if conf[2].index('{')
conf[2] = tk_split_list(conf[2])
else
conf[2] = tk_tcl2ruby(conf[2])
end
end
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
end
if conf.size == 1
ret[key] = conf[0][1..-1] # alias info
else
ret[key] = conf
end
}
fontconf = ret['font']
if fontconf
ret.delete('font')
ret.delete('kanjifont')
fontconf[3] = tagfont_configinfo(tag, fontconf[3])
ret['font'] = fontconf
end
ret
end
end
end
def current_tag_configinfo(tag, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
conf = tag_configinfo(tag, key)
{conf[0] => conf[4]}
else
ret = {}
tag_configinfo(tag).each{|conf|
ret[conf[0]] = conf[4] if conf.size > 2
}
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
tag_configinfo(tag, key).each{|k, conf|
ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
tag_ranges(tag)
Link
# File ext/tk/lib/tk/text.rb, line 1007 def tag_ranges(tag) #l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', # _get_eval_enc_str(tag))) l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', _get_eval_enc_str(tag)), false, true) r = [] while key=l.shift r.push [Tk::Text::IndexString.new(key), Tk::Text::IndexString.new(l.shift)] end r end
tag_remove(tag, *indices)
Link
tagid2obj(tagid)
Link
text_copy()
Link
text_cut()
Link
text_paste()
Link
value()
Link
value=(val)
Link
xview_pickplace(index)
Link