Class: Tgui::GlobalSignal

Inherits:
Signal show all
Defined in:
lib/white_gold/dsl/signal/global_signal.rb

Direct Known Subclasses

BackendGui::ViewSignal

Instance Attribute Summary

Attributes inherited from ExternObject

#pointer

Instance Method Summary collapse

Methods inherited from Signal

#_abi_connect, #_abi_disconnect, #_abi_is_enabled, #_abi_set_enabled, #initialize, #suppress

Methods inherited from ExternObject

abi_attr, abi_bit_enum, abi_def, abi_enum, #abi_pack, abi_signal, abi_static, #abi_unpack, callback_storage, callback_storage=, data_storage=, finalizer, global_callback_storage, global_callback_storage=, #initialize, #initialized, self_abi_def, self_abi_def_setter

Methods included from Packer

#abi_pack, #abi_packer, #abi_packer_method_name

Methods included from Unpacker

#abi_unpack, #abi_unpacker, #abi_unpacker_method_name

Methods included from BangDef

#def!

Constructor Details

This class inherits a constructor from Tgui::Signal

Instance Method Details

#block_caller(&b) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/white_gold/dsl/signal/global_signal.rb', line 7

def block_caller &b
  Fiddle::Closure::BlockCaller.new(0, [0]) do
    @widget.page.upon! @widget do
      b.(@widget)
    end
  end
end

#connect(&b) ⇒ Object



19
20
21
22
23
24
# File 'lib/white_gold/dsl/signal/global_signal.rb', line 19

def connect &b
  @block_caller = self.block_caller &b
  id = _abi_connect(@block_caller)
  @@global_callback_storage[id] = self
  return id
end

#disconnect(id) ⇒ Object



26
27
28
29
30
# File 'lib/white_gold/dsl/signal/global_signal.rb', line 26

def disconnect id
  success = _abi_disconnect(id)
  @@global_callback_storage.delete(id) if success
  return success
end