glimmer-dsl-swt 4.17.5.0 → 4.17.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -2
- data/README.md +250 -83
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +20 -5
- data/lib/glimmer/data_binding/tree_items_binding.rb +20 -2
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +2 -0
- data/lib/glimmer/dsl/swt/dialog_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/directory_dialog_expression.rb +48 -0
- data/lib/glimmer/dsl/swt/dsl.rb +2 -0
- data/lib/glimmer/dsl/swt/file_dialog_expression.rb +48 -0
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/shell_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/widget_expression.rb +8 -8
- data/lib/glimmer/swt/custom/checkbox_group.rb +181 -0
- data/lib/glimmer/swt/custom/code_text.rb +39 -31
- data/lib/glimmer/swt/custom/radio_group.rb +176 -0
- data/lib/glimmer/swt/directory_dialog_proxy.rb +65 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +0 -1
- data/lib/glimmer/swt/file_dialog_proxy.rb +66 -0
- data/lib/glimmer/swt/menu_proxy.rb +4 -4
- data/lib/glimmer/swt/shell_proxy.rb +5 -5
- data/lib/glimmer/swt/tab_item_proxy.rb +3 -3
- data/lib/glimmer/swt/widget_proxy.rb +27 -27
- data/lib/glimmer/ui/custom_shell.rb +3 -3
- data/lib/glimmer/ui/custom_widget.rb +3 -0
- data/samples/elaborate/meta_sample.rb +24 -19
- data/samples/hello/hello_checkbox.rb +85 -0
- data/samples/hello/hello_checkbox_group.rb +68 -0
- data/samples/hello/hello_combo.rb +12 -12
- data/samples/hello/hello_directory_dialog.rb +60 -0
- data/samples/hello/hello_expand_bar.rb +3 -1
- data/samples/hello/hello_file_dialog.rb +60 -0
- data/samples/hello/hello_group.rb +104 -0
- data/samples/hello/hello_list_multi_selection.rb +23 -23
- data/samples/hello/hello_list_single_selection.rb +18 -17
- data/samples/hello/hello_radio.rb +108 -0
- data/samples/hello/hello_radio_group.rb +84 -0
- data/samples/hello/hello_world.rb +3 -3
- metadata +19 -4
@@ -0,0 +1,65 @@
|
|
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 '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.DirectoryDialog
|
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 DirectoryDialogProxy < WidgetProxy
|
37
|
+
# TODO write rspec tests
|
38
|
+
include_package 'org.eclipse.swt.widgets'
|
39
|
+
|
40
|
+
def initialize(*args, swt_widget: nil)
|
41
|
+
if swt_widget
|
42
|
+
@swt_widget = swt_widget
|
43
|
+
else
|
44
|
+
style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
|
45
|
+
if style_args.any?
|
46
|
+
style_arg_start_index = args.index(style_args.first)
|
47
|
+
style_arg_last_index = args.index(style_args.last)
|
48
|
+
args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
|
49
|
+
end
|
50
|
+
if !args.first.is_a?(Shell)
|
51
|
+
current_shell = DisplayProxy.instance.swt_display.shells.first
|
52
|
+
args.unshift(current_shell.nil? ? ShellProxy.new : current_shell)
|
53
|
+
end
|
54
|
+
if args.first.is_a?(ShellProxy)
|
55
|
+
args[0] = args[0].swt_widget
|
56
|
+
end
|
57
|
+
parent = args[0]
|
58
|
+
@parent_proxy = parent.is_a?(Shell) ? ShellProxy.new(swt_widget: parent) : parent
|
59
|
+
@swt_widget = DirectoryDialog.new(*args)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -61,7 +61,6 @@ module Glimmer
|
|
61
61
|
|
62
62
|
def post_add_content
|
63
63
|
@swt_expand_item.setHeight(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]).y) unless @swt_expand_item.getHeight > 0
|
64
|
-
WidgetProxy.new('composite', self, []) # adding filler since it seems like the last child gets a bad style, so this gets it instead
|
65
64
|
end
|
66
65
|
|
67
66
|
def has_attribute?(attribute_name, *args)
|
@@ -0,0 +1,66 @@
|
|
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 '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
|
+
if swt_widget
|
43
|
+
@swt_widget = swt_widget
|
44
|
+
else
|
45
|
+
style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
|
46
|
+
if style_args.any?
|
47
|
+
style_arg_start_index = args.index(style_args.first)
|
48
|
+
style_arg_last_index = args.index(style_args.last)
|
49
|
+
args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args]
|
50
|
+
end
|
51
|
+
if !args.first.is_a?(Shell)
|
52
|
+
current_shell = DisplayProxy.instance.swt_display.shells.first
|
53
|
+
args.unshift(current_shell.nil? ? ShellProxy.new : current_shell)
|
54
|
+
end
|
55
|
+
if args.first.is_a?(ShellProxy)
|
56
|
+
args[0] = args[0].swt_widget
|
57
|
+
end
|
58
|
+
parent = args[0]
|
59
|
+
@parent_proxy = parent.is_a?(Shell) ? ShellProxy.new(swt_widget: parent) : parent
|
60
|
+
@swt_widget = FileDialog.new(*args)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 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
|
@@ -116,7 +116,7 @@ module Glimmer
|
|
116
116
|
else
|
117
117
|
menu_item_proxy.handle_observation_request(observation_request, &block)
|
118
118
|
end
|
119
|
-
end
|
119
|
+
end
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 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
|
@@ -65,7 +65,7 @@ module Glimmer
|
|
65
65
|
@swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN)
|
66
66
|
# TODO make this an option not the default
|
67
67
|
on_swt_show do
|
68
|
-
Thread.new do
|
68
|
+
Thread.new do
|
69
69
|
sleep(0.25)
|
70
70
|
async_exec do
|
71
71
|
@swt_widget.setActive unless @swt_widget.isDisposed
|
@@ -130,7 +130,7 @@ module Glimmer
|
|
130
130
|
@swt_widget.pack
|
131
131
|
@swt_widget.removeControlListener(listener.swt_listener)
|
132
132
|
@swt_widget.setMinimumSize(minimum_size)
|
133
|
-
elsif OS.linux?
|
133
|
+
elsif OS.linux?
|
134
134
|
@swt_widget.layout(true, true)
|
135
135
|
@swt_widget.setBounds(bounds)
|
136
136
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 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
|
@@ -50,6 +50,7 @@ module Glimmer
|
|
50
50
|
'check' => [:check],
|
51
51
|
'drag_source' => [:drop_copy],
|
52
52
|
'drop_target' => [:drop_copy],
|
53
|
+
'expand_bar' => [:v_scroll],
|
53
54
|
'list' => [:border, :v_scroll],
|
54
55
|
'menu_item' => [:push],
|
55
56
|
'radio' => [:radio],
|
@@ -61,7 +62,6 @@ module Glimmer
|
|
61
62
|
'toggle' => [:toggle],
|
62
63
|
'tool_bar' => [:push],
|
63
64
|
'tool_item' => [:push],
|
64
|
-
'expand_bar' => [:v_scroll],
|
65
65
|
'tree' => [:virtual, :border, :h_scroll, :v_scroll],
|
66
66
|
}
|
67
67
|
|
@@ -91,11 +91,11 @@ module Glimmer
|
|
91
91
|
}
|
92
92
|
|
93
93
|
KEYWORD_ALIASES = {
|
94
|
-
'
|
94
|
+
'arrow' => 'button',
|
95
95
|
'checkbox' => 'button',
|
96
96
|
'check' => 'button',
|
97
|
+
'radio' => 'button',
|
97
98
|
'toggle' => 'button',
|
98
|
-
'arrow' => 'button',
|
99
99
|
}
|
100
100
|
|
101
101
|
class << self
|
@@ -108,7 +108,7 @@ module Glimmer
|
|
108
108
|
if init_args.empty?
|
109
109
|
selected_widget_proxy_class.new(swt_widget: swt_widget)
|
110
110
|
else
|
111
|
-
selected_widget_proxy_class.new(*init_args)
|
111
|
+
selected_widget_proxy_class.new(*init_args)
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -119,11 +119,11 @@ module Glimmer
|
|
119
119
|
Glimmer::SWT.const_get(class_name)
|
120
120
|
rescue
|
121
121
|
Glimmer::SWT::WidgetProxy
|
122
|
-
end
|
122
|
+
end
|
123
123
|
end
|
124
124
|
|
125
125
|
def underscored_widget_name(swt_widget)
|
126
|
-
swt_widget.class.name.split(/::|\./).last.underscore
|
126
|
+
swt_widget.class.name.split(/::|\./).last.underscore
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -131,7 +131,7 @@ module Glimmer
|
|
131
131
|
|
132
132
|
# Initializes a new SWT Widget
|
133
133
|
#
|
134
|
-
# It is preferred to use `::create` method instead since it instantiates the
|
134
|
+
# It is preferred to use `::create` method instead since it instantiates the
|
135
135
|
# right subclass per widget keyword
|
136
136
|
#
|
137
137
|
# keyword, parent, swt_widget_args (including styles)
|
@@ -152,7 +152,7 @@ module Glimmer
|
|
152
152
|
@parent_proxy = parent.get_data('proxy') || parent_proxy_class.new(swt_widget: parent)
|
153
153
|
end
|
154
154
|
if @swt_widget&.get_data('proxy').nil?
|
155
|
-
@swt_widget.set_data('proxy', self)
|
155
|
+
@swt_widget.set_data('proxy', self)
|
156
156
|
DEFAULT_INITIALIZERS[underscored_widget_name]&.call(@swt_widget)
|
157
157
|
@parent_proxy.post_initialize_child(self)
|
158
158
|
end
|
@@ -376,7 +376,7 @@ module Glimmer
|
|
376
376
|
observer.call(@last_top_index)
|
377
377
|
end
|
378
378
|
}
|
379
|
-
end,
|
379
|
+
end,
|
380
380
|
:top_pixel => lambda do |observer|
|
381
381
|
@last_top_pixel = @swt_widget.getTopPixel
|
382
382
|
on_paint_control { |event|
|
@@ -480,13 +480,13 @@ module Glimmer
|
|
480
480
|
proxy.set_attribute(:transfer, :text)
|
481
481
|
proxy.on_drag_enter { |event|
|
482
482
|
event.detail = DNDProxy[:drop_copy]
|
483
|
-
}
|
483
|
+
}
|
484
484
|
end
|
485
485
|
end
|
486
486
|
|
487
487
|
# TODO eliminate duplication in the following methods perhaps by relying on exceptions
|
488
488
|
|
489
|
-
def can_handle_observation_request?(observation_request)
|
489
|
+
def can_handle_observation_request?(observation_request)
|
490
490
|
observation_request = observation_request.to_s
|
491
491
|
if observation_request.start_with?('on_swt_')
|
492
492
|
constant_name = observation_request.sub(/^on_swt_/, '')
|
@@ -509,7 +509,7 @@ module Glimmer
|
|
509
509
|
end
|
510
510
|
rescue => e
|
511
511
|
Glimmer::Config.logger.debug {e.full_message}
|
512
|
-
false
|
512
|
+
false
|
513
513
|
end
|
514
514
|
|
515
515
|
def can_handle_drop_observation_request?(observation_request)
|
@@ -547,7 +547,7 @@ module Glimmer
|
|
547
547
|
end
|
548
548
|
|
549
549
|
def method_missing(method, *args, &block)
|
550
|
-
if can_handle_observation_request?(method)
|
550
|
+
if can_handle_observation_request?(method)
|
551
551
|
handle_observation_request(method, &block)
|
552
552
|
else
|
553
553
|
swt_widget.send(method, *args, &block)
|
@@ -559,7 +559,7 @@ module Glimmer
|
|
559
559
|
end
|
560
560
|
|
561
561
|
def respond_to?(method, *args, &block)
|
562
|
-
super ||
|
562
|
+
super ||
|
563
563
|
can_handle_observation_request?(method) ||
|
564
564
|
swt_widget.respond_to?(method, *args, &block)
|
565
565
|
end
|
@@ -567,7 +567,7 @@ module Glimmer
|
|
567
567
|
private
|
568
568
|
|
569
569
|
def style(underscored_widget_name, styles)
|
570
|
-
styles = [styles].flatten.compact
|
570
|
+
styles = [styles].flatten.compact
|
571
571
|
styles = default_style(underscored_widget_name) if styles.empty?
|
572
572
|
interpret_style(*styles)
|
573
573
|
end
|
@@ -603,9 +603,9 @@ module Glimmer
|
|
603
603
|
end
|
604
604
|
|
605
605
|
def add_listener(underscored_listener_name, &block)
|
606
|
-
widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
|
606
|
+
widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
|
607
607
|
widget_listener_proxy = nil
|
608
|
-
safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
|
608
|
+
safe_block = lambda { |*args| block.call(*args) unless @swt_widget.isDisposed }
|
609
609
|
listener = listener_class.new(listener_method => safe_block)
|
610
610
|
@swt_widget.send(widget_add_listener_method, listener)
|
611
611
|
widget_listener_proxy = WidgetListenerProxy.new(swt_widget: @swt_widget, swt_listener: listener, widget_add_listener_method: widget_add_listener_method, swt_listener_class: listener_class, swt_listener_method: listener_method)
|
@@ -647,7 +647,7 @@ module Glimmer
|
|
647
647
|
listener_class.define_method('initialize') do |event_method_block_mapping|
|
648
648
|
@event_method_block_mapping = event_method_block_mapping
|
649
649
|
end
|
650
|
-
listener_type.getMethods.each do |event_method|
|
650
|
+
listener_type.getMethods.each do |event_method|
|
651
651
|
listener_class.define_method(event_method.getName) do |*args|
|
652
652
|
@event_method_block_mapping[event_method.getName]&.call(*args)
|
653
653
|
end
|
@@ -678,9 +678,9 @@ module Glimmer
|
|
678
678
|
},
|
679
679
|
'selection_count' => {
|
680
680
|
getter: {name: 'getSelectionCount'},
|
681
|
-
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
681
|
+
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
682
682
|
caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset
|
683
|
-
@swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
|
683
|
+
@swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
|
684
684
|
}},
|
685
685
|
},
|
686
686
|
}
|
@@ -773,13 +773,13 @@ module Glimmer
|
|
773
773
|
sleep(delayTime)
|
774
774
|
end
|
775
775
|
};
|
776
|
-
image_proxy = nil
|
776
|
+
image_proxy = nil
|
777
777
|
else
|
778
778
|
on_swt_Resize do |resize_event|
|
779
779
|
image_proxy.scale_to(@swt_widget.getSize.x, @swt_widget.getSize.y)
|
780
|
-
@swt_widget.setBackgroundImage(image_proxy.swt_image)
|
781
|
-
end
|
782
|
-
end
|
780
|
+
@swt_widget.setBackgroundImage(image_proxy.swt_image)
|
781
|
+
end
|
782
|
+
end
|
783
783
|
|
784
784
|
image_proxy&.swt_image
|
785
785
|
end,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2020 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
|
@@ -213,6 +213,7 @@ module Glimmer
|
|
213
213
|
def has_instance_method?(method_name)
|
214
214
|
respond_to?(method_name) and
|
215
215
|
!swt_widget&.respond_to?(method_name) and
|
216
|
+
(method(method_name) rescue nil) and
|
216
217
|
!method(method_name)&.source_location&.first&.include?('glimmer/dsl/engine.rb') and
|
217
218
|
!method(method_name)&.source_location&.first&.include?('glimmer/swt/widget_proxy.rb')
|
218
219
|
end
|
@@ -255,6 +256,8 @@ module Glimmer
|
|
255
256
|
end
|
256
257
|
|
257
258
|
def method_missing(method, *args, &block)
|
259
|
+
# TODO Consider supporting a glimmer error silencing option for methods defined here
|
260
|
+
# but fail the glimmer DSL for the right reason to avoid seeing noise in the log output
|
258
261
|
if can_handle_observation_request?(method)
|
259
262
|
handle_observation_request(method, &block)
|
260
263
|
else
|