Class: Tk::TreeCtrl::Item

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

Constant Summary collapse

TreeCtrlItemID_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, Checkbutton, CloneMenu, JAPANIZED_TK, LIBRARY_PATH, Labelframe, MenuButton, OptionMenuButton, PACKAGE_PATH, Panedwindow, RELEASE_DATE, Radiobutton, 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::BINARY, Encoding::BINARY_NAME, Encoding::DEFAULT_EXTERNAL_NAME, Encoding::DEFAULT_INTERNAL_NAME, Encoding::ENCODING_TABLE, Encoding::RubyEncoding, Encoding::TkCommandNames, Encoding::UNKNOWN, Encoding::UTF8_NAME

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

#[], #[]=, __IGNORE_UNKNOWN_CONFIGURE_OPTION__, #__check_available_configure_options, __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!, #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, #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 inherited from TkKernel

new

Constructor Details

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

Returns a new instance of Item.



1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1935

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

  Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
    Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {} 
    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



1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1923

def self.id2obj(tree, id)
  tpath = tree.path
  Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{
    if Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath]
      Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id]? \
                      Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[tpath][id] : id
    else
      id
    end
  }
end

Instance Method Details

#ancestorsObject



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

def ancestors
  @tree.item_ancestors(@id)
end

#bbox(*args) ⇒ Object



1958
1959
1960
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1958

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

#cget(opt) ⇒ Object



1981
1982
1983
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1981

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

#cget_strict(opt) ⇒ Object



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

def cget_strict(opt)
  @tree.item_cget_strict(@id, opt)
end

#childrenObject



1962
1963
1964
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1962

def children
  @tree.item_children(@id)
end

#collapseObject



1966
1967
1968
1969
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1966

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

#collapse_recurseObject



1971
1972
1973
1974
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1971

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

#complex(*args) ⇒ Object



1976
1977
1978
1979
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1976

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

#configinfo(*args) ⇒ Object



1992
1993
1994
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1992

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

#configure(*args) ⇒ Object



1988
1989
1990
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1988

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

#current_configinfo(*args) ⇒ Object



1996
1997
1998
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1996

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

#current_element_configinfo(*args) ⇒ Object



2032
2033
2034
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2032

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

#deleteObject



2000
2001
2002
2003
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2000

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

#element_actual(column, elem, key) ⇒ Object



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

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

#element_cget(opt) ⇒ Object



2017
2018
2019
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2017

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

#element_cget_strict(opt) ⇒ Object



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

def element_cget_strict(opt)
  @tree.item_element_cget_strict(@id, opt)
end

#element_configinfo(*args) ⇒ Object



2028
2029
2030
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2028

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

#element_configure(*args) ⇒ Object



2024
2025
2026
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2024

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

#element_dumpObject



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

def element_dump
  @tree.item_dump(@id)
end

#element_dump_hashObject



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

def element_dump_hash
  @tree.item_dump_hash(@id)
end

#expandObject



2036
2037
2038
2039
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2036

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

#expand_recurseObject



2041
2042
2043
2044
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2041

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

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



2046
2047
2048
2049
2050
2051
2052
2053
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2046

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



2056
2057
2058
2059
2060
2061
2062
2063
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2056

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:

  • (Boolean)


2066
2067
2068
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2066

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

#idObject



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

def id
  @id
end

#indexObject



2071
2072
2073
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2071

def index
  @tree.item_index(@id)
end

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



2075
2076
2077
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2075

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

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



2083
2084
2085
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2083

def isopen
  @tree.item_isopen(@id)
end

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



2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2182

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



2093
2094
2095
2096
2097
2098
2099
2100
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2093

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



2103
2104
2105
2106
2107
2108
2109
2110
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2103

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



2113
2114
2115
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2113

def numchildren
  @tree.item_numchildren(@id)
end

#parent_indexObject



2119
2120
2121
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2119

def parent_index
  @tree.item_parent(@id)
end

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



2123
2124
2125
2126
2127
2128
2129
2130
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2123

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

#removeObject



2133
2134
2135
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2133

def remove
  @tree.item_remove(@id)
end

#rncObject



2137
2138
2139
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2137

def rnc
  @tree.item_rnc(@id)
end

#sort(*opts) ⇒ Object



2141
2142
2143
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2141

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

#sort_not_really(*opts) ⇒ Object



2144
2145
2146
2147
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2144

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



2149
2150
2151
2152
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2149

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

#state_get(*args) ⇒ Object



2155
2156
2157
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2155

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

#state_set(*args) ⇒ Object



2159
2160
2161
2162
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2159

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

#style_elements(column) ⇒ Object



2164
2165
2166
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2164

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

#style_map(column, style, map) ⇒ Object



2168
2169
2170
2171
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2168

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

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



2173
2174
2175
2176
2177
2178
2179
2180
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2173

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



1950
1951
1952
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 1950

def to_s
  @id.to_s.dup
end

#toggleObject



2196
2197
2198
2199
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2196

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

#toggle_recurseObject



2201
2202
2203
2204
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2201

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

#visible(st = None) ⇒ Object



2206
2207
2208
2209
2210
2211
2212
2213
# File 'ext/lib/tkextlib/treectrl/tktreectrl.rb', line 2206

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