glimmer-dsl-swt 4.18.4.4 → 4.18.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,297 +1,299 @@
1
- # Copyright (c) 2007-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/swt/properties'
23
- require 'glimmer/swt/swt_proxy'
24
- require 'glimmer/swt/display_proxy'
25
- require 'glimmer/swt/color_proxy'
26
- require 'glimmer/swt/font_proxy'
27
- require 'glimmer/swt/transform_proxy'
28
-
29
- module Glimmer
30
- module SWT
31
- module Custom
32
- # Represents a shape (graphics) to be drawn on a control/widget/canvas/display
33
- # That is because Shape is drawn on a parent as graphics and doesn't have an SWT widget for itself
34
- class Shape
35
- include Packages
36
- include Properties
37
- # TODO support textExtent sized shapes nested within text/string
38
- # TODO support a Pattern DSL for methods that take Pattern arguments
39
-
40
- class << self
41
- def valid?(parent, keyword, *args, &block)
42
- gc_instance_methods.include?(method_name(keyword, args))
43
- end
44
-
45
- def gc_instance_methods
46
- @gc_instance_methods ||= org.eclipse.swt.graphics.GC.instance_methods.map(&:to_s)
47
- end
48
-
49
- def keywords
50
- @keywords ||= gc_instance_methods.select do |method_name|
51
- !method_name.end_with?('=') && (method_name.start_with?('draw_') || method_name.start_with?('fill_'))
52
- end.reject do |method_name|
53
- gc_instance_methods.include?("#{method_name}=") || gc_instance_methods.include?("set_#{method_name}")
54
- end.map do |method_name|
55
- method_name.gsub(/(draw|fill|gradient|round)_/, '')
56
- end.uniq.compact.to_a
57
- end
58
-
59
- def arg_options(args, extract: false)
60
- arg_options_method = extract ? :pop : :last
61
- options = args.send(arg_options_method) if args.last.is_a?(Hash)
62
- options.nil? ? {} : options.symbolize_keys
63
- end
64
-
65
- def method_name(keyword, args)
66
- method_arg_options = arg_options(args)
67
- unless flyweight_method_names.keys.include?([keyword, method_arg_options])
68
- keyword = keyword.to_s
69
- gradient = 'gradient_' if method_arg_options[:gradient]
70
- round = 'round_' if method_arg_options[:round]
71
- gc_instance_method_name_prefix = !['polyline', 'point', 'image', 'focus'].include?(keyword) && (method_arg_options[:fill] || method_arg_options[:gradient]) ? 'fill_' : 'draw_'
72
- flyweight_method_names[[keyword, method_arg_options]] = "#{gc_instance_method_name_prefix}#{gradient}#{round}#{keyword}"
73
- end
74
- flyweight_method_names[[keyword, method_arg_options]]
75
- end
76
-
77
- def flyweight_method_names
78
- @flyweight_method_names ||= {}
79
- end
80
-
81
- def pattern(*args)
82
- found_pattern = flyweigh_patterns[args]
83
- if found_pattern.nil? || found_pattern.is_disposed
84
- found_pattern = flyweigh_patterns[args] = org.eclipse.swt.graphics.Pattern.new(*args)
85
- end
86
- found_pattern
87
- end
88
-
89
- def flyweigh_patterns
90
- @flyweigh_patterns ||= {}
91
- end
92
- end
93
-
94
- attr_reader :parent, :name, :args, :options, :paint_listener_proxy
95
-
96
- def initialize(parent, keyword, *args, &property_block)
97
- @parent = parent
98
- @name = keyword
99
- @method_name = self.class.method_name(keyword, args)
100
- @options = self.class.arg_options(args, extract: true)
101
- @args = args
102
- @properties = {}
103
- @parent.shapes << self
104
- post_add_content if property_block.nil?
105
- end
106
-
107
- def draw?
108
- !fill?
109
- end
110
-
111
- def fill?
112
- @options[:fill]
113
- end
114
-
115
- def gradient?
116
- @options[:gradient]
117
- end
118
-
119
- def round?
120
- @options[:round]
121
- end
122
-
123
- def has_some_background?
124
- @properties.keys.map(&:to_s).include?('background') || @properties.keys.map(&:to_s).include?('background_pattern')
125
- end
126
-
127
- def has_some_foreground?
128
- @properties.keys.map(&:to_s).include?('foreground') || @properties.keys.map(&:to_s).include?('foreground_pattern')
129
- end
130
-
131
- def post_add_content
132
- amend_method_name_options_based_on_properties
133
- setup_painting
134
- @content_added = true
135
- end
136
-
137
- def apply_property_arg_conversions(method_name, property, args)
138
- args = args.dup
139
- the_java_method = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.detect {|m| m.name == method_name}
140
- if (args.first.is_a?(Symbol) || args.first.is_a?(String))
141
- if the_java_method.parameter_types.first == Color.java_class
142
- args[0] = ColorProxy.new(args[0])
143
- end
144
- if the_java_method.parameter_types.first == Java::int.java_class
145
- args[0] = SWTProxy.constant(args[0])
146
- end
147
- end
148
- if args.first.is_a?(ColorProxy)
149
- args[0] = args[0].swt_color
150
- end
151
- if args.first.is_a?(Hash) && the_java_method.parameter_types.first == Font.java_class
152
- args[0] = FontProxy.new(args[0])
153
- end
154
- if args.first.is_a?(FontProxy)
155
- args[0] = args[0].swt_font
156
- end
157
- if args.first.is_a?(TransformProxy)
158
- args[0] = args[0].swt_transform
159
- end
160
- if ['setBackgroundPattern', 'setForegroundPattern'].include?(method_name.to_s)
161
- args.each_with_index do |arg, i|
162
- if arg.is_a?(Symbol) || arg.is_a?(String)
163
- args[i] = ColorProxy.new(arg).swt_color
164
- elsif arg.is_a?(ColorProxy)
165
- args[i] = arg.swt_color
166
- end
167
- end
168
- new_args = [DisplayProxy.instance.swt_display] + args
169
- args[0] = pattern(*new_args, type: method_name.to_s.match(/set(.+)Pattern/)[1])
170
- args[1..-1] = []
171
- end
172
- args
173
- end
174
-
175
- def apply_shape_arg_conversions(method_name, args)
176
- if args.size > 1 && (method_name.include?('polygon') || method_name.include?('polyline'))
177
- args[0] = args.dup
178
- args[1..-1] = []
179
- end
180
- end
181
-
182
- def apply_shape_arg_defaults(method_name, args)
183
- if method_name.include?('round_rectangle') && args.size.between?(4, 5)
184
- (6 - args.size).times {args << 60}
185
- elsif method_name.include?('rectangle') && gradient? && args.size == 4
186
- args << true
187
- elsif (method_name.include?('text') || method_name.include?('string')) && !@properties.keys.map(&:to_s).include?('background') && args.size == 3
188
- args << true
189
- end
190
- if method_name.include?('image') && args.first.is_a?(String)
191
- args[0] = ImageProxy.new(args[0])
192
- end
193
- if method_name.include?('image') && args.first.is_a?(ImageProxy)
194
- @image = args[0] = args[0].swt_image
195
- end
196
- end
197
-
198
- # Tolerates shape extra args added by user by mistake
199
- # (e.g. happens when switching from round rectangle to a standard one without removing all extra args)
200
- def tolerate_shape_extra_args(method_name, args)
201
- the_java_method_arg_count = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.select do |m|
202
- m.name == method_name.camelcase(:lower)
203
- end.map(&:parameter_types).map(&:size).max
204
- if args.size > the_java_method_arg_count
205
- args[the_java_method_arg_count..-1] = []
206
- end
207
- end
208
-
209
- def amend_method_name_options_based_on_properties
210
- if has_some_background? && !has_some_foreground?
211
- @options[:fill] = true
212
- elsif !has_some_background? && has_some_foreground?
213
- @options[:fill] = false
214
- elsif @name == 'rectangle' && has_some_background? && has_some_foreground?
215
- @options[:fill] = true
216
- @options[:gradient] = true
217
- end
218
- if @name == 'rectangle' && @args.size > 4 && @args.last.is_a?(Numeric)
219
- @options[:round] = true
220
- end
221
- @method_name = self.class.method_name(@name, @args + [@options])
222
- end
223
-
224
- def has_attribute?(attribute_name, *args)
225
- self.class.gc_instance_methods.include?(attribute_setter(attribute_name))
226
- end
227
-
228
- def set_attribute(attribute_name, *args)
229
- @properties[attribute_name] = args
230
- if @content_added && !@parent.is_disposed
231
- @parent.resetup_shape_painting
232
- @parent.redraw
233
- end
234
- end
235
-
236
- def get_attribute(attribute_name)
237
- @properties.symbolize_keys[attribute_name.to_s.to_sym]
238
- end
239
-
240
- def pattern(*args, type: nil)
241
- instance_variable_name = "@#{type}_pattern"
242
- the_pattern = instance_variable_get(instance_variable_name)
243
- if the_pattern.nil?
244
- the_pattern = self.class.pattern(*args)
245
- end
246
- the_pattern
247
- end
248
-
249
- def dispose
250
- paint_listener_proxy&.unregister
251
- @background_pattern&.dispose
252
- @background_pattern = nil
253
- @foreground_pattern&.dispose
254
- @foreground_pattern = nil
255
- @image&.dispose
256
- @image = nil
257
- @parent.shapes.delete(self)
258
- end
259
-
260
- def setup_painting
261
- # TODO consider moving this method to parent (making the logic polymorphic)
262
- return if @parent.is_disposed
263
- if parent.respond_to?(:swt_display)
264
- @paint_listener_proxy = @parent.on_swt_paint(&method(:paint))
265
- elsif parent.respond_to?(:swt_image)
266
- paint(parent) # treat parent as paint event since you don't do repaints with images, it's a one time deal.
267
- elsif parent.respond_to?(:swt_widget)
268
- @paint_listener_proxy = @parent.on_paint_control(&method(:paint))
269
- end
270
- end
271
-
272
- def paint(paint_event)
273
- @properties['background'] = [@parent.background] if fill? && !has_some_background?
274
- @properties['foreground'] = [@parent.foreground] if @parent.respond_to?(:foreground) && draw? && !has_some_foreground?
275
- @properties['font'] = [@parent.font] if @parent.respond_to?(:font) && draw? && !@properties.keys.map(&:to_s).include?('font')
276
- @properties['transform'] = [nil] if @parent.respond_to?(:transform) && !@properties.keys.map(&:to_s).include?('transform')
277
- @properties.each do |property, args|
278
- method_name = attribute_setter(property)
279
- converted_args = apply_property_arg_conversions(method_name, property, args)
280
- paint_event.gc.send(method_name, *converted_args)
281
- if property == 'transform' && args.first.is_a?(TransformProxy)
282
- args.first.swt_transform.dispose
283
- end
284
- end
285
- apply_shape_arg_conversions(@method_name, @args)
286
- apply_shape_arg_defaults(@method_name, @args)
287
- tolerate_shape_extra_args(@method_name, @args)
288
- paint_event.gc.send(@method_name, *@args)
289
- end
290
-
291
- end
292
-
293
- end
294
-
295
- end
296
-
297
- end
1
+ # Copyright (c) 2007-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/swt/properties'
23
+ require 'glimmer/swt/swt_proxy'
24
+ require 'glimmer/swt/display_proxy'
25
+ require 'glimmer/swt/color_proxy'
26
+ require 'glimmer/swt/font_proxy'
27
+ require 'glimmer/swt/transform_proxy'
28
+
29
+ module Glimmer
30
+ module SWT
31
+ module Custom
32
+ # Represents a shape (graphics) to be drawn on a control/widget/canvas/display
33
+ # That is because Shape is drawn on a parent as graphics and doesn't have an SWT widget for itself
34
+ class Shape
35
+ include Packages
36
+ include Properties
37
+ # TODO support textExtent sized shapes nested within text/string
38
+ # TODO support a Pattern DSL for methods that take Pattern arguments
39
+
40
+ class << self
41
+ def valid?(parent, keyword, *args, &block)
42
+ gc_instance_methods.include?(method_name(keyword, args))
43
+ end
44
+
45
+ def gc_instance_methods
46
+ @gc_instance_methods ||= org.eclipse.swt.graphics.GC.instance_methods.map(&:to_s)
47
+ end
48
+
49
+ def keywords
50
+ @keywords ||= gc_instance_methods.select do |method_name|
51
+ !method_name.end_with?('=') && (method_name.start_with?('draw_') || method_name.start_with?('fill_'))
52
+ end.reject do |method_name|
53
+ gc_instance_methods.include?("#{method_name}=") || gc_instance_methods.include?("set_#{method_name}")
54
+ end.map do |method_name|
55
+ method_name.gsub(/(draw|fill|gradient|round)_/, '')
56
+ end.uniq.compact.to_a
57
+ end
58
+
59
+ def arg_options(args, extract: false)
60
+ arg_options_method = extract ? :pop : :last
61
+ options = args.send(arg_options_method) if args.last.is_a?(Hash)
62
+ options.nil? ? {} : options.symbolize_keys
63
+ end
64
+
65
+ def method_name(keyword, args)
66
+ method_arg_options = arg_options(args)
67
+ unless flyweight_method_names.keys.include?([keyword, method_arg_options])
68
+ keyword = keyword.to_s
69
+ gradient = 'gradient_' if method_arg_options[:gradient]
70
+ round = 'round_' if method_arg_options[:round]
71
+ gc_instance_method_name_prefix = !['polyline', 'point', 'image', 'focus'].include?(keyword) && (method_arg_options[:fill] || method_arg_options[:gradient]) ? 'fill_' : 'draw_'
72
+ flyweight_method_names[[keyword, method_arg_options]] = "#{gc_instance_method_name_prefix}#{gradient}#{round}#{keyword}"
73
+ end
74
+ flyweight_method_names[[keyword, method_arg_options]]
75
+ end
76
+
77
+ def flyweight_method_names
78
+ @flyweight_method_names ||= {}
79
+ end
80
+
81
+ def pattern(*args)
82
+ found_pattern = flyweigh_patterns[args]
83
+ if found_pattern.nil? || found_pattern.is_disposed
84
+ found_pattern = flyweigh_patterns[args] = org.eclipse.swt.graphics.Pattern.new(*args)
85
+ end
86
+ found_pattern
87
+ end
88
+
89
+ def flyweigh_patterns
90
+ @flyweigh_patterns ||= {}
91
+ end
92
+ end
93
+
94
+ attr_reader :parent, :name, :args, :options, :paint_listener_proxy
95
+
96
+ def initialize(parent, keyword, *args, &property_block)
97
+ @parent = parent
98
+ @name = keyword
99
+ @method_name = self.class.method_name(keyword, args)
100
+ @options = self.class.arg_options(args, extract: true)
101
+ @args = args
102
+ @properties = {}
103
+ @parent.shapes << self
104
+ post_add_content if property_block.nil?
105
+ end
106
+
107
+ def draw?
108
+ !fill?
109
+ end
110
+
111
+ def fill?
112
+ @options[:fill]
113
+ end
114
+
115
+ def gradient?
116
+ @options[:gradient]
117
+ end
118
+
119
+ def round?
120
+ @options[:round]
121
+ end
122
+
123
+ def has_some_background?
124
+ @properties.keys.map(&:to_s).include?('background') || @properties.keys.map(&:to_s).include?('background_pattern')
125
+ end
126
+
127
+ def has_some_foreground?
128
+ @properties.keys.map(&:to_s).include?('foreground') || @properties.keys.map(&:to_s).include?('foreground_pattern')
129
+ end
130
+
131
+ def post_add_content
132
+ unless @content_added
133
+ amend_method_name_options_based_on_properties
134
+ setup_painting
135
+ @content_added = true
136
+ end
137
+ end
138
+
139
+ def apply_property_arg_conversions(method_name, property, args)
140
+ args = args.dup
141
+ the_java_method = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.detect {|m| m.name == method_name}
142
+ if (args.first.is_a?(Symbol) || args.first.is_a?(String))
143
+ if the_java_method.parameter_types.first == Color.java_class
144
+ args[0] = ColorProxy.new(args[0])
145
+ end
146
+ if the_java_method.parameter_types.first == Java::int.java_class
147
+ args[0] = SWTProxy.constant(args[0])
148
+ end
149
+ end
150
+ if args.first.is_a?(ColorProxy)
151
+ args[0] = args[0].swt_color
152
+ end
153
+ if args.first.is_a?(Hash) && the_java_method.parameter_types.first == Font.java_class
154
+ args[0] = FontProxy.new(args[0])
155
+ end
156
+ if args.first.is_a?(FontProxy)
157
+ args[0] = args[0].swt_font
158
+ end
159
+ if args.first.is_a?(TransformProxy)
160
+ args[0] = args[0].swt_transform
161
+ end
162
+ if ['setBackgroundPattern', 'setForegroundPattern'].include?(method_name.to_s)
163
+ args.each_with_index do |arg, i|
164
+ if arg.is_a?(Symbol) || arg.is_a?(String)
165
+ args[i] = ColorProxy.new(arg).swt_color
166
+ elsif arg.is_a?(ColorProxy)
167
+ args[i] = arg.swt_color
168
+ end
169
+ end
170
+ new_args = [DisplayProxy.instance.swt_display] + args
171
+ args[0] = pattern(*new_args, type: method_name.to_s.match(/set(.+)Pattern/)[1])
172
+ args[1..-1] = []
173
+ end
174
+ args
175
+ end
176
+
177
+ def apply_shape_arg_conversions(method_name, args)
178
+ if args.size > 1 && (method_name.include?('polygon') || method_name.include?('polyline'))
179
+ args[0] = args.dup
180
+ args[1..-1] = []
181
+ end
182
+ end
183
+
184
+ def apply_shape_arg_defaults(method_name, args)
185
+ if method_name.include?('round_rectangle') && args.size.between?(4, 5)
186
+ (6 - args.size).times {args << 60}
187
+ elsif method_name.include?('rectangle') && gradient? && args.size == 4
188
+ args << true
189
+ elsif (method_name.include?('text') || method_name.include?('string')) && !@properties.keys.map(&:to_s).include?('background') && args.size == 3
190
+ args << true
191
+ end
192
+ if method_name.include?('image') && args.first.is_a?(String)
193
+ args[0] = ImageProxy.new(args[0])
194
+ end
195
+ if method_name.include?('image') && args.first.is_a?(ImageProxy)
196
+ @image = args[0] = args[0].swt_image
197
+ end
198
+ end
199
+
200
+ # Tolerates shape extra args added by user by mistake
201
+ # (e.g. happens when switching from round rectangle to a standard one without removing all extra args)
202
+ def tolerate_shape_extra_args(method_name, args)
203
+ the_java_method_arg_count = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.select do |m|
204
+ m.name == method_name.camelcase(:lower)
205
+ end.map(&:parameter_types).map(&:size).max
206
+ if args.size > the_java_method_arg_count
207
+ args[the_java_method_arg_count..-1] = []
208
+ end
209
+ end
210
+
211
+ def amend_method_name_options_based_on_properties
212
+ if has_some_background? && !has_some_foreground?
213
+ @options[:fill] = true
214
+ elsif !has_some_background? && has_some_foreground?
215
+ @options[:fill] = false
216
+ elsif @name == 'rectangle' && has_some_background? && has_some_foreground?
217
+ @options[:fill] = true
218
+ @options[:gradient] = true
219
+ end
220
+ if @name == 'rectangle' && @args.size > 4 && @args.last.is_a?(Numeric)
221
+ @options[:round] = true
222
+ end
223
+ @method_name = self.class.method_name(@name, @args + [@options])
224
+ end
225
+
226
+ def has_attribute?(attribute_name, *args)
227
+ self.class.gc_instance_methods.include?(attribute_setter(attribute_name))
228
+ end
229
+
230
+ def set_attribute(attribute_name, *args)
231
+ @properties[attribute_name] = args
232
+ if @content_added && !@parent.is_disposed
233
+ @parent.resetup_shape_painting
234
+ @parent.redraw
235
+ end
236
+ end
237
+
238
+ def get_attribute(attribute_name)
239
+ @properties.symbolize_keys[attribute_name.to_s.to_sym]
240
+ end
241
+
242
+ def pattern(*args, type: nil)
243
+ instance_variable_name = "@#{type}_pattern"
244
+ the_pattern = instance_variable_get(instance_variable_name)
245
+ if the_pattern.nil?
246
+ the_pattern = self.class.pattern(*args)
247
+ end
248
+ the_pattern
249
+ end
250
+
251
+ def dispose
252
+ paint_listener_proxy&.unregister
253
+ @background_pattern&.dispose
254
+ @background_pattern = nil
255
+ @foreground_pattern&.dispose
256
+ @foreground_pattern = nil
257
+ @image&.dispose
258
+ @image = nil
259
+ @parent.shapes.delete(self)
260
+ end
261
+
262
+ def setup_painting
263
+ # TODO consider moving this method to parent (making the logic polymorphic)
264
+ return if @parent.is_disposed
265
+ if parent.respond_to?(:swt_display)
266
+ @paint_listener_proxy = @parent.on_swt_paint(&method(:paint))
267
+ elsif parent.respond_to?(:swt_image)
268
+ paint(parent) # treat parent as paint event since you don't do repaints with images, it's a one time deal.
269
+ elsif parent.respond_to?(:swt_widget)
270
+ @paint_listener_proxy = @parent.on_paint_control(&method(:paint))
271
+ end
272
+ end
273
+
274
+ def paint(paint_event)
275
+ @properties['background'] = [@parent.background] if fill? && !has_some_background?
276
+ @properties['foreground'] = [@parent.foreground] if @parent.respond_to?(:foreground) && draw? && !has_some_foreground?
277
+ @properties['font'] = [@parent.font] if @parent.respond_to?(:font) && draw? && !@properties.keys.map(&:to_s).include?('font')
278
+ @properties['transform'] = [nil] if @parent.respond_to?(:transform) && !@properties.keys.map(&:to_s).include?('transform')
279
+ @properties.each do |property, args|
280
+ method_name = attribute_setter(property)
281
+ converted_args = apply_property_arg_conversions(method_name, property, args)
282
+ paint_event.gc.send(method_name, *converted_args)
283
+ if property == 'transform' && args.first.is_a?(TransformProxy)
284
+ args.first.swt_transform.dispose
285
+ end
286
+ end
287
+ apply_shape_arg_conversions(@method_name, @args)
288
+ apply_shape_arg_defaults(@method_name, @args)
289
+ tolerate_shape_extra_args(@method_name, @args)
290
+ paint_event.gc.send(@method_name, *@args)
291
+ end
292
+
293
+ end
294
+
295
+ end
296
+
297
+ end
298
+
299
+ end