glimmer-dsl-swt 4.18.5.0 → 4.18.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/README.md +16 -11
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +179 -33
- data/docs/reference/GLIMMER_SAMPLES.md +58 -0
- data/glimmer-dsl-swt.gemspec +7 -7
- data/lib/glimmer/data_binding/widget_binding.rb +4 -1
- data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
- data/lib/glimmer/swt/custom/drawable.rb +10 -2
- data/lib/glimmer/swt/custom/shape.rb +458 -58
- data/lib/glimmer/swt/custom/shape/arc.rb +35 -0
- data/lib/glimmer/swt/custom/shape/focus.rb +2 -2
- data/lib/glimmer/swt/custom/shape/image.rb +35 -9
- data/lib/glimmer/swt/custom/shape/line.rb +88 -4
- data/lib/glimmer/swt/custom/shape/oval.rb +18 -0
- data/lib/glimmer/swt/custom/shape/point.rb +10 -5
- data/lib/glimmer/swt/custom/shape/polygon.rb +105 -15
- data/lib/glimmer/swt/custom/shape/polyline.rb +88 -15
- data/lib/glimmer/swt/custom/shape/rectangle.rb +19 -0
- data/lib/glimmer/swt/custom/shape/text.rb +13 -3
- data/lib/glimmer/swt/{directory_dialog_proxy.rb → dialog_proxy.rb} +36 -7
- data/lib/glimmer/swt/font_proxy.rb +12 -6
- data/lib/glimmer/swt/message_box_proxy.rb +1 -0
- data/lib/glimmer/swt/properties.rb +3 -0
- data/lib/glimmer/swt/proxy_properties.rb +145 -0
- data/lib/glimmer/swt/transform_proxy.rb +39 -35
- data/lib/glimmer/swt/widget_proxy.rb +32 -60
- data/samples/elaborate/contact_manager.rb +2 -0
- data/samples/elaborate/login.rb +2 -0
- data/samples/elaborate/mandelbrot_fractal.rb +1 -0
- data/samples/elaborate/meta_sample.rb +1 -0
- data/samples/elaborate/tetris.rb +2 -1
- data/samples/elaborate/tic_tac_toe.rb +2 -0
- data/samples/elaborate/user_profile.rb +10 -8
- data/samples/hello/hello_browser.rb +2 -0
- data/samples/hello/hello_button.rb +2 -0
- data/samples/hello/hello_canvas.rb +157 -77
- data/samples/hello/hello_canvas_animation.rb +2 -0
- data/samples/hello/hello_canvas_transform.rb +2 -0
- data/samples/hello/hello_checkbox.rb +2 -0
- data/samples/hello/hello_checkbox_group.rb +2 -0
- data/samples/hello/hello_code_text.rb +2 -0
- data/{lib/glimmer/dsl/swt/directory_dialog_expression.rb → samples/hello/hello_color_dialog.rb} +44 -24
- data/samples/hello/hello_combo.rb +2 -0
- data/samples/hello/hello_computed.rb +2 -0
- data/samples/hello/hello_cursor.rb +2 -0
- data/samples/hello/hello_custom_shell.rb +1 -0
- data/samples/hello/hello_custom_widget.rb +2 -0
- data/samples/hello/hello_date_time.rb +2 -0
- data/samples/hello/hello_dialog.rb +2 -0
- data/samples/hello/hello_directory_dialog.rb +2 -0
- data/samples/hello/hello_drag_and_drop.rb +5 -3
- data/samples/hello/hello_expand_bar.rb +2 -0
- data/samples/hello/hello_file_dialog.rb +2 -0
- data/samples/hello/hello_font_dialog.rb +84 -0
- data/samples/hello/hello_group.rb +2 -0
- data/samples/hello/hello_link.rb +2 -0
- data/samples/hello/hello_list_multi_selection.rb +2 -0
- data/samples/hello/hello_list_single_selection.rb +2 -0
- data/samples/hello/hello_menu_bar.rb +2 -0
- data/samples/hello/hello_message_box.rb +2 -0
- data/samples/hello/hello_pop_up_context_menu.rb +2 -0
- data/samples/hello/hello_progress_bar.rb +2 -0
- data/samples/hello/hello_radio.rb +2 -0
- data/samples/hello/hello_radio_group.rb +2 -0
- data/samples/hello/hello_sash_form.rb +2 -0
- data/samples/hello/hello_spinner.rb +2 -0
- data/samples/hello/hello_styled_text.rb +19 -17
- data/samples/hello/hello_tab.rb +2 -0
- data/samples/hello/hello_table.rb +2 -0
- data/samples/hello/hello_world.rb +2 -0
- metadata +6 -6
- data/lib/glimmer/dsl/swt/file_dialog_expression.rb +0 -48
- data/lib/glimmer/swt/file_dialog_proxy.rb +0 -68
@@ -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,18 +19,20 @@
|
|
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
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
22
24
|
verbiage = <<-MULTI_LINE_STRING
|
23
25
|
|
24
|
-
Glimmer DSL for SWT is a native-GUI cross-platform desktop development library written in JRuby,
|
25
|
-
an OS-threaded faster version of Ruby.
|
26
|
-
Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring
|
27
|
-
of desktop application user-interfaces while relying on the robust Eclipse SWT library.
|
28
|
-
Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates
|
29
|
-
synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components
|
30
|
-
and enabling developers to solve business problems (test-first) without worrying about GUI concerns.
|
31
|
-
To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
32
|
-
Glimmer also includes native-executable packaging support, sorely lacking in other libraries,
|
33
|
-
thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on
|
26
|
+
Glimmer DSL for SWT is a native-GUI cross-platform desktop development library written in JRuby,
|
27
|
+
an OS-threaded faster version of Ruby.
|
28
|
+
Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring
|
29
|
+
of desktop application user-interfaces while relying on the robust Eclipse SWT library.
|
30
|
+
Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates
|
31
|
+
synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components
|
32
|
+
and enabling developers to solve business problems (test-first) without worrying about GUI concerns.
|
33
|
+
To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
34
|
+
Glimmer also includes native-executable packaging support, sorely lacking in other libraries,
|
35
|
+
thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on
|
34
36
|
the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.
|
35
37
|
|
36
38
|
MULTI_LINE_STRING
|
@@ -74,7 +76,7 @@ shell {
|
|
74
76
|
top_pixel bind(@presenter, :top_pixel)
|
75
77
|
|
76
78
|
# This demonstrates how to set styles via a listener
|
77
|
-
on_line_get_style { |line_style_event|
|
79
|
+
on_line_get_style { |line_style_event|
|
78
80
|
line_offset = line_style_event.lineOffset
|
79
81
|
if @presenter.line_index_for_offset(line_offset) % 52 < 13
|
80
82
|
line_size = line_style_event.lineText.size
|
@@ -95,7 +97,7 @@ shell {
|
|
95
97
|
line_size = line_style_event.lineText.size
|
96
98
|
style_range = StyleRange.new(line_offset, line_size, color(:dark_magenta).swt_color, color(:cyan).swt_color, swt(:normal))
|
97
99
|
style_range.strikeout = true
|
98
|
-
line_style_event.styles = [style_range].to_java(StyleRange)
|
100
|
+
line_style_event.styles = [style_range].to_java(StyleRange)
|
99
101
|
end
|
100
102
|
}
|
101
103
|
}
|
@@ -132,7 +134,7 @@ shell {
|
|
132
134
|
}
|
133
135
|
text {
|
134
136
|
text bind(@presenter, :top_pixel, on_read: ->(o) {"%04d" % [o] })
|
135
|
-
}
|
136
|
-
}
|
137
|
+
}
|
138
|
+
}
|
137
139
|
}
|
138
140
|
}.open
|
data/samples/hello/hello_tab.rb
CHANGED
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.5.
|
4
|
+
version: 4.18.5.5
|
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
|
+
date: 2021-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -388,13 +388,11 @@ files:
|
|
388
388
|
- lib/glimmer/dsl/swt/custom_widget_expression.rb
|
389
389
|
- lib/glimmer/dsl/swt/data_binding_expression.rb
|
390
390
|
- lib/glimmer/dsl/swt/dialog_expression.rb
|
391
|
-
- lib/glimmer/dsl/swt/directory_dialog_expression.rb
|
392
391
|
- lib/glimmer/dsl/swt/display_expression.rb
|
393
392
|
- lib/glimmer/dsl/swt/dnd_expression.rb
|
394
393
|
- lib/glimmer/dsl/swt/dsl.rb
|
395
394
|
- lib/glimmer/dsl/swt/exec_expression.rb
|
396
395
|
- lib/glimmer/dsl/swt/expand_item_expression.rb
|
397
|
-
- lib/glimmer/dsl/swt/file_dialog_expression.rb
|
398
396
|
- lib/glimmer/dsl/swt/font_expression.rb
|
399
397
|
- lib/glimmer/dsl/swt/image_expression.rb
|
400
398
|
- lib/glimmer/dsl/swt/layout_data_expression.rb
|
@@ -446,11 +444,10 @@ files:
|
|
446
444
|
- lib/glimmer/swt/custom/shape/rectangle.rb
|
447
445
|
- lib/glimmer/swt/custom/shape/text.rb
|
448
446
|
- lib/glimmer/swt/date_time_proxy.rb
|
449
|
-
- lib/glimmer/swt/
|
447
|
+
- lib/glimmer/swt/dialog_proxy.rb
|
450
448
|
- lib/glimmer/swt/display_proxy.rb
|
451
449
|
- lib/glimmer/swt/dnd_proxy.rb
|
452
450
|
- lib/glimmer/swt/expand_item_proxy.rb
|
453
|
-
- lib/glimmer/swt/file_dialog_proxy.rb
|
454
451
|
- lib/glimmer/swt/font_proxy.rb
|
455
452
|
- lib/glimmer/swt/image_proxy.rb
|
456
453
|
- lib/glimmer/swt/layout_data_proxy.rb
|
@@ -459,6 +456,7 @@ files:
|
|
459
456
|
- lib/glimmer/swt/message_box_proxy.rb
|
460
457
|
- lib/glimmer/swt/packages.rb
|
461
458
|
- lib/glimmer/swt/properties.rb
|
459
|
+
- lib/glimmer/swt/proxy_properties.rb
|
462
460
|
- lib/glimmer/swt/sash_form_proxy.rb
|
463
461
|
- lib/glimmer/swt/scrolled_composite_proxy.rb
|
464
462
|
- lib/glimmer/swt/shell_proxy.rb
|
@@ -505,6 +503,7 @@ files:
|
|
505
503
|
- samples/hello/hello_checkbox.rb
|
506
504
|
- samples/hello/hello_checkbox_group.rb
|
507
505
|
- samples/hello/hello_code_text.rb
|
506
|
+
- samples/hello/hello_color_dialog.rb
|
508
507
|
- samples/hello/hello_combo.rb
|
509
508
|
- samples/hello/hello_computed.rb
|
510
509
|
- samples/hello/hello_computed/contact.rb
|
@@ -517,6 +516,7 @@ files:
|
|
517
516
|
- samples/hello/hello_drag_and_drop.rb
|
518
517
|
- samples/hello/hello_expand_bar.rb
|
519
518
|
- samples/hello/hello_file_dialog.rb
|
519
|
+
- samples/hello/hello_font_dialog.rb
|
520
520
|
- samples/hello/hello_group.rb
|
521
521
|
- samples/hello/hello_link.rb
|
522
522
|
- samples/hello/hello_list_multi_selection.rb
|
@@ -1,48 +0,0 @@
|
|
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/static_expression'
|
23
|
-
require 'glimmer/dsl/parent_expression'
|
24
|
-
require 'glimmer/dsl/top_level_expression'
|
25
|
-
require 'glimmer/swt/file_dialog_proxy'
|
26
|
-
|
27
|
-
module Glimmer
|
28
|
-
module DSL
|
29
|
-
module SWT
|
30
|
-
class FileDialogExpression < StaticExpression
|
31
|
-
include TopLevelExpression
|
32
|
-
include ParentExpression
|
33
|
-
|
34
|
-
include_package 'org.eclipse.swt.widgets'
|
35
|
-
|
36
|
-
def can_interpret?(parent, keyword, *args, &block)
|
37
|
-
keyword == 'file_dialog' and
|
38
|
-
(parent.nil? or parent.is_a?(Shell) or parent.is_a?(Glimmer::SWT::ShellProxy))
|
39
|
-
end
|
40
|
-
|
41
|
-
def interpret(parent, keyword, *args, &block)
|
42
|
-
args = [parent] + args unless parent.nil?
|
43
|
-
Glimmer::SWT::FileDialogProxy.send(:new, *args)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,68 +0,0 @@
|
|
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/swt/swt_proxy'
|
23
|
-
require 'glimmer/swt/widget_proxy'
|
24
|
-
require 'glimmer/swt/display_proxy'
|
25
|
-
|
26
|
-
module Glimmer
|
27
|
-
module SWT
|
28
|
-
# Proxy for org.eclipse.swt.widgets.FileDialog
|
29
|
-
#
|
30
|
-
# Automatically uses the current shell if one is open.
|
31
|
-
# Otherwise, it instantiates a new shell parent
|
32
|
-
#
|
33
|
-
# Optionally takes a shell as an argument
|
34
|
-
#
|
35
|
-
# Follows the Proxy Design Pattern
|
36
|
-
class FileDialogProxy < WidgetProxy
|
37
|
-
# TODO write rspec tests
|
38
|
-
# TODO consider refactoring and sharing code with DirectoryDialogProxy (and do the same with their expressions)
|
39
|
-
include_package 'org.eclipse.swt.widgets'
|
40
|
-
|
41
|
-
def initialize(*args, swt_widget: nil)
|
42
|
-
auto_exec do
|
43
|
-
if swt_widget
|
44
|
-
@swt_widget = swt_widget
|
45
|
-
else
|
46
|
-
style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
|
47
|
-
if style_args.any?
|
48
|
-
style_arg_start_index = args.index(style_args.first)
|
49
|
-
style_arg_last_index = args.index(style_args.last)
|
50
|
-
args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
|
51
|
-
end
|
52
|
-
if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell)
|
53
|
-
args[0] = args[0].swt_widget
|
54
|
-
end
|
55
|
-
if !args.first.is_a?(Shell)
|
56
|
-
current_shell = DisplayProxy.instance.swt_display.shells.first
|
57
|
-
args.unshift(current_shell.nil? ? ShellProxy.new : current_shell)
|
58
|
-
end
|
59
|
-
parent = args[0]
|
60
|
-
@parent_proxy = parent.is_a?(Shell) ? ShellProxy.new(swt_widget: parent) : parent
|
61
|
-
@swt_widget = FileDialog.new(*args)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|