Class: Tk::TreeCtrl::Item

Inherits:
TkObject show all
Defined in:
lib/tkextlib/treectrl/tktreectrl.rb

Constant Summary collapse

TreeCtrlItemID_TBL =
TkCore::INTERP.create_table

Constants included from TkCore

TkCore::EventFlag, TkCore::INTERP, TkCore::WIDGET_DESTROY_HOOK

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, Tk::TCL_LIBRARY_PATH, Tk::TCL_MAJOR_VERSION, Tk::TCL_MINOR_VERSION, Tk::TCL_PACKAGE_PATH, Tk::TCL_PATCHLEVEL, Tk::TCL_PRECISION, Tk::TCL_VERSION, Tk::TK_MAJOR_VERSION, Tk::TK_MINOR_VERSION, Tk::TK_PATCHLEVEL, Tk::TK_VERSION, Tk::Tkextlib_RELEASE_DATE, Tk::TreeCtrl_Widget, X_Scrollable, Y_Scrollable

Constants included from Encoding

Encoding::TkCommandNames

Class Method Summary collapse

Instance Method Summary collapse

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

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 TkEvent

#install_bind, #install_bind_for_event_class

Methods included from TkBindCore

#bind, #bind_append, #bind_remove, #bindinfo

Methods included from TkConfigMethod

#[], #[]=, #config_hash_kv, #configure_cmd

Methods included from TkTreatFont

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

Methods included from Tk

BinaryString, EncodedString, UTF8_String, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, delete_kinsoku, destroy, #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, #root, show_kinsoku, 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

Methods included from Encoding

#encoding, #encoding=, #encoding_convertfrom, #encoding_convertto, #encoding_dirs, #encoding_dirs=, #encoding_names, #encoding_system, #encoding_system=

Methods inherited from TkKernel

new

Constructor Details

#initialize(parent, keys = {}) ⇒ Item

Returns a new instance of Item.



1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1812

def initialize(parent, keys={})
  @tree = parent
  @tpath = parent.path
  @path = @id = @tree.item_create(keys)

  unless Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath]
    Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] = {} 
  end
  Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath][@id] = self
end

Dynamic Method Handling

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

Class Method Details

.id2obj(tree, id) ⇒ Object



1805
1806
1807
1808
1809
1810
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1805

def self.id2obj(tree, id)
  tpath = tree.path
  return id unless Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath]
  Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id]? \
               Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id] : id
end

Instance Method Details

#ancestorsObject



1831
1832
1833
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1831

def ancestors
  @tree.item_ancestors(@id)
end

#bbox(*args) ⇒ Object



1835
1836
1837
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1835

def bbox(*args)
  @tree.item_bbox(@id, *args)
end

#cget(opt) ⇒ Object



1858
1859
1860
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1858

def cget(opt)
  @tree.item_cget(@id, opt)
end

#childrenObject



1839
1840
1841
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1839

def children
  @tree.item_children(@id)
end

#collapseObject



1843
1844
1845
1846
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1843

def collapse
  @tree.item_collapse(@id)
  self
end

#collapse_recurseObject



1848
1849
1850
1851
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1848

def collapse_recurse
  @tree.item_collapse_recurse(@id)
  self
end

#complex(*args) ⇒ Object



1853
1854
1855
1856
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1853

def complex(*args)
  @tree.item_complex(@id, *args)
  self
end

#configinfo(*args) ⇒ Object



1866
1867
1868
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1866

def configinfo(*args)
  @tree.item_configinfo(@id, *args)
end

#configure(*args) ⇒ Object



1862
1863
1864
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1862

def configure(*args)
  @tree.item_configure(@id, *args)
end

#current_configinfo(*args) ⇒ Object



1870
1871
1872
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1870

def current_configinfo(*args)
  @tree.current_item_configinfo(@id, *args)
end

#current_element_configinfo(*args) ⇒ Object



1903
1904
1905
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1903

def current_element_configinfo(*args)
  @tree.current_item_element_configinfo(@id, *args)
end

#deleteObject



1874
1875
1876
1877
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1874

def delete
  @tree.item_delete(@id)
  self
end

#element_actual(column, elem, key) ⇒ Object



1887
1888
1889
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1887

def element_actual(column, elem, key)
  @tree.item_element_actual(@id, column, elem, key)
end

#element_cget(opt) ⇒ Object



1891
1892
1893
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1891

def element_cget(opt)
  @tree.item_element_cget(@id, opt)
end

#element_configinfo(*args) ⇒ Object



1899
1900
1901
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1899

def element_configinfo(*args)
  @tree.item_element_configinfo(@id, *args)
end

#element_configure(*args) ⇒ Object



1895
1896
1897
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1895

def element_configure(*args)
  @tree.item_element_configure(@id, *args)
end

#element_dumpObject



1879
1880
1881
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1879

def element_dump
  @tree.item_dump(@id)
end

#element_dump_hashObject



1883
1884
1885
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1883

def element_dump_hash
  @tree.item_dump_hash(@id)
end

#expandObject



1907
1908
1909
1910
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1907

def expand
  @tree.item_expand(@id)
  self
end

#expand_recurseObject



1912
1913
1914
1915
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1912

def expand_recurse
  @tree.item_expand_recurse(@id)
  self
end

#firstchild(child = nil) ⇒ Object Also known as: first_child



1917
1918
1919
1920
1921
1922
1923
1924
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1917

def firstchild(child=nil)
  if child
    @tree.item_firstchild(@id, child)
    self
  else
    @tree.item_firstchild(@id)
  end
end

#hasbutton(st = None) ⇒ Object Also known as: has_button



1927
1928
1929
1930
1931
1932
1933
1934
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1927

def hasbutton(st=None)
  if st == None
    @tree.item_hasbutton(@id)
  else
    @tree.item_hasbutton(@id, st)
    self
  end
end

#hasbutton?Boolean Also known as: has_button?

Returns:



1937
1938
1939
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1937

def hasbutton?
  @tree.item_hasbutton(@id)
end

#idObject



1823
1824
1825
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1823

def id
  @id
end

#indexObject



1942
1943
1944
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1942

def index
  @tree.item_index(@id)
end

#isancestor(des) ⇒ Object Also known as: is_ancestor, isancestor?, is_ancestor?, ancestor?



1946
1947
1948
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1946

def isancestor(des)
  @tree.item_isancestor(@id, des)
end

#isopenObject Also known as: is_open, isopen?, is_open?, isopened?, is_opened?, open?



1954
1955
1956
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1954

def isopen
  @tree.item_isopen(@id)
end

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



2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2053

def item_text(column, txt=nil, *args)
  if args.empty?
    if txt
      @tree.item_text(@id, column, txt)
      self
    else
      @tree.item_text(@id, column)
    end
  else
    @tree.item_text(@id, column, txt, *args)
    self
  end
end

#lastchild(child = nil) ⇒ Object Also known as: last_child



1964
1965
1966
1967
1968
1969
1970
1971
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1964

def lastchild(child=nil)
  if child
    @tree.item_lastchild(@id, child)
    self
  else
    @tree.item_lastchild(@id)
  end
end

#nextsibling(nxt = nil) ⇒ Object Also known as: next_sibling



1974
1975
1976
1977
1978
1979
1980
1981
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1974

def nextsibling(nxt=nil)
  if nxt
    @tree.item_nextsibling(@id, nxt)
    self
  else
    @tree.item_nextsibling(@id)
  end
end

#numchildrenObject Also known as: num_children, children_size



1984
1985
1986
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1984

def numchildren
  @tree.item_numchildren(@id)
end

#parent_indexObject



1990
1991
1992
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1990

def parent_index
  @tree.item_parent(@id)
end

#prevsibling(nxt = nil) ⇒ Object Also known as: prev_sibling



1994
1995
1996
1997
1998
1999
2000
2001
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1994

def prevsibling(nxt=nil)
  if nxt
    @tree.item_prevsibling(@id, nxt)
    self
  else
    @tree.item_prevsibling(@id)
  end
end

#removeObject



2004
2005
2006
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2004

def remove
  @tree.item_remove(@id)
end

#rncObject



2008
2009
2010
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2008

def rnc
  @tree.item_rnc(@id)
end

#sort(*opts) ⇒ Object



2012
2013
2014
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2012

def sort(*opts)
  @tree.item_sort(@id, *opts)
end

#sort_not_really(*opts) ⇒ Object



2015
2016
2017
2018
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2015

def sort_not_really(*opts)
  @tree.item_sort_not_really(@id, *opts)
  self
end

#state_forcolumn(column, *args) ⇒ Object Also known as: state_for_column



2020
2021
2022
2023
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2020

def state_forcolumn(column, *args)
  @tree.item_state_forcolumn(@id, column, *args)
  self
end

#state_get(*args) ⇒ Object



2026
2027
2028
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2026

def state_get(*args)
  @tree.item_state_get(@id, *args)
end

#state_set(*args) ⇒ Object



2030
2031
2032
2033
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2030

def state_set(*args)
  @tree.item_state_set(@id, *args)
  self
end

#style_elements(column) ⇒ Object



2035
2036
2037
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2035

def style_elements(column)
  @tree.item_style_elements(@id, column)
end

#style_map(column, style, map) ⇒ Object



2039
2040
2041
2042
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2039

def style_map(column, style, map)
  @tree.item_style_map(@id, column, style, map)
  self
end

#style_set(column = nil, *args) ⇒ Object



2044
2045
2046
2047
2048
2049
2050
2051
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2044

def style_set(column=nil, *args)
  if args.empty?
    @tree.item_style_set(@id, column)
  else
    @tree.item_style_set(@id, column, *args)
    self
  end
end

#to_sObject



1827
1828
1829
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1827

def to_s
  @id.to_s.dup
end

#toggleObject



2067
2068
2069
2070
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2067

def toggle
  @tree.item_toggle(@id)
  self
end

#toggle_recurseObject



2072
2073
2074
2075
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2072

def toggle_recurse
  @tree.item_toggle_recurse(@id)
  self
end

#visible(st = None) ⇒ Object



2077
2078
2079
2080
2081
2082
2083
2084
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2077

def visible(st=None)
  if st == None
    @tree.item_visible(@id)
  else
    @tree.item_visible(@id, st)
    self
  end
end