glimmer-dsl-libui 0.2.1 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class BasicDrawText
7
+ include Glimmer
8
+
9
+ def alternating_color_string(initial: false, &block)
10
+ @index = 0 if initial
11
+ @index += 1
12
+ string {
13
+ if @index.odd?
14
+ color r: 128, g: 0, b: 64, a: 0.7
15
+ else
16
+ color r: 0, g: 128, b: 0, a: 0.7
17
+ end
18
+
19
+ block.call + "\n\n"
20
+ }
21
+ end
22
+
23
+ def launch
24
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
25
+ margined true
26
+
27
+ area {
28
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
29
+ # align :left # default alignment
30
+ default_font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
31
+
32
+ alternating_color_string(initial: true) {
33
+ ' At last Ygramul sensed that something was coming toward ' \
34
+ 'her. With the speed of lightning, she turned about, confronting ' \
35
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
36
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. '
37
+ }
38
+ alternating_color_string {
39
+ ' A cry of fear escaped Bastian. '
40
+ }
41
+ alternating_color_string {
42
+ ' A cry of terror passed through the ravine and echoed from ' \
43
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
44
+ 'someone else had arrived, for that sound could not have been ' \
45
+ 'made by the boy who stood there as though paralyzed with ' \
46
+ 'horror. '
47
+ }
48
+ alternating_color_string {
49
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
50
+ "But that's not possible. "
51
+ }
52
+ alternating_color_string {
53
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
54
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
55
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
56
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
57
+ 'words. '
58
+ }
59
+ }
60
+ }
61
+ }.show
62
+ end
63
+ end
64
+
65
+ BasicDrawText.new.launch
@@ -0,0 +1,68 @@
1
+
2
+ require 'glimmer-dsl-libui'
3
+
4
+ # Michael Ende (1929-1995)
5
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
6
+ # The English version, translated by Ralph Manheim, was published in 1983.
7
+ class BasicDrawText
8
+ include Glimmer
9
+
10
+ def alternating_color_string(initial: false, &block)
11
+ @index = 0 if initial
12
+ @index += 1
13
+ string {
14
+ if @index.odd?
15
+ color r: 128, g: 0, b: 64, a: 0.7
16
+ else
17
+ color r: 0, g: 128, b: 0, a: 0.7
18
+ end
19
+
20
+ block.call + "\n\n"
21
+ }
22
+ end
23
+
24
+ def launch
25
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
26
+ margined true
27
+
28
+ area {
29
+ on_draw do |area_draw_params|
30
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
31
+ # align :left # default alignment
32
+ default_font family: 'Georgia', size: 13, weight: :medium, italic: :normal, stretch: :normal
33
+
34
+ alternating_color_string(initial: true) {
35
+ ' At last Ygramul sensed that something was coming toward ' \
36
+ 'her. With the speed of lightning, she turned about, confronting ' \
37
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
38
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. '
39
+ }
40
+ alternating_color_string {
41
+ ' A cry of fear escaped Bastian. '
42
+ }
43
+ alternating_color_string {
44
+ ' A cry of terror passed through the ravine and echoed from ' \
45
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
46
+ 'someone else had arrived, for that sound could not have been ' \
47
+ 'made by the boy who stood there as though paralyzed with ' \
48
+ 'horror. '
49
+ }
50
+ alternating_color_string {
51
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
52
+ "But that's not possible. "
53
+ }
54
+ alternating_color_string {
55
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
56
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
57
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
58
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
59
+ 'words. '
60
+ }
61
+ }
62
+ end
63
+ }
64
+ }.show
65
+ end
66
+ end
67
+
68
+ BasicDrawText.new.launch
@@ -183,7 +183,7 @@ class ColorTheCircles
183
183
  }
184
184
  }
185
185
 
186
- vertical_box {
186
+ @area = area {
187
187
  left 0
188
188
  top 4
189
189
  hexpand true
@@ -191,30 +191,27 @@ class ColorTheCircles
191
191
  halign :fill
192
192
  valign :fill
193
193
 
194
- @area = area {
195
- on_draw do |area_draw_params|
194
+ on_draw do |area_draw_params|
195
+ path {
196
+ rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
197
+
198
+ fill :white
199
+ }
200
+
201
+ @circles_data.each do |circle_data|
196
202
  path {
197
- rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT)
203
+ circle_data[:circle] = circle(*circle_data[:args])
198
204
 
199
- fill :white
205
+ fill circle_data[:fill]
206
+ stroke circle_data[:stroke]
200
207
  }
201
-
202
- @circles_data.each do |circle_data|
203
- path {
204
- circle_data[:circle] = circle(*circle_data[:args])
205
-
206
- fill circle_data[:fill]
207
- stroke circle_data[:stroke]
208
- }
209
- end
210
- end
211
-
212
- on_mouse_down do |area_mouse_event|
213
- color_circle(area_mouse_event[:x], area_mouse_event[:y])
214
208
  end
215
- }
209
+ end
210
+
211
+ on_mouse_down do |area_mouse_event|
212
+ color_circle(area_mouse_event[:x], area_mouse_event[:y])
213
+ end
216
214
  }
217
-
218
215
  }
219
216
  }.show
220
217
  end
@@ -0,0 +1,106 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class CustomDrawText
7
+ include Glimmer
8
+
9
+ def launch
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
11
+ margined true
12
+
13
+ vertical_box {
14
+ form {
15
+ stretchy false
16
+
17
+ font_button { |fb|
18
+ label 'Font'
19
+
20
+ on_changed do
21
+ @string.font = fb.font
22
+ end
23
+ }
24
+ color_button { |cb|
25
+ label 'Color'
26
+
27
+ on_changed do
28
+ @string.color = cb.color
29
+ end
30
+ }
31
+ color_button { |cb|
32
+ label 'Background'
33
+
34
+ on_changed do
35
+ @string.background = cb.color
36
+ end
37
+ }
38
+ combobox { |c|
39
+ label 'Underline'
40
+ items Glimmer::LibUI.enum_symbols(:underline).map(&:to_s).map {|word| word.split('_').map(&:capitalize).join(' ')}
41
+ selected 'None'
42
+
43
+ on_selected do
44
+ @string.underline = c.selected_item.underscore
45
+ end
46
+ }
47
+ combobox { |c|
48
+ label 'Underline Built-In Color'
49
+ items Glimmer::LibUI.enum_symbols(:underline_color).map(&:to_s).map(&:capitalize)
50
+ selected 'Custom'
51
+
52
+ on_selected do
53
+ @underline_custom_color_button.enabled = c.selected_item == 'Custom'
54
+ if c.selected_item == 'Custom'
55
+ @string.underline_color = @underline_custom_color_button.color
56
+ else
57
+ @string.underline_color = c.selected_item.underscore
58
+ @underline_custom_color_button.color = :black
59
+ end
60
+ end
61
+ }
62
+ @underline_custom_color_button = color_button {
63
+ label 'Underline Custom Color'
64
+
65
+ on_changed do
66
+ @string.underline_color = @underline_custom_color_button.color
67
+ end
68
+ }
69
+ }
70
+
71
+ area {
72
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
73
+ # align :left # default alignment
74
+
75
+ @string = string {
76
+ ' At last Ygramul sensed that something was coming toward ' \
77
+ 'her. With the speed of lightning, she turned about, confronting ' \
78
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
79
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. ' \
80
+ "\n\n" \
81
+ ' A cry of fear escaped Bastian. ' \
82
+ "\n\n" \
83
+ ' A cry of terror passed through the ravine and echoed from ' \
84
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
85
+ 'someone else had arrived, for that sound could not have been ' \
86
+ 'made by the boy who stood there as though paralyzed with ' \
87
+ 'horror. ' \
88
+ "\n\n" \
89
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
90
+ "But that's not possible. " \
91
+ "\n\n" \
92
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
93
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
94
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
95
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
96
+ 'words. ' \
97
+ "\n\n"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }.show
103
+ end
104
+ end
105
+
106
+ CustomDrawText.new.launch
@@ -0,0 +1,120 @@
1
+ require 'glimmer-dsl-libui'
2
+
3
+ # Michael Ende (1929-1995)
4
+ # The Neverending Story is a fantasy novel by German writer Michael Ende,
5
+ # The English version, translated by Ralph Manheim, was published in 1983.
6
+ class CustomDrawText
7
+ include Glimmer
8
+
9
+ def launch
10
+ window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
11
+ margined true
12
+
13
+ vertical_box {
14
+ form {
15
+ stretchy false
16
+
17
+ font_button { |fb|
18
+ label 'Font'
19
+
20
+ on_changed do
21
+ @font = fb.font
22
+ @area.queue_redraw_all
23
+ end
24
+ }
25
+ color_button { |cb|
26
+ label 'Color'
27
+
28
+ on_changed do
29
+ @color = cb.color
30
+ @area.queue_redraw_all
31
+ end
32
+ }
33
+ color_button { |cb|
34
+ label 'Background'
35
+
36
+ on_changed do
37
+ @background = cb.color
38
+ @area.queue_redraw_all
39
+ end
40
+ }
41
+ combobox { |c|
42
+ label 'Underline'
43
+ items Glimmer::LibUI.enum_symbols(:underline).map(&:to_s).map {|word| word.split('_').map(&:capitalize).join(' ')}
44
+ selected 'None'
45
+
46
+ on_selected do
47
+ @underline = c.selected_item.underscore
48
+ @area.queue_redraw_all
49
+ end
50
+ }
51
+ combobox { |c|
52
+ label 'Underline Built-In Color'
53
+ items Glimmer::LibUI.enum_symbols(:underline_color).map(&:to_s).map(&:capitalize)
54
+ selected 'Custom'
55
+
56
+ on_selected do
57
+ @underline_custom_color_button.enabled = c.selected_item == 'Custom'
58
+ if c.selected_item == 'Custom'
59
+ @underline_color = @underline_custom_color_button.color
60
+ else
61
+ @underline_color = c.selected_item.underscore
62
+ @underline_custom_color_button.color = :black
63
+ end
64
+ @area.queue_redraw_all
65
+ end
66
+ }
67
+ @underline_custom_color_button = color_button {
68
+ label 'Underline Custom Color'
69
+
70
+ on_changed do
71
+ @underline_color = @underline_custom_color_button.color
72
+ @area.queue_redraw_all
73
+ end
74
+ }
75
+ }
76
+
77
+ @area = area {
78
+ on_draw do |area_draw_params|
79
+ text { # default arguments for x, y, and width are (0, 0, area_draw_params[:area_width])
80
+ # align :left # default alignment
81
+
82
+ @string = string {
83
+ font @font
84
+ color @color
85
+ background @background
86
+ underline @underline
87
+ underline_color @underline_color
88
+
89
+ ' At last Ygramul sensed that something was coming toward ' \
90
+ 'her. With the speed of lightning, she turned about, confronting ' \
91
+ 'Atreyu with an enormous steel-blue face. Her single eye had a ' \
92
+ 'vertical pupil, which stared at Atreyu with inconceivable malignancy. ' \
93
+ "\n\n" \
94
+ ' A cry of fear escaped Bastian. ' \
95
+ "\n\n" \
96
+ ' A cry of terror passed through the ravine and echoed from ' \
97
+ 'side to side. Ygramul turned her eye to left and right, to see if ' \
98
+ 'someone else had arrived, for that sound could not have been ' \
99
+ 'made by the boy who stood there as though paralyzed with ' \
100
+ 'horror. ' \
101
+ "\n\n" \
102
+ ' Could she have heard my cry? Bastion wondered in alarm. ' \
103
+ "But that's not possible. " \
104
+ "\n\n" \
105
+ ' And then Atreyu heard Ygramuls voice. It was very high ' \
106
+ 'and slightly hoarse, not at all the right kind of voice for that ' \
107
+ 'enormous face. Her lips did not move as she spoke. It was the ' \
108
+ 'buzzing of a great swarm of hornets that shaped itself into ' \
109
+ 'words. ' \
110
+ "\n\n"
111
+ }
112
+ }
113
+ end
114
+ }
115
+ }
116
+ }.show
117
+ end
118
+ end
119
+
120
+ CustomDrawText.new.launch
@@ -9,7 +9,7 @@ class TinyMidiPlayer
9
9
 
10
10
  def initialize
11
11
  @pid = nil
12
- @music_directory = File.expand_path(ARGV[0] || '~/Music/')
12
+ @music_directory = File.expand_path('../sounds', __dir__)
13
13
  @midi_files = Dir.glob(File.join(@music_directory, '**/*.mid'))
14
14
  .sort_by { |path| File.basename(path) }
15
15
  at_exit { stop_midi }
Binary file
@@ -40,7 +40,6 @@ module Glimmer
40
40
  super
41
41
  parent.post_add_content
42
42
  end
43
-
44
43
  end
45
44
  end
46
45
  end
@@ -22,6 +22,7 @@
22
22
  require 'glimmer/dsl/expression'
23
23
  require 'glimmer/libui/control_proxy'
24
24
  require 'glimmer/libui/shape'
25
+ require 'glimmer/libui/attributed_string'
25
26
 
26
27
  module Glimmer
27
28
  module DSL
@@ -30,7 +31,8 @@ module Glimmer
30
31
  def can_interpret?(parent, keyword, *args, &block)
31
32
  (
32
33
  parent.is_a?(Glimmer::LibUI::ControlProxy) or
33
- parent.is_a?(Glimmer::LibUI::Shape)
34
+ parent.is_a?(Glimmer::LibUI::Shape) or
35
+ parent.is_a?(Glimmer::LibUI::AttributedString)
34
36
  ) and
35
37
  block.nil? and
36
38
  parent.respond_to?(keyword, *args)
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/dsl/static_expression'
23
+ require 'glimmer/dsl/parent_expression'
24
+ require 'glimmer/libui/control_proxy/text_proxy'
25
+ require 'glimmer/libui/attributed_string'
26
+
27
+ module Glimmer
28
+ module DSL
29
+ module Libui
30
+ class StringExpression < StaticExpression
31
+ include ParentExpression
32
+
33
+ def can_interpret?(parent, keyword, *args, &block)
34
+ super and
35
+ parent.is_a?(Glimmer::LibUI::ControlProxy::TextProxy)
36
+ end
37
+
38
+ def interpret(parent, keyword, *args, &block)
39
+ Glimmer::LibUI::AttributedString.new(keyword, parent, args, &block)
40
+ end
41
+
42
+ def add_content(parent, keyword, *args, &block)
43
+ parent.post_add_content
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,156 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/libui/control_proxy'
23
+ require 'glimmer/libui/control_proxy/area_proxy'
24
+ require 'glimmer/libui/parent'
25
+ require 'glimmer/libui/control_proxy/transformable'
26
+
27
+ module Glimmer
28
+ module LibUI
29
+ class AttributedString
30
+ attr_accessor :string
31
+ attr_reader :block, :keyword, :parent_proxy, :args
32
+
33
+ def initialize(keyword, parent_proxy, args, &block)
34
+ @keyword = keyword
35
+ @parent_proxy = parent_proxy
36
+ @args = args
37
+ @string = @args.first || ''
38
+ @block = block
39
+ post_add_content if @block.nil?
40
+ end
41
+
42
+ def font(value = nil)
43
+ if value.nil?
44
+ @font
45
+ else
46
+ @font = value
47
+ redraw
48
+ end
49
+ end
50
+ alias font= font
51
+ alias set_font font
52
+
53
+ def color(value = nil)
54
+ if value.nil?
55
+ @color
56
+ else
57
+ @color = Glimmer::LibUI.interpret_color(value)
58
+ redraw
59
+ end
60
+ end
61
+ alias color= color
62
+ alias set_color color
63
+
64
+ def background(value = nil)
65
+ if value.nil?
66
+ @background
67
+ else
68
+ @background = Glimmer::LibUI.interpret_color(value)
69
+ redraw
70
+ end
71
+ end
72
+ alias background= background
73
+ alias set_background background
74
+
75
+ def underline(value = nil)
76
+ if value.nil?
77
+ @underline
78
+ else
79
+ @underline = value
80
+ redraw
81
+ end
82
+ end
83
+ alias underline= underline
84
+ alias set_underline underline
85
+
86
+ def underline_color(value = nil)
87
+ if value.nil?
88
+ @underline_color
89
+ else
90
+ @underline_color = value
91
+ redraw
92
+ end
93
+ end
94
+ alias underline_color= underline_color
95
+ alias set_underline_color underline_color
96
+
97
+ def post_add_content
98
+ block_result = block&.call
99
+ @string = block_result if block_result.is_a?(String)
100
+ @parent_proxy&.post_initialize_child(self)
101
+ end
102
+
103
+ def draw(area_draw_params)
104
+ @start = ::LibUI.attributed_string_len(@parent_proxy.attributed_string)
105
+ ::LibUI.attributed_string_append_unattributed(@parent_proxy.attributed_string, @string)
106
+ unless color.nil?
107
+ color_attribute = ::LibUI.new_color_attribute(@color[:r].to_f / 255.0, @color[:g].to_f / 255.0, @color[:b].to_f / 255.0, @color[:a] || 1.0)
108
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, color_attribute, @start, @start + @string.size)
109
+ end
110
+ unless background.nil?
111
+ background_attribute = ::LibUI.new_background_attribute(@background[:r].to_f / 255.0, @background[:g].to_f / 255.0, @background[:b].to_f / 255.0, @background[:a] || 1.0)
112
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, background_attribute, @start, @start + @string.size)
113
+ end
114
+ unless underline.nil?
115
+ underline_attribute = ::LibUI.new_underline_attribute(Glimmer::LibUI.enum_symbol_to_value(:underline, @underline))
116
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_attribute, @start, @start + @string.size)
117
+ end
118
+ unless underline_color.nil?
119
+ if Glimmer::LibUI.enum_symbols(:underline_color).include?(underline_color.to_s.to_sym) && underline_color.to_s.to_sym != :custom
120
+ underline_color_attribute = ::LibUI.new_underline_color_attribute(Glimmer::LibUI.enum_symbol_to_value(:underline_color, @underline_color), 0, 0, 0, 0)
121
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_color_attribute, @start, @start + @string.size)
122
+ else
123
+ the_color = Glimmer::LibUI.interpret_color(@underline_color)
124
+ underline_color_attribute = ::LibUI.new_underline_color_attribute(0, the_color[:r].to_f / 255.0, the_color[:g].to_f / 255.0, the_color[:b].to_f / 255.0, the_color[:a] || 1.0)
125
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, underline_color_attribute, @start, @start + @string.size)
126
+ end
127
+ end
128
+ unless font.nil?
129
+ family_attribute = ::LibUI.new_family_attribute(font[:family])
130
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, family_attribute, @start, @start + @string.size)
131
+ size_attribute = ::LibUI.new_size_attribute(font[:size])
132
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, size_attribute, @start, @start + @string.size)
133
+ weight_attribute = ::LibUI.new_weight_attribute(Glimmer::LibUI.enum_symbol_to_value(:text_weight, font[:weight]))
134
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, weight_attribute, @start, @start + @string.size)
135
+ italic_attribute = ::LibUI.new_italic_attribute(Glimmer::LibUI.enum_symbol_to_value(:text_italic, font[:italic]))
136
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, italic_attribute, @start, @start + @string.size)
137
+ stretch_attribute = ::LibUI.new_stretch_attribute(Glimmer::LibUI.enum_symbol_to_value(:text_stretch, font[:stretch]))
138
+ ::LibUI.attributed_string_set_attribute(@parent_proxy.attributed_string, stretch_attribute, @start, @start + @string.size)
139
+ end
140
+ destroy if area_proxy.nil?
141
+ end
142
+
143
+ def destroy
144
+ @parent_proxy&.children&.delete(self)
145
+ end
146
+
147
+ def redraw
148
+ area_proxy&.queue_redraw_all
149
+ end
150
+
151
+ def area_proxy
152
+ @parent_proxy.parent_proxy
153
+ end
154
+ end
155
+ end
156
+ end