white_gold 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) 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 +0 -8
  5. data/lib/white_gold/abi/extern_object.rb +6 -1
  6. data/lib/white_gold/abi/unpacker.rb +4 -2
  7. data/lib/white_gold/convention/bang_nest.rb +12 -2
  8. data/lib/white_gold/convention/bang_nested_caller.rb +34 -34
  9. data/lib/white_gold/convention/container_widgets.rb +53 -51
  10. data/lib/white_gold/convention/page.rb +22 -4
  11. data/lib/white_gold/{dsl → convention}/theme/color_attribute.rb +2 -0
  12. data/lib/white_gold/{dsl → convention}/theme/outline_attribute.rb +2 -0
  13. data/lib/white_gold/convention/theme/text_styles_attribute.rb +18 -0
  14. data/lib/white_gold/{dsl → convention}/theme/texture_attribute.rb +2 -0
  15. data/lib/white_gold/{dsl → convention}/theme/theme_attributed.rb +4 -18
  16. data/lib/white_gold/{dsl → convention}/theme/theme_component.rb +14 -3
  17. data/lib/white_gold/convention/theme_attributes.rb +49 -0
  18. data/lib/white_gold/convention/tree_node.rb +43 -0
  19. data/lib/white_gold/convention/widget_like.rb +0 -6
  20. data/lib/white_gold/dsl/backend_gui.rb +1 -0
  21. data/lib/white_gold/dsl/button_base.rb +17 -2
  22. data/lib/white_gold/dsl/canvas.rb +40 -0
  23. data/lib/white_gold/dsl/chat_box.rb +12 -1
  24. data/lib/white_gold/dsl/child_window.rb +22 -1
  25. data/lib/white_gold/dsl/color.rb +5 -2
  26. data/lib/white_gold/dsl/color_picker.rb +9 -0
  27. data/lib/white_gold/dsl/combo_box.rb +30 -2
  28. data/lib/white_gold/dsl/container.rb +17 -11
  29. data/lib/white_gold/dsl/edit_box.rb +29 -0
  30. data/lib/white_gold/dsl/file_dialog.rb +17 -0
  31. data/lib/white_gold/dsl/font.rb +5 -1
  32. data/lib/white_gold/dsl/grid.rb +3 -3
  33. data/lib/white_gold/dsl/group.rb +5 -0
  34. data/lib/white_gold/dsl/knob.rb +10 -0
  35. data/lib/white_gold/dsl/label.rb +14 -0
  36. data/lib/white_gold/dsl/list_box.rb +27 -11
  37. data/lib/white_gold/dsl/list_view.rb +29 -6
  38. data/lib/white_gold/dsl/menu_bar.rb +21 -48
  39. data/lib/white_gold/dsl/message_box.rb +8 -2
  40. data/lib/white_gold/dsl/panel_list_box.rb +3 -3
  41. data/lib/white_gold/dsl/progress_bar.rb +14 -0
  42. data/lib/white_gold/dsl/radio_button.rb +25 -0
  43. data/lib/white_gold/dsl/range_slider.rb +8 -0
  44. data/lib/white_gold/dsl/scrollbar.rb +19 -0
  45. data/lib/white_gold/dsl/separator_line.rb +5 -0
  46. data/lib/white_gold/dsl/sfml/circle_shape.rb +7 -0
  47. data/lib/white_gold/dsl/sfml/convex_shape.rb +15 -0
  48. data/lib/white_gold/dsl/sfml/rectangle_shape.rb +7 -0
  49. data/lib/white_gold/dsl/sfml/shape.rb +19 -0
  50. data/lib/white_gold/dsl/sfml/text.rb +22 -0
  51. data/lib/white_gold/dsl/signal/global_signal.rb +1 -1
  52. data/lib/white_gold/dsl/signal/signal.rb +1 -1
  53. data/lib/white_gold/dsl/signal/signal_animation_type.rb +1 -1
  54. data/lib/white_gold/dsl/signal/signal_bool.rb +1 -1
  55. data/lib/white_gold/dsl/signal/signal_color.rb +1 -1
  56. data/lib/white_gold/dsl/signal/signal_float.rb +1 -1
  57. data/lib/white_gold/dsl/signal/signal_int.rb +1 -1
  58. data/lib/white_gold/dsl/signal/signal_pointer.rb +1 -1
  59. data/lib/white_gold/dsl/signal/signal_range.rb +1 -1
  60. data/lib/white_gold/dsl/signal/signal_show_effect.rb +1 -1
  61. data/lib/white_gold/dsl/signal/signal_string.rb +1 -1
  62. data/lib/white_gold/dsl/signal/signal_u_int.rb +1 -1
  63. data/lib/white_gold/dsl/signal/signal_vector2f.rb +1 -1
  64. data/lib/white_gold/dsl/slider.rb +15 -0
  65. data/lib/white_gold/dsl/spin_button.rb +14 -0
  66. data/lib/white_gold/dsl/tab_container.rb +2 -2
  67. data/lib/white_gold/dsl/tabs.rb +26 -2
  68. data/lib/white_gold/dsl/text_area.rb +16 -0
  69. data/lib/white_gold/dsl/theme.rb +11 -51
  70. data/lib/white_gold/dsl/tree_view.rb +41 -33
  71. data/lib/white_gold/dsl/widget.rb +81 -39
  72. data/lib/white_gold/generated/tgui-abi-loader.gf.rb +197 -47
  73. data/lib/white_gold/library/theme/light.rb +15 -3
  74. data/lib/white_gold/master.rb +21 -40
  75. data/lib/white_gold/path/object.path.rb +0 -11
  76. data/lib/white_gold/tgui-abi.rb +17 -16
  77. data/lib/white_gold/version.rb +3 -0
  78. data/lib/white_gold.rb +29 -28
  79. metadata +26 -39
  80. data/lib/white_gold/dsl/theme/button_theme.rb +0 -19
  81. data/lib/white_gold/dsl/theme/chat_box_theme.rb +0 -16
  82. data/lib/white_gold/dsl/theme/child_window_theme.rb +0 -25
  83. data/lib/white_gold/dsl/theme/color_picker_theme.rb +0 -14
  84. data/lib/white_gold/dsl/theme/combo_box_theme.rb +0 -33
  85. data/lib/white_gold/dsl/theme/common_renderer.rb +0 -7
  86. data/lib/white_gold/dsl/theme/edit_box_theme.rb +0 -34
  87. data/lib/white_gold/dsl/theme/file_dialog_theme.rb +0 -22
  88. data/lib/white_gold/dsl/theme/group_theme.rb +0 -9
  89. data/lib/white_gold/dsl/theme/knob_theme.rb +0 -15
  90. data/lib/white_gold/dsl/theme/label_theme.rb +0 -20
  91. data/lib/white_gold/dsl/theme/list_box_theme.rb +0 -25
  92. data/lib/white_gold/dsl/theme/list_view_theme.rb +0 -27
  93. data/lib/white_gold/dsl/theme/menu_bar_theme.rb +0 -21
  94. data/lib/white_gold/dsl/theme/message_box_theme.rb +0 -11
  95. data/lib/white_gold/dsl/theme/progress_bar_theme.rb +0 -19
  96. data/lib/white_gold/dsl/theme/radio_button_theme.rb +0 -30
  97. data/lib/white_gold/dsl/theme/scrollbar_theme.rb +0 -24
  98. data/lib/white_gold/dsl/theme/separator_line_theme.rb +0 -9
  99. data/lib/white_gold/dsl/theme/slider_theme.rb +0 -20
  100. data/lib/white_gold/dsl/theme/spin_button_theme.rb +0 -19
  101. data/lib/white_gold/dsl/theme/tabs_theme.rb +0 -29
  102. data/lib/white_gold/dsl/theme/text_area_theme.rb +0 -22
  103. data/lib/white_gold/dsl/theme/text_styles_attribute.rb +0 -13
  104. data/lib/white_gold/dsl/theme/tree_view_theme.rb +0 -26
  105. data/lib/white_gold/dsl/theme/widget_theme.rb +0 -12
  106. /data/lib/white_gold/{dsl → convention}/theme/boolean_attribute.rb +0 -0
  107. /data/lib/white_gold/{dsl → convention}/theme/float_attribute.rb +0 -0
  108. /data/lib/white_gold/dsl/{checkbox.rb → check_box.rb} +0 -0
@@ -1,3 +1,4 @@
1
+ require_relative 'child_window'
1
2
  require_relative 'button'
2
3
  require_relative 'signal/signal_string'
3
4
  require_relative '../convention/widget_like'
@@ -5,6 +6,11 @@ require_relative '../convention/widget_like'
5
6
  module Tgui
6
7
  class MessageBox < ChildWindow
7
8
 
9
+ class Theme < ChildWindow::Theme
10
+ theme_attr :text_color, :color
11
+ theme_comp :button, Button::Theme
12
+ end
13
+
8
14
  api_attr :format do
9
15
  :to_s
10
16
  end
@@ -31,7 +37,7 @@ module Tgui
31
37
  end
32
38
 
33
39
  def press_signal_execute
34
- host.page.upon! host do
40
+ host.send! do
35
41
  @on_press_callbacks.each do |c|
36
42
  c.(id, self, host)
37
43
  end
@@ -46,7 +52,7 @@ module Tgui
46
52
  _abi_add_button abi_pack_string(text)
47
53
  button = Button.new self, object
48
54
  self_buttons[text] = button
49
- upon! button, **na, &b
55
+ button.send! **na, &b
50
56
  end
51
57
 
52
58
  def [](object)
@@ -8,7 +8,7 @@ module Tgui
8
8
  class SignalPanelListBoxItem < Tgui::SignalPanelListBoxItem
9
9
  def block_caller &b
10
10
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |id|
11
- @widget.page.upon! @widget do
11
+ @widget.send! do
12
12
  b.(@widget.self_objects.key(@widget.abi_unpack_string(id)), @widget)
13
13
  end
14
14
  end
@@ -22,7 +22,7 @@ module Tgui
22
22
  panel = Panel.new pointer: _abi_add_item(id, abi_pack_integer(index))
23
23
  panel.page = page
24
24
  self_objects[object] = id
25
- upon! panel, **na, &b
25
+ panel.send! **na, &b
26
26
  end
27
27
 
28
28
  def [](object)
@@ -71,7 +71,7 @@ module Tgui
71
71
  def! :template do |**na, &b|
72
72
  panel = Panel.new(pointer: _abi_get_panel_template)
73
73
  panel.page = page
74
- upon! panel, **na, &b
74
+ panel.send! **na, &b
75
75
  end
76
76
 
77
77
  # internal
@@ -5,6 +5,20 @@ require_relative 'signal/signal_u_int'
5
5
  module Tgui
6
6
  class ProgressBar < ClickableWidget
7
7
 
8
+ class Theme < Widget::Theme
9
+ theme_attr :borders, :outline
10
+ theme_attr :text_color, :color
11
+ theme_attr :text_color_filled, :color
12
+ theme_attr :background_color, :color
13
+ theme_attr :fill_color, :color
14
+ theme_attr :border_color, :color
15
+ theme_attr :texture_background, :texture
16
+ theme_attr :texture_fill, :texture
17
+ theme_attr :text_style, :text_styles
18
+ theme_attr :text_outline_color, :color
19
+ theme_attr :text_outline_thickness, :float
20
+ end
21
+
8
22
  abi_enum "FillDirection", :left_to_right, :right_to_left, :top_to_bottom, :bottom_to_top
9
23
  abi_attr :min, Float, :minimum
10
24
  abi_attr :max, Float, :maximum
@@ -3,6 +3,31 @@ require_relative 'signal/signal_bool'
3
3
 
4
4
  module Tgui
5
5
  class RadioButton < ClickableWidget
6
+
7
+ class Theme < Widget::Theme
8
+ theme_attr :borders, :outline
9
+ theme_attr :text_distance_ratio, :float
10
+ [ '', :_hover, :_disabled, :_checked, :_checked_hover, :_checked_disabled ].each do |v|
11
+ theme_attr "text_color#{v}".to_sym, :color
12
+ theme_attr "background_color#{v}".to_sym, :color
13
+ theme_attr "border_color#{v}".to_sym, :color
14
+ end
15
+ theme_attr :border_color_focused, :color
16
+ theme_attr :border_color_checked_focused, :color
17
+ theme_attr :check_color, :color
18
+ theme_attr :check_color_hover, :color
19
+ theme_attr :check_color_disabled, :color
20
+ theme_attr :texture_unchecked, :texture
21
+ theme_attr :texture_unchecked_hover, :texture
22
+ theme_attr :texture_unchecked_disabled, :texture
23
+ theme_attr :texture_unchecked_focused, :texture
24
+ theme_attr :texture_checked, :texture
25
+ theme_attr :texture_checked_hover, :texture
26
+ theme_attr :texture_checked_disabled, :texture
27
+ theme_attr :texture_checked_focused, :texture
28
+ theme_attr :text_style, :text_styles
29
+ theme_attr :text_style_checked, :text_styles
30
+ end
6
31
 
7
32
  abi_attr :checked?
8
33
  abi_attr :text, String
@@ -1,9 +1,17 @@
1
1
  require_relative 'widget'
2
+ require_relative 'slider'
2
3
  require_relative 'signal/signal_range'
3
4
 
4
5
  module Tgui
5
6
  class RangeSlider < Widget
6
7
 
8
+ class Theme < Slider::Theme
9
+ theme_attr :selected_track_color, :color
10
+ theme_attr :selected_track_color_hover, :color
11
+ theme_attr :texture_selected_track, :texture
12
+ theme_attr :texture_selected_track_hover, :texture
13
+ end
14
+
7
15
  abi_attr :min, Float, :minimum
8
16
  abi_attr :max, Float, :maximum
9
17
  abi_attr :selection_start, Float
@@ -4,6 +4,25 @@ require_relative 'signal/signal_u_int'
4
4
  module Tgui
5
5
  class Scrollbar < Widget
6
6
 
7
+ class Theme < Widget::Theme
8
+ theme_attr :track_color, :color
9
+ theme_attr :track_color_hover, :color
10
+ theme_attr :thumb_color, :color
11
+ theme_attr :thumb_color_hover, :color
12
+ theme_attr :arrow_background_color, :color
13
+ theme_attr :arrow_background_color_hover, :color
14
+ theme_attr :arrow_color, :color
15
+ theme_attr :arrow_color_hover, :color
16
+ theme_attr :texture_track, :texture
17
+ theme_attr :texture_track_hover, :texture
18
+ theme_attr :texture_thumb, :texture
19
+ theme_attr :texture_thumb_hover, :texture
20
+ theme_attr :texture_arrow_up, :texture
21
+ theme_attr :texture_arrow_up_hover, :texture
22
+ theme_attr :texture_arrow_down, :texture
23
+ theme_attr :texture_arrow_down_hover, :texture
24
+ end
25
+
7
26
  abi_enum "Policy", :auto, :always, :never
8
27
 
9
28
  abi_attr :max, Integer, :maximum
@@ -2,5 +2,10 @@ require_relative 'clickable_widget'
2
2
 
3
3
  module Tgui
4
4
  class SeparatorLine < ClickableWidget
5
+
6
+ class Theme < Widget::Theme
7
+ theme_attr :color, :color
8
+ end
9
+
5
10
  end
6
11
  end
@@ -0,0 +1,7 @@
1
+ require_relative 'shape'
2
+
3
+ module Tgui
4
+ class CircleShape < Shape
5
+ abi_attr :radius, Float
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'shape'
2
+
3
+ module Tgui
4
+ class ConvexShape < Shape
5
+ def initialized
6
+ @point_count = 0
7
+ end
8
+
9
+ def! :point do |x, y|
10
+ _abi_set_point_count @point_count + 1
11
+ _abi_set_point @point_count, *abi_pack(Vector2f, x, y)
12
+ @point_count += 1
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ require_relative 'shape'
2
+
3
+ module Tgui
4
+ class RectangleShape < Shape
5
+ abi_attr :size, Vector2f
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../../abi/extern_object'
2
+ require_relative '../../convention/bang_nest'
3
+
4
+ module Tgui
5
+ class Shape < ExternObject
6
+ include BangNest
7
+
8
+ abi_attr :texture, Texture
9
+ abi_attr :radius, Float
10
+ abi_attr :point_count, Integer
11
+ abi_attr :color, Color, :fill_color
12
+ abi_attr :border_color, Color, :outline_color
13
+ abi_attr :border, Float, :outline_thickness
14
+ abi_attr :position, Vector2f
15
+ abi_attr :rotation, Float
16
+ abi_attr :scale, Vector2f
17
+ abi_attr :origin, Vector2f
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../../abi/extern_object'
2
+
3
+ module Tgui
4
+ class Text < ExternObject
5
+ include BangNest
6
+
7
+ abi_attr :string, String
8
+ abi_attr :font, Font
9
+ abi_attr :character_size, Integer
10
+ abi_attr :line_spacing, Float
11
+ abi_attr :letter_spacing, Float
12
+ abi_attr :style, TextStyles
13
+ abi_attr :color, Color, :fill_color
14
+ abi_attr :border_color, Color, :outline_color
15
+ abi_attr :border, Float, :outline_thickness
16
+ abi_def :character_position, :find_character_pos, Integer => Vector2f
17
+ abi_attr :position, Vector2f
18
+ abi_attr :rotation, Float
19
+ abi_attr :scale, Vector2f
20
+ abi_attr :origin, Vector2f
21
+ end
22
+ end
@@ -6,7 +6,7 @@ module Tgui
6
6
 
7
7
  def block_caller &b
8
8
  Fiddle::Closure::BlockCaller.new(0, [0]) do
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(@widget)
11
11
  end
12
12
  end
@@ -10,7 +10,7 @@ module Tgui
10
10
 
11
11
  def block_caller &b
12
12
  Fiddle::Closure::BlockCaller.new(0, [0]) do
13
- @widget.page.upon! @widget do
13
+ @widget.send! do
14
14
  b.(@widget)
15
15
  end
16
16
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller
7
7
  block_caller = Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |animation_type|
8
8
  at = @widget.abi_unpack AnimationType, animation_type
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(at, @widget)
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |int|
8
8
  b = @widget.abi_unpack Boolean, int
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(b, @widget)
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |ptr|
8
8
  c = @widget.abi_unpack Color, ptr
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(c, @widget)
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_FLOAT]) do |float|
8
8
  f = @widget.abi_unpack_float float
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(f, @widget)
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |int|
8
8
  i = @widget.abi_unpack_integer int
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(i, @widget)
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Tgui
5
5
 
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |pointer|
8
- @widget.page.upon! @widget do
8
+ @widget.send! do
9
9
  b.(pointer, @widget)
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Tgui
5
5
 
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_FLOAT, Fiddle::TYPE_FLOAT]) do |min, max|
8
- @widget.page.upon! @widget do
8
+ @widget.send! do
9
9
  b.(min..max, @widget)
10
10
  end
11
11
  end
@@ -7,7 +7,7 @@ module Tgui
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT, Fiddle::TYPE_INT]) do |show_effect_type, shown|
8
8
  effect_type = @widget.abi_unpack ShowEffectType, show_effect_type
9
9
  shown = @widget.abi_unpack Boolean, shown
10
- @widget.page.upon! @widget do
10
+ @widget.send! do
11
11
  b.(effect_type, shown, @widget)
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |str|
8
8
  string = @widget.abi_unpack_string(str)
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(string, @widget)
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Tgui
6
6
  def block_caller &b
7
7
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |uint|
8
8
  int = @widget.abi_unpack Integer, uint
9
- @widget.page.upon! @widget do
9
+ @widget.send! do
10
10
  b.(int, @widget)
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Tgui
5
5
  def block_caller &b
6
6
  Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |ptr|
7
7
  vector = @widget.abi_unpack Vector2f, ptr
8
- @widget.page.upon! @widget do
8
+ @widget.send! do
9
9
  b.(vector, @widget)
10
10
  end
11
11
  end
@@ -4,6 +4,21 @@ require_relative 'signal/signal_float'
4
4
  module Tgui
5
5
  class Slider < Widget
6
6
 
7
+ class Theme < Widget::Theme
8
+ theme_attr :borders, :outline
9
+ theme_attr :track_color, :color
10
+ theme_attr :track_color_hover, :color
11
+ theme_attr :thumb_color, :color
12
+ theme_attr :thumb_color_hover, :color
13
+ theme_attr :border_color, :color
14
+ theme_attr :border_color_hover, :color
15
+ theme_attr :texture_track, :texture
16
+ theme_attr :texture_track_hover, :texture
17
+ theme_attr :texture_thumb, :texture
18
+ theme_attr :texture_thumb_hover, :texture
19
+ theme_attr :thumb_within_track, :boolean
20
+ end
21
+
7
22
  abi_attr :min, Float, :minimum
8
23
  abi_attr :max, Float, :maximum
9
24
  abi_attr :value, Float
@@ -4,6 +4,20 @@ require_relative 'signal/signal_float'
4
4
  module Tgui
5
5
  class SpinButton < ClickableWidget
6
6
 
7
+ class Theme < Widget::Theme
8
+ theme_attr :borders, :outline
9
+ theme_attr :border_between_arrows, :float
10
+ theme_attr :background_color, :color
11
+ theme_attr :background_color_hover, :color
12
+ theme_attr :arrow_color, :color
13
+ theme_attr :arrow_color_hover, :color
14
+ theme_attr :border_color, :color
15
+ theme_attr :texture_arrow_up, :texture
16
+ theme_attr :texture_arrow_up_hover, :texture
17
+ theme_attr :texture_arrow_down, :texture
18
+ theme_attr :texture_arrow_down_hover, :texture
19
+ end
20
+
7
21
  abi_attr :min, Float, :minimum
8
22
  abi_attr :max, Float, :maximum
9
23
  abi_attr :value, Float
@@ -75,7 +75,7 @@ module Tgui
75
75
  objects.insert index, object
76
76
  tab_panel = TabPanel.new self, index, panel_pointer
77
77
  tab_panel.page = page
78
- upon! tab_panel, **na, &b
78
+ tab_panel.send! **na, &b
79
79
  end
80
80
 
81
81
  def [](object)
@@ -93,7 +93,7 @@ module Tgui
93
93
  def! :tabs do |**na, &b|
94
94
  tabs = Tabs.new self, _abi_get_tabs
95
95
  tabs.page = page
96
- upon! tabs, **na, &b
96
+ tabs.send! **na, &b
97
97
  end
98
98
 
99
99
  def remove object
@@ -5,6 +5,30 @@ require_relative 'signal/signal'
5
5
  module Tgui
6
6
  class Tabs < Widget
7
7
 
8
+ class Theme < Widget::Theme
9
+ theme_attr :borders, :outline
10
+ theme_attr :background_color, :color
11
+ theme_attr :background_color_hover, :color
12
+ theme_attr :background_color_disabled, :color
13
+ theme_attr :selected_background_color, :color
14
+ theme_attr :selected_background_color_hover, :color
15
+ theme_attr :text_color, :color
16
+ theme_attr :text_color_hover, :color
17
+ theme_attr :text_color_disabled, :color
18
+ theme_attr :selected_text_color, :color
19
+ theme_attr :selected_text_color_hover, :color
20
+ theme_attr :border_color, :color
21
+ theme_attr :border_color_hover, :color
22
+ theme_attr :selected_border_color, :color
23
+ theme_attr :selected_border_color_hover, :color
24
+ theme_attr :texture_tab, :texture
25
+ theme_attr :texture_tab_hover, :texture
26
+ theme_attr :texture_selected_tab, :texture
27
+ theme_attr :texture_selected_tab_hover, :texture
28
+ theme_attr :texture_disabled_tab, :texture
29
+ theme_attr :distance_to_side, :float
30
+ end
31
+
8
32
  class Tab < WidgetLike
9
33
 
10
34
  abi_def :text=, :change_text, id: 0, String => nil
@@ -37,7 +61,7 @@ module Tgui
37
61
  end
38
62
  objects.insert index, object
39
63
  tab = Tab.new self, index
40
- upon! tab, **na, &b
64
+ tab.send! **na, &b
41
65
  end
42
66
 
43
67
  def remove object
@@ -77,7 +101,7 @@ module Tgui
77
101
 
78
102
  def block_caller &b
79
103
  Fiddle::Closure::BlockCaller.new(0, [0]) do
80
- @widget.page.upon! @widget do
104
+ @widget.send! do
81
105
  b.(@widget.selected, @widget)
82
106
  end
83
107
  end
@@ -6,6 +6,22 @@ require_relative 'signal/signal_string'
6
6
  module Tgui
7
7
  class TextArea < Widget
8
8
 
9
+ class Theme < Widget::Theme
10
+ theme_attr :borders, :outline
11
+ theme_attr :padding, :outline
12
+ theme_attr :background_color, :color
13
+ theme_attr :text_color, :color
14
+ theme_attr :default_text_color, :color
15
+ theme_attr :selected_text_color, :color
16
+ theme_attr :selected_text_background_color, :color
17
+ theme_attr :border_color, :color
18
+ theme_attr :caret_color, :color
19
+ theme_attr :texture_background, :texture
20
+ theme_attr :caret_width, :float
21
+ theme_comp :scrollbar, Scrollbar::Theme
22
+ theme_attr :scrollbar_width, :float
23
+ end
24
+
9
25
  abi_attr :text, String
10
26
  abi_def :add_text, String => nil
11
27
  abi_attr :default_text, String
@@ -1,9 +1,7 @@
1
1
  require 'tempfile'
2
2
  require_relative '../abi/extern_object'
3
3
  require_relative '../convention/bang_nest'
4
- Dir.each_child File.dirname(__FILE__) + "/theme" do |filename|
5
- require_relative "theme/#{filename}"
6
- end
4
+ require_relative '../convention/theme/theme_attributed'
7
5
 
8
6
  module Tgui
9
7
  class Theme < ExternObject
@@ -63,59 +61,20 @@ module Tgui
63
61
  self.attributes = {}
64
62
  end
65
63
 
66
- def! :custom do |comp, seed, **na, &b|
64
+ @@debug = false
65
+ def debug=(debug)
66
+ @@debug = debug
67
+ end
68
+
69
+ def! :custom do |type, seed, **na, &b|
67
70
  self.next_renderer_id = renderer_id = next_renderer_id.next
68
- send("#{comp}!", renderer_id, seed, **na, &b)
71
+ attribute = type.new(seed, renderer_id)
72
+ attributes[attribute.name] = attribute
73
+ attribute.send! **na, &b
69
74
  self_commit
70
75
  renderer_id
71
76
  end
72
77
 
73
-
74
- theme_attr :text_color, :color
75
- theme_attr :text_color_hover, :color
76
- theme_attr :text_color_disabled, :color
77
- theme_attr :background_color, :color
78
- theme_attr :background_color_hover, :color
79
- theme_attr :background_color_disabled, :color
80
- theme_attr :selected_text_color, :color
81
- theme_attr :selected_text_color_hover, :color
82
- theme_attr :selected_background_color, :color
83
- theme_attr :selected_background_color_hover, :color
84
- theme_attr :border_color, :color
85
- theme_attr :borders, :outline
86
- theme_attr :scrollbar_width, :float
87
- theme_attr :arrow_background_color, :color
88
- theme_attr :arrow_background_color_hover, :color
89
- theme_attr :arrow_background_color_disabled, :color
90
- theme_attr :arrow_color, :color
91
- theme_attr :arrow_color_hover, :color
92
- theme_attr :arrow_color_disabled, :color
93
-
94
- theme_comp :button, ButtonTheme
95
- theme_comp :chat_box, ChatBoxTheme
96
- theme_comp :child_window, ChildWindowTheme
97
- theme_comp :color_picker, ColorPickerTheme
98
- theme_comp :combobox, ComboBoxTheme, "ComboBox"
99
- theme_comp :editbox, EditBoxTheme, "EditBox"
100
- theme_comp :file_dialog, FileDialogTheme
101
- theme_comp :group, GroupTheme
102
- theme_comp :knob, KnobTheme
103
- theme_comp :label, LabelTheme
104
- theme_comp :listbox, ListBoxTheme, "ListBox"
105
- theme_comp :list_view, ListViewTheme
106
- theme_comp :menu, MenuBarTheme, "MenuBar"
107
- theme_comp :message_box, MessageBoxTheme
108
- theme_comp :progress_bar, ProgressBarTheme
109
- theme_comp :radio_button, RadioButtonTheme
110
- theme_comp :scrollbar, ScrollbarTheme
111
- theme_comp :separator, SeparatorLineTheme
112
- theme_comp :slider, SliderTheme
113
- theme_comp :spin_button, SpinButtonTheme
114
- theme_comp :tabs, TabsTheme
115
- theme_comp :text_area, TextAreaTheme
116
- theme_comp :tree_view, TreeViewTheme
117
- theme_comp :widget, WidgetTheme
118
-
119
78
  def self_commit custom_rendered = nil
120
79
  if attributes.size > 0
121
80
  file = Tempfile.new
@@ -129,6 +88,7 @@ module Tgui
129
88
  file << v.to_theme << "\n"
130
89
  end
131
90
  file.close
91
+ puts File.readlines(file.path) if @@debug
132
92
  _abi_load file.path
133
93
  ensure
134
94
  file.close!