white_gold 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/ext/dll/openal32.dll +0 -0
  3. data/ext/dll/sfml-audio-2.dll +0 -0
  4. data/ext/dll/sfml-graphics-2.dll +0 -0
  5. data/ext/dll/sfml-network-2.dll +0 -0
  6. data/ext/dll/sfml-system-2.dll +0 -0
  7. data/ext/dll/sfml-window-2.dll +0 -0
  8. data/ext/dll/tgui.dll +0 -0
  9. data/ext/so/libsfml-audio.so +0 -0
  10. data/ext/so/libsfml-graphics.so +0 -0
  11. data/ext/so/libsfml-network.so +0 -0
  12. data/ext/so/libsfml-system.so +0 -0
  13. data/ext/so/libsfml-window.so +0 -0
  14. data/ext/so/libtgui.so +0 -0
  15. data/lib/white_gold/abi/alias.rb +50 -0
  16. data/lib/white_gold/abi/enum.rb +43 -0
  17. data/lib/white_gold/abi/extern_object.rb +180 -0
  18. data/lib/white_gold/abi/interface/interface.rb +114 -0
  19. data/lib/white_gold/abi/interface/interface_collection_out.rb +29 -0
  20. data/lib/white_gold/abi/interface/interface_composed_out.rb +28 -0
  21. data/lib/white_gold/abi/interface/interface_single_out.rb +19 -0
  22. data/lib/white_gold/abi/packer.rb +28 -0
  23. data/lib/white_gold/abi/reducer.rb +12 -0
  24. data/lib/white_gold/abi/unpacker.rb +27 -0
  25. data/lib/white_gold/convention/api_child.rb +30 -0
  26. data/lib/white_gold/convention/bang_def.rb +5 -0
  27. data/lib/white_gold/convention/bang_nest.rb +16 -0
  28. data/lib/white_gold/convention/bang_nested_caller.rb +48 -0
  29. data/lib/white_gold/convention/bool_property.rb +13 -0
  30. data/lib/white_gold/convention/boolean.rb +2 -0
  31. data/lib/white_gold/convention/club.rb +26 -0
  32. data/lib/white_gold/convention/container_widgets.rb +181 -0
  33. data/lib/white_gold/convention/page.rb +96 -0
  34. data/lib/white_gold/convention/proc_method_factory.rb +22 -0
  35. data/lib/white_gold/convention/unit.rb +22 -0
  36. data/lib/white_gold/convention/widget_like.rb +146 -0
  37. data/lib/white_gold/dsl/backend_gui.rb +37 -0
  38. data/lib/white_gold/dsl/bitmap_button.rb +11 -0
  39. data/lib/white_gold/dsl/box_layout.rb +47 -0
  40. data/lib/white_gold/dsl/box_layout_ratios.rb +13 -0
  41. data/lib/white_gold/dsl/button.rb +10 -0
  42. data/lib/white_gold/dsl/button_base.rb +18 -0
  43. data/lib/white_gold/dsl/chat_box.rb +65 -0
  44. data/lib/white_gold/dsl/checkbox.rb +6 -0
  45. data/lib/white_gold/dsl/child_window.rb +47 -0
  46. data/lib/white_gold/dsl/clickable_widget.rb +15 -0
  47. data/lib/white_gold/dsl/color.rb +124 -0
  48. data/lib/white_gold/dsl/color_picker.rb +12 -0
  49. data/lib/white_gold/dsl/combo_box.rb +135 -0
  50. data/lib/white_gold/dsl/container.rb +95 -0
  51. data/lib/white_gold/dsl/edit_box.rb +38 -0
  52. data/lib/white_gold/dsl/file_dialog.rb +86 -0
  53. data/lib/white_gold/dsl/font.rb +23 -0
  54. data/lib/white_gold/dsl/grid.rb +131 -0
  55. data/lib/white_gold/dsl/group.rb +6 -0
  56. data/lib/white_gold/dsl/gui.rb +16 -0
  57. data/lib/white_gold/dsl/horizontal_layout.rb +6 -0
  58. data/lib/white_gold/dsl/horizontal_wrap.rb +6 -0
  59. data/lib/white_gold/dsl/knob.rb +16 -0
  60. data/lib/white_gold/dsl/label.rb +21 -0
  61. data/lib/white_gold/dsl/list_box.rb +125 -0
  62. data/lib/white_gold/dsl/list_view.rb +239 -0
  63. data/lib/white_gold/dsl/menu_bar.rb +252 -0
  64. data/lib/white_gold/dsl/message_box.rb +90 -0
  65. data/lib/white_gold/dsl/outline.rb +52 -0
  66. data/lib/white_gold/dsl/panel.rb +16 -0
  67. data/lib/white_gold/dsl/panel_list_box.rb +83 -0
  68. data/lib/white_gold/dsl/picture.rb +12 -0
  69. data/lib/white_gold/dsl/progress_bar.rb +19 -0
  70. data/lib/white_gold/dsl/radio_button.rb +18 -0
  71. data/lib/white_gold/dsl/radio_button_group.rb +14 -0
  72. data/lib/white_gold/dsl/range_slider.rb +15 -0
  73. data/lib/white_gold/dsl/rich_text_label.rb +6 -0
  74. data/lib/white_gold/dsl/scrollable_panel.rb +53 -0
  75. data/lib/white_gold/dsl/scrollbar.rb +28 -0
  76. data/lib/white_gold/dsl/separator_line.rb +6 -0
  77. data/lib/white_gold/dsl/signal/global_signal.rb +33 -0
  78. data/lib/white_gold/dsl/signal/signal.rb +44 -0
  79. data/lib/white_gold/dsl/signal/signal_animation_type.rb +16 -0
  80. data/lib/white_gold/dsl/signal/signal_bool.rb +16 -0
  81. data/lib/white_gold/dsl/signal/signal_color.rb +16 -0
  82. data/lib/white_gold/dsl/signal/signal_float.rb +16 -0
  83. data/lib/white_gold/dsl/signal/signal_int.rb +16 -0
  84. data/lib/white_gold/dsl/signal/signal_item.rb +6 -0
  85. data/lib/white_gold/dsl/signal/signal_item_hierarchy.rb +9 -0
  86. data/lib/white_gold/dsl/signal/signal_panel_list_box_item.rb +7 -0
  87. data/lib/white_gold/dsl/signal/signal_pointer.rb +15 -0
  88. data/lib/white_gold/dsl/signal/signal_range.rb +15 -0
  89. data/lib/white_gold/dsl/signal/signal_show_effect.rb +17 -0
  90. data/lib/white_gold/dsl/signal/signal_string.rb +16 -0
  91. data/lib/white_gold/dsl/signal/signal_typed_int_bool_ptr.rb +15 -0
  92. data/lib/white_gold/dsl/signal/signal_typed_size_t.rb +6 -0
  93. data/lib/white_gold/dsl/signal/signal_u_int.rb +16 -0
  94. data/lib/white_gold/dsl/signal/signal_vector2f.rb +14 -0
  95. data/lib/white_gold/dsl/slider.rb +26 -0
  96. data/lib/white_gold/dsl/spin_button.rb +24 -0
  97. data/lib/white_gold/dsl/spin_control.rb +15 -0
  98. data/lib/white_gold/dsl/subwidget_container.rb +9 -0
  99. data/lib/white_gold/dsl/tab_container.rb +121 -0
  100. data/lib/white_gold/dsl/tabs.rb +91 -0
  101. data/lib/white_gold/dsl/text_area.rb +34 -0
  102. data/lib/white_gold/dsl/texture.rb +53 -0
  103. data/lib/white_gold/dsl/theme/boolean_attribute.rb +13 -0
  104. data/lib/white_gold/dsl/theme/button_theme.rb +19 -0
  105. data/lib/white_gold/dsl/theme/chat_box_theme.rb +16 -0
  106. data/lib/white_gold/dsl/theme/child_window_theme.rb +25 -0
  107. data/lib/white_gold/dsl/theme/color_attribute.rb +13 -0
  108. data/lib/white_gold/dsl/theme/color_picker_theme.rb +14 -0
  109. data/lib/white_gold/dsl/theme/combo_box_theme.rb +33 -0
  110. data/lib/white_gold/dsl/theme/common_renderer.rb +7 -0
  111. data/lib/white_gold/dsl/theme/edit_box_theme.rb +34 -0
  112. data/lib/white_gold/dsl/theme/file_dialog_theme.rb +22 -0
  113. data/lib/white_gold/dsl/theme/float_attribute.rb +13 -0
  114. data/lib/white_gold/dsl/theme/group_theme.rb +9 -0
  115. data/lib/white_gold/dsl/theme/knob_theme.rb +15 -0
  116. data/lib/white_gold/dsl/theme/label_theme.rb +20 -0
  117. data/lib/white_gold/dsl/theme/list_box_theme.rb +25 -0
  118. data/lib/white_gold/dsl/theme/list_view_theme.rb +27 -0
  119. data/lib/white_gold/dsl/theme/menu_bar_theme.rb +21 -0
  120. data/lib/white_gold/dsl/theme/message_box_theme.rb +11 -0
  121. data/lib/white_gold/dsl/theme/outline_attribute.rb +13 -0
  122. data/lib/white_gold/dsl/theme/progress_bar_theme.rb +19 -0
  123. data/lib/white_gold/dsl/theme/radio_button_theme.rb +30 -0
  124. data/lib/white_gold/dsl/theme/scrollbar_theme.rb +24 -0
  125. data/lib/white_gold/dsl/theme/separator_line_theme.rb +9 -0
  126. data/lib/white_gold/dsl/theme/slider_theme.rb +20 -0
  127. data/lib/white_gold/dsl/theme/spin_button_theme.rb +19 -0
  128. data/lib/white_gold/dsl/theme/tabs_theme.rb +29 -0
  129. data/lib/white_gold/dsl/theme/text_area_theme.rb +22 -0
  130. data/lib/white_gold/dsl/theme/text_styles_attribute.rb +13 -0
  131. data/lib/white_gold/dsl/theme/texture_attribute.rb +17 -0
  132. data/lib/white_gold/dsl/theme/theme_attributed.rb +51 -0
  133. data/lib/white_gold/dsl/theme/theme_component.rb +23 -0
  134. data/lib/white_gold/dsl/theme/tree_view_theme.rb +26 -0
  135. data/lib/white_gold/dsl/theme/widget_theme.rb +12 -0
  136. data/lib/white_gold/dsl/theme.rb +144 -0
  137. data/lib/white_gold/dsl/toggle_button.rb +10 -0
  138. data/lib/white_gold/dsl/tool_tip.rb +21 -0
  139. data/lib/white_gold/dsl/tree_view.rb +186 -0
  140. data/lib/white_gold/dsl/util.rb +17 -0
  141. data/lib/white_gold/dsl/vertical_layout.rb +6 -0
  142. data/lib/white_gold/dsl/widget.rb +279 -0
  143. data/lib/white_gold/dsl/window.rb +16 -0
  144. data/lib/white_gold/generated/tgui-abi-loader.gf.rb +1813 -0
  145. data/lib/white_gold/library/theme/light.rb +111 -0
  146. data/lib/white_gold/master.rb +170 -0
  147. data/lib/white_gold/path/kernel.path.rb +3 -0
  148. data/lib/white_gold/path/numeric.path.rb +9 -0
  149. data/lib/white_gold/path/object.path.rb +22 -0
  150. data/lib/white_gold/path/string.path.rb +5 -0
  151. data/lib/white_gold/tgui-abi.rb +255 -0
  152. data/lib/white_gold/tgui-config.rb +20 -0
  153. data/lib/white_gold.rb +47 -0
  154. metadata +209 -0
@@ -0,0 +1,252 @@
1
+ require_relative 'widget'
2
+ require_relative '../convention/widget_like'
3
+ require_relative 'signal/signal_item_hierarchy'
4
+
5
+ module Tgui
6
+ class MenuBar < Widget
7
+
8
+ class ItemPressSignal
9
+ def initialize menu_bar, path
10
+ @menu_bar = menu_bar
11
+ @path = path
12
+ end
13
+
14
+ def connect &b
15
+ on_press = Fiddle::Closure::BlockCaller.new(0, [0]) do
16
+ @menu_bar.page.upon! @menu_bar do
17
+ b.(@path.last, @path, @menu_bar)
18
+ end
19
+ end
20
+
21
+ return @menu_bar.self_path_block @path do
22
+ id = @menu_bar._abi_connect_menu_item _1, _2, on_press
23
+ MenuBar.callback_storage[id] = on_press
24
+ id
25
+ end
26
+ end
27
+
28
+ def disconnect id
29
+ @menu_bar.on_menu_item_click.disconnect id
30
+ end
31
+ end
32
+
33
+ class SignalItemHierarchy < Tgui::SignalItemHierarchy
34
+
35
+ def block_caller &b
36
+ Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |vector|
37
+ path = []
38
+ loader = Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |str|
39
+ path << @widget.abi_unpack_string(str)
40
+ end
41
+ SignalItemHierarchy.fetch_path vector, loader
42
+ object_path = @widget.self_object_path path
43
+ @widget.page.upon! @widget do
44
+ b.(object_path.last, object_path, @widget)
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ class TreeNode
51
+ def initialize text
52
+ @text = text
53
+ @nodes = {}
54
+ end
55
+
56
+ attr_accessor :text
57
+ attr :nodes
58
+
59
+ def [](*path, grow: false)
60
+ if grow
61
+ path.reduce(self){|node, o| node.nodes[o] ||= TreeNode.new(nil) }
62
+ else
63
+ path.reduce(self){|node, o| node&.nodes[o] }
64
+ end
65
+ end
66
+
67
+ def cut *path, last
68
+ self[*path].nodes.delete last
69
+ end
70
+
71
+ def cut_branches *path
72
+ self[*path].nodes = {}
73
+ end
74
+
75
+ def path_str_to_object *path
76
+ object_path = []
77
+ path.reduce self do |node, str|
78
+ o, node = *node.nodes.find{|k, v| v.text == str }
79
+ object_path << o
80
+ node
81
+ end
82
+ object_path
83
+ end
84
+
85
+ def path_object_to_str *path
86
+ str_path = []
87
+ path.reduce self do |node, o|
88
+ node[o].tap{ str_path << _1.text }
89
+ end
90
+ str_path
91
+ end
92
+ end
93
+
94
+ api_attr :self_tree do
95
+ TreeNode.new nil
96
+ end
97
+ api_attr :format do
98
+ :to_s
99
+ end
100
+
101
+ class MenuItem < WidgetLike
102
+ def! :item do |object, **na, &b|
103
+ item_path = [*path, object]
104
+ host.self_tree[*item_path, grow: true].text = object.then(&host.format)
105
+ host.self_path_block item_path do
106
+ host._abi_add_menu_item _1, _2
107
+ end
108
+ item = Item.new host, item_path
109
+ upon! item, **na, &b
110
+ end
111
+
112
+ def! :separator do
113
+ item! "-"
114
+ end
115
+
116
+ def on_press(&b)
117
+ signal = ItemPressSignal.new host, path
118
+ block_given? ? signal.connect(&b) : signal
119
+ end
120
+
121
+ def on_press=(b)
122
+ on_press &b
123
+ end
124
+
125
+ def remove_subitems
126
+ host.self_path_block path do
127
+ host._abi_remove_sub_menu_item _1, _2
128
+ host.self_tree.cut_branches *_3
129
+ end
130
+ end
131
+
132
+ def text=(text)
133
+ host.self_path_block path do
134
+ host._abi_change_menu_item _1, _2, text
135
+ host.self_tree[*path].text = text
136
+ end
137
+ end
138
+
139
+ def text
140
+ host.self_tree[*path].text
141
+ end
142
+
143
+ def [](*path)
144
+ Item.new(host, self.path + path)
145
+ end
146
+ end
147
+
148
+ class Menu < MenuItem
149
+
150
+ alias_method :id, :text
151
+
152
+ abi_attr :enabled?, Boolean, :menu_enabled, id: 0
153
+ abi_def :remove, :remove_menu, id: 0
154
+
155
+ def path
156
+ [@id]
157
+ end
158
+ end
159
+
160
+ class Item < MenuItem
161
+ def initialize menu_bar, path
162
+ super(menu_bar, path.freeze)
163
+ end
164
+
165
+
166
+ def enabled=(enabled)
167
+ host.self_path_block path do
168
+ host._abi_set_menu_item_enabled _1, _2, enabled
169
+ end
170
+ end
171
+
172
+ def enabled?
173
+ host.self_path_block path do
174
+ host._abi_get_menu_item_enabled _1, _2
175
+ end
176
+ end
177
+
178
+ def remove
179
+ host.self_path_block path do
180
+ host._abi_remove_menu_item _1, _2
181
+ host.self_tree.cut *_3
182
+ end
183
+ end
184
+
185
+ def path
186
+ @id
187
+ end
188
+ end
189
+
190
+ def! :item do |object, **na, &b|
191
+ text = object.then(&format)
192
+ self_tree[object, grow: true].text = text
193
+ _abi_add_menu abi_pack_string(text)
194
+ item = Menu.new self, object
195
+ upon! item, **na, &b
196
+ end
197
+
198
+ def items=(items)
199
+ self_make_items items
200
+ end
201
+
202
+ def items
203
+ self_collect_items(self_tree)
204
+ end
205
+
206
+ def [](*path)
207
+ case path.size
208
+ when 0 then self
209
+ when 1 then Menu.new(self, path[0])
210
+ else Item.new(self, path)
211
+ end
212
+ end
213
+
214
+ abi_attr :min_item_width, Integer, :minimum_sub_menu_width
215
+ abi_attr :direction_inverted?, Boolean, :inverted_menu_direction
216
+ abi_def :close, :close_menu
217
+ abi_def :remove_all
218
+
219
+ def remove *path
220
+ self[*path].remove
221
+ end
222
+
223
+ abi_signal :on_item_click, SignalItemHierarchy, :on_menu_item_click
224
+
225
+ def self_path_block path, &b
226
+ path = self_tree.path_object_to_str *path
227
+ b.(*abi_pack(String.., *path), path)
228
+ end
229
+
230
+ def self_object_path path
231
+ self_tree.path_str_to_object *path
232
+ end
233
+
234
+ def self_collect_items tree_node
235
+ tree_node.nodes.map{|k, v| [k, self_collect_items(v)]}.to_h
236
+ end
237
+
238
+ def self_make_items items, path = []
239
+ items.each do |k, v|
240
+ item = self[*path].item k
241
+ case v
242
+ when Hash
243
+ self_make_items v, [*path, k]
244
+ when Proc
245
+ item.on_press &v
246
+ when String
247
+ item.text = v
248
+ end
249
+ end
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,90 @@
1
+ require_relative 'button'
2
+ require_relative 'signal/signal_string'
3
+ require_relative '../convention/widget_like'
4
+
5
+ module Tgui
6
+ class MessageBox < ChildWindow
7
+
8
+ api_attr :format do
9
+ :to_s
10
+ end
11
+
12
+ abi_enum "Alignment", :left, :center, :right
13
+ abi_attr :button_alignment, Alignment
14
+ abi_attr :label_alignment, Alignment
15
+ abi_attr :text, String
16
+
17
+ def initialized
18
+ on_button_press do |button, widget|
19
+ self_buttons[button]&.press_signal_execute
20
+ end
21
+ end
22
+
23
+ class Button < WidgetLike
24
+ def initialize host, id
25
+ super
26
+ @on_press_callbacks = []
27
+ end
28
+
29
+ def on_press=(on_press)
30
+ @on_press_callbacks << on_press.to_proc
31
+ end
32
+
33
+ def press_signal_execute
34
+ host.page.upon! host do
35
+ @on_press_callbacks.each do |c|
36
+ c.(id, self, host)
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ def! :button do |object = VOID, text: nil, **na, &b|
43
+ object = self.self_next_button_id = self_next_button_id.next if object == VOID
44
+ text ||= object.then(&format)
45
+ raise "Button with given text exists (#{text})" if self_buttons[text]
46
+ _abi_add_button abi_pack_string(text)
47
+ button = Button.new self, object
48
+ self_buttons[text] = button
49
+ upon! button, **na, &b
50
+ end
51
+
52
+ def [](object)
53
+ self_buttons.values.find{ _1.id == object }
54
+ end
55
+
56
+ def remove_buttons
57
+ self.buttons = {}
58
+ end
59
+
60
+ def buttons=(buttons)
61
+ self.self_buttons = {}
62
+ names = buttons.map do |object, on_press|
63
+ text = object.then(&format)
64
+ raise "Button with given text exists (#{text})" if self_buttons[text]
65
+ button = Button.new self, object
66
+ button.on_press = on_press
67
+ self_buttons[text] = button
68
+ text
69
+ end
70
+ self_change_buttons names
71
+ end
72
+
73
+ def buttons
74
+ self_buttons.values.map{ _1.id }
75
+ end
76
+
77
+ abi_signal :on_button_press, SignalString
78
+
79
+ #internal
80
+
81
+ abi_def :self_change_buttons, :change_buttons, String.. => nil
82
+
83
+ api_attr :self_buttons do
84
+ {}
85
+ end
86
+ api_attr :self_next_button_id do
87
+ "Button-0"
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,52 @@
1
+ require_relative '../abi/extern_object'
2
+
3
+ module Tgui
4
+ class Outline < ExternObject
5
+
6
+ def self.from *arg
7
+ case arg.size
8
+ when 1
9
+ a = arg.first
10
+ case a
11
+ when Outline
12
+ return a
13
+ when String, Numeric
14
+ o = arg * 4
15
+ else raise "Unsupported argument #{arg}"
16
+ end
17
+ when 2
18
+ o = [arg[0], arg[0], arg[1], arg[1]]
19
+ when 3
20
+ o = [arg[0], arg[1], arg[2], arg[2]]
21
+ when 4
22
+ o = arg
23
+ else raise "Unsupported argument #{arg}"
24
+ end
25
+ o = o.map do |v|
26
+ case v
27
+ when Numeric then Unit.nominate(v)
28
+ when String then v
29
+ else raise "Unsupported arguments #{arg}"
30
+ end
31
+ end
32
+ Outline.new *o
33
+ end
34
+
35
+ abi_def :left, :get_, nil => Float
36
+ abi_def :right, :get_, nil => Float
37
+ abi_def :top, :get_, nil => Float
38
+ abi_def :bottom, :get_, nil => Float
39
+
40
+ def to_a
41
+ [left, right, top, bottom]
42
+ end
43
+
44
+ def to_s
45
+ "(#{to_a.join(", ")})"
46
+ end
47
+
48
+ def inspect
49
+ to_s
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'group'
2
+ require_relative 'signal/signal_vector2f'
3
+
4
+ module Tgui
5
+ class Panel < Group
6
+
7
+ abi_signal :on_mouse_press, SignalVector2f
8
+ abi_signal :on_mouse_release, SignalVector2f
9
+ abi_signal :on_click, SignalVector2f
10
+ abi_signal :on_double_click, SignalVector2f
11
+ abi_signal :on_right_mouse_press, SignalVector2f
12
+ abi_signal :on_right_mouse_release, SignalVector2f
13
+ abi_signal :on_right_click, SignalVector2f
14
+
15
+ end
16
+ end
@@ -0,0 +1,83 @@
1
+ require_relative 'scrollable_panel'
2
+ require_relative '../convention/widget_like'
3
+ require_relative 'signal/signal_panel_list_box_item'
4
+
5
+ module Tgui
6
+ class PanelListBox < ScrollablePanel
7
+
8
+ class SignalPanelListBoxItem < Tgui::SignalPanelListBoxItem
9
+ def block_caller &b
10
+ Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |id|
11
+ @widget.page.upon! @widget do
12
+ b.(@widget.self_objects.key(@widget.abi_unpack_string(id)), @widget)
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ @@auto_item_id = "@/"
19
+
20
+ def! :item do |object, index: -1, **na, &b|
21
+ @@auto_item_id = id = @@auto_item_id.next
22
+ panel = Panel.new pointer: _abi_add_item(id, abi_pack_integer(index))
23
+ panel.page = page
24
+ self_objects[object] = id
25
+ upon! panel, **na, &b
26
+ end
27
+
28
+ def [](object)
29
+ Panel.new(pointer: _abi_get_item_by_id(self_objects[object])).tap do |panel|
30
+ panel.page = page
31
+ end
32
+ end
33
+
34
+ abi_def :item_width, :get_items_width, nil => Float
35
+ abi_packer "NominatedFloat" do |value|
36
+ case value
37
+ when Numeric then Unit.nominate value
38
+ else value
39
+ end
40
+ end
41
+ abi_unpacker "NominatedFloat" do |o|
42
+ abi_unpack_float o
43
+ end
44
+ abi_attr :item_height, "NominatedFloat", :items_height
45
+
46
+ def selected=(object)
47
+ _abi_set_selected_item_by_id self_objects[object]
48
+ end
49
+
50
+ def selected
51
+ id = abi_unpack_string(_abi_get_selected_item_id)
52
+ id == "" ? nil : self_objects.key(id)
53
+ end
54
+
55
+ abi_def :deselect, :deselect_item
56
+
57
+ def remove object
58
+ _abi_remove_item_by_id self_objects[object]
59
+ self_objects.delete object
60
+ end
61
+
62
+ def remove_all
63
+ _abi_remove_all_items
64
+ self_objects.clear
65
+ end
66
+
67
+ abi_attr :max_items, Integer, :maximum_items
68
+
69
+ abi_signal :on_item_select, SignalPanelListBoxItem
70
+
71
+ def! :template do |**na, &b|
72
+ panel = Panel.new(pointer: _abi_get_panel_template)
73
+ panel.page = page
74
+ upon! panel, **na, &b
75
+ end
76
+
77
+ # internal
78
+
79
+ api_attr :self_objects do
80
+ {}
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,12 @@
1
+ require_relative 'clickable_widget'
2
+ require_relative 'signal/signal_vector2f'
3
+
4
+ module Tgui
5
+ class Picture < ClickableWidget
6
+
7
+ abi_def :ignore_mouse, :ignore_mouse_events, Boolean => nil
8
+ abi_def :ignore_mouse?, :is_ignoring_mouse_events, nil => Boolean
9
+ abi_signal :on_double_click, SignalVector2f
10
+
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'clickable_widget'
2
+ require_relative 'signal/signal'
3
+ require_relative 'signal/signal_u_int'
4
+
5
+ module Tgui
6
+ class ProgressBar < ClickableWidget
7
+
8
+ abi_enum "FillDirection", :left_to_right, :right_to_left, :top_to_bottom, :bottom_to_top
9
+ abi_attr :min, Float, :minimum
10
+ abi_attr :max, Float, :maximum
11
+ abi_attr :value, Float
12
+ abi_attr :increment, Float, :increment_value
13
+ abi_attr :text, String
14
+ abi_attr :fill_direction, FillDirection
15
+ abi_signal :on_value_change, SignalUInt
16
+ abi_signal :on_full, Signal
17
+
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'clickable_widget'
2
+ require_relative 'signal/signal_bool'
3
+
4
+ module Tgui
5
+ class RadioButton < ClickableWidget
6
+
7
+ abi_attr :checked?
8
+ abi_attr :text, String
9
+ abi_attr :text_clickable?
10
+ abi_signal :on_check, Signal
11
+ abi_signal :on_uncheck, Signal
12
+ abi_signal :on_change, SignalBoolean
13
+ api_attr :object do
14
+ nil
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ require_relative 'container'
2
+
3
+ module Tgui
4
+ class RadioButtonGroup < Container
5
+
6
+ abi_def :uncheck, :uncheck_radio_buttons
7
+ abi_def :checked_radio_button, :get_, nil => Widget
8
+
9
+ def checked
10
+ checked_radio_button&.object
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'widget'
2
+ require_relative 'signal/signal_range'
3
+
4
+ module Tgui
5
+ class RangeSlider < Widget
6
+
7
+ abi_attr :min, Float, :minimum
8
+ abi_attr :max, Float, :maximum
9
+ abi_attr :selection_start, Float
10
+ abi_attr :selection_end, Float
11
+ abi_attr :step, Float
12
+ abi_signal :on_range_change, SignalRange
13
+
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'label'
2
+
3
+ module Tgui
4
+ class RichTextLabel < Label
5
+ end
6
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '../convention/widget_like'
2
+ require_relative 'panel'
3
+ require_relative 'scrollbar'
4
+
5
+ module Tgui
6
+ class ScrollablePanel < Panel
7
+
8
+ abi_attr :content_size, Vector2f
9
+ abi_def :content_offset, :get_, nil => Vector2f
10
+ abi_def :scrollbar_width, :get_, nil => Float
11
+ abi_enum Tgui::Scrollbar::Policy
12
+
13
+ class Scrollbar < WidgetLike
14
+
15
+ def policy=(policy)
16
+ host.send("_abi_set_#{id}_scrollbar_policy", host.abi_pack(Tgui::Scrollbar::Policy, policy))
17
+ end
18
+
19
+ def policy
20
+ host.abi_unpack(Tgui::Scrollbar::Policy, host.send("_abi_get_#{id}_scrollbar_policy"))
21
+ end
22
+
23
+ def amount=(amount)
24
+ host.send("_abi_set_#{id}_scroll_amount", host.abi_pack_integer(amount))
25
+ end
26
+
27
+ def amount
28
+ host.abi_unpack_integer(host.send("_abi_get_#{id}_scroll_amount"))
29
+ end
30
+
31
+ def value=(value)
32
+ host.send("_abi_set_#{id}_scrollbar_value", host.abi_pack_integer(value))
33
+ end
34
+
35
+ def value
36
+ host.abi_unpack_integer(host.send("_abi_get_#{id}_scrollbar_value"))
37
+ end
38
+
39
+ def shown?
40
+ host.abi_unpack_bool(host.send("_abi_is_#{id}_scrollbar_shown"))
41
+ end
42
+ end
43
+
44
+ def horizontal_scrollbar
45
+ Scrollbar.new self, :horizontal
46
+ end
47
+
48
+ def vertical_scrollbar
49
+ Scrollbar.new self, :vertical
50
+ end
51
+
52
+ end
53
+ end
@@ -0,0 +1,28 @@
1
+ require_relative 'widget'
2
+ require_relative 'signal/signal_u_int'
3
+
4
+ module Tgui
5
+ class Scrollbar < Widget
6
+
7
+ abi_enum "Policy", :auto, :always, :never
8
+
9
+ abi_attr :max, Integer, :maximum
10
+ abi_attr :value, Integer
11
+ abi_attr :viewport_size, Integer
12
+ abi_attr :speed, Integer, :scroll_amount
13
+ abi_attr :auto_hide?
14
+ abi_attr :vertical?, Boolean, :vertical_scroll
15
+
16
+ def horizontal=(horizontal)
17
+ self.vertical = !horizontal
18
+ end
19
+
20
+ def horizontal?
21
+ !vertical?
22
+ end
23
+
24
+ abi_def :default_width, :get_, nil => Float
25
+ abi_signal :on_value_change, SignalUInt
26
+
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'clickable_widget'
2
+
3
+ module Tgui
4
+ class SeparatorLine < ClickableWidget
5
+ end
6
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'signal'
2
+
3
+ module Tgui
4
+ class GlobalSignal < Signal
5
+
6
+
7
+ def block_caller &b
8
+ Fiddle::Closure::BlockCaller.new(0, [0]) do
9
+ @widget.page.upon! @widget do
10
+ b.(@widget)
11
+ end
12
+ end
13
+ end
14
+
15
+ def block_caller &b
16
+ Fiddle::Closure::BlockCaller.new(0, [0], &b)
17
+ end
18
+
19
+ def connect &b
20
+ @block_caller = self.block_caller &b
21
+ id = _abi_connect(@block_caller)
22
+ @@global_callback_storage[id] = self
23
+ return id
24
+ end
25
+
26
+ def disconnect id
27
+ success = _abi_disconnect(id)
28
+ @@global_callback_storage.delete(id) if success
29
+ return success
30
+ end
31
+
32
+ end
33
+ end