glimmer-dsl-swt 4.18.4.9 → 4.18.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +73 -0
- data/README.md +14 -5
- data/VERSION +1 -1
- data/bin/glimmer +3 -3
- data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +464 -149
- data/docs/reference/GLIMMER_SAMPLES.md +91 -4
- data/glimmer-dsl-swt.gemspec +24 -13
- data/lib/ext/glimmer/config.rb +3 -7
- data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
- data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
- data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
- data/lib/glimmer/data_binding/widget_binding.rb +13 -15
- data/lib/glimmer/dsl/swt/{file_dialog_expression.rb → auto_exec_expression.rb} +6 -18
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
- data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +2 -2
- data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/image_expression.rb +16 -2
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
- data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
- data/lib/glimmer/dsl/swt/shape_expression.rb +2 -2
- data/lib/glimmer/dsl/swt/shell_expression.rb +5 -2
- data/lib/glimmer/dsl/swt/widget_expression.rb +8 -4
- data/lib/glimmer/launcher.rb +3 -0
- data/lib/glimmer/rake_task/scaffold.rb +3 -0
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/custom/code_text.rb +33 -11
- data/lib/glimmer/swt/custom/drawable.rb +55 -0
- data/lib/glimmer/swt/custom/shape.rb +187 -43
- data/lib/glimmer/swt/custom/shape/arc.rb +60 -0
- data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/focus.rb} +15 -20
- data/lib/glimmer/swt/custom/shape/image.rb +99 -0
- data/lib/glimmer/swt/custom/shape/line.rb +65 -0
- data/lib/glimmer/swt/custom/shape/oval.rb +61 -0
- data/lib/glimmer/swt/custom/shape/point.rb +54 -0
- data/lib/glimmer/swt/custom/shape/polygon.rb +73 -0
- data/lib/glimmer/swt/custom/shape/polyline.rb +74 -0
- data/lib/glimmer/swt/custom/shape/rectangle.rb +101 -0
- data/lib/glimmer/swt/custom/shape/text.rb +85 -0
- data/lib/glimmer/swt/date_time_proxy.rb +9 -3
- data/lib/glimmer/swt/dialog_proxy.rb +92 -0
- data/lib/glimmer/swt/display_proxy.rb +62 -2
- data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
- data/lib/glimmer/swt/font_proxy.rb +13 -7
- data/lib/glimmer/swt/image_proxy.rb +15 -4
- data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
- data/lib/glimmer/swt/layout_proxy.rb +19 -15
- data/lib/glimmer/swt/menu_proxy.rb +2 -2
- data/lib/glimmer/swt/message_box_proxy.rb +21 -7
- data/lib/glimmer/swt/properties.rb +3 -0
- data/lib/glimmer/swt/proxy_properties.rb +145 -0
- data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
- data/lib/glimmer/swt/shell_proxy.rb +96 -80
- data/lib/glimmer/swt/swt_proxy.rb +17 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
- data/lib/glimmer/swt/table_proxy.rb +32 -11
- data/lib/glimmer/swt/transform_proxy.rb +39 -35
- data/lib/glimmer/swt/tree_proxy.rb +11 -16
- data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
- data/lib/glimmer/swt/widget_proxy.rb +192 -141
- data/lib/glimmer/ui.rb +5 -0
- data/lib/glimmer/ui/custom_shell.rb +13 -7
- data/lib/glimmer/ui/custom_widget.rb +4 -5
- data/samples/elaborate/contact_manager.rb +7 -7
- data/samples/elaborate/login.rb +25 -21
- data/samples/elaborate/mandelbrot_fractal.rb +87 -31
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/elaborate/tetris.rb +1 -0
- data/samples/elaborate/tic_tac_toe.rb +16 -14
- data/samples/elaborate/tic_tac_toe/board.rb +5 -5
- data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
- data/samples/hello/hello_button.rb +7 -7
- data/samples/hello/hello_canvas.rb +143 -41
- data/samples/hello/hello_checkbox.rb +16 -14
- data/samples/hello/hello_checkbox_group.rb +11 -9
- data/samples/hello/hello_color_dialog.rb +66 -0
- data/samples/hello/hello_combo.rb +14 -12
- data/samples/hello/hello_computed.rb +7 -7
- data/samples/hello/hello_cursor.rb +2 -1
- data/samples/hello/hello_custom_shell.rb +17 -21
- data/samples/hello/hello_custom_widget.rb +4 -6
- data/samples/hello/hello_date_time.rb +14 -12
- data/samples/hello/hello_directory_dialog.rb +7 -7
- data/samples/hello/hello_expand_bar.rb +8 -8
- data/samples/hello/hello_file_dialog.rb +7 -7
- data/samples/hello/hello_font_dialog.rb +82 -0
- data/samples/hello/hello_group.rb +18 -16
- data/samples/hello/hello_list_multi_selection.rb +13 -11
- data/samples/hello/hello_list_single_selection.rb +13 -11
- data/samples/hello/hello_progress_bar.rb +125 -0
- data/samples/hello/hello_radio.rb +18 -16
- data/samples/hello/hello_radio_group.rb +14 -12
- data/samples/hello/hello_spinner.rb +7 -7
- data/samples/hello/hello_tab.rb +5 -5
- data/samples/hello/hello_table.rb +10 -5
- data/samples/hello/hello_tree.rb +485 -0
- metadata +22 -22
- data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
- data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
@@ -32,32 +32,30 @@ module Glimmer
|
|
32
32
|
include Observer
|
33
33
|
|
34
34
|
attr_reader :widget, :property
|
35
|
-
def initialize(widget, property,
|
35
|
+
def initialize(widget, property, sync_exec: nil, async_exec: nil)
|
36
36
|
@widget = widget
|
37
37
|
@property = property
|
38
|
-
@
|
39
|
-
|
40
|
-
|
41
|
-
@widget.on_widget_disposed
|
42
|
-
|
38
|
+
@sync_exec = sync_exec
|
39
|
+
@async_exec = async_exec
|
40
|
+
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
41
|
+
if @widget.respond_to?(:on_widget_disposed)
|
42
|
+
@widget.on_widget_disposed do |dispose_event|
|
43
|
+
unregister_all_observables
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def call(value)
|
48
|
-
|
49
|
-
|
50
|
-
update_operation = lambda do
|
50
|
+
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
51
51
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
52
52
|
unregister_all_observables
|
53
53
|
return
|
54
54
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
update_operation.call
|
55
|
+
# need the rescue false for a scenario with tree items not being equal to model objects raising an exception
|
56
|
+
unless ((value == evaluate_property) rescue false) # need the rescue false for a scenario with tree items not being equal to model objects raising an exception
|
57
|
+
@widget.set_attribute(@property, value)
|
58
|
+
end
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
@@ -20,28 +20,16 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/dsl/static_expression'
|
23
|
-
require 'glimmer/dsl/
|
24
|
-
require 'glimmer/dsl/top_level_expression'
|
25
|
-
require 'glimmer/swt/file_dialog_proxy'
|
23
|
+
require 'glimmer/dsl/swt/exec_expression'
|
26
24
|
|
27
25
|
module Glimmer
|
28
26
|
module DSL
|
29
27
|
module SWT
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
28
|
+
# Automatically executes code block against the SWT Event Loop
|
29
|
+
# with sync_exec if needed (inside a thread other than GUI thread)
|
30
|
+
# to manipulate SWT UI objects on the UI thread safely
|
31
|
+
class AutoExecExpression < StaticExpression
|
32
|
+
include ExecExpression
|
45
33
|
end
|
46
34
|
end
|
47
35
|
end
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
|
+
require 'glimmer/swt/display_proxy'
|
25
26
|
|
26
27
|
module Glimmer
|
27
28
|
module DSL
|
@@ -36,23 +37,25 @@ module Glimmer
|
|
36
37
|
args[0].is_a?(DataBinding::ModelBinding) and
|
37
38
|
args[0].evaluate_options_property.is_a?(Array)
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
def interpret(parent, keyword, *args, &block)
|
41
42
|
model_binding = args[0]
|
42
43
|
|
43
44
|
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
44
45
|
# TODO consider delegating some of this work
|
45
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
46
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'items', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
46
47
|
widget_binding.call(model_binding.evaluate_options_property)
|
47
48
|
model = model_binding.base_model
|
48
49
|
widget_binding.observe(model, model_binding.options_property_name)
|
49
50
|
|
50
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'selection')
|
51
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'selection', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
51
52
|
widget_binding.call(model_binding.evaluate_property)
|
52
|
-
widget_binding.observe(
|
53
|
+
widget_binding.observe(model_binding)
|
53
54
|
|
54
|
-
|
55
|
-
|
55
|
+
Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
|
56
|
+
parent.on_widget_selected do
|
57
|
+
model_binding.call(widget_binding.evaluate_property)
|
58
|
+
end
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
@@ -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
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
|
+
require 'glimmer/swt/display_proxy'
|
25
26
|
|
26
27
|
module Glimmer
|
27
28
|
module DSL
|
@@ -44,21 +45,22 @@ module Glimmer
|
|
44
45
|
|
45
46
|
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
46
47
|
# TODO consider delegating some of this work
|
47
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
48
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'items', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
48
49
|
widget_binding.call(model_binding.evaluate_options_property)
|
49
|
-
model
|
50
|
-
widget_binding.observe(model, model_binding.options_property_name)
|
50
|
+
widget_binding.observe(model_binding.model, model_binding.options_property_name)
|
51
51
|
|
52
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'text')
|
52
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'text', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
53
53
|
widget_binding.call(model_binding.evaluate_property)
|
54
|
-
widget_binding.observe(
|
54
|
+
widget_binding.observe(model_binding)
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
|
57
|
+
parent.on_widget_selected do
|
58
|
+
model_binding.call(widget_binding.evaluate_property)
|
59
|
+
end
|
60
|
+
|
61
|
+
parent.on_modify_text do
|
62
|
+
model_binding.call(widget_binding.evaluate_property)
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
@@ -46,11 +46,14 @@ module Glimmer
|
|
46
46
|
|
47
47
|
def interpret(parent, keyword, *args, &block)
|
48
48
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
49
|
-
UI::CustomWidget.for(keyword).new(parent, *args, options, &block)
|
49
|
+
UI::CustomWidget.for(keyword).new(parent, *args, options, &block).tap do |new_custom_widget|
|
50
|
+
new_custom_widget.body_root.paint_pixel_by_pixel(&block) if block&.parameters&.count == 2
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
def add_content(parent, &block)
|
53
55
|
# TODO consider avoiding source_location
|
56
|
+
return if block&.parameters&.count == 2
|
54
57
|
if block.source_location == parent.content&.__getobj__.source_location
|
55
58
|
parent.content.call(parent) unless parent.content.called?
|
56
59
|
else
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
|
+
require 'glimmer/swt/display_proxy'
|
25
26
|
|
26
27
|
module Glimmer
|
27
28
|
module DSL
|
@@ -41,8 +42,7 @@ module Glimmer
|
|
41
42
|
|
42
43
|
def interpret(parent, keyword, *args, &block)
|
43
44
|
model_binding = args[0]
|
44
|
-
|
45
|
-
widget_binding = DataBinding::WidgetBinding.new(*widget_binding_parameters)
|
45
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, keyword, sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
46
46
|
widget_binding.call(model_binding.evaluate_property)
|
47
47
|
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
48
48
|
widget_binding.observe(model_binding)
|
@@ -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
|
@@ -23,24 +23,33 @@ require 'glimmer/dsl/static_expression'
|
|
23
23
|
require 'glimmer/dsl/parent_expression'
|
24
24
|
require 'glimmer/dsl/top_level_expression'
|
25
25
|
require 'glimmer/swt/shell_proxy'
|
26
|
+
require 'glimmer/swt/dialog_proxy'
|
26
27
|
|
27
28
|
module Glimmer
|
28
29
|
module DSL
|
29
30
|
module SWT
|
30
|
-
class DialogExpression <
|
31
|
+
class DialogExpression < Expression
|
31
32
|
include TopLevelExpression
|
32
33
|
include ParentExpression
|
33
34
|
|
34
35
|
def can_interpret?(parent, keyword, *args, &block)
|
35
|
-
|
36
|
-
(
|
36
|
+
(
|
37
|
+
(keyword == 'dialog') or
|
38
|
+
(keyword.to_s.end_with?('dialog') and Glimmer::SWT::DialogProxy.dialog_class(keyword))
|
39
|
+
) and
|
40
|
+
(parent.nil? or parent.is_a?(org.eclipse.swt.widgets.Shell) or parent.is_a?(Glimmer::SWT::ShellProxy))
|
37
41
|
end
|
38
42
|
|
39
43
|
def interpret(parent, keyword, *args, &block)
|
40
44
|
# TODO reconcile this with the actual org.eclipse.swt.widgets.Dialog widget (maybe rename this as dialog_shell)
|
41
|
-
|
42
|
-
|
43
|
-
|
45
|
+
if keyword == 'dialog'
|
46
|
+
args = [parent] + args unless parent.nil?
|
47
|
+
args += [:dialog_trim, :application_modal]
|
48
|
+
Glimmer::SWT::ShellProxy.new(*args)
|
49
|
+
else
|
50
|
+
args = [parent] + args unless parent.nil?
|
51
|
+
Glimmer::SWT::DialogProxy.new(keyword, *args)
|
52
|
+
end
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
data/lib/glimmer/dsl/swt/dsl.rb
CHANGED
@@ -41,7 +41,7 @@ module Glimmer
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def interpret(parent, keyword, *args, &block)
|
44
|
-
Glimmer::SWT::DisplayProxy.instance.
|
44
|
+
Glimmer::SWT::DisplayProxy.instance.send(exec_operation, *args) do |*args|
|
45
45
|
begin
|
46
46
|
block.call(*args)
|
47
47
|
rescue => e
|
@@ -37,7 +37,7 @@ module Glimmer
|
|
37
37
|
(parent.nil? || !parent.respond_to?('font')) and
|
38
38
|
!parent.is_a?(Glimmer::SWT::Custom::Shape) and
|
39
39
|
args.size == 1 and
|
40
|
-
args.first.is_a?(Hash)
|
40
|
+
(args.first.is_a?(Hash) || args.first.is_a?(org.eclipse.swt.graphics.FontData))
|
41
41
|
end
|
42
42
|
|
43
43
|
def interpret(parent, keyword, *args, &block)
|
@@ -34,17 +34,31 @@ module Glimmer
|
|
34
34
|
include ParentExpression
|
35
35
|
|
36
36
|
def can_interpret?(parent, keyword, *args, &block)
|
37
|
+
options = args.last.is_a?(Hash) ? args.last : {}
|
37
38
|
(keyword == 'image') and
|
38
|
-
(
|
39
|
+
(
|
40
|
+
options.keys.include?(:top_level) or
|
41
|
+
(
|
42
|
+
!parent.is_a?(Glimmer::SWT::Custom::Shape) and
|
43
|
+
(parent.nil? or parent.respond_to?('image=') or args.first.is_a?(Numeric))
|
44
|
+
)
|
45
|
+
)
|
39
46
|
end
|
40
47
|
|
41
48
|
def interpret(parent, keyword, *args, &block)
|
42
49
|
options = args.last.is_a?(Hash) ? args.last : {}
|
50
|
+
coordinate_args = args.size == (options.empty? ? 2 : 3)
|
43
51
|
args.unshift(parent) unless parent.nil? || options[:top_level]
|
44
|
-
|
52
|
+
@create_pixel_by_pixel = coordinate_args && block&.parameters&.count == 2
|
53
|
+
if @create_pixel_by_pixel
|
54
|
+
Glimmer::SWT::ImageProxy.create_pixel_by_pixel(*args, &block)
|
55
|
+
else
|
56
|
+
Glimmer::SWT::ImageProxy.create(*args, &block)
|
57
|
+
end
|
45
58
|
end
|
46
59
|
|
47
60
|
def add_content(parent, &block)
|
61
|
+
return if @create_pixel_by_pixel || block&.parameters&.count == 2
|
48
62
|
super
|
49
63
|
parent.post_add_content
|
50
64
|
end
|
@@ -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
|
@@ -23,6 +23,7 @@ require 'glimmer/dsl/expression'
|
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
25
|
require 'glimmer/data_binding/list_selection_binding'
|
26
|
+
require 'glimmer/swt/display_proxy'
|
26
27
|
|
27
28
|
module Glimmer
|
28
29
|
module DSL
|
@@ -42,7 +43,7 @@ module Glimmer
|
|
42
43
|
|
43
44
|
def interpret(parent, keyword, *args, &block)
|
44
45
|
model_binding = args[0]
|
45
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
46
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'items', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
46
47
|
widget_binding.call(model_binding.evaluate_options_property)
|
47
48
|
model = model_binding.base_model
|
48
49
|
#TODO make this options observer dependent and all similar observers in widget specific data binding interpretrs
|
@@ -50,13 +51,15 @@ module Glimmer
|
|
50
51
|
|
51
52
|
property_type = :string
|
52
53
|
property_type = :array if parent.has_style?(:multi)
|
53
|
-
list_selection_binding = DataBinding::ListSelectionBinding.new(parent, property_type)
|
54
|
+
list_selection_binding = DataBinding::ListSelectionBinding.new(parent, property_type, sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
54
55
|
list_selection_binding.call(model_binding.evaluate_property)
|
55
56
|
#TODO check if nested data binding works for list widget and other widgets that need custom data binding
|
56
|
-
list_selection_binding.observe(
|
57
|
+
list_selection_binding.observe(model_binding)
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
|
60
|
+
parent.on_widget_selected do
|
61
|
+
model_binding.call(list_selection_binding.evaluate_property)
|
62
|
+
end
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
@@ -30,7 +30,7 @@ module Glimmer
|
|
30
30
|
class PixelExpression < StaticExpression
|
31
31
|
|
32
32
|
def interpret(parent, keyword, *args, &block)
|
33
|
-
Glimmer::SWT::Custom::Shape.new(parent, '
|
33
|
+
Glimmer::SWT::Custom::Shape.new(parent, 'pixel', *args, &block)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
|
+
require 'glimmer/swt/display_proxy'
|
25
26
|
|
26
27
|
module Glimmer
|
27
28
|
module DSL
|
@@ -42,18 +43,20 @@ module Glimmer
|
|
42
43
|
|
43
44
|
#TODO make this options observer dependent and all similar observers in widget specific data binding handlers
|
44
45
|
# TODO consider delegating some of this work
|
45
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'items')
|
46
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'items', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
46
47
|
widget_binding.call(model_binding.evaluate_options_property)
|
47
48
|
model = model_binding.base_model
|
48
49
|
widget_binding.observe(model, model_binding.options_property_name)
|
49
50
|
|
50
|
-
widget_binding = DataBinding::WidgetBinding.new(parent, 'selection')
|
51
|
+
widget_binding = DataBinding::WidgetBinding.new(parent, 'selection', sync_exec: model_binding.binding_options[:sync_exec], async_exec: model_binding.binding_options[:async_exec])
|
51
52
|
widget_binding.call(model_binding.evaluate_property)
|
52
|
-
widget_binding.observe(
|
53
|
+
widget_binding.observe(model_binding)
|
53
54
|
|
54
55
|
raise(Glimmer::Error, "No radios found! Make sure radio selection is data-bound to a property having property_options as non-empty array!") if parent.items.empty?
|
55
|
-
|
56
|
-
|
56
|
+
Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: model_binding.binding_options[:sync_exec], override_async_exec: model_binding.binding_options[:async_exec]) do
|
57
|
+
parent.on_widget_selected do
|
58
|
+
model_binding.call(widget_binding.evaluate_property)
|
59
|
+
end
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|