Class: TkComponent::Builder::TkTreeNode

Inherits:
TkItem
  • Object
show all
Defined in:
lib/tk_component/builder/tk_item.rb

Instance Attribute Summary

Attributes inherited from TkItem

#native_item

Instance Method Summary collapse

Methods inherited from TkItem

#apply_internal_grid, #apply_option, #apply_options, #built, create, #create_native_item, #focus, #native_item_class, #remove, #set_event_handler, #set_event_handlers, #set_grid

Constructor Details

#initialize(parent_item, name, options = {}, grid = {}, event_handlers = []) ⇒ TkTreeNode

Returns a new instance of TkTreeNode.



333
334
335
336
337
338
339
340
341
342
# File 'lib/tk_component/builder/tk_item.rb', line 333

def initialize(parent_item, name, options = {}, grid = {}, event_handlers = [])
  item_options = options.dup
  parent_node = item_options.delete(:parent) || ''
  parent_native_item = (parent_node == '' ? '' : parent_node.native_item)
  at = item_options.delete(:at)
  selected = item_options.delete(:selected)
  @native_item = parent_item.native_item.insert(parent_native_item, at, item_options)
  parent_item.native_item.selection_add(@native_item) if selected
  set_event_handlers(event_handlers)
end