Class: Tk::BLT::Tree
Defined Under Namespace
Classes: Node, Notify, Tag, Trace
Constant Summary
collapse
- TkCommandNames =
['::blt::tree'.freeze].freeze
- TreeID_TBL =
TkCore::INTERP.create_table
Constants included
from TkCore
TkCore::EventFlag, TkCore::INTERP, TkCore::INTERP_MUTEX, TkCore::INTERP_ROOT_CHECK, TkCore::INTERP_THREAD, TkCore::INTERP_THREAD_STATUS, TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD, TkCore::WIDGET_DESTROY_HOOK, TkCore::WITH_ENCODING, TkCore::WITH_RUBY_VM
Constants included
from TkComm
TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames
Constants included
from TkUtil
TkUtil::None, TkUtil::RELEASE_DATE
Constants included
from Tk
AUTO_PATH, INTERP, JAPANIZED_TK, LIBRARY_PATH, MAINLOOP, PACKAGE_PATH, RELEASE_DATE, TCL_LIBRARY_PATH, TCL_MAJOR_VERSION, TCL_MINOR_VERSION, TCL_PACKAGE_PATH, TCL_PATCHLEVEL, TCL_PRECISION, TCL_VERSION, TK_MAJOR_VERSION, TK_MINOR_VERSION, TK_PATCHLEVEL, TK_VERSION, Tkextlib_RELEASE_DATE, TreeCtrl_Widget, X_Scrollable, Y_Scrollable
Constants included
from Encoding
Encoding::BINARY, Encoding::BINARY_NAME, Encoding::DEFAULT_EXTERNAL_NAME, Encoding::DEFAULT_INTERNAL_NAME, Encoding::ENCODING_TABLE, Encoding::RubyEncoding, Encoding::UNKNOWN, Encoding::UTF8_NAME
Class Method Summary
collapse
Instance Method Summary
collapse
-
#__destroy_hook__ ⇒ Object
-
#__keyonly_optkeys ⇒ Object
-
#ancestor(node1, node2) ⇒ Object
-
#ancestor?(node1, node2) ⇒ Boolean
-
#apply(node, keys = {}) ⇒ Object
-
#attach(tree_obj) ⇒ Object
-
#before?(node1, node2) ⇒ Boolean
-
#children(node) ⇒ Object
-
#copy(src, parent, keys = {}) ⇒ Object
-
#copy_to(src, dest_tree, parent, keys = {}) ⇒ Object
-
#degree(node) ⇒ Object
-
#delete(*nodes) ⇒ Object
-
#depth(node) ⇒ Object
-
#destroy ⇒ Object
-
#dump(node) ⇒ Object
-
#dump_to_file(node, file) ⇒ Object
-
#exist?(node, key = None) ⇒ Boolean
-
#find(node, keys = {}) ⇒ Object
-
#find_child(node, label) ⇒ Object
-
#first_child(node) ⇒ Object
-
#fullpath(node) ⇒ Object
-
#get(node) ⇒ Object
-
#get_value(node, key, default_val = None) ⇒ Object
-
#index(node) ⇒ Object
-
#initialzie(name = nil) ⇒ Object
-
#insert(parent, keys = {}) ⇒ Object
-
#keys(node, *nodes) ⇒ Object
-
#label(node, text = nil) ⇒ Object
-
#last_child(node) ⇒ Object
-
#leaf?(node) ⇒ Boolean
-
#link(parent, node, keys = {}) ⇒ Object
-
#link?(node) ⇒ Boolean
-
#move(node, dest, keys = {}) ⇒ Object
-
#next(node) ⇒ Object
-
#next_sibling(node) ⇒ Object
-
#notify_create(*args, &b) ⇒ Object
-
#notify_delete(id) ⇒ Object
-
#notify_info(id) ⇒ Object
-
#notify_names ⇒ Object
-
#parent(node) ⇒ Object
-
#position(node) ⇒ Object
-
#prev_sibling(node) ⇒ Object
-
#previous(node) ⇒ Object
-
#restore(node, str, keys = {}) ⇒ Object
-
#restore_from_file(node, file, keys = {}) ⇒ Object
-
#restore_overwrite(node, str, keys = {}) ⇒ Object
-
#restore_overwrite_from_file(node, file, keys = {}) ⇒ Object
-
#root(node = None) ⇒ Object
-
#root?(node) ⇒ Boolean
-
#set(node, data) ⇒ Object
-
#size(node) ⇒ Object
-
#sort(node, keys = {}) ⇒ Object
-
#tag_add(tag, *nodes) ⇒ Object
-
#tag_delete(tag, *nodes) ⇒ Object
-
#tag_forget(tag) ⇒ Object
-
#tag_get(node, *patterns) ⇒ Object
-
#tag_names(node = None) ⇒ Object
-
#tag_nodes(tag) ⇒ Object
-
#tag_set(node, *tags) ⇒ Object
-
#tag_unset(node, *tags) ⇒ Object
-
#tagid(tag) ⇒ Object
-
#trace_create(*args, &b) ⇒ Object
-
#trace_delete(*args) ⇒ Object
def trace_delete(*args) args.each{|id| if id.kind_of?(Tk::BLT::Tree::Trace) id.delete else tk_call(@path, ‘trace’, ‘delete’, id) Tk::BLT::Tree::Trace::TraceID_TBL.delete(id.to_s) end self } end.
-
#trace_info(id) ⇒ Object
-
#trace_names ⇒ Object
-
#type(node, key) ⇒ Object
-
#unset(node, *keys) ⇒ Object
-
#values(node, key = None) ⇒ Object
Methods inherited from TkObject
#epath, #event_generate, #method_missing, #path, #tk_send, #tk_send_to_list, #tk_send_to_list_with_enc, #tk_send_to_list_without_enc, #tk_send_to_simplelist, #tk_send_to_simplelist_with_enc, #tk_send_to_simplelist_without_enc, #tk_send_with_enc, #tk_send_without_enc, #to_eval
Methods included from TkCore
#_tk_call_to_list_core, #after, #after_cancel, #after_idle, #appname, #appsend, #appsend_deny, #appsend_displayof, callback, #callback_break, #callback_continue, #callback_return, #chooseColor, #chooseDirectory, #do_one_event, #event_generate, #getMultipleOpenFile, #getMultipleSaveFile, #getOpenFile, #getSaveFile, #get_eventloop_tick, #get_eventloop_weight, #get_no_event_wait, #inactive, #inactive_displayof, #info, #ip_eval, #ip_eval_with_enc, #ip_eval_without_enc, #ip_invoke, #ip_invoke_with_enc, #ip_invoke_without_enc, #is_mainloop?, #load_cmd_on_ip, #mainloop, #mainloop_exist?, #mainloop_thread?, #mainloop_watchdog, #messageBox, #rb_appsend, #rb_appsend_displayof, #reset_inactive, #reset_inactive_displayof, #restart, #scaling, #scaling_displayof, #set_eventloop_tick, #set_eventloop_weight, #set_no_event_wait, #tk_call, #tk_call_to_list, #tk_call_to_list_with_enc, #tk_call_to_list_without_enc, #tk_call_to_simplelist, #tk_call_to_simplelist_with_enc, #tk_call_to_simplelist_without_enc, #tk_call_with_enc, #tk_call_without_enc, #windowingsystem
Methods included from TkComm
_at, _callback_entry?, _callback_entry_class?, _curr_cmd_id, _fromUTF8, _genobj_for_tkwidget, _next_cmd_id, _toUTF8, array2tk_list, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #bindinfo_all, bool, image_obj, #install_cmd, install_cmd, list, num_or_nil, num_or_str, number, procedure, simplelist, slice_ary, string, #subst, tk_tcl2ruby, uninstall_cmd, #uninstall_cmd, window
Methods included from TkEvent
#install_bind, #install_bind_for_event_class
Methods included from TkUtil
#_conv_args, _conv_args, #_fromUTF8, #_get_eval_enc_str, _get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, #bool, bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, #num_or_nil, num_or_nil, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd, untrust
Methods included from TkBindCore
#bind, #bind_append, #bind_remove, #bindinfo
#[], #[]=, __IGNORE_UNKNOWN_CONFIGURE_OPTION__, #__check_available_configure_options, __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!, #cget, #cget_strict, #cget_tkstring, #config_hash_kv, #configinfo, #configure, #configure_cmd, #current_configinfo
#font_configinfo, #font_configure, #font_copy, #kanjifont_configure, #kanjifont_copy, #latinfont_configure, #latinfont_copy
Methods included from Tk
BinaryString, EncodedString, #Grid, #Pack, #Place, UTF8_String, __create_widget_set__, __disable_toplevel_control__, __import_toplevel_aliases__, __regist_toplevel_aliases__, __remove_toplevel_aliases__, __reset_toplevel_owner__, __set_loaded_toplevel_aliases__, __set_toplevel_aliases__, __toplevel_alias_setup_proc__, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, default_widget_set, default_widget_set=, delete_kinsoku, #encoding, #encoding=, errorCode, errorInfo, exit, focus, focus_lastfor, focus_next, focus_prev, focus_to, fromUTF8, grid, grid_forget, has_mainwindow?, load_tcllibrary, load_tclscript, load_tclscript_rsrc, load_tclscript_rsrcid, lower_window, pack, pack_forget, pkgconfig_get, pkgconfig_list, place, place_forget, raise_window, show_kinsoku, sleep, strictMotif, subst_tk_backslash, subst_utf_backslash, tcl_pkgconfig_get, tcl_pkgconfig_list, thread_update, thread_update_idletasks, tk_pkgconfig_get, tk_pkgconfig_list, toUTF8, to_backslash_sequence, toplevel_aliases_on_widget_set, ungrid, unload_tcllibrary, unpack, unplace, #update, update, update_idletasks, utf_to_backslash, utf_to_backslash_sequence, wakeup, widget_set_symbols
Methods included from Encoding
#default_encoding=, #encoding=, #encoding_convertfrom, #encoding_convertto, #encoding_dirs, #encoding_dirs=, #encoding_name, #encoding_names, #encoding_obj, #encoding_objs, #encoding_system=, #encoding_system_name, #encoding_system_obj, #force_default_encoding, #force_default_encoding=, #force_default_encoding?, #tk_encoding_names
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class TkObject
Class Method Details
.destroy(*names) ⇒ Object
619
620
621
622
|
# File 'lib/tkextlib/blt/tree.rb', line 619
def self.destroy(*names)
tk_call('::blt::tree', 'destroy',
*(names.collect{|n| (n.kind_of?(Tk::BLT::Tree))? n.id: n }) )
end
|
.names(pat = None) ⇒ Object
613
614
615
616
617
|
# File 'lib/tkextlib/blt/tree.rb', line 613
def self.names(pat = None)
simplelist(tk_call('::blt::tree', 'names', pat)).collect{|name|
id2obj(name)
}
end
|
.new(name = nil) ⇒ Object
624
625
626
627
628
629
630
631
632
633
634
635
636
|
# File 'lib/tkextlib/blt/tree.rb', line 624
def self.new(name = nil)
TreeID_TBL.mutex.synchronize{
if name && TreeID_TBL[name]
TreeID_TBL[name]
else
(obj = self.allocate).instance_eval{
initialize(name)
TreeID_TBL[@id] = self
}
obj
end
}
end
|
Instance Method Details
#__keyonly_optkeys ⇒ Object
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
|
# File 'lib/tkextlib/blt/tree.rb', line 587
def __keyonly_optkeys
{
'invert'=>nil, 'leafonly'=>nil, 'nocase'=>nil,
'path'=>nil,
'overwrite'=>nil,
'recurse'=>nil, 'tags'=>nil,
'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil,
'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil,
}
end
|
#ancestor(node1, node2) ⇒ Object
682
683
684
685
|
# File 'lib/tkextlib/blt/tree.rb', line 682
def ancestor(node1, node2)
Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor',
tagid(node1), tagid(node2)))
end
|
#ancestor?(node1, node2) ⇒ Boolean
787
788
789
790
|
# File 'lib/tkextlib/blt/tree.rb', line 787
def ancestor?(node1, node2)
bool(tk_call('::blt::tree', 'is', 'ancestor',
tagid(node1), tagid(node2)))
end
|
#apply(node, keys = {}) ⇒ Object
687
688
689
690
|
# File 'lib/tkextlib/blt/tree.rb', line 687
def apply(node, keys={})
tk_call('::blt::tree', 'apply', tagid(node), __conv_keyonly_opts(keys))
self
end
|
#attach(tree_obj) ⇒ Object
692
693
694
695
|
# File 'lib/tkextlib/blt/tree.rb', line 692
def attach(tree_obj)
tk_call('::blt::tree', 'attach', tree_obj)
self
end
|
#before?(node1, node2) ⇒ Boolean
791
792
793
794
|
# File 'lib/tkextlib/blt/tree.rb', line 791
def before?(node1, node2)
bool(tk_call('::blt::tree', 'is', 'before',
tagid(node1), tagid(node2)))
end
|
#children(node) ⇒ Object
697
698
699
700
701
|
# File 'lib/tkextlib/blt/tree.rb', line 697
def children(node)
simplelist(tk_call('::blt::tree', 'children', tagid(node))).collect{|n|
Tk::BLT::Tree::Node.id2obj(self, n)
}
end
|
#copy(src, parent, keys = {}) ⇒ Object
703
704
705
706
707
|
# File 'lib/tkextlib/blt/tree.rb', line 703
def copy(src, parent, keys={})
id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent),
__conv_keyonly_opts(keys))
Tk::BLT::Tree::Node.new(self, nil, 'node'=>id)
end
|
#copy_to(src, dest_tree, parent, keys = {}) ⇒ Object
708
709
710
711
712
713
714
|
# File 'lib/tkextlib/blt/tree.rb', line 708
def copy_to(src, dest_tree, parent, keys={})
return copy(src, parent, keys={}) unless dest_tree
id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree,
tagid(parent), __conv_keyonly_opts(keys))
Tk::BLT::Tree::Node.new(dest_tree, nil, 'node'=>id)
end
|
#degree(node) ⇒ Object
716
717
718
|
# File 'lib/tkextlib/blt/tree.rb', line 716
def degree(node)
number(tk_call('::blt::tree', 'degree', tagid(node)))
end
|
#depth(node) ⇒ Object
734
735
736
|
# File 'lib/tkextlib/blt/tree.rb', line 734
def depth(node)
number(tk_call('::blt::tree', 'depth', tagid(node)))
end
|
677
678
679
680
|
# File 'lib/tkextlib/blt/tree.rb', line 677
def destroy()
tk_call('::blt::tree', 'destroy', @id)
self
end
|
#dump(node) ⇒ Object
738
739
740
741
742
|
# File 'lib/tkextlib/blt/tree.rb', line 738
def dump(node)
simplelist(tk_call('::blt::tree', 'dump', tagid(node))).collect{|n|
simplelist(n)
}
end
|
#dump_to_file(node, file) ⇒ Object
744
745
746
747
|
# File 'lib/tkextlib/blt/tree.rb', line 744
def dump_to_file(node, file)
tk_call('::blt::tree', 'dumpfile', tagid(node), file)
self
end
|
#exist?(node, key = None) ⇒ Boolean
749
750
751
|
# File 'lib/tkextlib/blt/tree.rb', line 749
def exist?(node, key=None)
bool(tk_call('::blt::tree', 'exists', tagid(node), key))
end
|
#find(node, keys = {}) ⇒ Object
753
754
755
756
757
758
|
# File 'lib/tkextlib/blt/tree.rb', line 753
def find(node, keys={})
simplelist(tk_call('::blt::tree', 'find', tagid(node),
__conv_keyonly_opts(keys))).collect{|n|
Tk::BLT::Tree::Node.id2obj(self, n)
}
end
|
#find_child(node, label) ⇒ Object
760
761
762
763
|
# File 'lib/tkextlib/blt/tree.rb', line 760
def find_child(node, label)
ret = tk_call('::blt::tree', 'findchild', tagid(node), label)
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#first_child(node) ⇒ Object
765
766
767
768
|
# File 'lib/tkextlib/blt/tree.rb', line 765
def first_child(node)
ret = tk_call('::blt::tree', 'firstchild', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#fullpath(node) ⇒ Object
886
887
888
|
# File 'lib/tkextlib/blt/tree.rb', line 886
def fullpath(node)
tk_call('::blt::tree', 'path', tagid(node))
end
|
#get(node) ⇒ Object
770
771
772
|
# File 'lib/tkextlib/blt/tree.rb', line 770
def get(node)
Hash[*simplelist(tk_call('::blt::tree', 'get', tagid(node)))]
end
|
#get_value(node, key, default_val = None) ⇒ Object
773
774
775
|
# File 'lib/tkextlib/blt/tree.rb', line 773
def get_value(node, key, default_val=None)
tk_call('::blt::tree', 'get', tagid(node), key, default_val)
end
|
#index(node) ⇒ Object
777
778
779
780
|
# File 'lib/tkextlib/blt/tree.rb', line 777
def index(node)
Tk::BLT::Tree::Node.id2obj(self,
tk_call('::blt::tree', 'index', tagid(node)))
end
|
#initialzie(name = nil) ⇒ Object
638
639
640
641
642
643
644
645
646
647
648
649
|
# File 'lib/tkextlib/blt/tree.rb', line 638
def initialzie(name = nil)
if name
@path = @id = name
else
Tree_ID.mutex.synchronize{
@path = @id = Tree_ID.join(TkCore::INTERP._ip_id_)
Tree_ID[1].succ!
}
end
tk_call('::blt::tree', 'create', @id)
end
|
#insert(parent, keys = {}) ⇒ Object
782
783
784
785
|
# File 'lib/tkextlib/blt/tree.rb', line 782
def insert(parent, keys={})
id = tk_call('::blt::tree', 'insert', tagid(parent), keys)
Tk::BLT::Tree::Node.new(self, nil, 'node'=>id)
end
|
#keys(node, *nodes) ⇒ Object
805
806
807
808
809
810
811
812
813
814
|
# File 'lib/tkextlib/blt/tree.rb', line 805
def keys(node, *nodes)
if nodes.empty?
simplelist(tk_call('blt::tree', 'keys', tagid(node)))
else
simplelist(tk_call('blt::tree', 'keys', tagid(node),
*(nodes.collect{|n| tagid(n)}))).collect{|lst|
simplelist(lst)
}
end
end
|
#label(node, text = nil) ⇒ Object
816
817
818
819
820
821
822
823
|
# File 'lib/tkextlib/blt/tree.rb', line 816
def label(node, text=nil)
if text
tk_call('::blt::tree', 'label', tagid(node), text)
text
else
tk_call('::blt::tree', 'label', tagid(node))
end
end
|
#last_child(node) ⇒ Object
825
826
827
828
|
# File 'lib/tkextlib/blt/tree.rb', line 825
def last_child(node)
ret = tk_call('::blt::tree', 'lastchild', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#leaf?(node) ⇒ Boolean
795
796
797
|
# File 'lib/tkextlib/blt/tree.rb', line 795
def leaf?(node)
bool(tk_call('::blt::tree', 'is', 'leaf', tagid(node)))
end
|
#link(parent, node, keys = {}) ⇒ Object
830
831
832
833
834
|
# File 'lib/tkextlib/blt/tree.rb', line 830
def link(parent, node, keys={})
ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node),
__conv_keyonly_opts(keys))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#link?(node) ⇒ Boolean
798
799
800
|
# File 'lib/tkextlib/blt/tree.rb', line 798
def link?(node)
bool(tk_call('::blt::tree', 'is', 'link', tagid(node)))
end
|
#move(node, dest, keys = {}) ⇒ Object
836
837
838
839
|
# File 'lib/tkextlib/blt/tree.rb', line 836
def move(node, dest, keys={})
tk_call('::blt::tree', 'move', tagid(node), tagid(dest), keys)
self
end
|
#next(node) ⇒ Object
841
842
843
844
|
# File 'lib/tkextlib/blt/tree.rb', line 841
def next(node)
ret = tk_call('::blt::tree', 'next', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#next_sibling(node) ⇒ Object
846
847
848
849
|
# File 'lib/tkextlib/blt/tree.rb', line 846
def next_sibling(node)
ret = tk_call('::blt::tree', 'nextsibling', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#notify_create(*args, &b) ⇒ Object
851
852
853
|
# File 'lib/tkextlib/blt/tree.rb', line 851
def notify_create(*args, &b)
Tk::BLT::Tree::Notify.new(self, *args, &b)
end
|
#notify_info(id) ⇒ Object
867
868
869
870
871
872
873
|
# File 'lib/tkextlib/blt/tree.rb', line 867
def notify_info(id)
lst = simplelist(tk_call(@path, 'notify', 'info', tagid(id)))
lst[0] = Tk::BLT::Tree::Notify.id2obj(self, lst[0])
lst[1] = simplelist(lst[1]).collect{|flag| flag[1..-1]}
lst[2] = tk_tcl2ruby(lst[2])
lst
end
|
#notify_names ⇒ Object
875
876
877
878
879
|
# File 'lib/tkextlib/blt/tree.rb', line 875
def notify_names()
tk_call(@path, 'notify', 'names').collect{|id|
Tk::BLT::Tree::Notify.id2obj(self, id)
}
end
|
#parent(node) ⇒ Object
881
882
883
884
|
# File 'lib/tkextlib/blt/tree.rb', line 881
def parent(node)
ret = tk_call('::blt::tree', 'parent', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#position(node) ⇒ Object
890
891
892
|
# File 'lib/tkextlib/blt/tree.rb', line 890
def position(node)
number(tk_call('::blt::tree', 'position', tagid(node)))
end
|
#prev_sibling(node) ⇒ Object
899
900
901
902
|
# File 'lib/tkextlib/blt/tree.rb', line 899
def prev_sibling(node)
ret = tk_call('::blt::tree', 'prevsibling', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#previous(node) ⇒ Object
894
895
896
897
|
# File 'lib/tkextlib/blt/tree.rb', line 894
def previous(node)
ret = tk_call('::blt::tree', 'previous', tagid(node))
(ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret)
end
|
#restore(node, str, keys = {}) ⇒ Object
904
905
906
907
908
|
# File 'lib/tkextlib/blt/tree.rb', line 904
def restore(node, str, keys={})
tk_call('::blt::tree', 'restore', tagid(node), str,
__conv_keyonly_opts(keys))
self
end
|
#restore_from_file(node, file, keys = {}) ⇒ Object
917
918
919
920
921
|
# File 'lib/tkextlib/blt/tree.rb', line 917
def restore_from_file(node, file, keys={})
tk_call('::blt::tree', 'restorefile', tagid(node), file,
__conv_keyonly_opts(keys))
self
end
|
#restore_overwrite(node, str, keys = {}) ⇒ Object
909
910
911
912
913
914
915
|
# File 'lib/tkextlib/blt/tree.rb', line 909
def restore_overwrite(node, str, keys={})
keys = __conv_keyonly_opts(keys)
keys.delete('overwrite')
keys.delete(:overwrite)
tk_call('::blt::tree', 'restore', tagid(node), str, '-overwrite', keys)
self
end
|
#restore_overwrite_from_file(node, file, keys = {}) ⇒ Object
922
923
924
925
926
927
928
929
|
# File 'lib/tkextlib/blt/tree.rb', line 922
def restore_overwrite_from_file(node, file, keys={})
keys = __conv_keyonly_opts(keys)
keys.delete('overwrite')
keys.delete(:overwrite)
tk_call('::blt::tree', 'restorefile', tagid(node), file,
'-overwrite', keys)
self
end
|
#root(node = None) ⇒ Object
931
932
933
934
|
# File 'lib/tkextlib/blt/tree.rb', line 931
def root(node=None)
Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root',
tagid(node)))
end
|
#root?(node) ⇒ Boolean
801
802
803
|
# File 'lib/tkextlib/blt/tree.rb', line 801
def root?(node)
bool(tk_call('::blt::tree', 'is', 'root', tagid(node)))
end
|
#set(node, data) ⇒ Object
936
937
938
939
940
941
942
943
944
|
# File 'lib/tkextlib/blt/tree.rb', line 936
def set(node, data)
unless data.kind_of?(Hash)
fail ArgumentError, 'Hash is expected for data'
end
args = []
data.each{|k, v| args << k << v}
tk_call('::blt::tree', 'set', tagid(node), *args)
self
end
|
#size(node) ⇒ Object
946
947
948
|
# File 'lib/tkextlib/blt/tree.rb', line 946
def size(node)
number(tk_call('::blt::tree', 'size', tagid(node)))
end
|
#sort(node, keys = {}) ⇒ Object
950
951
952
953
|
# File 'lib/tkextlib/blt/tree.rb', line 950
def sort(node, keys={})
tk_call('::blt::tree', 'sort', tagid(node), __conv_keyonly_opts(keys))
self
end
|
#tag_add(tag, *nodes) ⇒ Object
955
956
957
958
|
# File 'lib/tkextlib/blt/tree.rb', line 955
def tag_add(tag, *nodes)
tk_call(@path, 'tag', 'add', tagid(tag), *(nodes.collect{|n| tagid(n)}))
self
end
|
#tag_delete(tag, *nodes) ⇒ Object
960
961
962
963
964
|
# File 'lib/tkextlib/blt/tree.rb', line 960
def tag_delete(tag, *nodes)
tk_call(@path, 'tag', 'delete', tagid(tag),
*(nodes.collect{|n| tagid(n)}))
self
end
|
#tag_forget(tag) ⇒ Object
966
967
968
969
970
971
972
973
|
# File 'lib/tkextlib/blt/tree.rb', line 966
def tag_forget(tag)
tag = tag.id if tag.kind_of?(Tk::BLT::Tree::Tag)
tk_call(@path, 'tag', 'forget', tag)
TreeTagID_TBL.mutex.synchronize{
TreeTagID_TBL[@path].delete(tag)
}
self
end
|
#tag_get(node, *patterns) ⇒ Object
975
976
977
978
979
980
|
# File 'lib/tkextlib/blt/tree.rb', line 975
def tag_get(node, *patterns)
simplelist(tk_call(@tpath, 'tag', 'get', tagid(node),
*(patterns.collect{|pat| tagid(pat)}))).collect{|str|
Tk::BLT::Tree::Tag.id2obj(self, str)
}
end
|
#tag_names(node = None) ⇒ Object
982
983
984
985
986
|
# File 'lib/tkextlib/blt/tree.rb', line 982
def tag_names(node = None)
simplelist(tk_call(@tpath, 'tag', 'names', tagid(node))).collect{|str|
Tk::BLT::Tree::Tag.id2obj(self, str)
}
end
|
#tag_nodes(tag) ⇒ Object
988
989
990
991
992
|
# File 'lib/tkextlib/blt/tree.rb', line 988
def tag_nodes(tag)
simplelist(tk_call(@tpath, 'tag', 'nodes', tagid(tag))).collect{|node|
Tk::BLT::Tree::Node.id2obj(self, node)
}
end
|
#tag_set(node, *tags) ⇒ Object
994
995
996
997
|
# File 'lib/tkextlib/blt/tree.rb', line 994
def tag_set(node, *tags)
tk_call(@path, 'tag', 'set', tagid(node), *(tags.collect{|t| tagid(t)}))
self
end
|
#tag_unset(node, *tags) ⇒ Object
999
1000
1001
1002
1003
|
# File 'lib/tkextlib/blt/tree.rb', line 999
def tag_unset(node, *tags)
tk_call(@path, 'tag', 'unset', tagid(node),
*(tags.collect{|t| tagid(t)}))
self
end
|
#trace_create(*args, &b) ⇒ Object
1005
1006
1007
|
# File 'lib/tkextlib/blt/tree.rb', line 1005
def trace_create(*args, &b)
Tk::BLT::Tree::Trace.new(self, *args, &b)
end
|
#trace_delete(*args) ⇒ Object
def trace_delete(*args)
args.each{|id|
if id.kind_of?(Tk::BLT::Tree::Trace)
id.delete
else
tk_call(@path, 'trace', 'delete', id)
Tk::BLT::Tree::Trace::TraceID_TBL[@path].delete(id.to_s)
end
self
}
end
1022
1023
1024
1025
1026
1027
1028
1029
|
# File 'lib/tkextlib/blt/tree.rb', line 1022
def trace_delete(*args)
args = args.collect{|id| tagid(id)}
tk_call(@path, 'trace', 'delete', *args)
Tk::BLT::Tree::Trace::TraceID_TBL.mutex.synchronize{
args.each{|id| Tk::BLT::Tree::Trace::TraceID_TBL[@path].delete(id.to_s)}
}
self
end
|
#trace_info(id) ⇒ Object
1031
1032
1033
1034
1035
1036
1037
|
# File 'lib/tkextlib/blt/tree.rb', line 1031
def trace_info(id)
lst = simplelist(tk_call(@path, 'trace', 'info', tagid(id)))
lst[0] = Tk::BLT::Tree::Trace.id2obj(self, lst[0])
lst[2] = simplelist(lst[2])
lst[3] = tk_tcl2ruby(lst[3])
lst
end
|
#trace_names ⇒ Object
1039
1040
1041
1042
1043
|
# File 'lib/tkextlib/blt/tree.rb', line 1039
def trace_names()
tk_call(@path, 'trace', 'names').collect{|id|
Tk::BLT::Tree::Trace.id2obj(self, id)
}
end
|
#type(node, key) ⇒ Object
1045
1046
1047
|
# File 'lib/tkextlib/blt/tree.rb', line 1045
def type(node, key)
tk_call('::blt::tree', 'type', tagid(node), key)
end
|
#unset(node, *keys) ⇒ Object
1049
1050
1051
1052
|
# File 'lib/tkextlib/blt/tree.rb', line 1049
def unset(node, *keys)
tk_call('::blt::tree', 'unset', tagid(node), *keys)
self
end
|
#values(node, key = None) ⇒ Object
1054
1055
1056
|
# File 'lib/tkextlib/blt/tree.rb', line 1054
def values(node, key=None)
simplelist(tk_call('::blt::tree', 'values', tagid(node), key))
end
|