glimmer-dsl-swt 4.17.3.0 → 4.17.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +126 -454
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +9 -6
- data/lib/glimmer-dsl-swt.rb +1 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +1 -0
- data/lib/glimmer/rake_task.rb +4 -21
- data/lib/glimmer/swt/custom/code_text.rb +88 -0
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/sash_form_proxy.rb +53 -0
- data/lib/glimmer/swt/widget_proxy.rb +1 -1
- data/samples/elaborate/meta_sample.rb +166 -0
- data/samples/hello/hello_sash_form.rb +137 -0
- metadata +11 -8
- data/lib/glimmer/rake_task/sample.rb +0 -115
@@ -0,0 +1,137 @@
|
|
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
|
+
class SashFormPresenter
|
23
|
+
include Glimmer
|
24
|
+
|
25
|
+
attr_accessor :sash_width, :orientation, :orientation_style
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@sash_width = 10
|
29
|
+
self.orientation = 'horizontal'
|
30
|
+
end
|
31
|
+
|
32
|
+
def orientation_options
|
33
|
+
['horizontal', 'vertical']
|
34
|
+
end
|
35
|
+
|
36
|
+
def orientation=(value)
|
37
|
+
@orientation = value
|
38
|
+
self.orientation_style = swt(@orientation)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
@presenter = SashFormPresenter.new
|
43
|
+
|
44
|
+
include Glimmer
|
45
|
+
|
46
|
+
shell {
|
47
|
+
grid_layout 1, false
|
48
|
+
minimum_size 740, 0
|
49
|
+
text 'Hello, Sash Form!'
|
50
|
+
|
51
|
+
@sash_form = sash_form {
|
52
|
+
layout_data(:fill, :fill, true, true) {
|
53
|
+
height_hint 200
|
54
|
+
}
|
55
|
+
sash_width bind(@presenter, :sash_width)
|
56
|
+
orientation bind(@presenter, :orientation_style)
|
57
|
+
weights 1, 2
|
58
|
+
|
59
|
+
@green_label = label {
|
60
|
+
text 'Hello, (resize >>)'
|
61
|
+
background :dark_green
|
62
|
+
foreground :white
|
63
|
+
font height: 30
|
64
|
+
}
|
65
|
+
|
66
|
+
@red_label = label {
|
67
|
+
text '(<< resize) Sash Form!'
|
68
|
+
background :red
|
69
|
+
foreground :white
|
70
|
+
font height: 30
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
composite {
|
75
|
+
layout_data(:fill, :fill, true, true)
|
76
|
+
grid_layout 2, true
|
77
|
+
|
78
|
+
label {
|
79
|
+
layout_data(:right, :center, true, false)
|
80
|
+
text 'Sash Width:'
|
81
|
+
font height: 16
|
82
|
+
}
|
83
|
+
spinner {
|
84
|
+
layout_data(:fill, :center, true, false) {
|
85
|
+
width_hint 100
|
86
|
+
}
|
87
|
+
selection bind(@presenter, :sash_width)
|
88
|
+
font height: 16
|
89
|
+
}
|
90
|
+
|
91
|
+
label {
|
92
|
+
layout_data(:right, :center, true, false)
|
93
|
+
text 'Orientation:'
|
94
|
+
font height: 16
|
95
|
+
}
|
96
|
+
combo(:read_only, :border) {
|
97
|
+
layout_data(:fill, :center, true, false) {
|
98
|
+
width_hint 100
|
99
|
+
}
|
100
|
+
selection bind(@presenter, :orientation)
|
101
|
+
font height: 16
|
102
|
+
}
|
103
|
+
|
104
|
+
button {
|
105
|
+
layout_data(:fill, :center, true, false)
|
106
|
+
text 'Maximize Green Label'
|
107
|
+
foreground :dark_green
|
108
|
+
font height: 16
|
109
|
+
|
110
|
+
on_widget_selected {
|
111
|
+
@sash_form.maximized_control = @green_label.swt_widget
|
112
|
+
}
|
113
|
+
}
|
114
|
+
button {
|
115
|
+
layout_data(:fill, :center, true, false)
|
116
|
+
text 'Maximize Red Label'
|
117
|
+
foreground :red
|
118
|
+
font height: 16
|
119
|
+
|
120
|
+
on_widget_selected {
|
121
|
+
@sash_form.maximized_control = @red_label.swt_widget
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
button {
|
126
|
+
layout_data(:fill, :center, true, false) {
|
127
|
+
horizontal_span 2
|
128
|
+
}
|
129
|
+
text 'Maximize None'
|
130
|
+
font height: 16
|
131
|
+
|
132
|
+
on_widget_selected {
|
133
|
+
@sash_form.maximized_control = nil
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}.open
|
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.17.
|
4
|
+
version: 4.17.4.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-10-
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,21 +185,21 @@ dependencies:
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: 3.23.0
|
189
189
|
- - "<"
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
192
|
-
name:
|
191
|
+
version: 4.0.0
|
192
|
+
name: rouge
|
193
193
|
prerelease: false
|
194
194
|
type: :runtime
|
195
195
|
version_requirements: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
199
|
+
version: 3.23.0
|
200
200
|
- - "<"
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
202
|
+
version: 4.0.0
|
203
203
|
- !ruby/object:Gem::Dependency
|
204
204
|
requirement: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
@@ -381,10 +381,10 @@ files:
|
|
381
381
|
- lib/glimmer/rake_task.rb
|
382
382
|
- lib/glimmer/rake_task/list.rb
|
383
383
|
- lib/glimmer/rake_task/package.rb
|
384
|
-
- lib/glimmer/rake_task/sample.rb
|
385
384
|
- lib/glimmer/rake_task/scaffold.rb
|
386
385
|
- lib/glimmer/swt/color_proxy.rb
|
387
386
|
- lib/glimmer/swt/cursor_proxy.rb
|
387
|
+
- lib/glimmer/swt/custom/code_text.rb
|
388
388
|
- lib/glimmer/swt/display_proxy.rb
|
389
389
|
- lib/glimmer/swt/dnd_proxy.rb
|
390
390
|
- lib/glimmer/swt/font_proxy.rb
|
@@ -394,6 +394,7 @@ files:
|
|
394
394
|
- lib/glimmer/swt/menu_proxy.rb
|
395
395
|
- lib/glimmer/swt/message_box_proxy.rb
|
396
396
|
- lib/glimmer/swt/packages.rb
|
397
|
+
- lib/glimmer/swt/sash_form_proxy.rb
|
397
398
|
- lib/glimmer/swt/scrolled_composite_proxy.rb
|
398
399
|
- lib/glimmer/swt/shell_proxy.rb
|
399
400
|
- lib/glimmer/swt/style_constantizable.rb
|
@@ -412,6 +413,7 @@ files:
|
|
412
413
|
- samples/elaborate/contact_manager/contact_manager_presenter.rb
|
413
414
|
- samples/elaborate/contact_manager/contact_repository.rb
|
414
415
|
- samples/elaborate/login.rb
|
416
|
+
- samples/elaborate/meta_sample.rb
|
415
417
|
- samples/elaborate/tic_tac_toe.rb
|
416
418
|
- samples/elaborate/tic_tac_toe/board.rb
|
417
419
|
- samples/elaborate/tic_tac_toe/cell.rb
|
@@ -428,6 +430,7 @@ files:
|
|
428
430
|
- samples/hello/hello_menu_bar.rb
|
429
431
|
- samples/hello/hello_message_box.rb
|
430
432
|
- samples/hello/hello_pop_up_context_menu.rb
|
433
|
+
- samples/hello/hello_sash_form.rb
|
431
434
|
- samples/hello/hello_tab.rb
|
432
435
|
- samples/hello/hello_world.rb
|
433
436
|
- vendor/swt/linux/swt.jar
|
@@ -1,115 +0,0 @@
|
|
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
|
-
require 'text-table'
|
23
|
-
require 'facets/string/titlecase'
|
24
|
-
require 'facets/string/underscore'
|
25
|
-
|
26
|
-
require_relative '../launcher'
|
27
|
-
|
28
|
-
module Glimmer
|
29
|
-
module RakeTask
|
30
|
-
# Lists Glimmer related gems to use in rake_task.rb
|
31
|
-
class Sample
|
32
|
-
class << self
|
33
|
-
def glimmer_gems(glimmer_gem_type = '*')
|
34
|
-
Gem.find_latest_files("glimmer-#{glimmer_gem_type}-*")
|
35
|
-
end
|
36
|
-
|
37
|
-
def glimmer_gem_libs(glimmer_gem_type = '*')
|
38
|
-
glimmer_gems(glimmer_gem_type).map {|file| file.sub(/\.rb$/, '')}.uniq.reject {|file| file.include?('glimmer-cs-gladiator')}
|
39
|
-
end
|
40
|
-
|
41
|
-
def glimmer_gem_samples(glimmer_gem_type = '*')
|
42
|
-
sample_directories = glimmer_gems(glimmer_gem_type).map do |lib|
|
43
|
-
File.dirname(File.dirname(lib))
|
44
|
-
end.select do |gem|
|
45
|
-
Dir.exist?(File.join(gem, 'samples'))
|
46
|
-
end.map do |gem|
|
47
|
-
Dir.glob(File.join(gem, 'samples', '*')).select {|file_or_dir| Dir.exist?(file_or_dir)}
|
48
|
-
end.flatten.uniq.reverse
|
49
|
-
if Dir.exist?('samples')
|
50
|
-
Dir.glob(File.join('samples', '*')).to_a.reverse.each do |dir|
|
51
|
-
sample_directories << dir if Dir.exist?(dir)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
sample_directories.uniq {|dir| File.basename(dir)}
|
55
|
-
end
|
56
|
-
|
57
|
-
def run(name)
|
58
|
-
name = name.underscore.downcase unless name.nil?
|
59
|
-
samples = glimmer_gem_samples.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
|
60
|
-
samples = samples.select {|path| path.include?("#{name}.rb")} unless name.nil?
|
61
|
-
Rake::Task['glimmer:sample:code'].invoke(name) if samples.size == 1
|
62
|
-
Glimmer::Launcher.new(samples << '--quiet=false').launch
|
63
|
-
end
|
64
|
-
|
65
|
-
def list(query)
|
66
|
-
glimmer_gem_samples.each do |dir|
|
67
|
-
sample_group_name = File.basename(dir)
|
68
|
-
human_sample_group_name = sample_group_name.underscore.titlecase
|
69
|
-
array_of_arrays = Dir.glob(File.join(dir, '*.rb')).map do |path|
|
70
|
-
File.basename(path, '.rb')
|
71
|
-
end.select do |path|
|
72
|
-
query.nil? || path.include?(query)
|
73
|
-
end.map do |path|
|
74
|
-
[path, path.underscore.titlecase, "#{'bin/' if Glimmer::Launcher.dev_mode?}glimmer sample:run[#{path}]"]
|
75
|
-
end.sort
|
76
|
-
if array_of_arrays.empty?
|
77
|
-
puts "No Glimmer #{human_sample_group_name} Samples match the query."
|
78
|
-
else
|
79
|
-
puts
|
80
|
-
puts " Glimmer #{human_sample_group_name} Samples:"
|
81
|
-
puts Text::Table.new(
|
82
|
-
:head => %w[Name Description Run],
|
83
|
-
:rows => array_of_arrays,
|
84
|
-
:horizontal_padding => 1,
|
85
|
-
:vertical_boundary => ' ',
|
86
|
-
:horizontal_boundary => ' ',
|
87
|
-
:boundary_intersection => ' '
|
88
|
-
)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def code(name)
|
94
|
-
require 'tty-markdown' unless OS.windows?
|
95
|
-
samples = glimmer_gem_samples.map {|dir| Dir.glob(File.join(dir, '*.rb'))}.reduce(:+).sort
|
96
|
-
sample = samples.detect {|path| path.include?("#{name.to_s.underscore.downcase}.rb")}
|
97
|
-
sample_additional_files = Dir.glob(File.join(sample.sub('.rb', ''), '**', '*.rb'))
|
98
|
-
code = ([sample] + sample_additional_files).map do |file|
|
99
|
-
<<~RUBY
|
100
|
-
|
101
|
-
# #{file}
|
102
|
-
|
103
|
-
#{File.read(file)}
|
104
|
-
|
105
|
-
# # #
|
106
|
-
|
107
|
-
RUBY
|
108
|
-
end.join("\n")
|
109
|
-
code = TTY::Markdown.parse("```ruby\n#{code}\n```") unless OS.windows?
|
110
|
-
puts code
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|