glimmer-dsl-swt 4.18.7.6 → 4.20.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +34 -21
  4. data/RUBY_VERSION +1 -1
  5. data/VERSION +1 -1
  6. data/bin/girb +10 -9
  7. data/bin/girb_runner.rb +8 -3
  8. data/bin/glimmer +10 -1
  9. data/bin/glimmer-setup +58 -0
  10. data/bin/glimmer_runner.rb +4 -0
  11. data/docs/reference/GLIMMER_COMMAND.md +19 -30
  12. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +39 -10
  13. data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +7 -1
  14. data/docs/reference/GLIMMER_SAMPLES.md +27 -0
  15. data/glimmer-dsl-swt.gemspec +0 -0
  16. data/lib/glimmer-dsl-swt.rb +8 -0
  17. data/lib/glimmer/data_binding/shine.rb +41 -26
  18. data/lib/glimmer/data_binding/widget_binding.rb +1 -1
  19. data/lib/glimmer/dsl/swt/c_tab_item_expression.rb +58 -0
  20. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +2 -1
  21. data/lib/glimmer/dsl/swt/dsl.rb +2 -1
  22. data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +49 -0
  23. data/lib/glimmer/dsl/swt/tab_item_expression.rb +7 -3
  24. data/lib/glimmer/dsl/swt/widget_expression.rb +1 -1
  25. data/lib/glimmer/launcher.rb +33 -51
  26. data/lib/glimmer/rake_task.rb +1 -1
  27. data/lib/glimmer/rake_task/package.rb +7 -2
  28. data/lib/glimmer/rake_task/scaffold.rb +227 -254
  29. data/lib/glimmer/swt/c_tab_item_proxy.rb +53 -0
  30. data/lib/glimmer/swt/custom/code_text.rb +17 -9
  31. data/lib/glimmer/swt/custom/shape.rb +15 -1
  32. data/lib/glimmer/swt/sash_form_proxy.rb +6 -0
  33. data/lib/glimmer/swt/shell_proxy.rb +3 -1
  34. data/lib/glimmer/swt/tab_folder_proxy.rb +1 -0
  35. data/lib/glimmer/swt/tab_item_proxy.rb +17 -18
  36. data/lib/glimmer/swt/widget_proxy.rb +9 -0
  37. data/samples/elaborate/contact_manager.rb +7 -5
  38. data/samples/elaborate/login.rb +7 -7
  39. data/samples/elaborate/mandelbrot_fractal.rb +13 -8
  40. data/samples/elaborate/meta_sample.rb +4 -2
  41. data/samples/elaborate/metronome.rb +4 -4
  42. data/samples/elaborate/stock_ticker.rb +2 -2
  43. data/samples/elaborate/tic_tac_toe.rb +2 -2
  44. data/samples/hello/hello_button.rb +1 -1
  45. data/samples/hello/hello_c_combo.rb +69 -0
  46. data/samples/hello/hello_c_tab.rb +174 -0
  47. data/samples/hello/hello_c_tab/denmark.png +0 -0
  48. data/samples/hello/hello_c_tab/finland.png +0 -0
  49. data/samples/hello/hello_c_tab/france.png +0 -0
  50. data/samples/hello/hello_c_tab/germany.png +0 -0
  51. data/samples/hello/hello_c_tab/italy.png +0 -0
  52. data/samples/hello/hello_c_tab/mexico.png +0 -0
  53. data/samples/hello/hello_c_tab/netherlands.png +0 -0
  54. data/samples/hello/hello_c_tab/norway.png +0 -0
  55. data/samples/hello/hello_c_tab/usa.png +0 -0
  56. data/samples/hello/hello_canvas.rb +5 -5
  57. data/samples/hello/hello_canvas_animation_data_binding.rb +1 -1
  58. data/samples/hello/hello_canvas_data_binding.rb +16 -16
  59. data/samples/hello/hello_checkbox.rb +4 -4
  60. data/samples/hello/hello_code_text.rb +3 -57
  61. data/samples/hello/hello_color_dialog.rb +1 -1
  62. data/samples/hello/hello_combo.rb +1 -1
  63. data/samples/hello/hello_computed.rb +5 -5
  64. data/samples/hello/hello_custom_widget.rb +1 -1
  65. data/samples/hello/hello_date_time.rb +4 -4
  66. data/samples/hello/hello_dialog.rb +3 -2
  67. data/samples/hello/hello_drag_and_drop.rb +1 -1
  68. data/samples/hello/hello_file_dialog.rb +1 -1
  69. data/samples/hello/hello_font_dialog.rb +3 -3
  70. data/samples/hello/hello_group.rb +6 -6
  71. data/samples/hello/hello_link.rb +56 -50
  72. data/samples/hello/hello_list_multi_selection.rb +1 -1
  73. data/samples/hello/hello_list_single_selection.rb +1 -1
  74. data/samples/hello/hello_progress_bar.rb +10 -10
  75. data/samples/hello/hello_radio.rb +6 -6
  76. data/samples/hello/hello_sash_form.rb +4 -4
  77. data/samples/hello/hello_shape.rb +1 -0
  78. data/samples/hello/hello_spinner.rb +6 -2
  79. data/samples/hello/hello_styled_text.rb +11 -11
  80. data/samples/hello/hello_tab.rb +2 -0
  81. data/vendor/swt/linux/swt.jar +0 -0
  82. data/vendor/swt/linux_aarch64/swt.jar +0 -0
  83. data/vendor/swt/mac/swt.jar +0 -0
  84. data/vendor/swt/mac_aarch64/swt.jar +0 -0
  85. data/vendor/swt/windows/swt.jar +0 -0
  86. metadata +76 -32
@@ -368,7 +368,7 @@ These proxy objects have an API and provide some convenience methods, some of wh
368
368
 
369
369
  Glimmer SWT proxies come with the instance method `#swt_widget`, which returns the actual SWT `Widget` object wrapped by the Glimmer widget proxy. It is useful in cases you'd like to do some custom SWT programming outside of Glimmer.
370
370
 
371
- ##### Shell widget proxy methods
371
+ ##### Shell Widget Proxy Methods
372
372
 
373
373
  Shell widget proxy has extra methods specific to SWT Shell:
374
374
  - `#open`: Opens the shell, making it visible and active, and starting the SWT Event Loop (you may learn more about it here: https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Display.html). If shell was already open, but hidden, it makes the shell visible.
@@ -380,6 +380,7 @@ Shell widget proxy has extra methods specific to SWT Shell:
380
380
  - `#visible?`: Returns whether a shell is visible
381
381
  - `#opened_before?`: Returns whether a shell has been opened at least once before (additionally implying the SWT Event Loop has been started already)
382
382
  - `#visible=`: Setting to true opens/shows shell. Setting to false hides the shell.
383
+ - `#layout`: Lays out contained widgets using SWT's `Shell#layout` method
383
384
  - `#pack`: Packs contained widgets using SWT's `Shell#pack` method
384
385
  - `#pack_same_size`: Packs contained widgets without changing shell's size when widget sizes change
385
386
 
@@ -919,6 +920,7 @@ Example loading a URL (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
919
920
  ```ruby
920
921
  shell {
921
922
  minimum_size 1024, 860
923
+ maximum_size 2000, 1000
922
924
  browser {
923
925
  url 'http://brightonresort.com/about'
924
926
  }
@@ -1040,6 +1042,10 @@ shell(:no_resize) {
1040
1042
  }
1041
1043
  ```
1042
1044
 
1045
+ ##### Fill Screen Window
1046
+
1047
+ SWT Shell can open and fill the screen with this style `swt(:fill_screen)`. This makes it have the size of the display, thus filling the screen. Keep in mind that this is different from being maximized (which is a special window state, not just filling the screen).
1048
+
1043
1049
  ### Widget Properties
1044
1050
 
1045
1051
  Widget properties such as text value, enablement, visibility, and layout details are set within the widget block using methods matching SWT widget property names in lower snakecase. You may refer to SWT widget guide for details on available widget properties:
@@ -2226,13 +2232,13 @@ This example adds on the one above it by specifying converters on read and write
2226
2232
 
2227
2233
  `text bind(contact, 'address.street', sync_exec: true)`
2228
2234
 
2229
- **(ALPHA FEATURE)**
2235
+ **(BETA FEATURE)**
2230
2236
 
2231
2237
  This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
2232
2238
 
2233
2239
  `text bind(contact, 'address.street', async_exec: true)`
2234
2240
 
2235
- **(ALPHA FEATURE)**
2241
+ **(BETA FEATURE)**
2236
2242
 
2237
2243
  This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
2238
2244
 
@@ -2244,7 +2250,7 @@ This example also specifies a converter on read of the model property, but via a
2244
2250
 
2245
2251
  This is a block shortcut version of the syntax above it. It facilitates formatting model data for read-only widgets since it's a very common view concern. It also saves the developer from having to create a separate formatter/presenter for the model when the view can be an active view that handles common simple formatting operations directly.
2246
2252
 
2247
- `text bind(contact, 'address.street', read_only: true)
2253
+ `text bind(contact, 'address.street', read_only: true)`
2248
2254
 
2249
2255
  This is read-ohly data-binding. It doesn't update contact.address.street when widget text property is changed.
2250
2256
 
@@ -2266,6 +2272,33 @@ This example demonstrates nested indexed computed value data binding whereby the
2266
2272
 
2267
2273
  Example from [samples/hello/hello_combo.rb](samples/hello_combo.rb) sample (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
2268
2274
 
2275
+ #### Shine
2276
+
2277
+ **(EARLY ALPHA FEATURE)**
2278
+
2279
+ The new Shine syntax for View/Model Attribute Mapping allows data-binding visually with simple arrow operators in Ruby.
2280
+
2281
+ Use `<=> [model, attribute, options]` for bidirectional (two-way) data-binding instead of `bind(model, attribute, options)`.
2282
+ Use `<= [model, attribute, options]` for unidirectional (one-way) data-binding instead of `bind(model, attribute, read_only: true, more_options)`
2283
+
2284
+ Examples:
2285
+
2286
+ ```ruby
2287
+ text <=> [@contact, :first_name]
2288
+ ```
2289
+
2290
+ ```ruby
2291
+ text <=> [@contact, :last_name]
2292
+ ```
2293
+
2294
+ ```ruby
2295
+ text <= [@contact, :name, computed_by: [:first_name, :last_name]]
2296
+ ```
2297
+
2298
+ Note that `table`, `tree`, custom widgets, custom shapes, and animations are not supported by Shine syntax for data-binding yet, so continue to use `bind` with them for the time being.
2299
+
2300
+ Check out [sample code](/samples) for more examples of Shine syntax in action, such as [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed).
2301
+
2269
2302
  #### Combo
2270
2303
 
2271
2304
  The `combo` widget provides a dropdown of options. By default, it also allows typing in a new option. To disable that behavior, you may use with the `:read_only` SWT style.
@@ -3119,8 +3152,6 @@ You may see another example at the [Hello, Radio Group!](GLIMMER_SAMPLES.md#hell
3119
3152
 
3120
3153
  ##### Code Text Custom Widget
3121
3154
 
3122
- **(BETA FEATURE)**
3123
-
3124
3155
  `code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
3125
3156
 
3126
3157
  It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
@@ -3145,8 +3176,6 @@ To use, simply use `code_text` in place of the `text` or `styled_text` widget. I
3145
3176
  **lines**
3146
3177
  (default: `false`)
3147
3178
 
3148
- **(BETA FEATURE)**
3149
-
3150
3179
  Shows line numbers when set to true.
3151
3180
 
3152
3181
  If set to a hash like `{width: 4}`, it sets the initial width of the line numbers lane in character count (default: 4)
@@ -3184,7 +3213,7 @@ Sets the code language, which can be one of the following [rouge gem](#https://r
3184
3213
  - bibtex
3185
3214
  - biml
3186
3215
  - bpf
3187
- - brainfuck
3216
+ - brainf*ck
3188
3217
  - brightscript
3189
3218
  - bsl
3190
3219
  - c
@@ -3471,7 +3500,7 @@ shell { |app_shell|
3471
3500
  }.open
3472
3501
  ```
3473
3502
 
3474
- 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`)
3503
+ 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`)
3475
3504
 
3476
3505
  You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
3477
3506
 
@@ -20,6 +20,12 @@ You may choose to generate a specific type of packaging instead by addionally pa
20
20
  glimmer package[msi]
21
21
  ```
22
22
 
23
+ Make sure to surround with double-quotes when running from ZShell (zsh):
24
+
25
+ ```
26
+ glimmer "package[msi]"
27
+ ```
28
+
23
29
  - Available Mac packaging types are `dmg`, `pkg`, and `image` (image means a pure Mac `app` without a setup program). Keep in mind that the packages you produce are compatible with the same MacOS you are on or older.
24
30
  - Available Windows packaging types are `msi`, `exe`, and `image` (image means a Windows application directory without a setup program). Learn more about Windows packaging are [over here](#windows-application-packaging).
25
31
 
@@ -190,7 +196,7 @@ Currently, `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored
190
196
  You can get around that in zsh by running glimmer package commands with `bash -c` prefix:
191
197
 
192
198
  ```
193
- bash -c 'glimmer package'
199
+ bash -c 'source ~/.glimmer_source; glimmer package'
194
200
  ```
195
201
 
196
202
  4. Java on Windows System PATH
@@ -2,7 +2,9 @@
2
2
  - [Hello Samples](#hello-samples)
3
3
  - [Hello, World!](#hello-world)
4
4
  - [Hello, Tab!](#hello-tab)
5
+ - [Hello, C Tab!](#hello-c-tab)
5
6
  - [Hello, Combo!](#hello-combo)
7
+ - [Hello, C Combo!](#hello-c-combo)
6
8
  - [Hello, List Single Selection!](#hello-list-single-selection)
7
9
  - [Hello, List Multi Selection!](#hello-list-multi-selection)
8
10
  - [Hello, Computed!](#hello-computed)
@@ -101,6 +103,20 @@ Code:
101
103
  ![Hello Tab English](/images/glimmer-hello-tab-english.png)
102
104
  ![Hello Tab French](/images/glimmer-hello-tab-french.png)
103
105
 
106
+ #### Hello, C Tab!
107
+
108
+ This sample demonstrates custom tab widget usage via the `c_tab_folder` and `c_tab_item` variations of `tab_folder` and `tab_item`, which can customize fonts/background/foreground colors for tabs and display additional tabs that do not fit in the window via a drop down.
109
+
110
+ Code:
111
+
112
+ [samples/hello/hello_c_tab.rb](/samples/hello/hello_c_tab.rb)
113
+
114
+ ![Hello C Tab](/images/glimmer-hello-c-tab.png)
115
+ ![Hello C Tab Extra Tabs](/images/glimmer-hello-c-tab-extra-tabs.png)
116
+ ![Hello C Tab Other Tab](/images/glimmer-hello-c-tab-other-tab.png)
117
+
118
+ Country flag images were made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com)
119
+
104
120
  #### Hello, Combo!
105
121
 
106
122
  This sample demonstrates combo data-binding.
@@ -112,6 +128,17 @@ Code:
112
128
  ![Hello Combo](/images/glimmer-hello-combo.png)
113
129
  ![Hello Combo Expanded](/images/glimmer-hello-combo-expanded.png)
114
130
 
131
+ #### Hello, C Combo!
132
+
133
+ This sample demonstrates the custom combo variation on combo, which allows the adjustment of the combo height based on font height or layout data.
134
+
135
+ Code:
136
+
137
+ [samples/hello/hello_c_combo.rb](/samples/hello/hello_c_combo.rb)
138
+
139
+ ![Hello Combo](/images/glimmer-hello-c-combo.png)
140
+ ![Hello Combo Expanded](/images/glimmer-hello-c-combo-expanded.png)
141
+
115
142
  #### Hello, List Single Selection!
116
143
 
117
144
  This sample demonstrates list single-selection data-binding.
Binary file
@@ -42,3 +42,11 @@ require 'facets/hash/symbolize_keys'
42
42
  require 'ext/glimmer/config'
43
43
  require 'ext/glimmer'
44
44
  require 'glimmer/dsl/swt/dsl'
45
+
46
+ if defined?(::IRB)
47
+ begin
48
+ Kernel.send(:remove_method, :y)
49
+ rescue
50
+ # No Op
51
+ end
52
+ end
@@ -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
@@ -19,26 +19,41 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- ## NOTE: Unsupported for now TODO support in the future
23
- #
24
- # require File.dirname(__FILE__) + "/glimmer"
25
- #
26
- # class Array
27
- # include Glimmer
28
- #
29
- # alias original_compare <=>
30
- #
31
- # def <=>(other)
32
- # if (self[0].class.name == "WidgetProxy")
33
- # content(self[0]) {
34
- # if (other.size == 2)
35
- # eval("#{self[1]} bind (other[0], other[1])")
36
- # elsif (other.size == 3)
37
- # eval("#{self[1]} bind (other[0], other[1], other[2])")
38
- # end
39
- # }
40
- # else
41
- # original_compare(other)
42
- # end
43
- # end
44
- # end
22
+ module Glimmer
23
+ module DataBinding
24
+ class Shine
25
+ include Glimmer
26
+
27
+ def initialize(parent, parent_attribute)
28
+ @parent = parent
29
+ @parent_attribute = parent_attribute
30
+ end
31
+
32
+ alias original_compare <=>
33
+
34
+ def <=>(other)
35
+ if other.is_a?(Array)
36
+ @parent.content {
37
+ send(@parent_attribute, bind(*other))
38
+ }
39
+ else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
40
+ original_compare(other)
41
+ end
42
+ end
43
+
44
+ def <=(other)
45
+ if other.is_a?(Array)
46
+ args_clone = other.clone
47
+ if args_clone.last.is_a?(Hash)
48
+ args_clone.last[:read_only] = true
49
+ else # || other.is_a?(Hash) # TODO support hash e.g. {model: model_obj, attribute: :some_attribute, more-options...}
50
+ args_clone << {read_only: true}
51
+ end
52
+ @parent.content {
53
+ send(@parent_attribute, bind(*args_clone))
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -53,7 +53,7 @@ module Glimmer
53
53
  return
54
54
  end
55
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
56
+ if @async_exec || !((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
57
  @widget.set_attribute(@property, value)
58
58
  end
59
59
  end
@@ -0,0 +1,58 @@
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'
23
+ require 'glimmer/dsl/static_expression'
24
+ require 'glimmer/dsl/parent_expression'
25
+ require 'glimmer/swt/widget_proxy'
26
+ require 'glimmer/swt/c_tab_item_proxy'
27
+
28
+ module Glimmer
29
+ module DSL
30
+ module SWT
31
+ class CTabItemExpression < StaticExpression
32
+ include ParentExpression
33
+
34
+ include_package 'org.eclipse.swt.custom'
35
+
36
+ def can_interpret?(parent, keyword, *args, &block)
37
+ initial_condition = (keyword == 'c_tab_item') and parent.respond_to?(:swt_widget)
38
+ if initial_condition
39
+ if parent.swt_widget.is_a?(CTabFolder)
40
+ return true
41
+ else
42
+ Glimmer::Config.logger.error {"c_tab_item widget may only be used directly under a c_tab_folder widget!"}
43
+ end
44
+ end
45
+ false
46
+ end
47
+
48
+ def interpret(parent, keyword, *args, &block)
49
+ Glimmer::SWT::CTabItemProxy.new(parent, args)
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -29,12 +29,13 @@ module Glimmer
29
29
  module SWT
30
30
  class ComboSelectionDataBindingExpression < Expression
31
31
  include_package 'org.eclipse.swt.widgets'
32
+ include_package 'org.eclipse.swt.custom'
32
33
 
33
34
  def can_interpret?(parent, keyword, *args, &block)
34
35
  keyword == 'selection' and
35
36
  block.nil? and
36
37
  parent.respond_to?(:swt_widget) and
37
- parent.swt_widget.is_a?(Combo) and
38
+ (parent.swt_widget.is_a?(Combo) || parent.swt_widget.is_a?(CCombo)) and
38
39
  args.size == 1 and
39
40
  args[0].is_a?(DataBinding::ModelBinding) and
40
41
  args[0].evaluate_options_property.is_a?(Array)
@@ -20,7 +20,7 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/launcher'
23
- require Glimmer::Launcher.swt_jar_file
23
+ require ENV['SWT_JAR_FILE_PATH'] || "#{Glimmer::Launcher.swt_jar_file}#{Glimmer::Launcher.special_cpu_architecture_suffix}"
24
24
  require 'glimmer/dsl/engine'
25
25
  Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
26
26
 
@@ -52,6 +52,7 @@ module Glimmer
52
52
  image
53
53
  multiply
54
54
  property
55
+ shine_data_binding
55
56
  block_property
56
57
  dialog
57
58
  widget
@@ -0,0 +1,49 @@
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/dsl/expression'
23
+ require 'glimmer/data_binding/model_binding'
24
+ require 'glimmer/data_binding/widget_binding'
25
+ require 'glimmer/swt/display_proxy'
26
+ require 'glimmer/data_binding/shine'
27
+
28
+ module Glimmer
29
+ module DSL
30
+ module SWT
31
+ class ShineDataBindingExpression < Expression
32
+ def can_interpret?(parent, keyword, *args, &block)
33
+ args.size == 0 and
34
+ block.nil? and
35
+ parent.respond_to?(:set_attribute) and
36
+ parent.respond_to?(:has_attribute?) and
37
+ parent.has_attribute?(keyword, *args) and
38
+ !parent.is_a?(Glimmer::UI::CustomWidget) and
39
+ !parent.is_a?(Glimmer::UI::CustomShape) and
40
+ !(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
41
+ end
42
+
43
+ def interpret(parent, keyword, *args, &block)
44
+ Glimmer::DataBinding::Shine.new(parent, keyword)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end