Class: Tgui::Theme
Constant Summary
collapse
- @@debug =
false
Tgui::ThemeAttributed::ATTRIBUTE_TYPES
Instance Attribute Summary collapse
Attributes inherited from ExternObject
#pointer
Class Method Summary
collapse
Instance Method Summary
collapse
theme_attr, theme_comp
Methods included from BangDef
#def!
Methods included from BangNest
#method_missing, #respond_to?
#bang_method_missing, #bang_object_stack, #bang_respond_to?, #self!, #upon!
abi_attr, abi_bit_enum, abi_def, abi_enum, #abi_pack, abi_signal, abi_static, #abi_unpack, callback_storage, callback_storage=, data_storage=, 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
Constructor Details
This class inherits a constructor from ExternObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class BangNest
Instance Attribute Details
Returns the value of attribute source.
55
56
57
|
# File 'lib/white_gold/dsl/theme.rb', line 55
def source
@source
end
|
Class Method Details
._abi_finalizer(*a) ⇒ Object
945
|
# File 'lib/white_gold/generated/tgui-abi-loader.gf.rb', line 945
def self._abi_finalizer(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Theme_finalizer(*a); end
|
._abi_get_default(*a) ⇒ Object
944
|
# File 'lib/white_gold/generated/tgui-abi-loader.gf.rb', line 944
def self._abi_get_default(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Theme_getDefault(*a); end
|
._abi_get_unshared(*a) ⇒ Object
947
|
# File 'lib/white_gold/generated/tgui-abi-loader.gf.rb', line 947
def self._abi_get_unshared(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Theme_getUnshared(*a); end
|
._abi_set_default(*a) ⇒ Object
943
|
# File 'lib/white_gold/generated/tgui-abi-loader.gf.rb', line 943
def self._abi_set_default(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Theme_setDefault(*a); end
|
.api_attr(name, &init) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/white_gold/dsl/theme.rb', line 33
def api_attr name, &init
define_method "#{name}=" do |value|
@@data_storage[Theme.get_unshared(@pointer).to_i][name] = value
end
init ||= proc{ nil }
define_method name do
@@data_storage[Theme.get_unshared(@pointer).to_i][name] ||= init.()
end
end
|
17
18
19
|
# File 'lib/white_gold/dsl/theme.rb', line 17
def default
self.new pointer: _abi_get_default
end
|
.default=(theme) ⇒ Object
13
14
15
|
# File 'lib/white_gold/dsl/theme.rb', line 13
def default=(theme)
_abi_set_default Util.expand_path(theme)
end
|
.finalizer(pointer) ⇒ Object
21
22
23
|
# File 'lib/white_gold/dsl/theme.rb', line 21
def finalizer pointer
_abi_finalizer pointer
end
|
.loadpath(seed) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/white_gold/dsl/theme.rb', line 25
def loadpath seed
case seed
when :light then File.dirname(File.dirname(__FILE__)) + '/library/theme/light.rb'
when String then Util.expand_path(seed)
else raise "#{seed} not available"
end
end
|
Instance Method Details
#_abi_load(*a) ⇒ Object
946
|
# File 'lib/white_gold/generated/tgui-abi-loader.gf.rb', line 946
def _abi_load(*a); Abi.call_arg_map! a; Abi.ABI_Theme_load(@pointer, *a); end
|
#debug=(debug) ⇒ Object
65
66
67
|
# File 'lib/white_gold/dsl/theme.rb', line 65
def debug=(debug)
@@debug = debug
end
|
#reset_attributes ⇒ Object
60
61
62
|
# File 'lib/white_gold/dsl/theme.rb', line 60
def reset_attributes
self.attributes = {}
end
|
#self_commit(custom_rendered = nil) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/white_gold/dsl/theme.rb', line 78
def self_commit custom_rendered = nil
if attributes.size > 0
file = Tempfile.new
begin
if @source
File.foreach @source do |line|
file << line
end
end
attributes.each do |k, v|
file << v.to_theme << "\n"
end
file.close
puts File.readlines(file.path) if @@debug
_abi_load file.path
ensure
file.close!
end
else
_abi_load @source if @source
end
custom_rendered&.each do |widget, renderer|
widget.self_renderer = renderer
end
end
|