Class: Tk::TreeCtrl

Inherits:
TkWindow show all
Includes:
Scrollable, ConfigMethod
Defined in:
ext/lib/tkextlib/treectrl/tktreectrl.rb,
ext/lib/tkextlib/treectrl/tktreectrl.rb

Defined Under Namespace

Modules: BindCallback, ConfigMethod Classes: BitmapElement, BorderElement, Column, Element, ImageElement, Item, NotifyEvent, RectangleElement, Style

Constant Summary collapse

BindTag_FileList =
TkBindTag.new_by_name('TreeCtrlFileList')
PACKAGE_NAME =
'treectrl'.freeze
HasColumnCreateCommand =
(TkPackage.vcompare(self.package_version, '1.1') >= 0)
TkCommandNames =
['treectrl'.freeze].freeze
WidgetClassName =
'TreeCtrl'.freeze

Constants included from TkUtil

TkUtil::None, TkUtil::RELEASE_DATE

Constants included from Tk

AUTO_PATH, Checkbutton, CloneMenu, JAPANIZED_TK, LIBRARY_PATH, Labelframe, MenuButton, OptionMenuButton, PACKAGE_PATH, Panedwindow, RELEASE_DATE, Radiobutton, 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

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Scrollable

#autoscroll, #unautoscroll

Methods included from YScrollable

#yscrollbar, #yscrollcommand, #yview, #yview_moveto, #yview_scroll

Methods included from XScrollable

#xscrollbar, #xscrollcommand, #xview, #xview_moveto, #xview_scroll

Methods included from ConfigMethod

#column_cget, #column_cget_strict, #column_configinfo, #column_configure, #column_dragcget, #column_dragcget_strict, #column_dragconfiginfo, #column_dragconfigure, #current_column_configinfo, #current_column_dragconfiginfo, #current_debug_configinfo, #current_dragimage_configinfo, #current_element_configinfo, #current_item_configinfo, #current_item_element_configinfo, #current_marquee_configinfo, #current_notify_configinfo, #current_style_configinfo, #debug_cget, #debug_cget_strict, #debug_configinfo, #debug_configure, #dragimage_cget, #dragimage_cget_strict, #dragimage_configinfo, #dragimage_configure, #element_cget, #element_cget_strict, #element_configinfo, #element_configure, #item_cget, #item_cget_strict, #item_configinfo, #item_configure, #item_element_cget, #item_element_cget_strict, #item_element_configinfo, #item_element_configure, #marquee_cget, #marquee_cget_strict, #marquee_configinfo, #marquee_configure, #notify_cget, #notify_cget_strict, #notify_configinfo, #notify_configure, #style_cget, #style_cget_strict, #style_configinfo, #style_configure, #tagid, #treectrl_tagid

Methods included from TkItemConfigMethod

__IGNORE_UNKNOWN_CONFIGURE_OPTION__, #__check_available_itemconfigure_options, #__current_itemconfiginfo, __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!, #current_itemconfiginfo, #itemcget, #itemcget_strict, #itemconfiginfo, #itemconfigure, #tagid

Methods included from TkItemConfigOptkeys

#__conv_item_keyonly_opts, #itemconfig_hash_kv

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_str, #num_or_str, number, #number, string, #string, uninstall_cmd

Methods included from TkTreatItemFont

#kanjifont_copy, #kanjitagfont_configure, #latintagfont_configure, #latintagfont_copy, #tagfont_configinfo, #tagfont_configure, #tagfont_copy

Methods inherited from TkWindow

_widget_inspect_full_=, _widget_inspect_full_?, #bind_class, #bindtags, #bindtags=, #bindtags_shift, #bindtags_unshift, #caret, #colormodel, #command, #cursor_propagate, #cursor_restore, database_class, #database_class, #database_classname, database_classname, #destroy, #eventloop_wait_destroy, #eventloop_wait_visibility, #exist?, #grab, #grab_current, #grab_release, #grab_set, #grab_set_global, #grab_status, #grid, #grid_anchor, #grid_bbox, #grid_column, #grid_columnconfig, #grid_columnconfiginfo, #grid_config, #grid_forget, #grid_in, #grid_info, #grid_location, #grid_propagate, #grid_remove, #grid_row, #grid_rowconfig, #grid_rowconfiginfo, #grid_size, #grid_slaves, #initialize, #inspect, #lower, #pack, #pack_config, #pack_forget, #pack_in, #pack_info, #pack_propagate, #pack_slaves, #place, #place_config, #place_configinfo, #place_forget, #place_in, #place_info, #place_slaves, #raise, #set_focus, #thread_wait_destroy, #thread_wait_visibility, #tktrans_get_image, #tktrans_set_image, to_eval, #wait_destroy, #wait_visibility

Methods included from TkBindCore

#bind, #bind_append, #bind_remove, #bindinfo

Methods included from TkWinfo

appname, atom, atomname, cells, children, classname, colormapfull, containing, depth, exist?, fpixels, geometry, height, id, interps, manager, mapped?, parent, pixels, pointerx, pointerxy, pointery, reqheight, reqwidth, rgb, rootx, rooty, screen, screencells, screendepth, screenheight, screenmmheight, screenmmwidth, screenvisual, screenwidth, server, toplevel, viewable, visual, visualid, visualsavailable, vrootheight, vrootwidth, vrootx, vrooty, widget, width, #winfo_appname, #winfo_atom, #winfo_atomname, #winfo_cells, #winfo_children, #winfo_classname, #winfo_colormapfull, #winfo_containing, #winfo_depth, #winfo_exist?, #winfo_fpixels, #winfo_geometry, #winfo_height, #winfo_id, #winfo_interps, #winfo_manager, #winfo_mapped?, #winfo_parent, #winfo_pixels, #winfo_pointerx, #winfo_pointerxy, #winfo_pointery, #winfo_reqheight, #winfo_reqwidth, #winfo_rgb, #winfo_rootx, #winfo_rooty, #winfo_screen, #winfo_screencells, #winfo_screendepth, #winfo_screenheight, #winfo_screenmmheight, #winfo_screenmmwidth, #winfo_screenvisual, #winfo_screenwidth, #winfo_server, #winfo_toplevel, #winfo_viewable, #winfo_visual, #winfo_visualid, #winfo_visualsavailable, #winfo_vrootheight, #winfo_vrootwidth, #winfo_vrootx, #winfo_vrooty, #winfo_widget, #winfo_width, #winfo_x, #winfo_y, x, y

Methods included from Tk

BinaryString, EncodedString, #Grid, #Pack, #Place, UTF8_String, __set_toplevel_aliases__, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, default_widget_set, default_widget_set=, delete_kinsoku, destroy, 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, #root, 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, ungrid, unload_tcllibrary, unpack, unplace, #update, update, update_idletasks, utf_to_backslash, utf_to_backslash_sequence, wakeup

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

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_str, number, procedure, simplelist, string, #subst, tk_tcl2ruby, uninstall_cmd, #uninstall_cmd, window

Methods included from TkEvent

#install_bind_for_event_class

Methods included from Tk::TkDND::DND

#dnd_bindsource, #dnd_bindsource_info, #dnd_bindtarget, #dnd_bindtarget_info, #dnd_clearsource, #dnd_cleartarget, #dnd_drag, version

Methods included from Tk::TkDND::Shape

package_patchlevel, #shape_bounds, #shape_get, #shape_offset, #shape_set, #shape_update, version

Methods inherited from TkObject

#destroy, #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 TkConfigMethod

#[], #[]=, __IGNORE_UNKNOWN_CONFIGURE_OPTION__, #__check_available_configure_options, __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!, #cget, #cget_strict, #config_hash_kv, #configinfo, #configure, #configure_cmd, #current_configinfo

Methods included from TkTreatFont

#font_configinfo, #font_configure, #font_copy, #kanjifont_configure, #kanjifont_copy, #latinfont_configure, #latinfont_copy

Methods inherited from TkKernel

new

Constructor Details

This class inherits a constructor from TkWindow

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TkObject

Class Method Details

.image_tint(img, color, alpha) ⇒ Object



61
62
63
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 61

def self.image_tint(img, color, alpha)
  Tk.tk_call_without_enc('imagetint', img, color, alpha)
end

.loupe(img, x, y, w, h, zoom) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'ext/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

.package_nameObject



23
24
25
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 23

def self.package_name
  PACKAGE_NAME
end

.package_versionObject



27
28
29
30
31
32
33
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 27

def self.package_version
  begin
    TkPackage.require('treectrl')
  rescue
    ''
  end
end

.text_layout(font, text, keys = {}) ⇒ Object



57
58
59
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 57

def self.text_layout(font, text, keys={})
  TkComm.list(Tk.tk_call_without_enc('textlayout', font, text, keys))
end

Instance Method Details

#__destroy_hook__Object



606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'ext/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

#activate(desc) ⇒ Object



664
665
666
667
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 664

def activate(desc)
  tk_send('activate', desc)
  self
end

#canvasx(x) ⇒ Object



669
670
671
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 669

def canvasx(x)
  number(tk_send('canvasx', x))
end

#canvasy(y) ⇒ Object



673
674
675
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 673

def canvasy(y)
  number(tk_send('canvasy', y))
end

#collapse(*dsc) ⇒ Object



677
678
679
680
# File 'ext/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

#collapse_recurse(*dsc) ⇒ Object



682
683
684
685
686
# File 'ext/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

#column_bbox(idx) ⇒ Object



688
689
690
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 688

def column_bbox(idx)
  list(tk_send('column', 'bbox', idx))
end

#column_compare(column1, op, column2) ⇒ Object



692
693
694
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 692

def column_compare(column1, op, column2)
  bool(tk_send('column', 'compare', column1, op, column2))
end

#column_countObject



696
697
698
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 696

def column_count
  num_or_str(tk_send('column', 'count'))
end

#column_create(keys = nil) ⇒ Object



700
701
702
703
704
705
706
# File 'ext/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

#column_delete(idx) ⇒ Object



708
709
710
711
712
713
714
715
716
# File 'ext/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

#column_id(idx) ⇒ Object



722
723
724
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 722

def column_id(idx)
  tk_send('column', 'id', idx)
end

#column_index(idx) ⇒ Object



718
719
720
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 718

def column_index(idx)
  num_or_str(tk_send('column', 'index', idx))
end

#column_list(visible = false) ⇒ Object



726
727
728
729
730
731
732
# File 'ext/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

#column_move(idx, before) ⇒ Object



737
738
739
740
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 737

def column_move(idx, before)
  tk_send('column', 'move', idx, before)
  self
end

#column_needed_width(idx) ⇒ Object Also known as: column_neededwidth



742
743
744
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 742

def column_needed_width(idx)
  num_or_str(tk_send('column', 'neededwidth', idx))
end

#column_order(column, visible = false) ⇒ Object



747
748
749
750
751
752
753
# File 'ext/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

#column_visible_listObject



733
734
735
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 733

def column_visible_list
  column_list(true)
end

#column_visible_order(column) ⇒ Object



754
755
756
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 754

def column_visible_order(column)
  column_order(column, true)
end

#column_width(idx) ⇒ Object



758
759
760
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 758

def column_width(idx)
  num_or_str(tk_send('column', 'width', idx))
end

#compare(item1, op, item2) ⇒ Object



762
763
764
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 762

def compare(item1, op, item2)
  bool(tk_send('compare', item1, op, item2))
end

#contentboxObject



766
767
768
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 766

def contentbox()
  list(tk_send('contentbox'))
end

#debug_dinfoObject



805
806
807
808
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 805

def debug_dinfo
  tk_send('debug', 'dinfo')
  self
end

#debug_scrollObject



810
811
812
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 810

def debug_scroll
  tk_send('debug', 'scroll')
end

#depth(item = None) ⇒ Object



770
771
772
# File 'ext/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

#dragimage_add(item, *args) ⇒ Object



774
775
776
777
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 774

def dragimage_add(item, *args)
  tk_send('dragimage', 'add', item, *args)
  self
end

#dragimage_clearObject



779
780
781
782
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 779

def dragimage_clear()
  tk_send('dragimage', 'clear')
  self
end

#dragimage_offset(*args) ⇒ Object

x, y



784
785
786
787
788
789
790
791
# File 'ext/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

#dragimage_visible(*args) ⇒ Object

mode



793
794
795
796
797
798
799
800
# File 'ext/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

#dragimage_visible?Boolean

Returns:

  • (Boolean)


801
802
803
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 801

def dragimage_visible?
  dragimage_visible()
end

#element_class(elem) ⇒ Object



860
861
862
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 860

def element_class(elem)
  Tk::TreeCtrl::Element.type2class(element_type(elem))
end

#element_create(elem, type, keys = nil) ⇒ Object



814
815
816
817
818
819
820
# File 'ext/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

#element_delete(*elems) ⇒ Object



822
823
824
825
826
827
828
829
830
831
832
# File 'ext/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

#element_namesObject



834
835
836
837
838
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 834

def element_names()
  list(tk_send('element', 'names')).collect!{|elem|
    Tk::TreeCtrl::Element.id2obj(self, elem)
  }
end

#element_perstate(elem, opt, st_list) ⇒ Object



852
853
854
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 852

def element_perstate(elem, opt, st_list)
  tk_send('element', 'perstate', elem, "-{opt}", st_list)
end

#element_type(elem) ⇒ Object



856
857
858
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 856

def element_type(elem)
  tk_send('element', 'type', elem)
end

#expand(*dsc) ⇒ Object



864
865
866
867
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 864

def expand(*dsc)
  tk_send('expand', *dsc)
  self
end

#expand_recurse(*dsc) ⇒ Object



869
870
871
872
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 869

def expand_recurse(*dsc)
  tk_send('expand', '-recurse', *dsc)
  self
end

#get_item_image(item, column = nil) ⇒ Object



1060
1061
1062
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1060

def get_item_image(item, column=nil)
  item_image(item, column)
end

#get_item_span(item, column = nil) ⇒ Object



1236
1237
1238
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1236

def get_item_span(item, column=nil)
  item_span(item, column)
end

#get_style_layout(style, elem, opt = None) ⇒ Object



1656
1657
1658
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1656

def get_style_layout(style, elem, opt=None)
  style_layout(style, elem, opt)
end

#identify(x, y) ⇒ Object



874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
# File 'ext/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

#index(idx) ⇒ Object



908
909
910
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 908

def index(idx)
  num_or_str(tk_send('index', idx))
end

#install_bind(cmd, *args) ⇒ Object



646
647
648
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 646

def install_bind(cmd, *args)
  install_bind_for_event_class(Tk::TreeCtrl::NotifyEvent, cmd, *args)
end

#item_ancestors(item) ⇒ Object



912
913
914
915
916
# File 'ext/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

#item_bbox(item, *args) ⇒ Object



918
919
920
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 918

def item_bbox(item, *args)
  list(tk_send('item', 'bbox', item, *args))
end

#item_children(item) ⇒ Object



922
923
924
925
926
# File 'ext/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

#item_collapse(item) ⇒ Object



928
929
930
931
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 928

def item_collapse(item)
  tk_send_without_enc('item', 'collapse', _get_eval_string(item, true))
  self
end

#item_collapse_recurse(item) ⇒ Object



933
934
935
936
937
# File 'ext/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

#item_compare(item1, op, item2) ⇒ Object



939
940
941
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 939

def item_compare(item1, op, item2)
  bool(tk_send('item', 'compare', item1, op, item2))
end

#item_complex(item, *args) ⇒ Object



943
944
945
946
947
948
# File 'ext/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

#item_countObject



950
951
952
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 950

def item_count
  num_or_str(tk_send('item', 'count'))
end

#item_create(keys = {}) ⇒ Object



954
955
956
# File 'ext/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

#item_delete(first, last = None) ⇒ Object



965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
# File 'ext/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

#item_dump(item) ⇒ Object



983
984
985
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 983

def item_dump(item)
  list(tk_send('item', 'dump', item))
end

#item_dump_hash(item) ⇒ Object



987
988
989
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 987

def item_dump_hash(item)
  Hash[*list(tk_send('item', 'dump', item))]
end

#item_element_actual(item, column, elem, key) ⇒ Object



991
992
993
# File 'ext/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

#item_element_perstate(elem, opt, st_list) ⇒ Object



995
996
997
# File 'ext/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

#item_expand(item) ⇒ Object



999
1000
1001
1002
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 999

def item_expand(item)
  tk_send('item', 'expand', item)
  self
end

#item_expand_recurse(item) ⇒ Object



1004
1005
1006
1007
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1004

def item_expand_recurse(item)
  tk_send('item', 'expand', item, '-recurse')
  self
end

#item_firstchild(parent, child = nil) ⇒ Object Also known as: item_first_child



1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'ext/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

#item_hasbutton(item, st = None) ⇒ Object Also known as: item_has_button



1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1023

def item_hasbutton(item, st=None)
  if st == None
    bool(tk_send_without_enc('item', 'hasbutton', 
                             _get_eval_string(item, true)))
  else
    tk_send_without_enc('item', 'hasbutton', 
                        _get_eval_string(item, true), 
                        _get_eval_string(st))
    self
  end
end

#item_hasbutton?(item) ⇒ Boolean Also known as: item_has_button?

Returns:

  • (Boolean)


1036
1037
1038
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1036

def item_hasbutton?(item)
  item_hasbutton(item)
end

#item_id(item) ⇒ Object



1041
1042
1043
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1041

def item_id(item)
  tk_send('item', 'id', item)
end

#item_image(item, column = nil, *args) ⇒ Object



1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
# File 'ext/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

#item_index(item) ⇒ Object



1067
1068
1069
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1067

def item_index(item)
  list(tk_send('item', 'index', item))
end

#item_isancestor(item, des) ⇒ Object Also known as: item_is_ancestor, item_isancestor?, item_is_ancestor?



1071
1072
1073
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1071

def item_isancestor(item, des)
  bool(tk_send('item', 'isancestor', item, des))
end

#item_isopen(item) ⇒ Object Also known as: item_is_open, item_isopen?, item_is_open?, item_isopened?, item_is_opened?



1078
1079
1080
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1078

def item_isopen(item)
  bool(tk_send('item', 'isopen', item))
end

#item_lastchild(parent, child = nil) ⇒ Object Also known as: item_last_child



1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'ext/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

#item_nextsibling(sibling, nxt = nil) ⇒ Object Also known as: item_next_sibling



1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'ext/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

#item_numchildren(item) ⇒ Object Also known as: item_num_children, item_children_size



1112
1113
1114
1115
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1112

def item_numchildren(item)
  number(tk_send_without_enc('item', 'numchildren', 
                             _get_eval_string(item, true)))
end

#item_order(item, visible = false) ⇒ Object



1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'ext/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

#item_parent(item) ⇒ Object



1132
1133
1134
1135
# File 'ext/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

#item_prevsibling(sibling, prev = nil) ⇒ Object Also known as: item_prev_sibling



1137
1138
1139
1140
1141
1142
1143
1144
1145
# File 'ext/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

#item_range(first, last) ⇒ Object



1148
1149
1150
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1148

def item_range(first, last)
  simplelist(tk_send('item', 'range', first, last))
end

#item_remove(item) ⇒ Object



1152
1153
1154
1155
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1152

def item_remove(item)
  tk_send('item', 'remove', item)
  self
end

#item_rnc(item) ⇒ Object



1157
1158
1159
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1157

def item_rnc(item)
  list(tk_send('item', 'rnc', item))
end

#item_sort(item, *opts) ⇒ Object



1217
1218
1219
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1217

def item_sort(item, *opts)
  _item_sort_core(true, item, *opts)
end

#item_sort_not_really(item, *opts) ⇒ Object



1220
1221
1222
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1220

def item_sort_not_really(item, *opts)
  _item_sort_core(false, item, *opts)
end

#item_span(item, column = nil, *args) ⇒ Object



1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
# File 'ext/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

#item_state_forcolumn(item, column, *args) ⇒ Object Also known as: item_state_for_column



1243
1244
1245
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1243

def item_state_forcolumn(item, column, *args)
  tk_send('item', 'state', 'forcolumn', item, column, *args)
end

#item_state_get(item, *args) ⇒ Object



1248
1249
1250
1251
1252
1253
1254
# File 'ext/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

#item_state_set(item, *args) ⇒ Object



1256
1257
1258
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1256

def item_state_set(item, *args)
  tk_send('item', 'state', 'set', item, *args)
end

#item_style_elements(item, column) ⇒ Object



1260
1261
1262
1263
1264
# File 'ext/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

#item_style_map(item, column, style, map) ⇒ Object



1266
1267
1268
1269
# File 'ext/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

#item_style_set(item, column = nil, *args) ⇒ Object



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'ext/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

#item_text(item, column, txt = nil, *args) ⇒ Object



1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
# File 'ext/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

#item_toggle(item) ⇒ Object



1309
1310
1311
1312
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1309

def item_toggle(item)
  tk_send('item', 'toggle', item)
  self
end

#item_toggle_recurse(item) ⇒ Object



1314
1315
1316
1317
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1314

def item_toggle_recurse(item)
  tk_send('item', 'toggle', item, '-recurse')
  self
end

#item_visible(item, st = None) ⇒ Object



1319
1320
1321
1322
1323
1324
1325
1326
# File 'ext/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

#item_visible?(item) ⇒ Boolean

Returns:

  • (Boolean)


1327
1328
1329
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1327

def item_visible?(item)
  item_visible(item)
end

#item_visible_order(item) ⇒ Object



1128
1129
1130
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1128

def item_visible_order(item)
  item_order(item, true)
end

#marquee_anchor(*args) ⇒ Object



1331
1332
1333
1334
1335
1336
1337
1338
# File 'ext/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

#marquee_coords(*args) ⇒ Object



1340
1341
1342
1343
1344
1345
1346
1347
# File 'ext/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

#marquee_corner(*args) ⇒ Object



1349
1350
1351
1352
1353
1354
1355
1356
# File 'ext/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

#marquee_identifyObject



1358
1359
1360
1361
1362
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1358

def marquee_identify()
  list(tk_send('marquee', 'identify')).collect!{|id|
    Tk::TreeCtrl::Item.id2obj(self, id)
  }
end

#marquee_visible(st = None) ⇒ Object



1364
1365
1366
1367
1368
1369
1370
1371
# File 'ext/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

#marquee_visible?Boolean

Returns:

  • (Boolean)


1372
1373
1374
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1372

def marquee_visible?()
  marquee_visible()
end

#notify_bind(obj, event, *args) ⇒ Object

def notify_bind(obj, event, cmd=Proc.new, *args)

_bind([@path, 'notify', 'bind', obj], event, cmd, *args)
self

end



1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
# File 'ext/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

#notify_bind_append(obj, event, *args) ⇒ Object

def notify_bind_append(obj, event, cmd=Proc.new, *args)

_bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
self

end



1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
# File 'ext/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

#notify_bind_remove(obj, event) ⇒ Object



1406
1407
1408
1409
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1406

def notify_bind_remove(obj, event)
  _bind_remove([@path, 'notify', 'bind', obj], event)
  self
end

#notify_bindinfo(obj, event = nil) ⇒ Object



1411
1412
1413
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1411

def notify_bindinfo(obj, event=nil)
  _bindinfo([@path, 'notify', 'bind', obj], event)
end

#notify_detailnames(event) ⇒ Object



1415
1416
1417
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1415

def notify_detailnames(event)
  list(tk_send('notify', 'detailnames', event))
end

#notify_eventnamesObject



1419
1420
1421
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1419

def notify_eventnames()
  list(tk_send('notify', 'eventnames'))
end

#notify_generate(pattern, char_map = None, percents_cmd = None) ⇒ Object



1423
1424
1425
1426
1427
# File 'ext/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

#notify_install(pattern, percents_cmd = nil, &b) ⇒ Object



1429
1430
1431
1432
1433
1434
1435
1436
1437
# File 'ext/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

#notify_install_detail(event, detail, percents_cmd = nil, &b) ⇒ Object



1439
1440
1441
1442
1443
1444
1445
1446
# File 'ext/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

#notify_install_event(event, percents_cmd = nil, &b) ⇒ Object



1448
1449
1450
1451
1452
1453
1454
1455
# File 'ext/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

#notify_linkage(pattern, detail = None) ⇒ Object



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
# File 'ext/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

#notify_unbind(pattern = nil) ⇒ Object



1483
1484
1485
1486
1487
1488
1489
1490
# File 'ext/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

#notify_uninstall(pattern) ⇒ Object



1492
1493
1494
1495
1496
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1492

def notify_uninstall(pattern)
  pattern = "<#{pattern}>"
  tk_send('notify', 'uninstall', pattern)
  self
end

#notify_uninstall_detail(event, detail) ⇒ Object



1498
1499
1500
1501
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1498

def notify_uninstall_detail(event, detail)
  tk_send('notify', 'uninstall', 'detail', event, detail)
  self
end

#notify_uninstall_event(event) ⇒ Object



1503
1504
1505
1506
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1503

def notify_uninstall_event(event)
  tk_send('notify', 'uninstall', 'event', event)
  self
end

#numcolumnsObject Also known as: num_columns, columns_size



1508
1509
1510
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1508

def numcolumns()
  num_or_str(tk_send('numcolumns'))
end

#numitemsObject Also known as: num_items, items_size



1514
1515
1516
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1514

def numitems()
  num_or_str(tk_send('numitems'))
end

#orphansObject



1520
1521
1522
1523
1524
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1520

def orphans()
  list(tk_send('orphans')).collect!{|id|
    Tk::TreeCtrl::Item.id2obj(self, id)
  }
end

#range(first, last) ⇒ Object



1526
1527
1528
1529
1530
# File 'ext/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

#see(item) ⇒ Object



1550
1551
1552
1553
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1550

def see(item)
  tk_send('see', item)
  self
end

#selection_add(first, last = None) ⇒ Object



1555
1556
1557
1558
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1555

def selection_add(first, last=None)
  tk_send('selection', 'add', first, last)
  self
end

#selection_anchor(item = None) ⇒ Object



1560
1561
1562
1563
# File 'ext/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

#selection_clear(*args) ⇒ Object

first, last



1565
1566
1567
1568
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1565

def selection_clear(*args) # first, last
  tk_send('selection', 'clear', *args)
  self
end

#selection_countObject



1570
1571
1572
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1570

def selection_count()
  number(tk_send('selection', 'count'))
end

#selection_getObject



1574
1575
1576
1577
1578
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1574

def selection_get()
  list(tk_send('selection', 'get')).collect!{|id|
    Tk::TreeCtrl::Item.id2obj(self, id)
  }
end

#selection_includes(item) ⇒ Object



1580
1581
1582
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1580

def selection_includes(item)
  bool(tk_send('selection', 'includes', item))
end

#selection_modify(sel, desel) ⇒ Object



1584
1585
1586
1587
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1584

def selection_modify(sel, desel)
  tk_send('selection', 'modify', sel, desel)
  self
end

#set_item_image(item, col, img, *args) ⇒ Object



1063
1064
1065
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1063

def set_item_image(item, col, img, *args)
  item_image(item, col, img, *args)
end

#set_item_span(item, col, num, *args) ⇒ Object



1239
1240
1241
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1239

def set_item_span(item, col, num, *args)
  item_span(item, col, num, *args)
end

#set_style_layout(style, elem, slot, value = None) ⇒ Object



1659
1660
1661
1662
1663
1664
1665
# File 'ext/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

#state_define(name) ⇒ Object



1532
1533
1534
1535
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1532

def state_define(name)
  tk_send('state', 'define', name)
  self
end

#state_linkage(name) ⇒ Object



1537
1538
1539
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1537

def state_linkage(name)
  tk_send('state', 'linkage', name)
end

#state_namesObject



1541
1542
1543
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1541

def state_names()
  list(tk_send('state', 'names'))
end

#state_undefine(*names) ⇒ Object



1545
1546
1547
1548
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1545

def state_undefine(*names)
  tk_send('state', 'undefine', *names)
  self
end

#style_create(style, keys = None) ⇒ Object



1589
1590
1591
1592
1593
1594
1595
# File 'ext/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

#style_delete(*args) ⇒ Object



1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
# File 'ext/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

#style_elements(style, *elems) ⇒ Object



1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
# File 'ext/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

#style_layout(style, elem, keys = None) ⇒ Object



1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
# File 'ext/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

#style_namesObject



1667
1668
1669
1670
1671
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1667

def style_names()
  list(tk_send('style', 'names')).collect!{|id|
    Tk::TreeCtrl::Style.id2obj(self, id)
  }
end

#toggle(*items) ⇒ Object



1673
1674
1675
1676
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1673

def toggle(*items)
  tk_send('toggle', *items)
  self
end

#toggle_recurseObject



1678
1679
1680
1681
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1678

def toggle_recurse()
  tk_send('toggle', '-recurse', *items)
  self
end