glimmer-dsl-libui 0.0.28 → 0.1.3

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,51 @@
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/shape'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Represents a figure consisting of shapes (nested under path)
27
+ # Can optionally have `closed true` property (connecting last point to first point automatically)
28
+ class Figure < Shape
29
+ parameters :x, :y
30
+
31
+ def draw(area_draw_params)
32
+ ::LibUI.draw_path_new_figure(path_proxy.libui, *@args) unless @args.empty? # TODO if args empty then wait till there is an arc child and it starts the figure
33
+ children.each {|child| child.draw(area_draw_params)}
34
+ ::LibUI.draw_path_close_figure(path_proxy.libui) if closed?
35
+ super
36
+ end
37
+
38
+ def closed(value = nil)
39
+ if value.nil?
40
+ @closed
41
+ else
42
+ @closed = value
43
+ area_proxy&.queue_redraw_all
44
+ end
45
+ end
46
+ alias closed= closed
47
+ alias set_closed closed
48
+ alias closed? closed
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,35 @@
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/shape'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class Line < Shape
27
+ parameters :x, :y
28
+
29
+ def draw(area_draw_params)
30
+ ::LibUI.draw_path_line_to(path_proxy.libui, *@args)
31
+ super
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,169 @@
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
+
24
+ module Glimmer
25
+ module LibUI
26
+ # Proxy for LibUI path objects
27
+ #
28
+ # Follows the Proxy Design Pattern
29
+ class PathProxy < ControlProxy
30
+ # TODO support mode without parent proxy
31
+ def initialize(keyword, parent, args, &block)
32
+ @keyword = keyword
33
+ @parent_proxy = parent
34
+ @args = args
35
+ @block = block
36
+ @enabled = true
37
+ post_add_content if @block.nil?
38
+ end
39
+
40
+ def post_initialize_child(child)
41
+ super
42
+ children << child
43
+ end
44
+
45
+ def post_add_content
46
+ super
47
+ if @parent_proxy.nil? && area_draw_params
48
+ draw(area_draw_params)
49
+ destroy
50
+ end
51
+ end
52
+
53
+ def children
54
+ @children ||= []
55
+ end
56
+
57
+ def draw(area_draw_params)
58
+ build_control
59
+ children.each {|child| child.draw(area_draw_params)}
60
+ ::LibUI.draw_path_end(@libui)
61
+ ::LibUI.draw_fill(area_draw_params[:context], @libui, fill_draw_brush.to_ptr) unless fill.empty?
62
+ ::LibUI.draw_stroke(area_draw_params[:context], @libui, stroke_draw_brush, draw_stroke_params) unless stroke.empty?
63
+ ::LibUI.draw_free_path(@libui)
64
+ end
65
+
66
+ def draw_fill_mode
67
+ @args[0].is_a?(Integer) ? @args[0] : @args[0].to_s == 'alternate' ? 1 : 0
68
+ end
69
+
70
+ def fill(args = nil)
71
+ if args.nil?
72
+ @fill ||= {}
73
+ else
74
+ @fill = args
75
+ @fill[:a] = 1.0 if @fill[:a].nil?
76
+ @parent_proxy&.queue_redraw_all
77
+ end
78
+ @fill.tap do
79
+ @fill_observer ||= Glimmer::DataBinding::Observer.proc do
80
+ @parent_proxy&.queue_redraw_all
81
+ end
82
+ @fill_observer.observe(@fill)
83
+ end
84
+ end
85
+ alias fill= fill
86
+ alias set_fill fill
87
+
88
+ def fill_draw_brush
89
+ @fill_draw_brush ||= ::LibUI::FFI::DrawBrush.malloc
90
+ init_draw_brush(@fill_draw_brush, @fill)
91
+ @fill_draw_brush
92
+ end
93
+
94
+ def stroke(args = nil)
95
+ if args.nil?
96
+ @stroke ||= {}
97
+ else
98
+ @stroke = args
99
+ @stroke[:a] = 1.0 if @stroke[:a].nil?
100
+ @parent_proxy&.queue_redraw_all
101
+ end
102
+ @stroke.tap do
103
+ @stroke_observer ||= Glimmer::DataBinding::Observer.proc do
104
+ @parent_proxy&.queue_redraw_all
105
+ end
106
+ @stroke_observer.observe(@stroke)
107
+ end
108
+ end
109
+ alias stroke= stroke
110
+ alias set_stroke stroke
111
+
112
+ def stroke_draw_brush
113
+ @stroke_draw_brush ||= ::LibUI::FFI::DrawBrush.malloc
114
+ init_draw_brush(@stroke_draw_brush, @stroke)
115
+ @stroke_draw_brush
116
+ end
117
+
118
+ def draw_stroke_params
119
+ @draw_stroke_params ||= ::LibUI::FFI::DrawStrokeParams.malloc
120
+ @draw_stroke_params.Cap = @stroke[:cap] || 0 # flat
121
+ @draw_stroke_params.Join = @stroke[:join] || 0 # miter
122
+ @draw_stroke_params.Thickness = @stroke[:thickness] || 1
123
+ @draw_stroke_params.MiterLimit = @stroke[:miter_limit] || 10 # DEFAULT_MITER_LIMIT
124
+ @draw_stroke_params_dashes ||= Fiddle::Pointer.malloc(8)
125
+ @draw_stroke_params.Dashes = @draw_stroke_params_dashes
126
+ @draw_stroke_params.NumDashes = @stroke[:num_dashes] || 0 # TODO reimplement this line correctly (perhaps no need to pass num dashes, yet dashes themselves and use their count here)
127
+ @draw_stroke_params.DashPhase = @stroke[:dash_phase] || 0
128
+ @draw_stroke_params
129
+ end
130
+
131
+ # returns area_draw_params if built inside on_draw listener (not needed if declared outside)
132
+ def area_draw_params
133
+ @args[0] if @parent_proxy.nil?
134
+ end
135
+
136
+ def destroy
137
+ @parent_proxy.children.delete(self) unless @parent_proxy.nil?
138
+ ControlProxy.control_proxies.delete(self)
139
+ end
140
+
141
+ private
142
+
143
+ def build_control
144
+ @libui = ::LibUI.draw_new_path(draw_fill_mode)
145
+ end
146
+
147
+ def init_draw_brush(draw_brush, draw_brush_args)
148
+ case draw_brush_args[:type]
149
+ when Integer
150
+ draw_brush.Type = draw_brush_args[:type]
151
+ when :solid, 'solid'
152
+ draw_brush.Type = 0
153
+ when :linear_gradient, 'linear_gradient'
154
+ draw_brush.Type = 1
155
+ when :radial_gradient, 'radial_gradient'
156
+ draw_brush.Type = 2
157
+ when :image, 'image'
158
+ draw_brush.Type = 3
159
+ else
160
+ draw_brush.Type = 0
161
+ end
162
+ draw_brush.R = (draw_brush_args[:r] || draw_brush_args[:red]).to_f / 255.0
163
+ draw_brush.G = (draw_brush_args[:g] || draw_brush_args[:green]).to_f / 255.0
164
+ draw_brush.B = (draw_brush_args[:b] || draw_brush_args[:blue]).to_f / 255.0
165
+ draw_brush.A = (draw_brush_args[:a] || draw_brush_args[:alpha])
166
+ end
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,35 @@
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/shape'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class Rectangle < Shape
27
+ parameters :x, :y, :width, :height
28
+
29
+ def draw(area_draw_params)
30
+ ::LibUI.draw_path_add_rectangle(path_proxy.libui, *@args)
31
+ super
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,129 @@
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
+ module Glimmer
23
+ module LibUI
24
+ # Represents LibUI lightweight shape objects nested under path (e.g. line, rectangle, arc, bezier)
25
+ class Shape
26
+ class << self
27
+ def exists?(keyword)
28
+ Glimmer::LibUI.constants.include?(constant_symbol(keyword)) and
29
+ shape_class(keyword).respond_to?(:ancestors) and
30
+ shape_class(keyword).ancestors.include?(Shape)
31
+ end
32
+
33
+ def create(keyword, parent, args, &block)
34
+ shape_class(keyword).new(keyword, parent, args, &block)
35
+ end
36
+
37
+ def shape_class(keyword)
38
+ Glimmer::LibUI.const_get(constant_symbol(keyword))
39
+ end
40
+
41
+ def parameters(*params)
42
+ if params.empty?
43
+ @parameters
44
+ else
45
+ @parameters = params
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def constant_symbol(keyword)
52
+ "#{keyword.camelcase(:upper)}".to_sym
53
+ end
54
+ end
55
+
56
+ attr_reader :parent, :args, :keyword, :block
57
+
58
+ def initialize(keyword, parent, args, &block)
59
+ @keyword = keyword
60
+ @parent = parent
61
+ @args = args
62
+ @block = block
63
+ post_add_content if @block.nil?
64
+ end
65
+
66
+ # Subclasses may override to perform post add_content work (normally must call super)
67
+ def post_add_content
68
+ @parent&.post_initialize_child(self)
69
+ end
70
+
71
+ # Subclasses may override to perform post initialization work on an added child (normally must call super)
72
+ def post_initialize_child(child)
73
+ children << child
74
+ end
75
+
76
+ def children
77
+ @children ||= []
78
+ end
79
+
80
+ # Subclasses must override to perform draw work and call super afterwards to ensure calling destroy when semi-declarative in an on_draw method
81
+ def draw(area_draw_params)
82
+ destroy if area_proxy.nil?
83
+ end
84
+
85
+ def destroy
86
+ @parent.children.delete(self)
87
+ end
88
+
89
+ def area_proxy
90
+ find_parent_in_ancestors { |parent| parent.nil? || parent.is_a?(AreaProxy) }
91
+ end
92
+
93
+ def path_proxy
94
+ find_parent_in_ancestors { |parent| parent.nil? || parent.is_a?(PathProxy) }
95
+ end
96
+
97
+ def respond_to?(method_name, *args, &block)
98
+ self.class.parameters.include?(method_name.to_s.sub(/=$/, '').sub(/^set_/, '').to_sym) or
99
+ super(method_name, true)
100
+ end
101
+
102
+ def method_missing(method_name, *args, &block)
103
+ method_name_parameter = method_name.to_s.sub(/=$/, '').sub(/^set_/, '').to_sym
104
+ if self.class.parameters.include?(method_name_parameter)
105
+ method_name = method_name.to_s
106
+ parameter_index = self.class.parameters.index(method_name_parameter)
107
+ if method_name.start_with?('set_') || method_name.end_with?('=') || !args.empty?
108
+ @args[parameter_index] = args.first
109
+ area_proxy&.queue_redraw_all
110
+ else
111
+ @args[parameter_index]
112
+ end
113
+ else
114
+ super
115
+ end
116
+ end
117
+
118
+ private
119
+
120
+ def find_parent_in_ancestors(&condition)
121
+ found = self
122
+ until condition.call(found)
123
+ found = found.respond_to?(:parent_proxy) ? found.parent_proxy : found.parent
124
+ end
125
+ found
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,35 @@
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/shape'
23
+
24
+ module Glimmer
25
+ module LibUI
26
+ class Square < Shape
27
+ parameters :x, :y, :length
28
+
29
+ def draw(area_draw_params)
30
+ ::LibUI.draw_path_add_rectangle(path_proxy.libui, *@args, length)
31
+ super
32
+ end
33
+ end
34
+ end
35
+ end
@@ -21,6 +21,7 @@
21
21
 
22
22
  require 'glimmer/libui/control_proxy'
23
23
  require 'glimmer/data_binding/observer'
24
+ require 'glimmer/fiddle_consumer'
24
25
 
25
26
  using ArrayIncludeMethods
26
27
 
@@ -30,6 +31,8 @@ module Glimmer
30
31
  #
31
32
  # Follows the Proxy Design Pattern
32
33
  class TableProxy < ControlProxy
34
+ include Glimmer::FiddleConsumer
35
+
33
36
  attr_reader :model_handler, :model, :table_params, :columns
34
37
 
35
38
  def initialize(keyword, parent, args, &block)
@@ -112,8 +115,8 @@ module Glimmer
112
115
 
113
116
  def build_control
114
117
  @model_handler = ::LibUI::FFI::TableModelHandler.malloc
115
- @model_handler.NumColumns = rbcallback(4) { @columns.map {|c| c.is_a?(DualColumn) ? 2 : 1}.sum }
116
- @model_handler.ColumnType = rbcallback(4, [1, 1, 4]) do |_, _, column|
118
+ @model_handler.NumColumns = fiddle_closure_block_caller(4) { @columns.map {|c| c.is_a?(DualColumn) ? 2 : 1}.sum }
119
+ @model_handler.ColumnType = fiddle_closure_block_caller(4, [1, 1, 4]) do |_, _, column|
117
120
  case @columns[column]
118
121
  when TextColumnProxy, ButtonColumnProxy, NilClass
119
122
  0
@@ -123,8 +126,8 @@ module Glimmer
123
126
  2
124
127
  end
125
128
  end
126
- @model_handler.NumRows = rbcallback(4) { cell_rows.count }
127
- @model_handler.CellValue = rbcallback(1, [1, 1, 4, 4]) do |_, _, row, column|
129
+ @model_handler.NumRows = fiddle_closure_block_caller(4) { cell_rows.count }
130
+ @model_handler.CellValue = fiddle_closure_block_caller(1, [1, 1, 4, 4]) do |_, _, row, column|
128
131
  the_cell_rows = expanded_cell_rows
129
132
  case @columns[column]
130
133
  when TextColumnProxy, ButtonColumnProxy, NilClass
@@ -137,7 +140,7 @@ module Glimmer
137
140
  ::LibUI.new_table_value_int((expanded_cell_rows[row] && (expanded_cell_rows[row][column].to_i)))
138
141
  end
139
142
  end
140
- @model_handler.SetCellValue = rbcallback(0, [1, 1, 4, 4, 1]) do |_, _, row, column, val|
143
+ @model_handler.SetCellValue = fiddle_closure_block_caller(0, [1, 1, 4, 4, 1]) do |_, _, row, column, val|
141
144
  case @columns[column]
142
145
  when TextColumnProxy
143
146
  column = @columns[column].index
@@ -167,16 +170,6 @@ module Glimmer
167
170
  end
168
171
  end
169
172
 
170
- def rbcallback(*args, &block)
171
- # TODO consider moving to a more general reusable location in the future (e.g. when used with `AreaProxy`)
172
- # Protects BlockCaller objects from garbage collection.
173
- @blockcaller ||= []
174
- args << [0] if args.size == 1 # Argument types are ommited
175
- blockcaller = Fiddle::Closure::BlockCaller.new(*args, &block)
176
- @blockcaller << blockcaller
177
- blockcaller
178
- end
179
-
180
173
  def next_column_index
181
174
  @next_column_index ||= -1
182
175
  @next_column_index += 1
@@ -48,8 +48,14 @@ module Glimmer
48
48
  end
49
49
 
50
50
  def on_destroy(&block)
51
+ # TODO look into a way to generalize this logic for multiple listeners
51
52
  @on_destroy_procs ||= []
52
- @on_destroy_procs << block
53
+ if block.nil?
54
+ @on_destroy_procs
55
+ else
56
+ @on_destroy_procs << block
57
+ block
58
+ end
53
59
  end
54
60
 
55
61
  def show
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.5
19
+ version: 2.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.5
26
+ version: 2.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: os
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -194,6 +194,9 @@ files:
194
194
  - VERSION
195
195
  - bin/girb
196
196
  - bin/girb_runner.rb
197
+ - examples/area_gallery.rb
198
+ - examples/basic_area.rb
199
+ - examples/basic_area2.rb
197
200
  - examples/basic_button.rb
198
201
  - examples/basic_entry.rb
199
202
  - examples/basic_table.rb
@@ -208,6 +211,8 @@ files:
208
211
  - examples/color_button.rb
209
212
  - examples/control_gallery.rb
210
213
  - examples/date_time_picker.rb
214
+ - examples/dynamic_area.rb
215
+ - examples/dynamic_area2.rb
211
216
  - examples/editable_column_table.rb
212
217
  - examples/editable_table.rb
213
218
  - examples/font_button.rb
@@ -226,8 +231,13 @@ files:
226
231
  - lib/glimmer/dsl/libui/open_file_expression.rb
227
232
  - lib/glimmer/dsl/libui/property_expression.rb
228
233
  - lib/glimmer/dsl/libui/save_file_expression.rb
234
+ - lib/glimmer/dsl/libui/shape_expression.rb
229
235
  - lib/glimmer/dsl/libui/tab_item_expression.rb
236
+ - lib/glimmer/fiddle_consumer.rb
230
237
  - lib/glimmer/libui/about_menu_item_proxy.rb
238
+ - lib/glimmer/libui/arc.rb
239
+ - lib/glimmer/libui/area_proxy.rb
240
+ - lib/glimmer/libui/bezier.rb
231
241
  - lib/glimmer/libui/box.rb
232
242
  - lib/glimmer/libui/button_column_proxy.rb
233
243
  - lib/glimmer/libui/button_proxy.rb
@@ -245,6 +255,7 @@ files:
245
255
  - lib/glimmer/libui/editable_column.rb
246
256
  - lib/glimmer/libui/editable_combobox_proxy.rb
247
257
  - lib/glimmer/libui/enableable_column.rb
258
+ - lib/glimmer/libui/figure.rb
248
259
  - lib/glimmer/libui/font_button_proxy.rb
249
260
  - lib/glimmer/libui/form_proxy.rb
250
261
  - lib/glimmer/libui/grid_proxy.rb
@@ -255,15 +266,20 @@ files:
255
266
  - lib/glimmer/libui/image_proxy.rb
256
267
  - lib/glimmer/libui/image_text_column_proxy.rb
257
268
  - lib/glimmer/libui/label_proxy.rb
269
+ - lib/glimmer/libui/line.rb
258
270
  - lib/glimmer/libui/menu_item_proxy.rb
259
271
  - lib/glimmer/libui/menu_proxy.rb
260
272
  - lib/glimmer/libui/multiline_entry_proxy.rb
261
273
  - lib/glimmer/libui/non_wrapping_multiline_entry_proxy.rb
274
+ - lib/glimmer/libui/path_proxy.rb
262
275
  - lib/glimmer/libui/preferences_menu_item_proxy.rb
263
276
  - lib/glimmer/libui/progress_bar_column_proxy.rb
264
277
  - lib/glimmer/libui/quit_menu_item_proxy.rb
265
278
  - lib/glimmer/libui/radio_buttons_proxy.rb
279
+ - lib/glimmer/libui/rectangle.rb
266
280
  - lib/glimmer/libui/separator_menu_item_proxy.rb
281
+ - lib/glimmer/libui/shape.rb
282
+ - lib/glimmer/libui/square.rb
267
283
  - lib/glimmer/libui/tab_item_proxy.rb
268
284
  - lib/glimmer/libui/table_proxy.rb
269
285
  - lib/glimmer/libui/text_column_proxy.rb