glimmer-dsl-swt 4.17.2.0 → 4.17.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,86 @@
1
+ # Copyright (c) 2007-2020 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
+ # This class declares a `greeting_label` custom widget (by convention)
23
+ class GreetingLabel
24
+ include Glimmer::UI::CustomWidget
25
+
26
+ # multiple options without default values
27
+ options :name, :colors
28
+
29
+ # single option with default value
30
+ option :greeting, default: 'Hello'
31
+
32
+ # internal attribute (not a custom widget option)
33
+ attr_accessor :color
34
+
35
+ before_body {
36
+ @font = {height: 24, style: :bold}
37
+ @color = :black
38
+ }
39
+
40
+ after_body {
41
+ return if colors.nil?
42
+
43
+ Thread.new {
44
+ colors.cycle { |color|
45
+ async_exec {
46
+ self.color = color
47
+ }
48
+ sleep(1)
49
+ }
50
+ }
51
+ }
52
+
53
+ body {
54
+ # pass received swt_style through to label to customize (e.g. :center to center text)
55
+ label(swt_style) {
56
+ text "#{greeting}, #{name}!"
57
+ font @font
58
+ foreground bind(self, :color)
59
+ }
60
+ }
61
+
62
+ end
63
+
64
+ # including Glimmer enables the Glimmer DSL syntax, including auto-discovery of the `greeting_label` custom widget
65
+ include Glimmer
66
+
67
+ shell {
68
+ fill_layout :vertical
69
+
70
+ minimum_size 215, 215
71
+ text 'Hello, Custom Widget!'
72
+
73
+ # custom widget options are passed in a hash
74
+ greeting_label(name: 'Sean')
75
+
76
+ # pass :center SWT style followed by custom widget options hash
77
+ greeting_label(:center, name: 'Laura', greeting: 'Aloha') #
78
+
79
+ greeting_label(:right, name: 'Rick') {
80
+ # you can nest attributes under custom widgets just like any standard widget
81
+ foreground :red
82
+ }
83
+
84
+ # the colors option cycles between colors for the label foreground every second
85
+ greeting_label(:center, name: 'Mary', greeting: 'Aloha', colors: [:red, :dark_green, :blue])
86
+ }.open
@@ -21,20 +21,25 @@
21
21
 
22
22
  class HelloTab
23
23
  include Glimmer
24
+
24
25
  def launch
25
26
  shell {
26
- text "Hello, Tab!"
27
+ text 'Hello, Tab!'
28
+
27
29
  tab_folder {
28
30
  tab_item {
29
- text "English"
31
+ text 'English'
32
+
30
33
  label {
31
- text "Hello, World!"
34
+ text 'Hello, World!'
32
35
  }
33
36
  }
37
+
34
38
  tab_item {
35
- text "French"
39
+ text 'French'
40
+
36
41
  label {
37
- text "Bonjour, Univers!"
42
+ text 'Bonjour, Univers!'
38
43
  }
39
44
  }
40
45
  }
@@ -22,8 +22,8 @@
22
22
  include Glimmer
23
23
 
24
24
  shell {
25
- text "Glimmer"
25
+ text 'Glimmer'
26
26
  label {
27
- text "Hello, World!"
27
+ text 'Hello, World!'
28
28
  }
29
29
  }.open
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.17.2.0
4
+ version: 4.17.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-25 00:00:00.000000000 Z
11
+ date: 2020-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 1.0.0
18
+ version: 1.0.1
19
19
  name: glimmer
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -57,7 +57,7 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.10.1
60
+ version: 0.10.2
61
61
  name: puts_debuggerer
62
62
  prerelease: false
63
63
  type: :runtime
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.10.1
68
+ version: 0.10.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
@@ -420,6 +420,8 @@ files:
420
420
  - samples/hello/hello_combo.rb
421
421
  - samples/hello/hello_computed.rb
422
422
  - samples/hello/hello_computed/contact.rb
423
+ - samples/hello/hello_custom_shell.rb
424
+ - samples/hello/hello_custom_widget.rb
423
425
  - samples/hello/hello_drag_and_drop.rb
424
426
  - samples/hello/hello_list_multi_selection.rb
425
427
  - samples/hello/hello_list_single_selection.rb