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, 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__, add_kinsoku, bell, bell_on_display, const_missing, current_grabs, cursor_display, default_widget_set, default_widget_set=, 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, 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, toplevel_aliases_on_widget_set, 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.



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

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



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

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



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

def ancestors
  @tree.item_ancestors(@id)
end

#bbox(*args) ⇒ Object



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

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

#cget(opt) ⇒ Object



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

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

#cget_strict(opt) ⇒ Object



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

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

#cget_tkstring(opt) ⇒ Object



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

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

#childrenObject



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

def children
  @tree.item_children(@id)
end

#collapseObject



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

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

#collapse_recurseObject



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

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

#complex(*args) ⇒ Object



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

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

#configinfo(*args) ⇒ Object



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

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

#configure(*args) ⇒ Object



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

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

#current_configinfo(*args) ⇒ Object



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

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

#current_element_configinfo(*args) ⇒ Object



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

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

#deleteObject



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

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

#element_actual(column, elem, key) ⇒ Object



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

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

#element_cget_strict(opt) ⇒ Object



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

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

#element_cget_tkstring(opt) ⇒ Object



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

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

#element_configinfo(*args) ⇒ Object



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

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

#element_configure(*args) ⇒ Object



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

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

#element_dumpObject



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

def element_dump
  @tree.item_dump(@id)
end

#element_dump_hashObject



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

def element_dump_hash
  @tree.item_dump_hash(@id)
end

#expandObject



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

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

#expand_recurseObject



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

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

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



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

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



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

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)


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

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

#idObject



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

def id
  @id
end

#indexObject



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

def index
  @tree.item_index(@id)
end

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



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

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

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



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

def isopen
  @tree.item_isopen(@id)
end

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



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

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



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

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



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

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



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

def numchildren
  @tree.item_numchildren(@id)
end

#parent_indexObject



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

def parent_index
  @tree.item_parent(@id)
end

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



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

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

#removeObject



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

def remove
  @tree.item_remove(@id)
end

#rncObject



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

def rnc
  @tree.item_rnc(@id)
end

#sort(*opts) ⇒ Object



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

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

#sort_not_really(*opts) ⇒ Object



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

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



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

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

#state_get(*args) ⇒ Object



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

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

#state_set(*args) ⇒ Object



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

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

#style_elements(column) ⇒ Object



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

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

#style_map(column, style, map) ⇒ Object



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

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

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



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

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



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

def to_s
  @id.to_s.dup
end

#toggleObject



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

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

#toggle_recurseObject



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

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

#visible(st = None) ⇒ Object



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

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