Class: Tgui::ComboBox::Item

Inherits:
WidgetLike show all
Defined in:
lib/white_gold/dsl/combo_box.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=, 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

#initialize(combo_box, id) ⇒ Item

Returns a new instance of Item.



33
34
35
36
# File 'lib/white_gold/dsl/combo_box.rb', line 33

def initialize combo_box, id
  @combo_box = combo_box
  @id = id
end

Dynamic Method Handling

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

Instance Method Details

#objectObject



42
43
44
# File 'lib/white_gold/dsl/combo_box.rb', line 42

def object
  return @combo_box.self_objects[@id]
end

#object=(object) ⇒ Object



38
39
40
# File 'lib/white_gold/dsl/combo_box.rb', line 38

def object=(object)
  @combo_box.self_objects[@id] = object
end

#selected=(selected) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/white_gold/dsl/combo_box.rb', line 54

def selected=(selected)
  if selected
    @combo_box.selected = object
  else
    @combo_box.deselect if selected?
  end
end

#selected?Boolean

Returns:



62
63
64
# File 'lib/white_gold/dsl/combo_box.rb', line 62

def selected?
  @combo_box.selected == object
end

#textObject



50
51
52
# File 'lib/white_gold/dsl/combo_box.rb', line 50

def text
  abi_unpack_string(@combo_box._abi_get_item_by_id abi_pack_string(@id))
end

#text=(text) ⇒ Object



46
47
48
# File 'lib/white_gold/dsl/combo_box.rb', line 46

def text=(text)
  @combo_box._abi_change_item_by_id abi_pack_string(@id), abi_pack_string(text)
end