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, Fontchooser, 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::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 TkEvent

#install_bind, #install_bind_for_event_class

Methods included from TkUtil

_conv_args, #_conv_args, #_fromUTF8, #_get_eval_enc_str, _get_eval_enc_str, #_get_eval_string, _get_eval_string, #_symbolkey2str, _symbolkey2str, #_toUTF8, #bool, bool, callback, eval_cmd, hash_kv, #hash_kv, install_cmd, num_or_nil, #num_or_nil, #num_or_str, num_or_str, #number, number, string, #string, uninstall_cmd, untrust

Methods included from TkBindCore

#bind, #bind_append, #bind_remove, #bindinfo

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, #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, 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.


1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1988

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


1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 1976

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


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

def ancestors
  @tree.item_ancestors(@id)
end

#bbox(*args) ⇒ Object


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

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

#cget(opt) ⇒ Object


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

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

#cget_strict(opt) ⇒ Object


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

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

#cget_tkstring(opt) ⇒ Object


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

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

#childrenObject


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

def children
  @tree.item_children(@id)
end

#collapseObject


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

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

#collapse_recurseObject


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

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

#complex(*args) ⇒ Object


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

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

#configinfo(*args) ⇒ Object


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

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

#configure(*args) ⇒ Object


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

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

#current_configinfo(*args) ⇒ Object


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

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

#current_element_configinfo(*args) ⇒ Object


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

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

#deleteObject


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

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

#element_actual(column, elem, key) ⇒ Object


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

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

#element_cget_strict(opt) ⇒ Object


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

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

#element_cget_tkstring(opt) ⇒ Object


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

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

#element_configinfo(*args) ⇒ Object


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

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

#element_configure(*args) ⇒ Object


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

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

#element_dumpObject


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

def element_dump
  @tree.item_dump(@id)
end

#element_dump_hashObject


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

def element_dump_hash
  @tree.item_dump_hash(@id)
end

#expandObject


2095
2096
2097
2098
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2095

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

#expand_recurseObject


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

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

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


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

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


2115
2116
2117
2118
2119
2120
2121
2122
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2115

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)

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

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

#idObject


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

def id
  @id
end

#indexObject


2130
2131
2132
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2130

def index
  @tree.item_index(@id)
end

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


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

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

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


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

def isopen
  @tree.item_isopen(@id)
end

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


2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2241

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


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

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


2162
2163
2164
2165
2166
2167
2168
2169
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2162

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


2172
2173
2174
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2172

def numchildren
  @tree.item_numchildren(@id)
end

#parent_indexObject


2178
2179
2180
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2178

def parent_index
  @tree.item_parent(@id)
end

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


2182
2183
2184
2185
2186
2187
2188
2189
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2182

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

#removeObject


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

def remove
  @tree.item_remove(@id)
end

#rncObject


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

def rnc
  @tree.item_rnc(@id)
end

#sort(*opts) ⇒ Object


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

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

#sort_not_really(*opts) ⇒ Object


2203
2204
2205
2206
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2203

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


2208
2209
2210
2211
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2208

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

#state_get(*args) ⇒ Object


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

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

#state_set(*args) ⇒ Object


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

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

#style_elements(column) ⇒ Object


2223
2224
2225
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2223

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

#style_map(column, style, map) ⇒ Object


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

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

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


2232
2233
2234
2235
2236
2237
2238
2239
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2232

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


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

def to_s
  @id.to_s.dup
end

#toggleObject


2255
2256
2257
2258
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2255

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

#toggle_recurseObject


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

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

#visible(st = None) ⇒ Object


2265
2266
2267
2268
2269
2270
2271
2272
# File 'lib/tkextlib/treectrl/tktreectrl.rb', line 2265

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