glimmer-dsl-swt 4.18.5.0 → 4.18.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dae230b3e4a50ef2425a4b5155e98ff598e0bb0e3d1f7a5c15eaadcbf5688d41
4
- data.tar.gz: 7ec51028f89ec3ff207aecbb2f91ad43b03e1e6db8d03885e681972cdd9fd1f9
3
+ metadata.gz: e3086c3823faac7765ca33e069111da2f027462fc9d09a2a9799a2ff094d6692
4
+ data.tar.gz: be7070377808b55cfa4bde48543b8a98fdff77205c9db0c07d0f4ac42078e00e
5
5
  SHA512:
6
- metadata.gz: '0954400586b6df73a08070b2f7bd0669b11dca0ecb9ba614e1719b0a41e9966dad2f7d16c5f3b344bb14cbc4074978b793d206d6034dc3ce5034aee98e9732de'
7
- data.tar.gz: '086c20606c6319fa70c480b3633d60682723d246a46c7d4f3d2b2e8d3c9ed83f2d22a7e7f3288cc35fb38f11f0895ed3b98b8297ee607767094f179612aabbc2'
6
+ metadata.gz: 79e966ac5b7c342d8a9b936387e59f299f4895ae93c01600f8289cc06448b4d90beb0bd6e24073728d7a379172e1513b3cdf05fb3cdd4361ee08bd337870f491
7
+ data.tar.gz: 3c89781755c57a6cfc2990d85352bb37674e41a8d2f55f50c26c0d44f948ab26342b58bc98fcc9f93818cf19036ea0032a84b1565397abc7b7aa93a029b8c851
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.5.1
4
+
5
+ - Hello, Color Dialog! Sample
6
+ - Hello, Font Dialog! Sample
7
+ - Handle SWT RGB color data objects when setting colors on widgets (e.g. background)
8
+ - Enhance Hello, Canvas! with Color selector via right-click menu
9
+ - Fixed issue with tree multi selection throwing an exception
10
+
3
11
  ### 4.18.5.0
4
12
 
5
13
  - Automatic `sync_exec` usage from threads other than the GUI thread, thus absolving software engineers from the need to use `sync_exec` explicitly anymore.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.5.0
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.5.1
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -342,7 +342,7 @@ jgem install glimmer-dsl-swt
342
342
 
343
343
  Or this command if you want a specific version:
344
344
  ```
345
- jgem install glimmer-dsl-swt -v 4.18.5.0
345
+ jgem install glimmer-dsl-swt -v 4.18.5.1
346
346
  ```
347
347
 
348
348
  `jgem` is JRuby's version of `gem` command.
@@ -360,7 +360,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
360
360
 
361
361
  Add the following to `Gemfile`:
362
362
  ```
363
- gem 'glimmer-dsl-swt', '~> 4.18.5.0'
363
+ gem 'glimmer-dsl-swt', '~> 4.18.5.1'
364
364
  ```
365
365
 
366
366
  And, then run:
@@ -404,6 +404,8 @@ Glimmer configuration may be done via the `Glimmer::Config` module.
404
404
 
405
405
  ## Samples
406
406
 
407
+ See a listing of Glimmer DSL for SWT samples over here, including screenshots and explanations of what each sample demonstrates:
408
+
407
409
  [docs/reference/GLIMMER_SAMPLES.md](docs/reference/GLIMMER_SAMPLES.md)
408
410
 
409
411
  Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer-dsl-swt` gem first and then use the `glimmer samples` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.5.0
1
+ 4.18.5.1
@@ -432,7 +432,7 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
432
432
 
433
433
  Glimmer facilitates building dialogs by using the `dialog` keyword, which automatically adds the SWT.DIALOG_TRIM and SWT.APPLICATION_MODAL [widget styles](#widget-styles) needed for a dialog.
434
434
 
435
- Check out [Hello, Dialog!](#hello-dialog) sample to learn more.
435
+ Check out [Hello, Dialog!](GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
436
436
 
437
437
  ##### message_box
438
438
 
@@ -895,7 +895,7 @@ shell {
895
895
  }.open
896
896
  ```
897
897
 
898
- You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
898
+ You may check out a more full-fledged example in [Hello, Sash Form!](GLIMMER_SAMPLES.md#hello-sash-form)
899
899
 
900
900
  ![Hello Sash Form](/images/glimmer-hello-sash-form.png)
901
901
 
@@ -1473,7 +1473,7 @@ Screenshot:
1473
1473
 
1474
1474
  ![Canvas Animation Example](/images/glimmer-example-canvas.png)
1475
1475
 
1476
- Learn more at the [Hello, Canvas! Sample](#hello-canvas).
1476
+ Learn more at the [Hello, Canvas! Sample](GLIMMER_SAMPLES.md#hello-canvas).
1477
1477
 
1478
1478
  If you ever have special needs or optimizations, you could always default to direct SWT painting via [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) instead. Learn more at the [SWT Graphics Guide](https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html) and [SWT Image Guide](https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html#Saving%20Images).
1479
1479
 
@@ -1517,7 +1517,7 @@ shell {
1517
1517
 
1518
1518
  #### Shapes inside a Widget
1519
1519
 
1520
- Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
1520
+ Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](GLIMMER_SAMPLES.md#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
1521
1521
 
1522
1522
  #### Shapes inside an Image
1523
1523
 
@@ -1889,7 +1889,7 @@ transform(1, 1, 4, 2, 2, 4).
1889
1889
  translate(3, 7)
1890
1890
  ```
1891
1891
 
1892
- Learn more at the [Hello, Canvas Transform! Sample](#hello-canvas-transform).
1892
+ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-canvas-transform).
1893
1893
 
1894
1894
  ### Canvas Animation DSL
1895
1895
 
@@ -1955,7 +1955,7 @@ API of Animation Object (returned from `animation` keyword):
1955
1955
  - `#cycle_limited?` returns true if `cycle_count` is specified
1956
1956
  - `#duration_limited?` returns true if `duration_limit` is specified
1957
1957
 
1958
- Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
1958
+ Learn more at the [Hello, Canvas Animation! Sample](GLIMMER_SAMPLES.md#hello-canvas-animation).
1959
1959
 
1960
1960
  If there is anything missing you would like added to the Glimmer Animation DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
1961
1961
 
@@ -1963,7 +1963,7 @@ If there is anything missing you would like added to the Glimmer Animation DSL t
1963
1963
 
1964
1964
  Animation could be alternatively implemented without the `animation` keyword through a loop that invokes model methods inside `sync_exec {}` (or `async_exec {}`), which indirectly cause updates to the GUI via data-binding.
1965
1965
 
1966
- The [Glimmer Tetris](#glimmer-tetris) sample provides a good example of that.
1966
+ The [Glimmer Tetris](#tetris) sample provides a good example of that.
1967
1967
 
1968
1968
  ### Data-Binding
1969
1969
 
@@ -3162,7 +3162,7 @@ Simply install the [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video
3162
3162
  This [Eclipse guide](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm) for how to write custom SWT widgets is also applicable to Glimmer Custom Widgets written in Ruby. I recommend reading it:
3163
3163
  [https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm)
3164
3164
 
3165
- Also, you may check out [Hello, Custom Widget!](#hello-custom-widget) for another example.
3165
+ Also, you may check out [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
3166
3166
 
3167
3167
  ### Custom Shells
3168
3168
 
@@ -3233,7 +3233,7 @@ shell { |app_shell|
3233
3233
 
3234
3234
  If you use a Custom Shell as the top-level app shell, you may invoke the class method `::launch` instead to avoid building an app class yourself or including Glimmer into the top-level namespace (e.g. `Tetris.launch` instead of `include Glimmer; tetris.open`)
3235
3235
 
3236
- You may check out [Hello, Custom Shell!](#hello-custom-shell) for another example.
3236
+ You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
3237
3237
 
3238
3238
  ### Drag and Drop
3239
3239
 
@@ -3247,7 +3247,7 @@ To get started, simply follow these steps:
3247
3247
  1. On the drop target widget, add `on_drop` [DropTargetListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetListener.html) event handler block at minimum (you may also add `on_drag_enter` [must set [`event.detail`](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEvent.html#detail) if added], `on_drag_over`, `on_drag_leave`, `on_drag_operation_changed` and `on_drop_accept` if needed)
3248
3248
  1. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
3249
3249
 
3250
- Example (taken from [samples/hello/hello_drag_and_drop.rb](#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
3250
+ Example (taken from [samples/hello/hello_drag_and_drop.rb](GLIMMER_SAMPLES.md#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
3251
3251
 
3252
3252
  ```ruby
3253
3253
  class Location
@@ -36,6 +36,8 @@
36
36
  - [Hello, Cursor!](#hello-cursor)
37
37
  - [Hello, Progress Bar!](#hello-progress-bar)
38
38
  - [Hello, Tree!](#hello-tree)
39
+ - [Hello, Color Dialog!](#hello-color-dialog)
40
+ - [Hello, Font Dialog!](#hello-font-dialog)
39
41
  - [Elaborate Samples](#elaborate-samples)
40
42
  - [User Profile](#user-profile)
41
43
  - [Login](#login)
@@ -562,6 +564,22 @@ Hello, Canvas!
562
564
 
563
565
  ![Hello Canvas](/images/glimmer-hello-canvas.png)
564
566
 
567
+ Hello, Canvas! with Moved Shapes (via Drag'n'Drop)
568
+
569
+ ![Hello Canvas Moved Shapes](/images/glimmer-hello-canvas-moved-shapes.png)
570
+
571
+ Hello, Canvas! Menu (for background/foreground color changes)
572
+
573
+ ![Hello Canvas Menu](/images/glimmer-hello-canvas-menu.png)
574
+
575
+ Hello, Canvas! Color Dialog
576
+
577
+ ![Hello Canvas Color Dialog](/images/glimmer-hello-canvas-color-dialog.png)
578
+
579
+ Hello, Canvas! Colors Changed
580
+
581
+ ![Hello Canvas Colors Changed](/images/glimmer-hello-canvas-colors-changed.png)
582
+
565
583
  #### Hello, Canvas Animation!
566
584
 
567
585
  This sample demonstrates the use of the `canvas` widget and [Animation DSL](#canvas-animation-dsl) in Glimmer.
@@ -630,6 +648,38 @@ Hello, Tree!
630
648
 
631
649
  ![Hello Tree](/images/glimmer-hello-tree.png)
632
650
 
651
+ #### Hello, Color Dialog!
652
+
653
+ This sample demonstrates the use of the `color_dialog` keyword.
654
+
655
+ Code:
656
+
657
+ [samples/hello/hello_color_dialog.rb](/samples/hello/hello_color_dialog.rb)
658
+
659
+ Hello, Color Dialog!
660
+
661
+ ![Hello Color Dialog](/images/glimmer-hello-color-dialog.png)
662
+
663
+ ![Hello Color Dialog Choose Color](/images/glimmer-hello-color-dialog-choose-color.png)
664
+
665
+ ![Hello Color Dialog Color Changed](/images/glimmer-hello-color-dialog-color-changed.png)
666
+
667
+ #### Hello, Font Dialog!
668
+
669
+ This sample demonstrates the use of the `font_dialog` keyword.
670
+
671
+ Code:
672
+
673
+ [samples/hello/hello_font_dialog.rb](/samples/hello/hello_font_dialog.rb)
674
+
675
+ Hello, Font Dialog!
676
+
677
+ ![Hello Font Dialog](/images/glimmer-hello-font-dialog.png)
678
+
679
+ ![Hello Font Dialog Choose Font](/images/glimmer-hello-font-dialog-choose-font.png)
680
+
681
+ ![Hello Font Dialog Font Changed](/images/glimmer-hello-font-dialog-font-changed.png)
682
+
633
683
  ### Elaborate Samples
634
684
 
635
685
  For more elaborate samples, check the following:
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.18.5.0 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.5.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.5.0"
9
+ s.version = "4.18.5.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-02-22"
14
+ s.date = "2021-02-23"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -69,13 +69,11 @@ Gem::Specification.new do |s|
69
69
  "lib/glimmer/dsl/swt/custom_widget_expression.rb",
70
70
  "lib/glimmer/dsl/swt/data_binding_expression.rb",
71
71
  "lib/glimmer/dsl/swt/dialog_expression.rb",
72
- "lib/glimmer/dsl/swt/directory_dialog_expression.rb",
73
72
  "lib/glimmer/dsl/swt/display_expression.rb",
74
73
  "lib/glimmer/dsl/swt/dnd_expression.rb",
75
74
  "lib/glimmer/dsl/swt/dsl.rb",
76
75
  "lib/glimmer/dsl/swt/exec_expression.rb",
77
76
  "lib/glimmer/dsl/swt/expand_item_expression.rb",
78
- "lib/glimmer/dsl/swt/file_dialog_expression.rb",
79
77
  "lib/glimmer/dsl/swt/font_expression.rb",
80
78
  "lib/glimmer/dsl/swt/image_expression.rb",
81
79
  "lib/glimmer/dsl/swt/layout_data_expression.rb",
@@ -127,11 +125,10 @@ Gem::Specification.new do |s|
127
125
  "lib/glimmer/swt/custom/shape/rectangle.rb",
128
126
  "lib/glimmer/swt/custom/shape/text.rb",
129
127
  "lib/glimmer/swt/date_time_proxy.rb",
130
- "lib/glimmer/swt/directory_dialog_proxy.rb",
128
+ "lib/glimmer/swt/dialog_proxy.rb",
131
129
  "lib/glimmer/swt/display_proxy.rb",
132
130
  "lib/glimmer/swt/dnd_proxy.rb",
133
131
  "lib/glimmer/swt/expand_item_proxy.rb",
134
- "lib/glimmer/swt/file_dialog_proxy.rb",
135
132
  "lib/glimmer/swt/font_proxy.rb",
136
133
  "lib/glimmer/swt/image_proxy.rb",
137
134
  "lib/glimmer/swt/layout_data_proxy.rb",
@@ -140,6 +137,7 @@ Gem::Specification.new do |s|
140
137
  "lib/glimmer/swt/message_box_proxy.rb",
141
138
  "lib/glimmer/swt/packages.rb",
142
139
  "lib/glimmer/swt/properties.rb",
140
+ "lib/glimmer/swt/proxy_properties.rb",
143
141
  "lib/glimmer/swt/sash_form_proxy.rb",
144
142
  "lib/glimmer/swt/scrolled_composite_proxy.rb",
145
143
  "lib/glimmer/swt/shell_proxy.rb",
@@ -186,6 +184,7 @@ Gem::Specification.new do |s|
186
184
  "samples/hello/hello_checkbox.rb",
187
185
  "samples/hello/hello_checkbox_group.rb",
188
186
  "samples/hello/hello_code_text.rb",
187
+ "samples/hello/hello_color_dialog.rb",
189
188
  "samples/hello/hello_combo.rb",
190
189
  "samples/hello/hello_computed.rb",
191
190
  "samples/hello/hello_computed/contact.rb",
@@ -198,6 +197,7 @@ Gem::Specification.new do |s|
198
197
  "samples/hello/hello_drag_and_drop.rb",
199
198
  "samples/hello/hello_expand_bar.rb",
200
199
  "samples/hello/hello_file_dialog.rb",
200
+ "samples/hello/hello_font_dialog.rb",
201
201
  "samples/hello/hello_group.rb",
202
202
  "samples/hello/hello_link.rb",
203
203
  "samples/hello/hello_list_multi_selection.rb",
@@ -52,7 +52,10 @@ module Glimmer
52
52
  unregister_all_observables
53
53
  return
54
54
  end
55
- @widget.set_attribute(@property, value) unless evaluate_property == value
55
+ # need the rescue false for a scenario with tree items not being equal to model objects raising an exception
56
+ unless ((value == evaluate_property) rescue false) # need the rescue false for a scenario with tree items not being equal to model objects raising an exception
57
+ @widget.set_attribute(@property, value)
58
+ end
56
59
  end
57
60
  end
58
61
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2021 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -23,24 +23,33 @@ require 'glimmer/dsl/static_expression'
23
23
  require 'glimmer/dsl/parent_expression'
24
24
  require 'glimmer/dsl/top_level_expression'
25
25
  require 'glimmer/swt/shell_proxy'
26
+ require 'glimmer/swt/dialog_proxy'
26
27
 
27
28
  module Glimmer
28
29
  module DSL
29
30
  module SWT
30
- class DialogExpression < StaticExpression
31
+ class DialogExpression < Expression
31
32
  include TopLevelExpression
32
33
  include ParentExpression
33
34
 
34
35
  def can_interpret?(parent, keyword, *args, &block)
35
- keyword == 'dialog' and
36
- (parent.nil? or parent.is_a?(Glimmer::SWT::ShellProxy))
36
+ (
37
+ (keyword == 'dialog') or
38
+ (keyword.to_s.end_with?('dialog') and Glimmer::SWT::DialogProxy.dialog_class(keyword))
39
+ ) and
40
+ (parent.nil? or parent.is_a?(org.eclipse.swt.widgets.Shell) or parent.is_a?(Glimmer::SWT::ShellProxy))
37
41
  end
38
42
 
39
43
  def interpret(parent, keyword, *args, &block)
40
44
  # TODO reconcile this with the actual org.eclipse.swt.widgets.Dialog widget (maybe rename this as dialog_shell)
41
- args = [parent] + args unless parent.nil?
42
- args += [:dialog_trim, :application_modal]
43
- Glimmer::SWT::ShellProxy.send(:new, *args)
45
+ if keyword == 'dialog'
46
+ args = [parent] + args unless parent.nil?
47
+ args += [:dialog_trim, :application_modal]
48
+ Glimmer::SWT::ShellProxy.new(*args)
49
+ else
50
+ args = [parent] + args unless parent.nil?
51
+ Glimmer::SWT::DialogProxy.new(keyword, *args)
52
+ end
44
53
  end
45
54
  end
46
55
  end
@@ -53,6 +53,7 @@ module Glimmer
53
53
  multiply
54
54
  property
55
55
  block_property
56
+ dialog
56
57
  widget
57
58
  custom_widget
58
59
  shape
@@ -37,7 +37,7 @@ module Glimmer
37
37
  (parent.nil? || !parent.respond_to?('font')) and
38
38
  !parent.is_a?(Glimmer::SWT::Custom::Shape) and
39
39
  args.size == 1 and
40
- args.first.is_a?(Hash)
40
+ (args.first.is_a?(Hash) || args.first.is_a?(org.eclipse.swt.graphics.FontData))
41
41
  end
42
42
 
43
43
  def interpret(parent, keyword, *args, &block)
@@ -38,7 +38,7 @@ module Glimmer
38
38
 
39
39
  def interpret(parent, keyword, *args, &block)
40
40
  args = [parent] + args unless parent.nil?
41
- Glimmer::SWT::ShellProxy.send(:new, *args)
41
+ Glimmer::SWT::ShellProxy.new(*args)
42
42
  end
43
43
  end
44
44
  class WindowExpression < ShellExpression
@@ -174,6 +174,9 @@ module Glimmer
174
174
  def apply_property_arg_conversions(method_name, property, args)
175
175
  args = args.dup
176
176
  the_java_method = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.detect {|m| m.name == method_name}
177
+ if the_java_method.parameter_types.first == Color.java_class && args.first.is_a?(RGB)
178
+ args[0] = [args[0].red, args[0].green, args[0].blue]
179
+ end
177
180
  if ['setBackground', 'setForeground'].include?(method_name.to_s) && args.first.is_a?(Array)
178
181
  args[0] = ColorProxy.new(args[0])
179
182
  end
@@ -188,7 +191,7 @@ module Glimmer
188
191
  if args.first.is_a?(ColorProxy)
189
192
  args[0] = args[0].swt_color
190
193
  end
191
- if args.first.is_a?(Hash) && the_java_method.parameter_types.first == Font.java_class
194
+ if (args.first.is_a?(Hash) || args.first.is_a?(FontData)) && the_java_method.parameter_types.first == Font.java_class
192
195
  args[0] = FontProxy.new(args[0])
193
196
  end
194
197
  if args.first.is_a?(FontProxy)
@@ -199,20 +202,20 @@ module Glimmer
199
202
  end
200
203
  if ['setBackgroundPattern', 'setForegroundPattern'].include?(method_name.to_s)
201
204
  @parent.requires_shape_disposal = true
205
+ args = args.first if args.first.is_a?(Array)
202
206
  args.each_with_index do |arg, i|
203
- if arg.is_a?(Symbol) || arg.is_a?(String)
204
- args[i] = ColorProxy.new(arg).swt_color
205
- elsif arg.is_a?(ColorProxy)
206
- args[i] = arg.swt_color
207
- end
207
+ arg = ColorProxy.new(arg.red, arg.green, arg.blue) if arg.is_a?(RGB)
208
+ arg = ColorProxy.new(arg) if arg.is_a?(Symbol) || arg.is_a?(String)
209
+ arg = arg.swt_color if arg.is_a?(ColorProxy)
210
+ args[i] = arg
208
211
  end
209
212
  @pattern_args ||= {}
210
213
  pattern_type = method_name.to_s.match(/set(.+)Pattern/)[1]
211
214
  if args.first.is_a?(Pattern)
212
215
  new_args = @pattern_args[pattern_type]
213
216
  else
214
- new_args = [DisplayProxy.instance.swt_display] + args
215
- @pattern_args[pattern_type] = new_args
217
+ new_args = args.first.is_a?(Display) ? args : ([DisplayProxy.instance.swt_display] + args)
218
+ @pattern_args[pattern_type] = new_args.dup
216
219
  end
217
220
  args[0] = pattern(*new_args, type: pattern_type)
218
221
  args[1..-1] = []
@@ -323,7 +326,7 @@ module Glimmer
323
326
  if parameter_name?(attribute_name)
324
327
  set_parameter_attribute(attribute_name, *args)
325
328
  else
326
- @properties[attribute_name] = args
329
+ @properties[ruby_attribute_getter(attribute_name)] = args
327
330
  end
328
331
  if @content_added && !@parent.is_disposed
329
332
  @calculated_paint_args = false
@@ -366,6 +369,18 @@ module Glimmer
366
369
  the_pattern
367
370
  end
368
371
 
372
+ def pattern_args(type: nil)
373
+ @pattern_args && @pattern_args[type.to_s.capitalize]
374
+ end
375
+
376
+ def background_pattern_args
377
+ pattern_args(type: 'background')
378
+ end
379
+
380
+ def foreground_pattern_args
381
+ pattern_args(type: 'foreground')
382
+ end
383
+
369
384
  def dispose(dispose_images: true, dispose_patterns: true)
370
385
  if dispose_patterns
371
386
  @background_pattern&.dispose