glimmer-dsl-swt 4.18.4.11 → 4.18.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +7 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +121 -5
  8. data/docs/reference/GLIMMER_SAMPLES.md +17 -4
  9. data/glimmer-dsl-swt.gemspec +19 -9
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +9 -27
  15. data/lib/glimmer/dsl/swt/auto_exec_expression.rb +36 -0
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  18. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  19. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  20. data/lib/glimmer/dsl/swt/image_expression.rb +8 -1
  21. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  22. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  23. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  24. data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/widget_expression.rb +4 -3
  26. data/lib/glimmer/launcher.rb +3 -0
  27. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  28. data/lib/glimmer/swt/custom/code_text.rb +11 -11
  29. data/lib/glimmer/swt/custom/drawable.rb +4 -0
  30. data/lib/glimmer/swt/custom/shape.rb +129 -20
  31. data/lib/glimmer/swt/custom/shape/arc.rb +43 -0
  32. data/lib/glimmer/swt/custom/shape/focus.rb +43 -0
  33. data/lib/glimmer/swt/custom/shape/image.rb +86 -0
  34. data/lib/glimmer/swt/custom/shape/line.rb +58 -0
  35. data/lib/glimmer/swt/custom/shape/oval.rb +43 -0
  36. data/lib/glimmer/swt/custom/shape/point.rb +52 -0
  37. data/lib/glimmer/swt/custom/shape/polygon.rb +73 -0
  38. data/lib/glimmer/swt/custom/shape/polyline.rb +73 -0
  39. data/lib/glimmer/swt/custom/shape/rectangle.rb +87 -0
  40. data/lib/glimmer/swt/custom/shape/text.rb +73 -0
  41. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  42. data/lib/glimmer/swt/directory_dialog_proxy.rb +20 -18
  43. data/lib/glimmer/swt/display_proxy.rb +62 -2
  44. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  45. data/lib/glimmer/swt/file_dialog_proxy.rb +20 -18
  46. data/lib/glimmer/swt/font_proxy.rb +1 -1
  47. data/lib/glimmer/swt/image_proxy.rb +1 -1
  48. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  49. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  50. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  51. data/lib/glimmer/swt/message_box_proxy.rb +20 -7
  52. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  53. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  54. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  55. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  56. data/lib/glimmer/swt/table_proxy.rb +32 -11
  57. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  58. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  59. data/lib/glimmer/swt/widget_proxy.rb +200 -117
  60. data/lib/glimmer/ui.rb +5 -0
  61. data/lib/glimmer/ui/custom_shell.rb +11 -5
  62. data/lib/glimmer/ui/custom_widget.rb +4 -5
  63. data/samples/elaborate/contact_manager.rb +7 -7
  64. data/samples/elaborate/login.rb +25 -21
  65. data/samples/elaborate/mandelbrot_fractal.rb +3 -5
  66. data/samples/elaborate/tetris.rb +1 -0
  67. data/samples/elaborate/tic_tac_toe.rb +16 -14
  68. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  69. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  70. data/samples/hello/hello_button.rb +7 -7
  71. data/samples/hello/hello_canvas.rb +43 -2
  72. data/samples/hello/hello_checkbox.rb +16 -14
  73. data/samples/hello/hello_checkbox_group.rb +11 -9
  74. data/samples/hello/hello_combo.rb +14 -12
  75. data/samples/hello/hello_computed.rb +7 -7
  76. data/samples/hello/hello_cursor.rb +2 -1
  77. data/samples/hello/hello_custom_shell.rb +17 -21
  78. data/samples/hello/hello_custom_widget.rb +4 -6
  79. data/samples/hello/hello_date_time.rb +14 -12
  80. data/samples/hello/hello_directory_dialog.rb +7 -7
  81. data/samples/hello/hello_expand_bar.rb +8 -8
  82. data/samples/hello/hello_file_dialog.rb +7 -7
  83. data/samples/hello/hello_group.rb +18 -16
  84. data/samples/hello/hello_list_multi_selection.rb +13 -11
  85. data/samples/hello/hello_list_single_selection.rb +13 -11
  86. data/samples/hello/hello_progress_bar.rb +3 -7
  87. data/samples/hello/hello_radio.rb +18 -16
  88. data/samples/hello/hello_radio_group.rb +14 -12
  89. data/samples/hello/hello_spinner.rb +7 -7
  90. data/samples/hello/hello_tab.rb +5 -5
  91. data/samples/hello/hello_table.rb +10 -5
  92. data/samples/hello/hello_tree.rb +485 -0
  93. metadata +17 -18
@@ -30,7 +30,7 @@ module Glimmer
30
30
  class PixelExpression < StaticExpression
31
31
 
32
32
  def interpret(parent, keyword, *args, &block)
33
- Glimmer::SWT::Custom::Shape.new(parent, 'point', *args, &block)
33
+ Glimmer::SWT::Custom::Shape.new(parent, 'pixel', *args, &block)
34
34
  end
35
35
  end
36
36
  end
@@ -22,6 +22,7 @@
22
22
  require 'glimmer/dsl/expression'
23
23
  require 'glimmer/data_binding/model_binding'
24
24
  require 'glimmer/data_binding/widget_binding'
25
+ require 'glimmer/swt/display_proxy'
25
26
 
26
27
  module Glimmer
27
28
  module DSL
@@ -42,18 +43,20 @@ module Glimmer
42
43
 
43
44
  #TODO make this options observer dependent and all similar observers in widget specific data binding handlers
44
45
  # TODO consider delegating some of this work
45
- widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
46
+ widget_binding = DataBinding::WidgetBinding.new(parent, 'items', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
46
47
  widget_binding.call(model_binding.evaluate_options_property)
47
48
  model = model_binding.base_model
48
49
  widget_binding.observe(model, model_binding.options_property_name)
49
50
 
50
- widget_binding = DataBinding::WidgetBinding.new(parent, 'selection')
51
+ widget_binding = DataBinding::WidgetBinding.new(parent, 'selection', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
51
52
  widget_binding.call(model_binding.evaluate_property)
52
- widget_binding.observe(model, model_binding.property_name_expression)
53
+ widget_binding.observe(model_binding)
53
54
 
54
55
  raise(Glimmer::Error, "No radios found! Make sure radio selection is data-bound to a property having property_options as non-empty array!") if parent.items.empty?
55
- parent.on_widget_selected do
56
- model_binding.call(widget_binding.evaluate_property)
56
+ Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
57
+ parent.on_widget_selected do
58
+ model_binding.call(widget_binding.evaluate_property)
59
+ end
57
60
  end
58
61
  end
59
62
  end
@@ -37,7 +37,7 @@ module Glimmer
37
37
  end
38
38
 
39
39
  def interpret(parent, keyword, *args, &block)
40
- Glimmer::SWT::Custom::Shape.new(parent, keyword, *args, &block)
40
+ Glimmer::SWT::Custom::Shape.create(parent, keyword, *args, &block)
41
41
  end
42
42
 
43
43
  def add_content(parent, &block)
@@ -33,10 +33,11 @@ module Glimmer
33
33
  EXCLUDED_KEYWORDS = %w[shell display tab_item] + Glimmer::SWT::Custom::Shape.keywords - ['text']
34
34
 
35
35
  def can_interpret?(parent, keyword, *args, &block)
36
- result = !EXCLUDED_KEYWORDS.include?(keyword) &&
37
- parent.respond_to?(:swt_widget) && #TODO change to composite?(parent)
36
+ !EXCLUDED_KEYWORDS.include?(keyword) and
37
+ parent.respond_to?(:swt_widget) and
38
+ !parent.is_a?(Glimmer::SWT::Custom::Shape) and
39
+ !((keyword.to_s == 'text') and (args.first.is_a?(String) or parent.swt_widget.class == org.eclipse.swt.widgets.Canvas)) and
38
40
  Glimmer::SWT::WidgetProxy.widget_exists?(keyword)
39
- (keyword.to_s == 'text' && args.first.is_a?(String)) ? false : result
40
41
  end
41
42
 
42
43
  def interpret(parent, keyword, *args, &block)
@@ -27,9 +27,12 @@ require 'fileutils'
27
27
  require 'os'
28
28
 
29
29
  module Glimmer
30
+ # Launcher of glimmer applications and main entry point for the `glimmer` command.
30
31
  class Launcher
31
32
  OPERATING_SYSTEMS_SUPPORTED = ["mac", "windows", "linux"]
32
33
 
34
+ # TODO convert to a bash script to achieve faster startup time
35
+
33
36
  TEXT_USAGE = <<~MULTI_LINE_STRING
34
37
  Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v#{File.read(File.expand_path('../../../VERSION', __FILE__))}
35
38
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
@@ -94,6 +94,9 @@ module Glimmer
94
94
  # Mac
95
95
  .DS_Store
96
96
 
97
+ # Warbler
98
+ Jars.lock
99
+
97
100
  # Gladiator (Glimmer Editor)
98
101
  .gladiator
99
102
 
@@ -136,13 +136,13 @@ module Glimmer
136
136
  editable false
137
137
  caret nil
138
138
  on_focus_gained {
139
- @styled_text_proxy&.swt_widget.setFocus
139
+ @styled_text_proxy&.setFocus
140
140
  }
141
141
  on_key_pressed {
142
- @styled_text_proxy&.swt_widget.setFocus
142
+ @styled_text_proxy&.setFocus
143
143
  }
144
144
  on_mouse_up {
145
- @styled_text_proxy&.swt_widget.setFocus
145
+ @styled_text_proxy&.setFocus
146
146
  }
147
147
  }
148
148
 
@@ -172,7 +172,7 @@ module Glimmer
172
172
  character = event.keyCode.chr rescue nil
173
173
  case [event.stateMask, character]
174
174
  when [(OS.mac? ? swt(:command) : swt(:ctrl)), 'a']
175
- @styled_text_proxy.swt_widget.selectAll
175
+ @styled_text_proxy.selectAll
176
176
  when [(swt(:ctrl) if OS.mac?), 'a']
177
177
  jump_to_beginning_of_line
178
178
  when [(swt(:ctrl) if OS.mac?), 'e']
@@ -263,17 +263,17 @@ module Glimmer
263
263
  end
264
264
 
265
265
  def jump_to_beginning_of_line
266
- current_line_index = @styled_text_proxy.swt_widget.getLineAtOffset(@styled_text_proxy.swt_widget.getCaretOffset)
267
- beginning_of_current_line_offset = @styled_text_proxy.swt_widget.getOffsetAtLine(current_line_index)
268
- @styled_text_proxy.swt_widget.setSelection(beginning_of_current_line_offset, beginning_of_current_line_offset)
266
+ current_line_index = @styled_text_proxy.getLineAtOffset(@styled_text_proxy.getCaretOffset)
267
+ beginning_of_current_line_offset = @styled_text_proxy.getOffsetAtLine(current_line_index)
268
+ @styled_text_proxy.setSelection(beginning_of_current_line_offset, beginning_of_current_line_offset)
269
269
  end
270
270
 
271
271
  def jump_to_end_of_line
272
- current_line_index = @styled_text_proxy.swt_widget.getLineAtOffset(@styled_text_proxy.swt_widget.getCaretOffset)
273
- current_line = @styled_text_proxy.swt_widget.getLine(current_line_index)
274
- beginning_of_current_line_offset = @styled_text_proxy.swt_widget.getOffsetAtLine(current_line_index)
272
+ current_line_index = @styled_text_proxy.getLineAtOffset(@styled_text_proxy.getCaretOffset)
273
+ current_line = @styled_text_proxy.getLine(current_line_index)
274
+ beginning_of_current_line_offset = @styled_text_proxy.getOffsetAtLine(current_line_index)
275
275
  new_offset = beginning_of_current_line_offset + current_line.size
276
- @styled_text_proxy.swt_widget.setSelection(new_offset, new_offset)
276
+ @styled_text_proxy.setSelection(new_offset, new_offset)
277
277
  end
278
278
  end
279
279
  end
@@ -38,6 +38,10 @@ module Glimmer
38
38
  @image_buffered_shapes ||= []
39
39
  end
40
40
 
41
+ def shape_at_location(x, y)
42
+ shapes.reverse.detect {|shape| shape.include?(x, y)}
43
+ end
44
+
41
45
  def add_shape(shape)
42
46
  if !@image_double_buffered || shape.args.first == @image_proxy_buffer
43
47
  shapes << shape
@@ -38,6 +38,15 @@ module Glimmer
38
38
  # TODO support a Pattern DSL for methods that take Pattern arguments
39
39
 
40
40
  class << self
41
+ def create(parent, keyword, *args, &property_block)
42
+ potential_shape_class_name = keyword.to_s.camelcase(:upper).to_sym
43
+ if constants.include?(potential_shape_class_name)
44
+ const_get(potential_shape_class_name).new(parent, keyword, *args, &property_block)
45
+ else
46
+ new(parent, keyword, *args, &property_block)
47
+ end
48
+ end
49
+
41
50
  def valid?(parent, keyword, *args, &block)
42
51
  gc_instance_methods.include?(method_name(keyword, arg_options(args)))
43
52
  end
@@ -79,15 +88,15 @@ module Glimmer
79
88
  end
80
89
 
81
90
  def pattern(*args)
82
- found_pattern = flyweigh_patterns[args]
91
+ found_pattern = flyweight_patterns[args]
83
92
  if found_pattern.nil? || found_pattern.is_disposed
84
- found_pattern = flyweigh_patterns[args] = org.eclipse.swt.graphics.Pattern.new(*args)
93
+ found_pattern = flyweight_patterns[args] = org.eclipse.swt.graphics.Pattern.new(*args)
85
94
  end
86
95
  found_pattern
87
96
  end
88
97
 
89
- def flyweigh_patterns
90
- @flyweigh_patterns ||= {}
98
+ def flyweight_patterns
99
+ @flyweight_patterns ||= {}
91
100
  end
92
101
  end
93
102
 
@@ -123,6 +132,29 @@ module Glimmer
123
132
  @options[:round]
124
133
  end
125
134
 
135
+ # subclasses (like polygon) may override to indicate if a point x,y coordinates fall inside the shape
136
+ # has a default implementation for rectangle and oval
137
+ def include?(x, y)
138
+ case @name
139
+ when 'rectangle', 'oval', 'arc'
140
+ self_x = self.x
141
+ self_y = self.y
142
+ width = self.width
143
+ height = self.height
144
+ x.between?(self_x, self_x + width) && y.between?(self_y, self_y + height)
145
+ else
146
+ false
147
+ end
148
+ end
149
+
150
+ def move_by(x_delta, y_delta)
151
+ case @name
152
+ when 'rectangle', 'oval', 'arc'
153
+ self.x += x_delta
154
+ self.y += y_delta
155
+ end
156
+ end
157
+
126
158
  def has_some_background?
127
159
  @properties.keys.map(&:to_s).include?('background') || @properties.keys.map(&:to_s).include?('background_pattern')
128
160
  end
@@ -174,8 +206,15 @@ module Glimmer
174
206
  args[i] = arg.swt_color
175
207
  end
176
208
  end
177
- new_args = [DisplayProxy.instance.swt_display] + args
178
- args[0] = pattern(*new_args, type: method_name.to_s.match(/set(.+)Pattern/)[1])
209
+ @pattern_args ||= {}
210
+ pattern_type = method_name.to_s.match(/set(.+)Pattern/)[1]
211
+ if args.first.is_a?(Pattern)
212
+ new_args = @pattern_args[pattern_type]
213
+ else
214
+ new_args = [DisplayProxy.instance.swt_display] + args
215
+ @pattern_args[pattern_type] = new_args
216
+ end
217
+ args[0] = pattern(*new_args, type: pattern_type)
179
218
  args[1..-1] = []
180
219
  end
181
220
  args
@@ -186,6 +225,28 @@ module Glimmer
186
225
  @args[0] = @args.dup
187
226
  @args[1..-1] = []
188
227
  end
228
+ if @name == 'image'
229
+ if @args.first.is_a?(String)
230
+ @args[0] = ImageProxy.new(@args[0])
231
+ end
232
+ if @args.first.is_a?(ImageProxy)
233
+ @image = @args[0] = @args[0].swt_image
234
+ end
235
+ if @args.first.nil?
236
+ @image = nil
237
+ end
238
+ end
239
+ if @name == 'text'
240
+ if @args[3].is_a?(Symbol) || @args[3].is_a?(String)
241
+ @args[3] = [@args[3]]
242
+ end
243
+ if @args[3].is_a?(Array)
244
+ if @args[3].size == 1 && @args[3].first.is_a?(Array)
245
+ @args[3] = @args[3].first
246
+ end
247
+ @args[3] = SWTProxy[*@args[3]]
248
+ end
249
+ end
189
250
  end
190
251
 
191
252
  def apply_shape_arg_defaults!
@@ -202,12 +263,6 @@ module Glimmer
202
263
  @args[1] = 0
203
264
  @args[2] = 0
204
265
  end
205
- if @args.first.is_a?(String)
206
- @args[0] = ImageProxy.new(@args[0])
207
- end
208
- if @args.first.is_a?(ImageProxy)
209
- @image = @args[0] = @args[0].swt_image
210
- end
211
266
  end
212
267
  end
213
268
 
@@ -217,14 +272,14 @@ module Glimmer
217
272
  the_java_method_arg_count = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.select do |m|
218
273
  m.name == @method_name.camelcase(:lower)
219
274
  end.map(&:parameter_types).map(&:size).max
220
- if @args.size > the_java_method_arg_count
275
+ if the_java_method_arg_count && @args.to_a.size > the_java_method_arg_count
221
276
  @args[the_java_method_arg_count..-1] = []
222
277
  end
223
278
  end
224
279
 
225
280
  def amend_method_name_options_based_on_properties!
226
281
  return if @name == 'point'
227
- if has_some_background? && !has_some_foreground?
282
+ if @name != 'text' && has_some_background? && !has_some_foreground?
228
283
  @options[:fill] = true
229
284
  elsif !has_some_background? && has_some_foreground?
230
285
  @options[:fill] = false
@@ -237,13 +292,39 @@ module Glimmer
237
292
  end
238
293
  @method_name = self.class.method_name(@name, @options)
239
294
  end
240
-
295
+
296
+ # parameter names for arguments to pass to SWT GC.xyz method for rendering shape (e.g. draw_image(image, x, y) yields :image, :x, :y parameter names)
297
+ def parameter_names
298
+ []
299
+ end
300
+
301
+ def possible_parameter_names
302
+ parameter_names
303
+ end
304
+
305
+ def parameter_name?(attribute_name)
306
+ possible_parameter_names.map(&:to_s).include?(ruby_attribute_getter(attribute_name))
307
+ end
308
+
309
+ def parameter_index(attribute_name)
310
+ parameter_names.map(&:to_s).index(attribute_name.to_s)
311
+ end
312
+
313
+ def set_parameter_attribute(attribute_name, *args)
314
+ @args[parameter_index(ruby_attribute_getter(attribute_name))] = args.size == 1 ? args.first : args
315
+ end
316
+
241
317
  def has_attribute?(attribute_name, *args)
242
- self.class.gc_instance_methods.include?(attribute_setter(attribute_name))
318
+ self.class.gc_instance_methods.include?(attribute_setter(attribute_name)) or
319
+ parameter_name?(attribute_name)
243
320
  end
244
321
 
245
322
  def set_attribute(attribute_name, *args)
246
- @properties[attribute_name] = args
323
+ if parameter_name?(attribute_name)
324
+ set_parameter_attribute(attribute_name, *args)
325
+ else
326
+ @properties[attribute_name] = args
327
+ end
247
328
  if @content_added && !@parent.is_disposed
248
329
  @calculated_paint_args = false
249
330
  @parent.redraw
@@ -251,13 +332,35 @@ module Glimmer
251
332
  end
252
333
 
253
334
  def get_attribute(attribute_name)
254
- @properties.symbolize_keys[attribute_name.to_s.to_sym]
335
+ if parameter_name?(attribute_name)
336
+ @args[parameter_index(attribute_name)]
337
+ else
338
+ @properties.symbolize_keys[attribute_name.to_s.to_sym]
339
+ end
340
+ end
341
+
342
+ def method_missing(method_name, *args, &block)
343
+ if method_name.to_s.end_with?('=')
344
+ set_attribute(method_name, *args)
345
+ elsif has_attribute?(method_name)
346
+ get_attribute(method_name)
347
+ else
348
+ super
349
+ end
350
+ end
351
+
352
+ def respond_to?(method_name, *args, &block)
353
+ if has_attribute?(method_name)
354
+ true
355
+ else
356
+ super
357
+ end
255
358
  end
256
359
 
257
360
  def pattern(*args, type: nil)
258
361
  instance_variable_name = "@#{type}_pattern"
259
362
  the_pattern = instance_variable_get(instance_variable_name)
260
- if the_pattern.nil?
363
+ if the_pattern.nil? || the_pattern.is_disposed
261
364
  the_pattern = self.class.pattern(*args)
262
365
  end
263
366
  the_pattern
@@ -288,11 +391,15 @@ module Glimmer
288
391
  end
289
392
  end
290
393
  paint_event.gc.send(@method_name, *@args)
394
+ rescue => e
395
+ Glimmer::Config.logger.error {"Error encountered in painting shape: #{self.inspect}"}
396
+ Glimmer::Config.logger.error {e.full_message}
291
397
  end
292
398
 
293
399
  def calculate_paint_args!
294
400
  unless @calculated_paint_args
295
- if @name == 'point'
401
+ if @name == 'pixel'
402
+ @name = 'point'
296
403
  # optimized performance calculation for pixel points
297
404
  if !@properties[:foreground].is_a?(Color)
298
405
  if @properties[:foreground].is_a?(Array)
@@ -334,3 +441,5 @@ module Glimmer
334
441
  end
335
442
 
336
443
  end
444
+
445
+ Dir[File.expand_path(File.join(__dir__, 'shape', '**', '*.rb'))].each {|shape_file| require(shape_file)}
@@ -0,0 +1,43 @@
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/custom/shape'
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
+ class Arc < Shape
36
+ def parameter_names
37
+ [:x, :y, :width, :height, :start_angle, :arc_angle]
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
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/custom/shape'
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
+ class Focus < Shape
36
+ def parameter_names
37
+ [:x, :y, :width, :height]
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end