glimmer-dsl-swt 4.18.4.6 → 4.18.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +20 -11
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +273 -66
  6. data/docs/reference/GLIMMER_SAMPLES.md +144 -41
  7. data/glimmer-dsl-swt.gemspec +13 -5
  8. data/lib/glimmer/data_binding/widget_binding.rb +16 -3
  9. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  10. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
  11. data/lib/glimmer/dsl/swt/data_binding_expression.rb +2 -1
  12. data/lib/glimmer/dsl/swt/image_expression.rb +14 -3
  13. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +1 -0
  14. data/lib/glimmer/dsl/swt/shell_expression.rb +4 -1
  15. data/lib/glimmer/dsl/swt/widget_expression.rb +4 -1
  16. data/lib/glimmer/swt/color_proxy.rb +5 -4
  17. data/lib/glimmer/swt/custom/animation.rb +1 -0
  18. data/lib/glimmer/swt/custom/code_text.rb +22 -0
  19. data/lib/glimmer/swt/custom/drawable.rb +80 -4
  20. data/lib/glimmer/swt/custom/radio_group.rb +2 -1
  21. data/lib/glimmer/swt/custom/shape.rb +80 -46
  22. data/lib/glimmer/swt/image_proxy.rb +30 -8
  23. data/lib/glimmer/swt/scrolled_composite_proxy.rb +15 -6
  24. data/lib/glimmer/swt/shell_proxy.rb +2 -0
  25. data/lib/glimmer/swt/swt_proxy.rb +1 -0
  26. data/lib/glimmer/swt/tab_item_proxy.rb +1 -0
  27. data/lib/glimmer/swt/widget_proxy.rb +24 -5
  28. data/lib/glimmer/ui/custom_shell.rb +3 -3
  29. data/samples/elaborate/mandelbrot_fractal.rb +348 -39
  30. data/samples/elaborate/meta_sample.rb +1 -1
  31. data/samples/elaborate/tetris.rb +5 -5
  32. data/samples/hello/hello_combo.rb +1 -1
  33. data/samples/hello/hello_cursor.rb +57 -0
  34. data/samples/hello/hello_list_multi_selection.rb +1 -1
  35. data/samples/hello/hello_list_single_selection.rb +1 -1
  36. data/samples/hello/hello_progress_bar.rb +129 -0
  37. data/samples/hello/hello_table.rb +1 -1
  38. data/samples/hello/hello_table/baseball_park.png +0 -0
  39. metadata +11 -3
@@ -219,7 +219,7 @@ class MetaSampleApplication
219
219
  SampleDirectory.sample_directories.each { |sample_directory|
220
220
  expand_item {
221
221
  layout_data(:fill, :fill, true, true)
222
- text " #{sample_directory.name} Samples"
222
+ text " #{sample_directory.name} Samples (#{sample_directory.samples.count})"
223
223
 
224
224
  radio_group { |radio_group_proxy|
225
225
  row_layout(:vertical) {
@@ -155,19 +155,19 @@ class Tetris
155
155
  color = colored ? color(([:white] + Model::Tetromino::LETTER_COLORS.values).sample) : color(:white)
156
156
  x = column * icon_block_size
157
157
  y = row * icon_block_size
158
- rectangle(x, y, icon_block_size, icon_block_size, fill: true) {
158
+ rectangle(x, y, icon_block_size, icon_block_size) {
159
159
  background color
160
160
  }
161
- polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size, fill: true) {
161
+ polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
162
162
  background rgb(color.red + 4*BEVEL_CONSTANT, color.green + 4*BEVEL_CONSTANT, color.blue + 4*BEVEL_CONSTANT)
163
163
  }
164
- polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size, fill: true) {
164
+ polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
165
165
  background rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
166
166
  }
167
- polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, fill: true) {
167
+ polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
168
168
  background rgb(color.red - 2*BEVEL_CONSTANT, color.green - 2*BEVEL_CONSTANT, color.blue - 2*BEVEL_CONSTANT)
169
169
  }
170
- polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size, fill: true) {
170
+ polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
171
171
  background rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
172
172
  }
173
173
  }
@@ -46,7 +46,7 @@ class HelloCombo
46
46
  text 'Hello, Combo!'
47
47
 
48
48
  combo(:read_only) {
49
- selection bind(person, :country)
49
+ selection bind(person, :country) # also binds to country_options by convention
50
50
  }
51
51
 
52
52
  button {
@@ -0,0 +1,57 @@
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
+ class HelloCursor
23
+ include Glimmer::UI::CustomShell
24
+
25
+ attr_accessor :selected_cursor
26
+
27
+ def selected_cursor_options
28
+ org.eclipse.swt.SWT.constants.select {|c| c.to_s.start_with?('CURSOR_')}.map {|c| c.to_s.sub('CURSOR_', '').downcase}
29
+ end
30
+
31
+ after_body {
32
+ observe(self, :selected_cursor) {
33
+ body_root.cursor = selected_cursor
34
+ }
35
+ }
36
+
37
+ body {
38
+ shell {
39
+ grid_layout
40
+
41
+ text 'Hello, Cursor!'
42
+ cursor :wait
43
+
44
+ label {
45
+ text 'Please select a cursor style and see it change the mouse cursor (varies per platform):'
46
+ font style: :bold
47
+ cursor :no
48
+ }
49
+ radio_group {
50
+ grid_layout 5, true
51
+ selection bind(self, :selected_cursor)
52
+ }
53
+ }
54
+ }
55
+ end
56
+
57
+ HelloCursor.launch
@@ -59,7 +59,7 @@ class HelloListMultiSelection
59
59
  text 'Hello, List Multi Selection!'
60
60
 
61
61
  list(:multi) {
62
- selection bind(person, :provinces)
62
+ selection bind(person, :provinces) # also binds to provinces_options by convention
63
63
  }
64
64
 
65
65
  button {
@@ -44,7 +44,7 @@ class HelloListSingleSelection
44
44
  text 'Hello, List Single Selection!'
45
45
 
46
46
  list {
47
- selection bind(person, :country)
47
+ selection bind(person, :country) # also binds to country_options by convention
48
48
  }
49
49
 
50
50
  button {
@@ -0,0 +1,129 @@
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
+ class HelloProgressBar
23
+ include Glimmer::UI::CustomWindow
24
+
25
+ class ProgressModel
26
+ attr_accessor :minimum, :maximum, :selection, :delay
27
+ end
28
+
29
+ before_body {
30
+ @progress_model = ProgressModel.new
31
+ @progress_model.minimum = 0
32
+ @progress_model.maximum = 100
33
+ @progress_model.selection = 0
34
+ @progress_model.delay = 0.01
35
+ }
36
+
37
+ body {
38
+ shell {
39
+ grid_layout(4, true)
40
+
41
+ text 'Hello, Progress Bar!'
42
+
43
+ progress_bar(:indeterminate) {
44
+ layout_data(:fill, :center, true, false) {
45
+ horizontal_span 4
46
+ }
47
+ }
48
+
49
+ label {
50
+ text 'Minimum'
51
+ }
52
+
53
+ label {
54
+ text 'Maximum'
55
+ }
56
+
57
+ label {
58
+ text 'Selection'
59
+ }
60
+
61
+ label {
62
+ text 'Delay in Seconds'
63
+ }
64
+
65
+ spinner {
66
+ selection bind(@progress_model, :minimum)
67
+ }
68
+
69
+ spinner {
70
+ selection bind(@progress_model, :maximum)
71
+ }
72
+
73
+ spinner {
74
+ selection bind(@progress_model, :selection)
75
+ }
76
+
77
+ spinner {
78
+ digits 2
79
+ minimum 1
80
+ maximum 200
81
+ selection bind(@progress_model, :delay, on_read: ->(v) {v.to_f*100.0}, on_write: ->(v) {v.to_f/100.0})
82
+ }
83
+
84
+ progress_bar {
85
+ layout_data(:fill, :center, true, false) {
86
+ horizontal_span 4
87
+ }
88
+ minimum bind(@progress_model, :minimum)
89
+ maximum bind(@progress_model, :maximum)
90
+ selection bind(@progress_model, :selection)
91
+ }
92
+
93
+ progress_bar(:vertical) {
94
+ layout_data(:fill, :center, true, false) {
95
+ horizontal_span 4
96
+ }
97
+ minimum bind(@progress_model, :minimum)
98
+ maximum bind(@progress_model, :maximum)
99
+ selection bind(@progress_model, :selection)
100
+ }
101
+
102
+ button {
103
+ layout_data(:fill, :center, true, false) {
104
+ horizontal_span 4
105
+ }
106
+ text "Start"
107
+
108
+ on_widget_selected {
109
+ # if a previous thread is running, then kill first
110
+ # (killing is not dangerous since it is only a thread about updating progress)
111
+ @current_thread&.kill
112
+ @current_thread = Thread.new {
113
+ # GUI updates must happen in sync_exec calls.
114
+ # Alternatively, add `sync_exec: true` to all the updated property `bind(...)` statements above
115
+ sync_exec { @progress_model.selection = @progress_model.minimum }
116
+ (@progress_model.minimum..@progress_model.maximum).to_a.each do |n|
117
+ sync_exec {
118
+ @progress_model.selection = n
119
+ }
120
+ sleep(@progress_model.delay)
121
+ end
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ end
128
+
129
+ HelloProgressBar.launch
@@ -192,7 +192,7 @@ class HelloTable
192
192
  layout_data :center, :center, true, false
193
193
 
194
194
  text 'BASEBALL PLAYOFF SCHEDULE'
195
- background :transparent
195
+ background :transparent if OS.windows?
196
196
  foreground rgb(94, 107, 103)
197
197
  font name: 'Optima', height: 38, style: :bold
198
198
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.4.6
4
+ version: 4.18.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -350,8 +350,14 @@ executables:
350
350
  - girb
351
351
  extensions: []
352
352
  extra_rdoc_files:
353
- - LICENSE.txt
354
353
  - README.md
354
+ - docs/reference/GLIMMER_COMMAND.md
355
+ - docs/reference/GLIMMER_CONFIGURATION.md
356
+ - docs/reference/GLIMMER_GIRB.md
357
+ - docs/reference/GLIMMER_GUI_DSL_SYNTAX.md
358
+ - docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md
359
+ - docs/reference/GLIMMER_SAMPLES.md
360
+ - docs/reference/GLIMMER_STYLE_GUIDE.md
355
361
  files:
356
362
  - CHANGELOG.md
357
363
  - LICENSE.txt
@@ -504,6 +510,7 @@ files:
504
510
  - samples/hello/hello_combo.rb
505
511
  - samples/hello/hello_computed.rb
506
512
  - samples/hello/hello_computed/contact.rb
513
+ - samples/hello/hello_cursor.rb
507
514
  - samples/hello/hello_custom_shell.rb
508
515
  - samples/hello/hello_custom_widget.rb
509
516
  - samples/hello/hello_date_time.rb
@@ -519,6 +526,7 @@ files:
519
526
  - samples/hello/hello_menu_bar.rb
520
527
  - samples/hello/hello_message_box.rb
521
528
  - samples/hello/hello_pop_up_context_menu.rb
529
+ - samples/hello/hello_progress_bar.rb
522
530
  - samples/hello/hello_radio.rb
523
531
  - samples/hello/hello_radio_group.rb
524
532
  - samples/hello/hello_sash_form.rb