Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 61
def self.image_tint(img, color, alpha)
Tk.tk_call_without_enc('imagetint', img, color, alpha)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 47
def self.loupe(img, x, y, w, h, zoom)
# NOTE: platform == 'unix' only
# img => TkPhotoImage
# x, y => screen coords
# w, h => magnifier width and height
# zoom => zooming rate
Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 23
def self.package_name
PACKAGE_NAME
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 606
def __destroy_hook__
Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.delete(@path)
}
Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.delete(@path)
}
Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.delete(@path)
}
Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.delete(@path)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 664
def activate(desc)
tk_send('activate', desc)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 669
def canvasx(x)
number(tk_send('canvasx', x))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 673
def canvasy(y)
number(tk_send('canvasy', y))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 677
def collapse(*dsc)
tk_send_without_enc('collapse', *(dsc.map!{|d| _get_eval_string(d, true)}))
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 682
def collapse_recurse(*dsc)
tk_send_without_enc('collapse', '-recurse',
*(dsc.map!{|d| _get_eval_string(d, true)}))
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 688
def column_bbox(idx)
list(tk_send('column', 'bbox', idx))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 692
def column_compare(column1, op, column2)
bool(tk_send('column', 'compare', column1, op, column2))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 696
def column_count
num_or_str(tk_send('column', 'count'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 700
def column_create(keys=nil)
if keys && keys.kind_of?(Hash)
num_or_str(tk_send('column', 'create', *hash_kv(keys)))
else
num_or_str(tk_send('column', 'create'))
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 708
def column_delete(idx)
Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{
if Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path]
Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[self.path].delete(idx)
end
}
tk_send('column', 'delete', idx)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 722
def column_id(idx)
tk_send('column', 'id', idx)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 718
def column_index(idx)
num_or_str(tk_send('column', 'index', idx))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 726
def column_list(visible=false)
if visible
simplelist(tk_send('column', 'list', '-visible'))
else
simplelist(tk_send('column', 'list'))
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 737
def column_move(idx, before)
tk_send('column', 'move', idx, before)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 742
def column_needed_width(idx)
num_or_str(tk_send('column', 'neededwidth', idx))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 747
def column_order(column, visible=false)
if visible
num_or_str(tk_send('column', 'order', column, '-visible'))
else
num_or_str(tk_send('column', 'order', column))
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 733
def column_visible_list
column_list(true)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 754
def column_visible_order(column)
column_order(column, true)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 758
def column_width(idx)
num_or_str(tk_send('column', 'width', idx))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 762
def compare(item1, op, item2)
bool(tk_send('compare', item1, op, item2))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 766
def contentbox()
list(tk_send('contentbox'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 805
def debug_dinfo
tk_send('debug', 'dinfo')
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 810
def debug_scroll
tk_send('debug', 'scroll')
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 770
def depth(item=None)
num_or_str(tk_send_without_enc('depth', _get_eval_string(item, true)))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 774
def dragimage_add(item, *args)
tk_send('dragimage', 'add', item, *args)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 779
def dragimage_clear()
tk_send('dragimage', 'clear')
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 784
def dragimage_offset(*args) # x, y
if args.empty?
list(tk_send('dragimage', 'offset'))
else
tk_send('dragimage', 'offset', *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 793
def dragimage_visible(*args) # mode
if args..empty?
bool(tk_send('dragimage', 'visible'))
else
tk_send('dragimage', 'visible', *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 801
def dragimage_visible?
dragimage_visible()
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 860
def element_class(elem)
Tk::TreeCtrl::Element.type2class(element_type(elem))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 814
def element_create(elem, type, keys=nil)
if keys && keys.kind_of?(Hash)
tk_send('element', 'create', elem, type, *hash_kv(keys))
else
tk_send('element', 'create', elem, type)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 822
def element_delete(*elems)
Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{
if Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path]
elems.each{|elem|
Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[self.path].delete(elem)
}
end
}
tk_send('element', 'delete', *elems)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 834
def element_names()
list(tk_send('element', 'names')).collect!{|elem|
Tk::TreeCtrl::Element.id2obj(self, elem)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 852
def element_perstate(elem, opt, st_list)
tk_send('element', 'perstate', elem, "-{opt}", st_list)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 856
def element_type(elem)
tk_send('element', 'type', elem)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 864
def expand(*dsc)
tk_send('expand', *dsc)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 869
def expand_recurse(*dsc)
tk_send('expand', '-recurse', *dsc)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1060
def get_item_image(item, column=nil)
item_image(item, column)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1236
def get_item_span(item, column=nil)
item_span(item, column)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1656
def get_style_layout(style, elem, opt=None)
style_layout(style, elem, opt)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 874
def identify(x, y)
lst = list(tk_send('identify', x, y))
if lst[0] == 'item'
lst[1] = Tk::TreeCtrl::Item.id2obj(self, lst[1])
size = lst.size
i = 2
while i < size
case lst[i]
when 'line'
i += 1
lst[i] = Tk::TreeCtrl::Item.id2obj(self, lst[i])
i += 1
when 'button'
i += 1
when 'column'
i += 2
when 'elem'
i += 1
lst[i] = Tk::TreeCtrl::Element.id2obj(self, lst[i])
i += 1
else
i += 1
end
end
end
lst
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 908
def index(idx)
num_or_str(tk_send('index', idx))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 646
def install_bind(cmd, *args)
install_bind_for_event_class(Tk::TreeCtrl::NotifyEvent, cmd, *args)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 912
def item_ancestors(item)
list(tk_send('item', 'ancestors', item)).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 918
def item_bbox(item, *args)
list(tk_send('item', 'bbox', item, *args))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 922
def item_children(item)
list(tk_send('item', 'children', item)).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 928
def item_collapse(item)
tk_send_without_enc('item', 'collapse', _get_eval_string(item, true))
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 933
def item_collapse_recurse(item)
tk_send_without_enc('item', 'collapse',
_get_eval_string(item, true), '-recurse')
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 939
def item_compare(item1, op, item2)
bool(tk_send('item', 'compare', item1, op, item2))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 943
def item_complex(item, *args)
tk_send_without_enc('item', 'complex',
_get_eval_string(item, true),
*(args.map!{|arg| _get_eval_string(arg, true)}))
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 950
def item_count
num_or_str(tk_send('item', 'count'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 954
def item_create(keys={})
num_or_str(tk_send_without_enc('item', 'create', *hash_kv(keys, true)))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 965
def item_delete(first, last=None)
Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
if Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path]
if first == 'all' || first == :all || last == 'all' || last == :all
Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[self.path].clear
elsif last == None
_erase_children(first)
else
self.range(first, last).each{|id|
_erase_children(id)
}
end
end
}
tk_send('item', 'delete', first, last)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 983
def item_dump(item)
list(tk_send('item', 'dump', item))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 987
def item_dump_hash(item)
Hash[*list(tk_send('item', 'dump', item))]
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 991
def item_element_actual(item, column, elem, key)
tk_send('item', 'element', 'actual', item, column, elem, "-#{key}")
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 995
def item_element_perstate(elem, opt, st_list)
tk_send('item', 'element', 'perstate', elem, "-{opt}", st_list)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 999
def item_expand(item)
tk_send('item', 'expand', item)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1004
def item_expand_recurse(item)
tk_send('item', 'expand', item, '-recurse')
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1009
def item_firstchild(parent, child=nil)
if child
tk_send_without_enc('item', 'firstchild',
_get_eval_string(parent, true),
_get_eval_string(child, true))
self
else
id = num_or_str(tk_send_without_enc('item', 'firstchild',
_get_eval_string(parent, true)))
Tk::TreeCtrl::Item.id2obj(self, id)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1041
def item_id(item)
tk_send('item', 'id', item)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1045
def item_image(item, column=nil, *args)
if args.empty?
if column
img = tk_send('item', 'image', item, column)
TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
else
simplelist(tk_send('item', 'image', item)).collect!{|img|
TkImage::Tk_IMGTBL[img]? TkImage::Tk_IMGTBL[img] : img
}
end
else
tk_send('item', 'image', item, column, *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1067
def item_index(item)
list(tk_send('item', 'index', item))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1071
def item_isancestor(item, des)
bool(tk_send('item', 'isancestor', item, des))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1078
def item_isopen(item)
bool(tk_send('item', 'isopen', item))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1087
def item_lastchild(parent, child=nil)
if child
tk_send_without_enc('item', 'lastchild',
_get_eval_string(parent, true),
_get_eval_string(child, true))
self
else
id = num_or_str(tk_send_without_enc('item', 'lastchild',
_get_eval_string(parent, true)))
Tk::TreeCtrl::Item.id2obj(self, id)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1101
def item_nextsibling(sibling, nxt=nil)
if nxt
tk_send('item', 'nextsibling', sibling, nxt)
self
else
id = num_or_str(tk_send('item', 'nextsibling', sibling))
Tk::TreeCtrl::Item.id2obj(self, id)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1112
def item_numchildren(item)
number(tk_send_without_enc('item', 'numchildren',
_get_eval_string(item, true)))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1119
def item_order(item, visible=false)
if visible
ret = num_or_str(tk_send('item', 'order', item, '-visible'))
else
ret = num_or_str(tk_send('item', 'order', item))
end
(ret.kind_of?(Fixnum) && ret < 0)? nil: ret
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1132
def item_parent(item)
id = num_or_str(tk_send('item', 'parent', item))
Tk::TreeCtrl::Item.id2obj(self, id)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1137
def item_prevsibling(sibling, prev=nil)
if prev
tk_send('item', 'prevsibling', sibling, prev)
self
else
id = num_or_str(tk_send('item', 'prevsibling', sibling))
Tk::TreeCtrl::Item.id2obj(self, id)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1148
def item_range(first, last)
simplelist(tk_send('item', 'range', first, last))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1152
def item_remove(item)
tk_send('item', 'remove', item)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1157
def item_rnc(item)
list(tk_send('item', 'rnc', item))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1217
def item_sort(item, *opts)
_item_sort_core(true, item, *opts)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1220
def item_sort_not_really(item, *opts)
_item_sort_core(false, item, *opts)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1224
def item_span(item, column=nil, *args)
if args.empty?
if column
list(tk_send('item', 'span', item, column))
else
simplelist(tk_send('item', 'span', item)).collect!{|elem| list(elem)}
end
else
tk_send('item', 'span', item, column, *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1243
def item_state_forcolumn(item, column, *args)
tk_send('item', 'state', 'forcolumn', item, column, *args)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1248
def item_state_get(item, *args)
if args.empty?
list(tk_send('item', 'state', 'get', item *args))
else
bool(tk_send('item', 'state', 'get', item))
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1256
def item_state_set(item, *args)
tk_send('item', 'state', 'set', item, *args)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1260
def item_style_elements(item, column)
list(tk_send('item', 'style', 'elements', item, column)).collect!{|id|
Tk::TreeCtrl::Style.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1266
def item_style_map(item, column, style, map)
tk_send('item', 'style', 'map', item, column, style, map)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1271
def item_style_set(item, column=nil, *args)
if args.empty?
if column
id = tk_send_without_enc('item', 'style', 'set',
_get_eval_string(item, true),
_get_eval_string(column, true))
Tk::TreeCtrl::Style.id2obj(self, id)
else
list(tk_send_without_enc('item', 'style', 'set',
_get_eval_string(item, true))).collect!{|id|
Tk::TreeCtrl::Style.id2obj(self, id)
}
end
else
tk_send_without_enc('item', 'style', 'set',
_get_eval_string(item, true),
_get_eval_string(column, true),
*(args.flatten.map!{|arg|
_get_eval_string(arg, true)
}))
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1295
def item_text(item, column, txt=nil, *args)
if args.empty?
if txt
tk_send('item', 'text', item, column, txt)
self
else
tk_send('item', 'text', item, column)
end
else
tk_send('item', 'text', item, column, txt, *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1309
def item_toggle(item)
tk_send('item', 'toggle', item)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1314
def item_toggle_recurse(item)
tk_send('item', 'toggle', item, '-recurse')
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1319
def item_visible(item, st=None)
if st == None
bool(tk_send('item', 'visible', item))
else
tk_send('item', 'visible', item, st)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1327
def item_visible?(item)
item_visible(item)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1128
def item_visible_order(item)
item_order(item, true)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1331
def marquee_anchor(*args)
if args.empty?
list(tk_send('marquee', 'anchor'))
else
tk_send('marquee', 'anchor', *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1340
def marquee_coords(*args)
if args.empty?
list(tk_send('marquee', 'coords'))
else
tk_send('marquee', 'coords', *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1349
def marquee_corner(*args)
if args.empty?
tk_send('marquee', 'corner')
else
tk_send('marquee', 'corner', *args)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1358
def marquee_identify()
list(tk_send('marquee', 'identify')).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1364
def marquee_visible(st=None)
if st == None
bool(tk_send('marquee', 'visible'))
else
tk_send('marquee', 'visible', st)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1372
def marquee_visible?()
marquee_visible()
end
def #notify_bind(obj, event, cmd=Proc.new, *args)
_bind([@path, 'notify', 'bind', obj], event, cmd, *args) self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1380
def notify_bind(obj, event, *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, 'notify', 'bind', obj], event, cmd, *args)
self
end
def #notify_bind_append(obj, event, cmd=Proc.new, *args)
_bind_append([@path, 'notify', 'bind', obj], event, cmd, *args) self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1395
def notify_bind_append(obj, event, *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, 'notify', 'bind', obj], event, cmd, *args)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1406
def notify_bind_remove(obj, event)
_bind_remove([@path, 'notify', 'bind', obj], event)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1411
def notify_bindinfo(obj, event=nil)
_bindinfo([@path, 'notify', 'bind', obj], event)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1415
def notify_detailnames(event)
list(tk_send('notify', 'detailnames', event))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1419
def notify_eventnames()
list(tk_send('notify', 'eventnames'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1423
def notify_generate(pattern, char_map=None, percents_cmd=None)
pattern = "<#{pattern}>"
tk_send('notify', 'generate', pattern, char_map, percents_cmd)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1429
def notify_install(pattern, percents_cmd=nil, &b)
pattern = "<#{pattern}>"
percents_cmd = Proc.new(&b) if !percents_cmd && b
if percents_cmd
procedure(tk_send('notify', 'install', pattern, percents_cmd))
else
procedure(tk_send('notify', 'install', pattern))
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1439
def notify_install_detail(event, detail, percents_cmd=nil, &b)
percents_cmd = Proc.new(&b) if !percents_cmd && b
if percents_cmd
tk_send('notify', 'install', 'detail', event, detail, percents_cmd)
else
tk_send('notify', 'install', 'detail', event, detail)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1448
def notify_install_event(event, percents_cmd=nil, &b)
percents_cmd = Proc.new(&b) if !percents_cmd && b
if percents_cmd
tk_send('notify', 'install', 'event', event, percents_cmd)
else
tk_send('notify', 'install', 'event', event)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1457
def notify_linkage(pattern, detail=None)
if detail != None
tk_send('notify', 'linkage', pattern, detail)
else
begin
if pattern.to_s.index(?-)
# TreeCtrl 1.1 format?
begin
tk_send('notify', 'linkage', "<#{pattern}>")
rescue
# TreeCtrl 1.0?
tk_send('notify', 'linkage', pattern)
end
else
# TreeCtrl 1.0 format?
begin
tk_send('notify', 'linkage', pattern)
rescue
# TreeCtrl 1.1?
tk_send('notify', 'linkage', "<#{pattern}>")
end
end
end
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1483
def notify_unbind(pattern=nil)
if pattern
tk_send('notify', 'unbind', "<#{pattern}>")
else
tk_send('notify', 'unbind')
end
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1492
def notify_uninstall(pattern)
pattern = "<#{pattern}>"
tk_send('notify', 'uninstall', pattern)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1498
def notify_uninstall_detail(event, detail)
tk_send('notify', 'uninstall', 'detail', event, detail)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1503
def notify_uninstall_event(event)
tk_send('notify', 'uninstall', 'event', event)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1508
def numcolumns()
num_or_str(tk_send('numcolumns'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1514
def numitems()
num_or_str(tk_send('numitems'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1520
def orphans()
list(tk_send('orphans')).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1526
def range(first, last)
list(tk_send('range', first, last)).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1550
def see(item)
tk_send('see', item)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1555
def selection_add(first, last=None)
tk_send('selection', 'add', first, last)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1560
def selection_anchor(item=None)
id = num_or_str(tk_send('selection', 'anchor', item))
Tk::TreeCtrl::Item.id2obj(self, id)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1565
def selection_clear(*args) # first, last
tk_send('selection', 'clear', *args)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1570
def selection_count()
number(tk_send('selection', 'count'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1574
def selection_get()
list(tk_send('selection', 'get')).collect!{|id|
Tk::TreeCtrl::Item.id2obj(self, id)
}
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1580
def selection_includes(item)
bool(tk_send('selection', 'includes', item))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1584
def selection_modify(sel, desel)
tk_send('selection', 'modify', sel, desel)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1063
def set_item_image(item, col, img, *args)
item_image(item, col, img, *args)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1239
def set_item_span(item, col, num, *args)
item_span(item, col, num, *args)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1659
def set_style_layout(style, elem, slot, value=None)
if slot.kind_of?(Hash)
style_layout(style, elem, slot)
else
style_layout(style, elem, {slot=>value})
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1532
def state_define(name)
tk_send('state', 'define', name)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1537
def state_linkage(name)
tk_send('state', 'linkage', name)
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1541
def state_names()
list(tk_send('state', 'names'))
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1545
def state_undefine(*names)
tk_send('state', 'undefine', *names)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1589
def style_create(style, keys=None)
if keys && keys != None
tk_send('style', 'create', style, *hash_kv(keys))
else
tk_send('style', 'create', style)
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1597
def style_delete(*args)
Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{
if Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path]
args.each{|sty|
Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[self.path].delete(sty)
}
end
}
tk_send('style', 'delete', *args)
self
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1609
def style_elements(style, *elems)
if elems.empty?
list(tk_send('style', 'elements', style)).collect!{|id|
Tk::TreeCtrl::Element.id2obj(self, id)
}
else
tk_send('style', 'elements', style, elems.flatten)
self
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1637
def style_layout(style, elem, keys=None)
if keys && keys != None
if keys.kind_of?(Hash)
tk_send('style', 'layout', style, elem, *hash_kv(keys))
self
else
_conv_style_layout_val(keys,
tk_send('style', 'layout',
style, elem, "-#{keys}"))
end
else
ret = Hash.new
Hash[*simplelist(tk_send('style', 'layout', style, elem))].each{|k, v|
k = k[1..-1]
ret[k] = _conv_style_layout_val(k, v)
}
ret
end
end
# File tk/lib/tkextlib/treectrl/tktreectrl.rb, line 1667
def style_names()
list(tk_send('style', 'names')).collect!{|id|
Tk::TreeCtrl::Style.id2obj(self, id)
}
end