white_gold 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/ext/dll/tgui.dll +0 -0
  3. data/ext/so/libtgui.so +0 -0
  4. data/lib/white_gold/abi/enum.rb +1 -1
  5. data/lib/white_gold/abi/extern_object.rb +2 -2
  6. data/lib/white_gold/abi/interface/interface.rb +3 -7
  7. data/lib/white_gold/convention/container_widgets.rb +47 -87
  8. data/lib/white_gold/convention/page.rb +18 -8
  9. data/lib/white_gold/convention/theme/boolean_attribute.rb +11 -9
  10. data/lib/white_gold/convention/theme/color_attribute.rb +11 -9
  11. data/lib/white_gold/convention/theme/float_attribute.rb +11 -9
  12. data/lib/white_gold/convention/theme/outline_attribute.rb +11 -9
  13. data/lib/white_gold/convention/theme/text_styles_attribute.rb +14 -12
  14. data/lib/white_gold/convention/theme/texture_attribute.rb +14 -12
  15. data/lib/white_gold/convention/theme/theme_attributed.rb +2 -2
  16. data/lib/white_gold/convention/theme/theme_component.rb +2 -2
  17. data/lib/white_gold/convention/theme_attributes.rb +6 -2
  18. data/lib/white_gold/convention/widget/keyboard_control.rb +30 -0
  19. data/lib/white_gold/convention/widget_class_aliases.rb +24 -0
  20. data/lib/white_gold/convention/widget_like.rb +1 -4
  21. data/lib/white_gold/dsl/backend_gui.rb +5 -4
  22. data/lib/white_gold/dsl/canvas.rb +5 -5
  23. data/lib/white_gold/dsl/chat_box.rb +1 -1
  24. data/lib/white_gold/dsl/child_window.rb +2 -2
  25. data/lib/white_gold/dsl/color.rb +39 -29
  26. data/lib/white_gold/dsl/combo_box.rb +2 -2
  27. data/lib/white_gold/dsl/container.rb +1 -1
  28. data/lib/white_gold/dsl/custom_widget.rb +28 -0
  29. data/lib/white_gold/dsl/edit_box.rb +1 -2
  30. data/lib/white_gold/dsl/font.rb +4 -0
  31. data/lib/white_gold/dsl/grid.rb +34 -10
  32. data/lib/white_gold/dsl/gui.rb +14 -1
  33. data/lib/white_gold/dsl/label.rb +3 -2
  34. data/lib/white_gold/dsl/list_box.rb +2 -2
  35. data/lib/white_gold/dsl/list_view.rb +12 -12
  36. data/lib/white_gold/dsl/menu_bar.rb +4 -4
  37. data/lib/white_gold/dsl/message_box.rb +3 -3
  38. data/lib/white_gold/dsl/outline.rb +4 -0
  39. data/lib/white_gold/dsl/panel.rb +8 -0
  40. data/lib/white_gold/dsl/panel_list_box.rb +12 -3
  41. data/lib/white_gold/dsl/picture.rb +0 -2
  42. data/lib/white_gold/dsl/radio_button.rb +16 -3
  43. data/lib/white_gold/dsl/scrollable_panel.rb +7 -0
  44. data/lib/white_gold/dsl/sfml/circle_shape.rb +4 -0
  45. data/lib/white_gold/dsl/sfml/convex_shape.rb +4 -0
  46. data/lib/white_gold/dsl/sfml/rectangle_shape.rb +4 -0
  47. data/lib/white_gold/dsl/sfml/shape.rb +3 -2
  48. data/lib/white_gold/dsl/sfml/text.rb +7 -1
  49. data/lib/white_gold/dsl/signal/global_signal.rb +1 -1
  50. data/lib/white_gold/dsl/signal/signal.rb +1 -1
  51. data/lib/white_gold/dsl/signal/signal_animation_type.rb +1 -1
  52. data/lib/white_gold/dsl/signal/signal_bool.rb +4 -4
  53. data/lib/white_gold/dsl/signal/signal_color.rb +1 -1
  54. data/lib/white_gold/dsl/signal/signal_float.rb +1 -1
  55. data/lib/white_gold/dsl/signal/signal_int.rb +1 -1
  56. data/lib/white_gold/dsl/signal/signal_pointer.rb +1 -1
  57. data/lib/white_gold/dsl/signal/signal_range.rb +1 -1
  58. data/lib/white_gold/dsl/signal/signal_show_effect.rb +1 -1
  59. data/lib/white_gold/dsl/signal/signal_string.rb +1 -1
  60. data/lib/white_gold/dsl/signal/signal_u_int.rb +1 -1
  61. data/lib/white_gold/dsl/signal/signal_vector2f.rb +1 -1
  62. data/lib/white_gold/dsl/tab_container.rb +2 -2
  63. data/lib/white_gold/dsl/tabs.rb +2 -2
  64. data/lib/white_gold/dsl/texture.rb +6 -1
  65. data/lib/white_gold/dsl/theme.rb +3 -4
  66. data/lib/white_gold/dsl/toggle_button.rb +3 -0
  67. data/lib/white_gold/dsl/tree_view.rb +2 -2
  68. data/lib/white_gold/dsl/util.rb +3 -1
  69. data/lib/white_gold/dsl/widget.rb +59 -27
  70. data/lib/white_gold/dsl/window.rb +12 -2
  71. data/lib/white_gold/generated/tgui-abi-loader.gf.rb +106 -15
  72. data/lib/white_gold/library/theme/light.rb +8 -1
  73. data/lib/white_gold/master.rb +77 -44
  74. data/lib/white_gold/path/array.path.rb +9 -0
  75. data/lib/white_gold/path/object.path.rb +0 -6
  76. data/lib/white_gold/tgui-abi.rb +36 -31
  77. data/lib/white_gold/version.rb +1 -1
  78. data/lib/white_gold.rb +8 -6
  79. metadata +37 -9
  80. data/lib/white_gold/abi/reducer.rb +0 -12
  81. data/lib/white_gold/convention/bang_def.rb +0 -5
  82. data/lib/white_gold/convention/bang_nest.rb +0 -26
  83. data/lib/white_gold/convention/bang_nested_caller.rb +0 -48
  84. data/lib/white_gold/convention/proc_method_factory.rb +0 -22
@@ -1,11 +1,11 @@
1
1
  require_relative '../abi/extern_object'
2
- require_relative '../convention/bang_nest'
2
+ require_relative 'signal/signal_bool'
3
3
  require_relative 'signal/global_signal'
4
4
  require_relative 'font'
5
5
 
6
6
  module Tgui
7
7
  class BackendGui < ExternObject
8
- include BangNest
8
+ include Extree
9
9
 
10
10
  class ViewSignal < GlobalSignal
11
11
  def block_caller &b
@@ -21,8 +21,7 @@ module Tgui
21
21
  abi_def :viewport=, :set_absolute_, [Integer] * 4 => nil
22
22
  abi_def :viewport, :get_, nil => [Float] * 4
23
23
  abi_def :relative_viewport=, [Float] * 4 => nil
24
- abi_def :tab_focus_pass?, :is_tab_key_usage_enabled, nil => Boolean
25
- abi_def :tab_focus_pass=, :tab_key_usage_enabled, Boolean => nil
24
+ abi_attr :tab_focus_enabled?, Boolean, :tab_key_usage_enabled
26
25
  abi_attr :font, Font
27
26
  abi_def :unfocus, :unfocus_all_widgets
28
27
  abi_attr :opacity, Float
@@ -33,6 +32,8 @@ module Tgui
33
32
  abi_def :crd_to_px, :map_coords_to_pixel, [Float, Float] => [Float, Float]
34
33
  abi_attr :keyboard_navigation?, Boolean, :keyboard_navigation_enabled
35
34
  abi_signal :on_view_change, ViewSignal
35
+ abi_signal :on_focus, Signal, :on_window_focus
36
+ abi_signal :on_unfocus, Signal, :on_window_unfocus
36
37
 
37
38
  end
38
39
  end
@@ -10,29 +10,29 @@ module Tgui
10
10
  end
11
11
 
12
12
  def! :rectangle do |**na, &b|
13
- shape = RectangleShape.new.send! **na, &b
13
+ shape = scope! RectangleShape.new, **na, &b
14
14
  host._abi_draw shape
15
15
  end
16
16
 
17
17
  def! :circle do |**na, &b|
18
- shape = CircleShape.new.send! **na, &b
18
+ shape = scope! CircleShape.new, **na, &b
19
19
  host._abi_draw shape
20
20
  end
21
21
 
22
22
  def! :convex do |**na, &b|
23
- shape = ConvexShape.new.send! **na, &b
23
+ shape = scope! ConvexShape.new, **na, &b
24
24
  host._abi_draw shape
25
25
  end
26
26
 
27
27
  def! :text do |**na, &b|
28
- text = Text.new.send! **na, &b
28
+ text = scope! Text.new, **na, &b
29
29
  host._abi_draw text
30
30
  end
31
31
 
32
32
  end
33
33
 
34
34
  def! :draw do |&b|
35
- Draw.new(self, nil).send! &b
35
+ scope! Draw.new(self, nil), &b
36
36
  _abi_display
37
37
  end
38
38
 
@@ -44,7 +44,7 @@ module Tgui
44
44
  _abi_add_line abi_pack_string(text), abi_pack(Color, color), abi_pack(TextStyles, *style)
45
45
  line = Line.new self, objects.size
46
46
  objects << object
47
- line.send! **na, &b
47
+ scope! line, **na, &b
48
48
  end
49
49
 
50
50
  def [](index)
@@ -28,7 +28,7 @@ module Tgui
28
28
  class SignalClosing < Tgui::Signal
29
29
  def block_caller &b
30
30
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |ptr|
31
- @widget.send! do
31
+ @widget.host! do
32
32
  b.(ptr, @widget)
33
33
  end
34
34
  end
@@ -47,7 +47,7 @@ module Tgui
47
47
  abi_attr :title_buttons, TitleButtons
48
48
  abi_attr :resizable?
49
49
  abi_attr :position_locked?
50
- abi_attr :keep_in_parent?
50
+ abi_attr :keep_in_parent?, Boolean, :get_
51
51
 
52
52
  def close destroy = false
53
53
  if destroy
@@ -8,40 +8,50 @@ module Tgui
8
8
  green: [0, 200, 0, 255],
9
9
  blue: [0, 0, 200, 255],
10
10
  yellow: [200, 200, 0, 255],
11
- white: [200, 200, 200, 255],
12
- black: [0, 0, 0, 255]
11
+ white: [255, 255, 255, 255],
12
+ black: [0, 0, 0, 255],
13
+ gray: [100, 100, 100, 255],
14
+ transparent: [255, 255, 255, 0]
13
15
  }
14
16
 
15
- def self.from *arg
16
- case arg.size
17
- when 1
18
- arg = arg.first
19
- case arg
20
- when Color
21
- return arg
22
- when String
23
- r, g, b, a = *tones_from_string(arg)
24
- when :random
25
- r, g, b = 5.times.map{ rand 255 }
26
- a = 255
27
- when Symbol
28
- r, g, b, a = *PREDEFINED_COLORS[arg]
29
- when Numeric
30
- r = g = b = arg
17
+ class << self
18
+ def finalizer pointer
19
+ _abi_delete pointer
20
+ end
21
+
22
+ def from *arg
23
+ case arg.size
24
+ when 1
25
+ arg = arg.first
26
+ case arg
27
+ when Color
28
+ return arg
29
+ when String
30
+ r, g, b, a = *tones_from_string(arg)
31
+ when :random
32
+ r, g, b = 5.times.map{ rand 255 }
33
+ a = 255
34
+ when Symbol
35
+ r, g, b, a = *PREDEFINED_COLORS[arg]
36
+ when Numeric
37
+ r = g = b = arg
38
+ a = 255
39
+ else raise "Unsupported argument #{arg} #{arg.class}"
40
+ end
41
+ when 2
42
+ r = g = b = arg[0]
43
+ a = arg[1]
44
+ when 3
45
+ r, g, b = *arg
31
46
  a = 255
32
- else raise "Unsupported argument #{arg} #{arg.class}"
47
+ when 4
48
+ r, g, b, a = *arg
49
+ else raise "Unsupported argument #{arg}"
33
50
  end
34
- when 2
35
- r = g = b = arg[0]
36
- a = arg[1]
37
- when 3
38
- r, g, b = *arg
39
- a = 255
40
- when 4
41
- r, g, b, a = *arg
42
- else raise "Unsupported argument #{arg}"
51
+ Color.new r, g, b, a
43
52
  end
44
- Color.new r, g, b, a
53
+
54
+ alias_method :[], :from
45
55
  end
46
56
 
47
57
  abi_def :red, :get_, nil => Integer
@@ -37,7 +37,7 @@ module Tgui
37
37
  def block_caller &b
38
38
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP]) do |str1, str2|
39
39
  id = @widget.abi_unpack_string(str2)
40
- @widget.send! do
40
+ @widget.host! do
41
41
  b.(@widget.self_get_object_by_id(id), @widget)
42
42
  end
43
43
  end
@@ -99,7 +99,7 @@ module Tgui
99
99
  _abi_add_item abi_pack_string(text), abi_pack_string(id)
100
100
  item = Item.new self, id
101
101
  self_objects[id] = object
102
- item.send! **na, &b
102
+ scope! item, **na, &b
103
103
  end
104
104
 
105
105
  def selected
@@ -12,7 +12,7 @@ module Tgui
12
12
  return widgets
13
13
  end
14
14
 
15
- abi_def :add, [Object, String] => nil
15
+ abi_def :self_add, :add, [Object, String] => nil
16
16
  abi_def :remove_all
17
17
  abi_def :inner_size, :get_, nil => Vector2f
18
18
  abi_def :child_offset, :get_, nil => Vector2f
@@ -0,0 +1,28 @@
1
+ require_relative 'widget'
2
+
3
+ module Tgui
4
+ class CustomWidget < Widget
5
+
6
+ api_attr :callbacks do
7
+ {}
8
+ end
9
+
10
+ def self_key_press=(value)
11
+ block_caller = Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT], &value)
12
+ _abi_impl_key_pressed block_caller
13
+ self.callbacks[:self_key_press] = block_caller
14
+ end
15
+
16
+ def self_can_gain_focus=(value)
17
+ block_caller = Fiddle::Closure::BlockCaller.new(Fiddle::TYPE_INT, [0], &value)
18
+ _abi_impl_can_gain_focus block_caller
19
+ self.callbacks[:self_can_gain_focus] = block_caller
20
+ end
21
+
22
+ def self_focus_changed=(value)
23
+ block_caller = Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT], &value)
24
+ _abi_impl_focus_changed block_caller
25
+ self.callbacks[:self_focus_changed] = block_caller
26
+ end
27
+ end
28
+ end
@@ -51,8 +51,7 @@ module Tgui
51
51
  abi_def :selected_text, :get_, nil => String
52
52
  abi_attr :password_character, String
53
53
  abi_attr :characters_limit, Integer, :maximum_characters
54
- abi_def :limited_text_width=, :limit_text_width, Boolean => nil
55
- abi_def :limited_text_width?, :is_text_width_limited, nil => Boolean
54
+ abi_attr :text_width_limited?, Boolean, :get_
56
55
  abi_attr :read_only?
57
56
  abi_attr :caret_position, Integer
58
57
  abi_attr :suffix, String
@@ -3,6 +3,10 @@ require_relative '../abi/extern_object'
3
3
  module Tgui
4
4
  class Font < ExternObject
5
5
 
6
+ def self.finalizer pointer
7
+ _abi_delete pointer
8
+ end
9
+
6
10
  def self.from *arg
7
11
  case arg.size
8
12
  when 1
@@ -27,23 +27,47 @@ module Tgui
27
27
  abi_unpack(Outline, _abi_get_widget_padding(w))
28
28
  end
29
29
 
30
- abi_enum "Alignment", :center, :upper_left, :up, :upper_right, :right, :bottom_right, :bottom, :bottom_left, :left,
31
- top_left: :upper_left, left_top: :upper_left,
32
- top_right: :upper_right, right_top: :upper_right,
33
- right_bottom: :bottom_right, left_bottom: :bottom_left
30
+ abi_enum "Alignment", :center, :top_left, :top, :top_right, :right, :bottom_right, :bottom, :bottom_left, :left,
31
+ left_top: :top_left, right_top: :upper_right, right_bottom: :bottom_right, left_bottom: :bottom_left
32
+
33
+ abi_packer Alignment do |*arg|
34
+ case arg.size
35
+ when 1
36
+ o = arg.first
37
+ when 2
38
+ a = case arg[0]
39
+ when :begin then :left
40
+ when :end then :right
41
+ else arg[0]
42
+ end
43
+ b = case arg[1]
44
+ when :begin then :top
45
+ when :end then :bottom
46
+ else arg[1]
47
+ end
48
+ o = if a == :center && b == :center
49
+ :center
50
+ elsif a == :center
51
+ b
52
+ elsif b == :center
53
+ a
54
+ else
55
+ "#{a}_#{b}".to_sym
56
+ end
57
+ else raise "Unsupported argument #{arg}"
58
+ end
59
+ Alignment.sym_to_i o
60
+ end
34
61
 
35
62
  api_child :alignment= do |w, alignment|
36
- _abi_set_widget_alignment w, abi_pack(Alignment, alignment)
63
+ p abi_pack(Alignment, *alignment)
64
+ _abi_set_widget_alignment w, abi_pack(Alignment, *alignment)
37
65
  end
38
66
 
39
67
  api_child :alignment do |w|
40
68
  abi_unpack(Alignment, _abi_get_widget_alignment(w))
41
69
  end
42
70
 
43
- api_child :alignment do |w|
44
- Alignment[_abi_get_widget_alignment]
45
- end
46
-
47
71
  api_child :cell= do |w, cell|
48
72
  _abi_set_widget_cell w, abi_pack_integer(cell[0]), abi_pack_integer(cell[1])
49
73
  end
@@ -82,7 +106,7 @@ module Tgui
82
106
  return widgets
83
107
  end
84
108
 
85
- def add widget, id
109
+ def self_add widget, id
86
110
  super
87
111
  _abi_set_widget_cell abi_pack(Widget, widget), *cell
88
112
  _abi_set_widget_alignment abi_pack(Widget, widget), abi_pack(Alignment, alignment) if alignment
@@ -4,13 +4,26 @@ require_relative 'signal/signal'
4
4
  module Tgui
5
5
  class Gui < BackendGui
6
6
 
7
+ def self.finalizer(pointer)
8
+ _abi_delete pointer
9
+ end
10
+
7
11
  abi_def :self_add, :add, [Object, String] => nil
8
12
  abi_def :self_remove, :remove, [Object] => nil
9
13
  abi_def :self_active?, :is_active, nil => Boolean
10
14
  abi_def :self_poll_events, :poll_events
11
15
  abi_def :self_draw, :draw
12
- abi_def :clear_color=, Color => nil
16
+ abi_def :background_color=, :set_clear_color, Color => nil
13
17
  abi_attr :clipboard, String
18
+ abi_def :screen_size, :get_, nil => Vector2i
19
+
20
+ attr_accessor :page
21
+
22
+ def! :messagebox do |*a, **na, &b|
23
+ messagebox = MessageBox.new
24
+ @page.send! :add, messagebox
25
+ @page.scope! messagebox, *a, **na, &b
26
+ end
14
27
 
15
28
  end
16
29
  end
@@ -22,10 +22,11 @@ module Tgui
22
22
  abi_attr :scrollbar_value, Integer
23
23
  abi_attr :auto_size?, Boolean, :get_
24
24
  abi_attr :max_width, Integer, :maximum_text_width
25
- abi_def :ignore_mouse_events, Boolean => nil
26
- abi_def :ignore_mouse_events?, :ignoring_mouse_events, nil => Boolean
27
25
  abi_enum "HorizontalAlignment", :left, :center, :right
28
26
  abi_attr :horizontal_alignment, HorizontalAlignment
27
+ def alignment=(a)
28
+ self.horizontal_alignment = a
29
+ end
29
30
  abi_enum "VerticalAlignment", :top, :center, :bottom
30
31
  abi_attr :vertical_alignment, VerticalAlignment
31
32
  abi_enum Scrollbar::Policy
@@ -29,7 +29,7 @@ module Tgui
29
29
  def block_caller &b
30
30
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP]) do |str1, str2|
31
31
  id = @widget.abi_unpack_string(str2)
32
- @widget.send! do
32
+ @widget.host! do
33
33
  b.(@widget.self_get_object_by_id(id), @widget)
34
34
  end
35
35
  end
@@ -80,7 +80,7 @@ module Tgui
80
80
  _abi_add_item abi_pack_string(text), abi_pack_string(id)
81
81
  item = Item.new self, id
82
82
  na[:object] ||= object
83
- item.send! **na, &b
83
+ scope! item, **na, &b
84
84
  end
85
85
 
86
86
  def remove_all
@@ -31,7 +31,7 @@ module Tgui
31
31
  class ListViewItemSignal < Tgui::SignalInt
32
32
  def block_caller &b
33
33
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |index|
34
- @widget.send! do
34
+ @widget.host! do
35
35
  b.(@widget.self_objects[index], @widget)
36
36
  end
37
37
  end
@@ -41,7 +41,7 @@ module Tgui
41
41
  class ListViewColumnSignal < Tgui::SignalInt
42
42
  def block_caller &b
43
43
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |index|
44
- @widget.send! do
44
+ @widget.host! do
45
45
  b.(@widget.columns[index], @widget)
46
46
  end
47
47
  end
@@ -93,14 +93,14 @@ module Tgui
93
93
  index = _abi_add_column
94
94
  column = Column.new self, index
95
95
  columns << column
96
- column.send! **na, &b
96
+ scope! column, **na, &b
97
97
  end
98
98
 
99
99
  def! :item do |object, **na, &b|
100
100
  self_add_object object, na[:index]
101
101
  item = Item.new self, object
102
102
  na.delete :index
103
- item.send! **na, &b
103
+ scope! item, **na, &b
104
104
  end
105
105
 
106
106
  def items=(items)
@@ -173,17 +173,17 @@ module Tgui
173
173
 
174
174
  def! :grid_lines do | **na, &b|
175
175
  lines = GridLines.new self
176
- lines.send! **na, &b
176
+ scope! lines, **na, &b
177
177
  end
178
178
 
179
179
  def grid_lines=(grid_lines)
180
180
  case grid_lines
181
181
  when Numeric
182
- api_bang_grid_lines width: grid_lines
182
+ send! :grid_lines, width: grid_lines
183
183
  when false
184
- api_bang_grid_lines horizontal: false, vertical: false
184
+ send! :grid_lines, horizontal: false, vertical: false
185
185
  when Hash
186
- api_bang_grid_lines **grid_lines
186
+ send! :grid_lines, **grid_lines
187
187
  end
188
188
  end
189
189
 
@@ -199,17 +199,17 @@ module Tgui
199
199
 
200
200
  def! :header do |**na, &b|
201
201
  header = Header.new self
202
- header.send! **na, &b
202
+ scope! header, **na, &b
203
203
  end
204
204
 
205
205
  def header=(header)
206
206
  case header
207
207
  when true, false
208
- api_bang_header visible: header
208
+ send! :header, visible: header
209
209
  when Hash
210
- api_bang_header **header
210
+ send! :header, **header
211
211
  when Proc
212
- api_bang_header &header
212
+ send! :header, &header
213
213
  end
214
214
  end
215
215
 
@@ -30,7 +30,7 @@ module Tgui
30
30
 
31
31
  def connect &b
32
32
  on_press = Fiddle::Closure::BlockCaller.new(0, [0]) do
33
- @menu_bar.send! do
33
+ @menu_bar.host! do
34
34
  b.(@path.last, @path, @menu_bar)
35
35
  end
36
36
  end
@@ -57,7 +57,7 @@ module Tgui
57
57
  end
58
58
  SignalItemHierarchy.fetch_path vector, loader
59
59
  object_path = @widget.self_object_path path
60
- @widget.send! do
60
+ @widget.host! do
61
61
  b.(object_path.last, object_path, @widget)
62
62
  end
63
63
  end
@@ -79,7 +79,7 @@ module Tgui
79
79
  host._abi_add_menu_item _1, _2
80
80
  end
81
81
  item = Item.new host, item_path
82
- item.send! **na, &b
82
+ scope! item, **na, &b
83
83
  end
84
84
 
85
85
  def! :separator do
@@ -165,7 +165,7 @@ module Tgui
165
165
  self_tree[object, grow: true].text = text
166
166
  _abi_add_menu abi_pack_string(text)
167
167
  item = Menu.new self, object
168
- item.send! **na, &b
168
+ scope! item, **na, &b
169
169
  end
170
170
 
171
171
  def items=(items)
@@ -37,7 +37,7 @@ module Tgui
37
37
  end
38
38
 
39
39
  def press_signal_execute
40
- host.send! do
40
+ host.host! do
41
41
  @on_press_callbacks.each do |c|
42
42
  c.(id, self, host)
43
43
  end
@@ -52,7 +52,7 @@ module Tgui
52
52
  _abi_add_button abi_pack_string(text)
53
53
  button = Button.new self, object
54
54
  self_buttons[text] = button
55
- button.send! **na, &b
55
+ scope! button, **na, &b
56
56
  end
57
57
 
58
58
  def [](object)
@@ -73,7 +73,7 @@ module Tgui
73
73
  self_buttons[text] = button
74
74
  text
75
75
  end
76
- self_change_buttons names
76
+ self_change_buttons *names
77
77
  end
78
78
 
79
79
  def buttons
@@ -3,6 +3,10 @@ require_relative '../abi/extern_object'
3
3
  module Tgui
4
4
  class Outline < ExternObject
5
5
 
6
+ def self.finalizer pointer
7
+ _abi_delete pointer
8
+ end
9
+
6
10
  def self.from *arg
7
11
  case arg.size
8
12
  when 1
@@ -4,6 +4,14 @@ require_relative 'signal/signal_vector2f'
4
4
  module Tgui
5
5
  class Panel < Group
6
6
 
7
+ class Theme < Group::Theme
8
+ theme_attr :borders, :outline
9
+ theme_attr :border_color, :color
10
+ theme_attr :background_color, :color
11
+ theme_attr :texture_background, :texture
12
+ theme_attr :rounded_border_radius, :float
13
+ end
14
+
7
15
  abi_signal :on_mouse_press, SignalVector2f
8
16
  abi_signal :on_mouse_release, SignalVector2f
9
17
  abi_signal :on_click, SignalVector2f
@@ -5,10 +5,19 @@ require_relative 'signal/signal_panel_list_box_item'
5
5
  module Tgui
6
6
  class PanelListBox < ScrollablePanel
7
7
 
8
+ class Theme < ScrollablePanel::Theme
9
+
10
+ theme_attr :items_background_color, :color
11
+ theme_attr :items_background_color_hover, :color
12
+ theme_attr :selected_items_background_color, :color
13
+ theme_attr :selected_items_background_color_hover, :color
14
+
15
+ end
16
+
8
17
  class SignalPanelListBoxItem < Tgui::SignalPanelListBoxItem
9
18
  def block_caller &b
10
19
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |id|
11
- @widget.send! do
20
+ @widget.host! do
12
21
  b.(@widget.self_objects.key(@widget.abi_unpack_string(id)), @widget)
13
22
  end
14
23
  end
@@ -22,7 +31,7 @@ module Tgui
22
31
  panel = Panel.new pointer: _abi_add_item(id, abi_pack_integer(index))
23
32
  panel.page = page
24
33
  self_objects[object] = id
25
- panel.send! **na, &b
34
+ scope! panel, **na, &b
26
35
  end
27
36
 
28
37
  def [](object)
@@ -71,7 +80,7 @@ module Tgui
71
80
  def! :template do |**na, &b|
72
81
  panel = Panel.new(pointer: _abi_get_panel_template)
73
82
  panel.page = page
74
- panel.send! **na, &b
83
+ scope! panel, **na, &b
75
84
  end
76
85
 
77
86
  # internal
@@ -4,8 +4,6 @@ require_relative 'signal/signal_vector2f'
4
4
  module Tgui
5
5
  class Picture < ClickableWidget
6
6
 
7
- abi_def :ignore_mouse, :ignore_mouse_events, Boolean => nil
8
- abi_def :ignore_mouse?, :is_ignoring_mouse_events, nil => Boolean
9
7
  abi_signal :on_double_click, SignalVector2f
10
8
 
11
9
  end
@@ -28,16 +28,29 @@ module Tgui
28
28
  theme_attr :text_style, :text_styles
29
29
  theme_attr :text_style_checked, :text_styles
30
30
  end
31
+
32
+ api_attr :format do
33
+ :to_s
34
+ end
31
35
 
32
36
  abi_attr :checked?
33
37
  abi_attr :text, String
34
38
  abi_attr :text_clickable?
35
39
  abi_signal :on_check, Signal
36
40
  abi_signal :on_uncheck, Signal
37
- abi_signal :on_change, SignalBoolean
38
- api_attr :object do
41
+ abi_signal :on_change, SignalBool
42
+
43
+ def object
44
+ self_object
45
+ end
46
+
47
+ def object=(object)
48
+ self.self_object = object
49
+ self.text = object.then(&format)
50
+ end
51
+
52
+ api_attr :self_object do
39
53
  nil
40
54
  end
41
-
42
55
  end
43
56
  end
@@ -5,6 +5,13 @@ require_relative 'scrollbar'
5
5
  module Tgui
6
6
  class ScrollablePanel < Panel
7
7
 
8
+ class Theme < Panel::Theme
9
+
10
+ theme_comp :scrollbar, Tgui::Scrollbar::Theme
11
+ theme_attr :scrollbar_width, :float
12
+
13
+ end
14
+
8
15
  abi_attr :content_size, Vector2f
9
16
  abi_def :content_offset, :get_, nil => Vector2f
10
17
  abi_def :scrollbar_width, :get_, nil => Float
@@ -3,5 +3,9 @@ require_relative 'shape'
3
3
  module Tgui
4
4
  class CircleShape < Shape
5
5
  abi_attr :radius, Float
6
+
7
+ def self.finalizer pointer
8
+ _abi_delete pointer
9
+ end
6
10
  end
7
11
  end
@@ -11,5 +11,9 @@ module Tgui
11
11
  _abi_set_point @point_count, *abi_pack(Vector2f, x, y)
12
12
  @point_count += 1
13
13
  end
14
+
15
+ def self.finalizer pointer
16
+ _abi_delete pointer
17
+ end
14
18
  end
15
19
  end