diff options
Diffstat (limited to 'ext/tk/lib/tkextlib/bwidget/tree.rb')
-rw-r--r-- | ext/tk/lib/tkextlib/bwidget/tree.rb | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index 86074ab6f4..089c482fe8 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -22,7 +22,7 @@ class Tk::BWidget::Tree TkCommandNames = ['Tree'.freeze].freeze WidgetClassName = 'Tree'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl @@ -57,6 +57,37 @@ class Tk::BWidget::Tree end end + def areabind(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_append(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_remove(*args) + _bind_remove_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + self + end + + def areabindinfo(*args) + _bindinfo_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + end + #def imagebind(*args) # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args) # self @@ -158,6 +189,16 @@ class Tk::BWidget::Tree bool(tk_send('exists', tagid(node))) end + def find(findinfo, confine=None) + Tk::BWidget::Tree::Node.id2obj(self, tk_send(findinfo, confine)) + end + def find_position(x, y, confine=None) + self.find(_at(x,y), confine) + end + def find_line(linenum) + self.find(linenum) + end + def index(node) num_or_str(tk_send('index', tagid(node))) end @@ -167,6 +208,10 @@ class Tk::BWidget::Tree self end + def line(node) + number(tk_send('line', tagid(node))) + end + def move(parent, node, idx) tk_send('move', tagid(parent), tagid(node), idx) self @@ -183,7 +228,7 @@ class Tk::BWidget::Tree end def open?(node) - bool(@tree.itemcget(tagid(node), 'open')) + bool(self.itemcget(tagid(node), 'open')) end def open_tree(node, recurse=None) @@ -264,7 +309,7 @@ class Tk::BWidget::Tree::Node TreeNode_TBL = TkCore::INTERP.create_table - (TreeNode_ID = ['bw:node'.freeze, '00000'.taint]).instance_eval{ + (TreeNode_ID = ['bw:node'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -355,6 +400,9 @@ class Tk::BWidget::Tree::Node val end + def cget_tkstring(key) + @tree.itemcget_tkstring(@id, key) + end def cget(key) @tree.itemcget(@id, key) end @@ -450,4 +498,3 @@ class Tk::BWidget::Tree::Node @tree.visible(@id) end end - |