Class: Tgui::TreeView::Item

Inherits:
WidgetLike show all
Defined in:
lib/white_gold/dsl/tree_view.rb

Instance Attribute Summary

Attributes inherited from WidgetLike

#host, #id

Instance Method Summary collapse

Methods inherited from WidgetLike

abi_attr, abi_bit_enum, abi_def, abi_enum, #flags=, #initialize, self_abi_def, self_abi_def_setter, self_abi_def_setter_with_id, self_abi_def_with_id, self_packers_id_extend

Methods included from BangDef

#def!

Methods included from BangNest

#method_missing, #respond_to?

Methods included from BangNestedCaller

#bang_method_missing, #bang_object_stack, #bang_respond_to?, #self!, #upon!

Constructor Details

This class inherits a constructor from WidgetLike

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BangNest

Instance Method Details

#[](*path_end) ⇒ Object



120
121
122
# File 'lib/white_gold/dsl/tree_view.rb', line 120

def [](*path_end)
  Item.new host, [*path, *path_end]
end

#collapsed=(collapsed) ⇒ Object



92
93
94
# File 'lib/white_gold/dsl/tree_view.rb', line 92

def collapsed=(collapsed)
  self.expanded = !collapsed
end

#expanded=(expanded) ⇒ Object



86
87
88
89
90
# File 'lib/white_gold/dsl/tree_view.rb', line 86

def expanded=(expanded)
  self_path_block do
    expanded ? host._abi_expand(_1, _2) : host._abi_collapse(_1, _2)
  end
end

#objectObject



124
125
126
# File 'lib/white_gold/dsl/tree_view.rb', line 124

def object
  path.last
end

#removeObject



109
110
111
112
113
114
# File 'lib/white_gold/dsl/tree_view.rb', line 109

def remove
  self_path_block do
    host._abi_remove_item _1, _2, abi_pack_boolean(false)
    host.self_tree.cut *_3
  end
end

#selected=(selected) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/white_gold/dsl/tree_view.rb', line 96

def selected=(selected)
  if selected
    self_path_block do
      host.select_item(_1, _2)
    end
  else
    selected_item = host.selected_item
    if selected_item.path == path
      host.deselect_item
    end
  end
end

#self_path_block(&b) ⇒ Object



82
83
84
# File 'lib/white_gold/dsl/tree_view.rb', line 82

def self_path_block &b
  host.self_path_block path, &b
end