glimmer-dsl-swt 4.20.14.2 → 4.20.15.3

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: 3563ef87997628bd87b78de0900279aefcde38f911e2be4a786dfd8a48d5c2f7
4
- data.tar.gz: aab8501a3e614bafa0cf6e9cbae5b326dd0d9acdeb201a41799734f7d322bbae
3
+ metadata.gz: 8187254bb12badee8c5b1ae5c15fe8c3245062f357ce2924af4f2c2d0a6b7f5f
4
+ data.tar.gz: d31a4d862b72eeaa862a63d79188b2b4443118e24d66d7ac2388992a22f3b660
5
5
  SHA512:
6
- metadata.gz: 660347ec9199923ab6b12021b5bc920b83cacc67f76f50f883ace45b5cb3fb2523638a513b45e33bcea250fdd69376d508db26de69534662dfdcd6e5dd524a30
7
- data.tar.gz: 4f490bd3cf9035acf624e83dfd0a071385796d4cebcacb205bdd9c3113f96d7f7ca9c0e625ffaed96c8a17fa4d78b04153eb6d0bc1ef7fc269c29334bd679f52
6
+ metadata.gz: bf2d969abd0153a9390814d25ab7ad0aebcdf89285bce909084dfa4023299f9b7a605ce444fddfb7421c3640cf8ac980fd217d660779f4cea862072d309075ca
7
+ data.tar.gz: 87da79424c4b6b9d16b4c5ae4531924e5d95d1932b673f0edc5f5a9f801ab4fa4cc4a94d0b9addb905882d1990bbc95fe649dce79303e0440ab6a3c21fdbdaae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.15.3
4
+
5
+ - Updated Hello, Text! sample to have a no-border `text` widget
6
+
7
+ ### 4.20.15.2
8
+
9
+ - Fixed `widget#print` support and Hello, Print Dialog! handling of cancellation of printing
10
+
11
+ ### 4.20.15.1
12
+
13
+ - Glimmer Clock elaborate sample
14
+
15
+ ### 4.20.15.0
16
+
17
+ - Hello, Print Dialog!
18
+ - Hello, Print!
19
+ - `widget#print` method that automates work in Hello, Print Dialog! and is used in Hello, Print!
20
+
21
+ ### 4.20.14.2
22
+
23
+ - Hello, Toggle!
24
+
3
25
  ### 4.20.14.1
4
26
 
5
27
  - Upgrade to Glimmer 2.1.1
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.20.14.2
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.20.15.3
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)
@@ -15,7 +15,7 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.14.2 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.15.3 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -321,7 +321,7 @@ jgem install glimmer-dsl-swt
321
321
 
322
322
  Or this command if you want a specific version:
323
323
  ```
324
- jgem install glimmer-dsl-swt -v 4.20.14.2
324
+ jgem install glimmer-dsl-swt -v 4.20.15.3
325
325
  ```
326
326
 
327
327
  `jgem` is JRuby's version of `gem` command.
@@ -349,7 +349,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
349
349
 
350
350
  Add the following to `Gemfile`:
351
351
  ```
352
- gem 'glimmer-dsl-swt', '~> 4.20.14.2'
352
+ gem 'glimmer-dsl-swt', '~> 4.20.15.3'
353
353
  ```
354
354
 
355
355
  And, then run:
@@ -370,7 +370,7 @@ glimmer
370
370
  ```
371
371
 
372
372
  ```
373
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.14.2
373
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.15.3
374
374
 
375
375
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
376
376
 
@@ -546,7 +546,7 @@ Learn more at: [docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md](docs/refer
546
546
 
547
547
  ## App Updates
548
548
 
549
- Glimmer already supports automatic (and manual) app updates via the Mac App Store for Mac apps. Simply run the `glimmer package` command with the Mac App Store keys configured as per [Mac Application Distribution](mac-application-distribution) instructions and you get automatic (and manual) app update support courtesy of the Mac App Store.
549
+ Glimmer should have support for automatic (and manual) app updates via the Mac App Store for Mac apps. Simply run the `glimmer package` command with the Mac App Store keys configured as per [Mac Application Distribution](mac-application-distribution) instructions and you get automatic (and manual) app update support courtesy of the Mac App Store.
550
550
 
551
551
  ## Glimmer Supporting Libraries
552
552
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.14.2
1
+ 4.20.15.3
@@ -33,6 +33,8 @@
33
33
  - [Hello, Checkbox Group!](#hello-checkbox-group)
34
34
  - [Hello, Directory Dialog!](#hello-directory-dialog)
35
35
  - [Hello, File Dialog!](#hello-file-dialog)
36
+ - [Hello, Print Dialog!](#hello-print-dialog)
37
+ - [Hello, Print!](#hello-print)
36
38
  - [Hello, Date Time!](#hello-date-time)
37
39
  - [Hello, Scale!](#hello-scale)
38
40
  - [Hello, Slider!](#hello-slider)
@@ -65,6 +67,7 @@
65
67
  - [Tic Tac Toe](#tic-tac-toe)
66
68
  - [Connect 4](#connect-4)
67
69
  - [Contact Manager](#contact-manager)
70
+ - [Clock](#clock)
68
71
  - [Game of Life](#game-of-life)
69
72
  - [Glimmer Tetris](#glimmer-tetris)
70
73
  - [Klondike Solitaire](#klondike-solitaire)
@@ -613,7 +616,7 @@ Hello, Directory Dialog! Selected Directory
613
616
 
614
617
  #### Hello, File Dialog!
615
618
 
616
- This sample demonstrates the use of a `file_dialog` in Glimmer.
619
+ This sample demonstrates the use of `file_dialog` in Glimmer.
617
620
 
618
621
  Code:
619
622
 
@@ -631,6 +634,30 @@ Hello, File Dialog! Selected File
631
634
 
632
635
  ![Hello File Dialog](/images/glimmer-hello-file-dialog-selected-file.png)
633
636
 
637
+ #### Hello, Print Dialog!
638
+
639
+ This sample demonstrates the use of `print_dialog` in Glimmer.
640
+
641
+ Code:
642
+
643
+ [samples/hello/hello_print_dialog.rb](/samples/hello/hello_print_dialog.rb)
644
+
645
+ Hello, Print Dialog!
646
+
647
+ ![Hello Print Dialog](/images/glimmer-hello-print-dialog.png)
648
+
649
+ #### Hello, Print!
650
+
651
+ This sample demonstrates the use of `widget#print`, which automates work from Hello, Print Dialog! assuming a single page
652
+
653
+ Code:
654
+
655
+ [samples/hello/hello_print.rb](/samples/hello/hello_print.rb)
656
+
657
+ Hello, Print!
658
+
659
+ ![Hello Print](/images/glimmer-hello-print.png)
660
+
634
661
  #### Hello, Date Time!
635
662
 
636
663
  This sample demonstrates the use of [date_time](#datetime) widget keywords in Glimmer: `date`, `date_drop_down`, `time`, and `calendar`
@@ -1157,6 +1184,16 @@ Contact Manager - Edit Done
1157
1184
 
1158
1185
  ![Contact Manager](/images/glimmer-contact-manager-edit-done.png)
1159
1186
 
1187
+ #### Clock
1188
+
1189
+ This sample demonstrates how to build an animation based application.
1190
+
1191
+ Code:
1192
+
1193
+ [samples/elaborate/clock.rb](/samples/elaborate/clock.rb)
1194
+
1195
+ ![Clock](/images/glimmer-clock.png)
1196
+
1160
1197
  #### Game of Life
1161
1198
 
1162
1199
  This sample demonstrates how to build an interactive canvas-based visualization of Conway's Game of Life ([test-first](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/game_of_life/model/grid_spec.rb)), taking advantage of data-binding and multi-threading.
@@ -1211,7 +1248,7 @@ Check out a souped up large-card-size packaged version of the game in the [Glimm
1211
1248
 
1212
1249
  #### Battleship
1213
1250
 
1214
- This sample demonstrates how to build an interactive board game with A.I., MVC architecture, hybrid canvas widget/shape approach, custom-widgets, data-binding, observers, and widget drag & drop.
1251
+ This sample demonstrates how to build an interactive board game with MVC architecture, hybrid canvas widget/shape approach, custom-widgets, data-binding, observers, and widget drag & drop. Note that the A.I. is very simplistic as it is besides the point of this GUI demo, which focuses on leveraging Glimmer DSL for SWT.
1215
1252
 
1216
1253
  Code:
1217
1254
 
Binary file
@@ -31,6 +31,7 @@ module Glimmer
31
31
  'org.eclipse.swt.browser',
32
32
  'org.eclipse.swt.custom',
33
33
  'org.eclipse.swt.dnd',
34
+ 'org.eclipse.swt.printing',
34
35
  ]
35
36
  DEFAULT_AUTO_SYNC_EXEC = true
36
37
 
@@ -610,6 +610,40 @@ module Glimmer
610
610
  (@swt_widget.style & comparison) == comparison
611
611
  end
612
612
  end
613
+
614
+ def print(gc=nil, job_name: nil)
615
+ if gc.is_a?(org.eclipse.swt.graphics.GC)
616
+ @swt_widget.print(gc)
617
+ else
618
+ image = Image.new(DisplayProxy.instance.swt_display, bounds)
619
+ gc = org.eclipse.swt.graphics.GC.new(image)
620
+ success = print(gc)
621
+ if success
622
+ printer_data = DialogProxy.new('print_dialog', shell.get_data('proxy')).open
623
+ if printer_data
624
+ printer = Printer.new(printer_data)
625
+ job_name ||= 'Glimmer'
626
+ if printer.start_job(job_name)
627
+ printer_gc = org.eclipse.swt.graphics.GC.new(printer)
628
+ if printer.start_page
629
+ printer_gc.drawImage(image, 0, 0)
630
+ printer.end_page
631
+ else
632
+ success = false
633
+ end
634
+ printer_gc.dispose
635
+ printer.end_job
636
+ else
637
+ success = false
638
+ end
639
+ printer.dispose
640
+ gc.dispose
641
+ image.dispose
642
+ end
643
+ end
644
+ success
645
+ end
646
+ end
613
647
 
614
648
  def dispose
615
649
  auto_exec do
@@ -0,0 +1,74 @@
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 Clock
23
+ include Glimmer::UI::CustomShell
24
+
25
+ body {
26
+ shell {
27
+ text 'Glimmer Clock'
28
+ minimum_size 400, 430
29
+
30
+ canvas {
31
+ initial_time = Time.now
32
+ background :black
33
+
34
+ animation {
35
+ every 0.01 # every hundredth of a second to ensure higher accuracy
36
+
37
+ frame { |index|
38
+ time = Time.now
39
+
40
+ oval(0, 0, 400, 400) {
41
+ background :white
42
+ }
43
+ polygon(-5, -5, 180, 0, -5, 5) {
44
+ background :black
45
+
46
+ transform {
47
+ translate 200, 200
48
+ rotate(time.sec*6 - 90)
49
+ }
50
+ }
51
+ polygon(-5, -5, 135, 0, -5, 5) {
52
+ background :dark_gray
53
+
54
+ transform {
55
+ translate 200, 200
56
+ rotate(time.min*6 - 90)
57
+ }
58
+ }
59
+ polygon(-5, -5, 90, 0, -5, 5) {
60
+ background :gray
61
+
62
+ transform {
63
+ translate 200, 200
64
+ rotate((time.hour - 12)*30 - 90)
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ end
73
+
74
+ Clock.launch
@@ -72,9 +72,9 @@ class Tetris
72
72
  when swt(:arrow_right), 'd'.bytes.first
73
73
  game.right!
74
74
  when swt(:shift), swt(:alt)
75
- if key_event.keyLocation == swt(:right) # right shift key
75
+ if key_event.keyLocation == swt(:right) # right key
76
76
  game.rotate!(:right)
77
- elsif key_event.keyLocation == swt(:left) # left shift key
77
+ elsif key_event.keyLocation == swt(:left) # left key
78
78
  game.rotate!(:left)
79
79
  end
80
80
  end
@@ -39,8 +39,8 @@ class Timer
39
39
  ## Use after_body block to setup observers for widgets in body
40
40
  #
41
41
  after_body do
42
- Thread.new {
43
- loop {
42
+ Thread.new do
43
+ loop do
44
44
  sleep(1)
45
45
  if @countdown
46
46
  sync_exec {
@@ -54,8 +54,8 @@ class Timer
54
54
  end
55
55
  }
56
56
  end
57
- }
58
- }
57
+ end
58
+ end
59
59
  end
60
60
 
61
61
  ## Add widget content inside custom shell body
@@ -48,6 +48,7 @@ class HelloCanvas
48
48
 
49
49
  @canvas = canvas {
50
50
  background :yellow
51
+
51
52
  rectangle(0, 0, 220, 400) {
52
53
  background rgb(255, 0, 0)
53
54
  }
@@ -87,7 +87,7 @@ class HelloLabel
87
87
 
88
88
  ['denmark', 'finland', 'norway'].each do |image_name|
89
89
  label {
90
- layout_data :fill, :center, true, false
90
+ layout_data :center, :center, true, false
91
91
  image File.expand_path("images/#{image_name}.png", __dir__)
92
92
  }
93
93
  text {
@@ -0,0 +1,60 @@
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-swt'
23
+
24
+ class HelloPrint
25
+ include Glimmer::UI::CustomShell
26
+
27
+ body {
28
+ shell {
29
+ text 'Hello, Print!'
30
+ @composite = composite {
31
+ row_layout(:vertical) {
32
+ fill true
33
+ center true
34
+ }
35
+
36
+ label(:center) {
37
+ text "Whatever you see inside the app composite\nwill get printed when clicking the Print button."
38
+ font height: 16
39
+ }
40
+
41
+ button {
42
+ text 'Print'
43
+
44
+ on_widget_selected do
45
+ # The widget#print method automates all the work seen in Hello, Print Dialog!
46
+ # the caveat is it assumes everything fits on one page
47
+ unless @composite.print
48
+ message_box {
49
+ text 'Unable To Print'
50
+ message 'Sorry! Printing is not supported on this platform!'
51
+ }.open
52
+ end
53
+ end
54
+ }
55
+ }
56
+ }
57
+ }
58
+ end
59
+
60
+ HelloPrint.launch
@@ -0,0 +1,89 @@
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-swt'
23
+
24
+ class HelloPrintDialog
25
+ include Glimmer::UI::CustomShell
26
+
27
+ body {
28
+ shell {
29
+ text 'Hello, Print Dialog!'
30
+ @composite = composite {
31
+ row_layout(:vertical) {
32
+ fill true
33
+ center true
34
+ }
35
+
36
+ label(:center) {
37
+ text "Whatever you see inside the app composite\nwill get printed when clicking the Print button."
38
+ font height: 16
39
+ }
40
+
41
+ button {
42
+ text 'Print'
43
+
44
+ on_widget_selected do
45
+ # note: you may check out Hello, Print! for a simpler version that automates the work below
46
+ image = Image.new(display.swt_display, @composite.bounds)
47
+ gc = org.eclipse.swt.graphics.GC.new(image)
48
+ success = @composite.print(gc)
49
+ if success
50
+ printer_data = print_dialog.open
51
+ if printer_data
52
+ printer = Printer.new(printer_data)
53
+ if printer.start_job('Glimmer')
54
+ printer_gc = org.eclipse.swt.graphics.GC.new(printer)
55
+ if printer.start_page
56
+ printer_gc.drawImage(image, 0, 0)
57
+ printer.end_page
58
+ else
59
+ message_box {
60
+ text 'Unable To Print'
61
+ message 'Sorry! Cannot start printer page!'
62
+ }.open
63
+ end
64
+ printer_gc.dispose
65
+ printer.end_job
66
+ else
67
+ message_box {
68
+ text 'Unable To Print'
69
+ message 'Sorry! Cannot start printer job!'
70
+ }.open
71
+ end
72
+ printer.dispose
73
+ gc.dispose
74
+ image.dispose
75
+ end
76
+ else
77
+ message_box {
78
+ text 'Unable To Print'
79
+ message 'Sorry! Printing is not supported on this platform!'
80
+ }.open
81
+ end
82
+ end
83
+ }
84
+ }
85
+ }
86
+ }
87
+ end
88
+
89
+ HelloPrintDialog.launch
@@ -107,18 +107,18 @@ class HelloProgressBar
107
107
  }
108
108
  text "Start"
109
109
 
110
- on_widget_selected {
110
+ on_widget_selected do
111
111
  # if a previous thread is running, then kill first
112
112
  # (killing is not dangerous since it is only a thread about updating progress)
113
113
  @current_thread&.kill
114
- @current_thread = Thread.new {
114
+ @current_thread = Thread.new do
115
115
  @progress_model.selection = @progress_model.minimum
116
116
  (@progress_model.minimum..@progress_model.maximum).to_a.each do |n|
117
117
  @progress_model.selection = n
118
118
  sleep(@progress_model.delay)
119
119
  end
120
- }
121
- }
120
+ end
121
+ end
122
122
  }
123
123
  }
124
124
  }
@@ -109,9 +109,9 @@ shell {
109
109
  foreground :dark_green
110
110
  font height: 16
111
111
 
112
- on_widget_selected {
112
+ on_widget_selected do
113
113
  @sash_form.maximized_control = @green_label.swt_widget
114
- }
114
+ end
115
115
  }
116
116
  button {
117
117
  layout_data(:fill, :center, true, false)
@@ -119,9 +119,9 @@ shell {
119
119
  foreground :red
120
120
  font height: 16
121
121
 
122
- on_widget_selected {
122
+ on_widget_selected do
123
123
  @sash_form.maximized_control = @red_label.swt_widget
124
- }
124
+ end
125
125
  }
126
126
 
127
127
  button {
@@ -131,9 +131,9 @@ shell {
131
131
  text 'Maximize None'
132
132
  font height: 16
133
133
 
134
- on_widget_selected {
134
+ on_widget_selected do
135
135
  @sash_form.maximized_control = nil
136
- }
136
+ end
137
137
  }
138
138
  }
139
139
  }.open
@@ -1,12 +1,34 @@
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
+
1
22
  require 'glimmer-dsl-swt'
2
23
 
3
24
  class HelloText
4
25
  include Glimmer::UI::CustomShell
5
26
 
6
- attr_accessor :default, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
27
+ attr_accessor :default, :no_border, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
7
28
 
8
29
  before_body do
9
30
  self.default = 'default is :border style'
31
+ self.no_border = 'no border'
10
32
  self.center = 'centered'
11
33
  self.left = 'left-aligned'
12
34
  self.right = 'right-aligned'
@@ -32,6 +54,14 @@ class HelloText
32
54
  text <=> [self, :default]
33
55
  }
34
56
 
57
+ label {
58
+ text 'text(:none)'
59
+ }
60
+ text(:none) { # no border
61
+ layout_data :fill, :center, true, false
62
+ text <=> [self, :no_border]
63
+ }
64
+
35
65
  label {
36
66
  text 'text(:center, :border)'
37
67
  }
@@ -69,7 +99,7 @@ class HelloText
69
99
  }
70
100
  text(:read_only, :border) {
71
101
  layout_data :fill, :center, true, false
72
- text <=> [self, :read_only]
102
+ text <= [self, :read_only]
73
103
  }
74
104
 
75
105
  label {
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.20.14.2
4
+ version: 4.20.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-09 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -552,6 +552,7 @@ files:
552
552
  - samples/elaborate/calculator/model/command/operation/subtract.rb
553
553
  - samples/elaborate/calculator/model/command/point.rb
554
554
  - samples/elaborate/calculator/model/presenter.rb
555
+ - samples/elaborate/clock.rb
555
556
  - samples/elaborate/connect4.rb
556
557
  - samples/elaborate/connect4/model/grid.rb
557
558
  - samples/elaborate/connect4/model/slot.rb
@@ -646,6 +647,8 @@ files:
646
647
  - samples/hello/hello_menu_bar.rb
647
648
  - samples/hello/hello_message_box.rb
648
649
  - samples/hello/hello_pop_up_context_menu.rb
650
+ - samples/hello/hello_print.rb
651
+ - samples/hello/hello_print_dialog.rb
649
652
  - samples/hello/hello_progress_bar.rb
650
653
  - samples/hello/hello_radio.rb
651
654
  - samples/hello/hello_radio_group.rb