Class: Tgui::MessageBox::Button

Inherits:
WidgetLike show all
Defined in:
lib/white_gold/dsl/message_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(host, id) ⇒ Button

Returns a new instance of Button.



30
31
32
33
# File 'lib/white_gold/dsl/message_box.rb', line 30

def initialize host, id
  super
  @on_press_callbacks = []
end

Dynamic Method Handling

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

Instance Method Details

#on_press=(on_press) ⇒ Object



35
36
37
# File 'lib/white_gold/dsl/message_box.rb', line 35

def on_press=(on_press)
  @on_press_callbacks << on_press.to_proc
end

#press_signal_executeObject



39
40
41
42
43
44
45
# File 'lib/white_gold/dsl/message_box.rb', line 39

def press_signal_execute
  host.page.upon! host do
    @on_press_callbacks.each do |c|
      c.(id, self, host)
    end
  end
end