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::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, Fontchooser, 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_nil, num_or_str, number, procedure, simplelist, slice_ary, 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_nil, num_or_nil, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd, untrust

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, __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__, _replace_toplevel_aliases, add_kinsoku, backup_current_topdef, bell, bell_on_display, const_missing, current_grabs, cursor_display, default_widget_set, default_widget_set=, define_topalias, define_topobj, 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, regist_sym_for_loaded_file, replace_topalias, replace_topobj, #root, set_topalias, 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, topalias_defined?, toplevel_aliases_on_widget_set, topobj_defined?, 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

Methods inherited from TkKernel

new

Constructor Details

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

Returns a new instance of Item.



1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1980

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



1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1968

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



1999
2000
2001
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1999

def ancestors
  @tree.item_ancestors(@id)
end

#bbox(*args) ⇒ Object



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

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

#cget(opt) ⇒ Object



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

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

#cget_strict(opt) ⇒ Object



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

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

#cget_tkstring(opt) ⇒ Object



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

def cget_tkstring(opt)
  @tree.item_cget_tkstring(@id, opt)
end

#childrenObject



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

def children
  @tree.item_children(@id)
end

#collapseObject



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

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

#collapse_recurseObject



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

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

#complex(*args) ⇒ Object



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

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

#configinfo(*args) ⇒ Object



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

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

#configure(*args) ⇒ Object



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

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

#current_configinfo(*args) ⇒ Object



2044
2045
2046
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2044

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

#current_element_configinfo(*args) ⇒ Object



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

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

#deleteObject



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

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

#element_actual(column, elem, key) ⇒ Object



2061
2062
2063
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2061

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

#element_cget_strict(opt) ⇒ Object



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

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

#element_cget_tkstring(opt) ⇒ Object



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

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

#element_configinfo(*args) ⇒ Object



2079
2080
2081
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2079

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

#element_configure(*args) ⇒ Object



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

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

#element_dumpObject



2053
2054
2055
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2053

def element_dump
  @tree.item_dump(@id)
end

#element_dump_hashObject



2057
2058
2059
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2057

def element_dump_hash
  @tree.item_dump_hash(@id)
end

#expandObject



2087
2088
2089
2090
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2087

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

#expand_recurseObject



2092
2093
2094
2095
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2092

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

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



2097
2098
2099
2100
2101
2102
2103
2104
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2097

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



2107
2108
2109
2110
2111
2112
2113
2114
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2107

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)


2117
2118
2119
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2117

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

#idObject



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

def id
  @id
end

#indexObject



2122
2123
2124
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2122

def index
  @tree.item_index(@id)
end

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



2126
2127
2128
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2126

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

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



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

def isopen
  @tree.item_isopen(@id)
end

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



2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2233

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



2144
2145
2146
2147
2148
2149
2150
2151
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2144

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



2154
2155
2156
2157
2158
2159
2160
2161
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2154

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



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

def numchildren
  @tree.item_numchildren(@id)
end

#parent_indexObject



2170
2171
2172
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2170

def parent_index
  @tree.item_parent(@id)
end

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



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

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

#removeObject



2184
2185
2186
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2184

def remove
  @tree.item_remove(@id)
end

#rncObject



2188
2189
2190
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2188

def rnc
  @tree.item_rnc(@id)
end

#sort(*opts) ⇒ Object



2192
2193
2194
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2192

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

#sort_not_really(*opts) ⇒ Object



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

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



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

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

#state_get(*args) ⇒ Object



2206
2207
2208
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2206

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

#state_set(*args) ⇒ Object



2210
2211
2212
2213
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2210

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

#style_elements(column) ⇒ Object



2215
2216
2217
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2215

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

#style_map(column, style, map) ⇒ Object



2219
2220
2221
2222
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2219

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

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



2224
2225
2226
2227
2228
2229
2230
2231
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2224

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



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

def to_s
  @id.to_s.dup
end

#toggleObject



2247
2248
2249
2250
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2247

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

#toggle_recurseObject



2252
2253
2254
2255
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2252

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

#visible(st = None) ⇒ Object



2257
2258
2259
2260
2261
2262
2263
2264
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2257

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