glimmer-dsl-opal 0.28.0 → 0.29.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 +27 -0
- data/LICENSE.txt +1 -1
- data/README.md +175 -28
- data/VERSION +1 -1
- data/app/assets/images/glimmer/images/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/glimmer/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/glimmer/jquery-ui.css +109 -106
- data/app/assets/stylesheets/glimmer/jquery-ui.structure.css +91 -91
- data/app/assets/stylesheets/glimmer/jquery-ui.theme.css +18 -15
- data/app/controllers/glimmer/image_paths_controller.rb +0 -1
- data/config/routes.rb +1 -1
- data/lib/display.rb +1 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +1 -1
- data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/bind_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/custom_widget_expression.rb +3 -3
- data/lib/glimmer/dsl/opal/data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dialog_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/dsl.rb +2 -0
- data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/image_expression.rb +64 -0
- data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/menu_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/message_box_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/property_expression.rb +2 -3
- data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/shape_expression.rb +6 -4
- data/lib/glimmer/dsl/opal/shell_expression.rb +2 -2
- data/lib/glimmer/dsl/opal/shine_data_binding_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/swt_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
- data/lib/glimmer/dsl/opal/widget_expression.rb +1 -1
- data/lib/glimmer/engine.rb +1 -1
- data/lib/glimmer/swt/arrow_proxy.rb +7 -1
- data/lib/glimmer/swt/button_proxy.rb +4 -3
- data/lib/glimmer/swt/c_combo_proxy.rb +1 -1
- data/lib/glimmer/swt/c_tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/c_tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/checkbox_proxy.rb +3 -2
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/composite_proxy.rb +1 -1
- data/lib/glimmer/swt/control_editor.rb +1 -1
- data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
- data/lib/glimmer/swt/custom/radio_group.rb +1 -1
- data/lib/glimmer/swt/custom/shape/arc.rb +75 -0
- data/lib/glimmer/swt/custom/shape/image.rb +98 -0
- data/lib/glimmer/swt/custom/shape/line.rb +4 -1
- data/lib/glimmer/swt/custom/shape/oval.rb +1 -1
- data/lib/glimmer/swt/custom/shape/point.rb +4 -1
- data/lib/glimmer/swt/custom/shape/polygon.rb +4 -1
- data/lib/glimmer/swt/custom/shape/polyline.rb +4 -1
- data/lib/glimmer/swt/custom/shape/rectangle.rb +53 -2
- data/lib/glimmer/swt/custom/shape/text.rb +52 -2
- data/lib/glimmer/swt/custom/shape.rb +101 -5
- data/lib/glimmer/swt/date_time_proxy.rb +2 -2
- data/lib/glimmer/swt/dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/font_proxy.rb +1 -1
- data/lib/glimmer/swt/image_proxy.rb +29 -0
- data/lib/glimmer/swt/label_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_dialog_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/latest_shell_proxy.rb +4 -4
- data/lib/glimmer/swt/layout_proxy.rb +1 -1
- data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
- data/lib/glimmer/swt/menu_item_proxy.rb +3 -3
- data/lib/glimmer/swt/menu_proxy.rb +22 -16
- data/lib/glimmer/swt/message_box_proxy.rb +1 -1
- data/lib/glimmer/swt/progress_bar_proxy.rb +1 -1
- data/lib/glimmer/swt/scale_proxy.rb +7 -1
- data/lib/glimmer/swt/shell_proxy.rb +1 -1
- data/lib/glimmer/swt/slider_proxy.rb +6 -0
- data/lib/glimmer/swt/spinner_proxy.rb +4 -3
- data/lib/glimmer/swt/style_constantizable.rb +1 -1
- data/lib/glimmer/swt/swt_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/table_editor.rb +1 -1
- data/lib/glimmer/swt/table_item_proxy.rb +3 -3
- data/lib/glimmer/swt/table_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +29 -28
- data/lib/glimmer/swt.rb +1 -1
- data/lib/glimmer/ui/custom_shell.rb +1 -5
- data/lib/glimmer/ui/custom_widget.rb +5 -5
- data/lib/glimmer/util/proc_tracker.rb +3 -3
- data/lib/glimmer-dsl-opal/ext/date.rb +8 -8
- data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
- data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/block.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/game.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/past_game.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/model/tetromino.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/block.rb +45 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/high_score_dialog.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/playfield.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/score_lane.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris/view/tetris_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/tetris.rb +3 -3
- data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/user_profile.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/elaborate/weather.rb +5 -4
- data/lib/glimmer-dsl-opal/samples/hello/hello_arrow.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_combo.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_c_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_canvas.rb +25 -2
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_composite.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_cursor.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_label.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_layout.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_print.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_progress_bar.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_scale.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_slider.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_spinner.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_text.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
- data/lib/glimmer-dsl-opal/samples/hello/images/scaffold_app.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/AUTHORS.txt +35 -1
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/index.html +503 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.css +4 -4
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.js +3 -10
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.structure.min.css +2 -2
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css +2 -2
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/package.json +26 -26
- data/lib/glimmer-dsl-opal/vendor/jquery.js +10881 -2
- data/lib/glimmer-dsl-opal/vendor/two.min.js +24 -0
- data/lib/glimmer-dsl-opal.rb +2 -1
- data/lib/glimmer-dsl-swt.rb +1 -1
- data/lib/net/http.rb +1 -1
- data/lib/os.rb +1 -1
- metadata +16 -16
- data/app/assets/images/glimmer/images/ui-icons_222222_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
- data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
@@ -56,7 +56,7 @@ module Glimmer
|
|
56
56
|
old_item_ids_per_model = old_items.reduce({}) {|hash, item| hash.merge(item.get_data.hash => item.id) }
|
57
57
|
parent.remove_all
|
58
58
|
model_collection.each do |model|
|
59
|
-
table_item = Glimmer::SWT::TableItemProxy.new(parent)
|
59
|
+
table_item = Glimmer::SWT::TableItemProxy.new(parent, [], nil)
|
60
60
|
for index in 0..(column_properties.size-1)
|
61
61
|
table_item.set_text(index, model.send(column_properties[index]).to_s)
|
62
62
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2022 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
|
@@ -52,7 +52,7 @@ module Glimmer
|
|
52
52
|
# TODO clean code by extracting methods into CustomShell
|
53
53
|
if !Glimmer::UI::CustomShell.requested? && custom_widget_class&.ancestors&.to_a.include?(Glimmer::UI::CustomShell)
|
54
54
|
if Glimmer::SWT::DisplayProxy.instance.shells.empty? || Glimmer::SWT::DisplayProxy.open_custom_shells_in_current_window?
|
55
|
-
custom_widget_class.new(parent,
|
55
|
+
custom_widget_class.new(parent, args, {}, &block)
|
56
56
|
else
|
57
57
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
58
58
|
options = options.merge('swt_style' => args.join(',')) unless args.join(',').empty?
|
@@ -75,7 +75,7 @@ module Glimmer
|
|
75
75
|
# just a placeholder that has an open method # TODO return an actual CustomShell in the future that does the work happening above in the #open method
|
76
76
|
Glimmer::SWT::MakeShiftShellProxy.new
|
77
77
|
else
|
78
|
-
custom_widget_class&.new(parent,
|
78
|
+
custom_widget_class&.new(parent, args, {}, &block)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -26,7 +26,7 @@ module Glimmer
|
|
26
26
|
#TODO make this options observer dependent and all similar observers in element specific data binding handlers
|
27
27
|
element_binding.observe(model_binding)
|
28
28
|
# TODO simplify this logic and put it where it belongs
|
29
|
-
parent.add_observer(model_binding, keyword) if parent.respond_to?(:add_observer
|
29
|
+
parent.add_observer(model_binding, keyword) if parent.respond_to?(:add_observer)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/glimmer/dsl/opal/dsl.rb
CHANGED
@@ -31,6 +31,7 @@ require 'glimmer/dsl/opal/dialog_expression'
|
|
31
31
|
require 'glimmer/dsl/opal/shape_expression'
|
32
32
|
require 'glimmer/dsl/opal/shine_data_binding_expression'
|
33
33
|
require 'glimmer/dsl/opal/shape_expression'
|
34
|
+
require 'glimmer/dsl/opal/image_expression'
|
34
35
|
|
35
36
|
module Glimmer
|
36
37
|
module DSL
|
@@ -47,6 +48,7 @@ module Glimmer
|
|
47
48
|
checkbox_group_selection_data_binding
|
48
49
|
data_binding
|
49
50
|
font
|
51
|
+
image
|
50
52
|
layout
|
51
53
|
block_property
|
52
54
|
property
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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/expression'
|
23
|
+
require 'glimmer/dsl/top_level_expression'
|
24
|
+
require 'glimmer/dsl/parent_expression'
|
25
|
+
require 'glimmer/swt/image_proxy'
|
26
|
+
|
27
|
+
module Glimmer
|
28
|
+
module DSL
|
29
|
+
module Opal
|
30
|
+
# image expression
|
31
|
+
# Note: Cannot be a static expression because it clashes with image property expression
|
32
|
+
class ImageExpression < Expression
|
33
|
+
include TopLevelExpression
|
34
|
+
include ParentExpression
|
35
|
+
|
36
|
+
def can_interpret?(parent, keyword, *args, &block)
|
37
|
+
options = args.last.is_a?(Hash) ? args.last : {}
|
38
|
+
(
|
39
|
+
(keyword == 'image') and
|
40
|
+
(
|
41
|
+
options.keys.include?(:top_level) or
|
42
|
+
(
|
43
|
+
!parent.is_a?(Glimmer::SWT::Custom::Shape) &&
|
44
|
+
!parent.is_a?(Glimmer::SWT::CanvasProxy)
|
45
|
+
)
|
46
|
+
)
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def interpret(parent, keyword, *args, &block)
|
51
|
+
# options = args.last.is_a?(Hash) ? args.last : {}
|
52
|
+
# args.unshift(parent) unless parent.nil? || options[:top_level]
|
53
|
+
Glimmer::SWT::ImageProxy.create(*args, &block)
|
54
|
+
end
|
55
|
+
|
56
|
+
def add_content(parent, keyword, *args, &block)
|
57
|
+
return if @create_pixel_by_pixel || block&.parameters&.count == 2
|
58
|
+
super(parent, keyword, *args, &block)
|
59
|
+
parent.post_add_content
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2022 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
|
@@ -48,7 +48,7 @@ module Glimmer
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def add_content(parent, keyword, *args, &block)
|
51
|
-
super(parent, &block)
|
51
|
+
super(parent, keyword, *args, &block)
|
52
52
|
parent.post_add_content
|
53
53
|
end
|
54
54
|
|
@@ -1,16 +1,15 @@
|
|
1
1
|
require 'glimmer/dsl/expression'
|
2
|
+
require 'glimmer/swt/custom/shape'
|
2
3
|
|
3
4
|
module Glimmer
|
4
5
|
module DSL
|
5
6
|
module Opal
|
6
7
|
class PropertyExpression < StaticExpression
|
7
|
-
include TopLevelExpression
|
8
|
-
|
9
8
|
def can_interpret?(parent, keyword, *args, &block)
|
10
9
|
parent and
|
11
10
|
(!args.empty?) and
|
12
11
|
parent.respond_to?(:set_attribute) and
|
13
|
-
parent.respond_to?(keyword
|
12
|
+
parent.respond_to?(keyword) and
|
14
13
|
keyword and
|
15
14
|
block.nil?
|
16
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2022 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
|
@@ -22,6 +22,7 @@
|
|
22
22
|
require 'glimmer/dsl/expression'
|
23
23
|
require 'glimmer/dsl/parent_expression'
|
24
24
|
require 'glimmer/swt/swt_proxy'
|
25
|
+
require 'glimmer/swt/canvas_proxy'
|
25
26
|
require 'glimmer/swt/custom/shape'
|
26
27
|
|
27
28
|
module Glimmer
|
@@ -31,9 +32,10 @@ module Glimmer
|
|
31
32
|
include ParentExpression
|
32
33
|
|
33
34
|
def can_interpret?(parent, keyword, *args, &block)
|
34
|
-
|
35
|
-
|
36
|
-
(keyword
|
35
|
+
# TODO consider parent as WidgetProxy too just like SWT
|
36
|
+
(parent.is_a?(Glimmer::SWT::CanvasProxy) or parent.is_a?(Glimmer::SWT::Custom::Shape)) and
|
37
|
+
Glimmer::SWT::Custom::Shape.valid?(parent, keyword, args, &block) and
|
38
|
+
((keyword != 'text' && keyword != 'image') || args.size >= 3 || (args.empty? && block_given?))
|
37
39
|
end
|
38
40
|
|
39
41
|
def interpret(parent, keyword, *args, &block)
|
@@ -23,12 +23,12 @@ module Glimmer
|
|
23
23
|
# just a placeholder that has an open method # TODO return an actual CustomShell in the future that does the work happening above in the #open method
|
24
24
|
Glimmer::SWT::MakeShiftShellProxy.new
|
25
25
|
else
|
26
|
-
Glimmer::SWT::ShellProxy.new(
|
26
|
+
Glimmer::SWT::ShellProxy.new(args)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def add_content(parent, keyword, *args, &block)
|
31
|
-
super(parent, &block)
|
31
|
+
super(parent, keyword, *args, &block)
|
32
32
|
parent.post_add_content
|
33
33
|
end
|
34
34
|
end
|
@@ -22,7 +22,7 @@ module Glimmer
|
|
22
22
|
|
23
23
|
def add_content(parent, keyword, *args, &block)
|
24
24
|
if parent.rendered? || parent.skip_content_on_render_blocks?
|
25
|
-
super(parent, &block)
|
25
|
+
super(parent, keyword, *args, &block)
|
26
26
|
parent.post_add_content
|
27
27
|
else
|
28
28
|
parent.add_content_on_render(&block)
|
data/lib/glimmer/engine.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2022 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
|
@@ -25,6 +25,12 @@ require 'glimmer/swt/button_proxy'
|
|
25
25
|
module Glimmer
|
26
26
|
module SWT
|
27
27
|
class ArrowProxy < ButtonProxy
|
28
|
+
STYLE = <<~CSS
|
29
|
+
.arrow {
|
30
|
+
position: relative;
|
31
|
+
}
|
32
|
+
CSS
|
33
|
+
|
28
34
|
def initialize(parent, args, block)
|
29
35
|
if args.to_a.include?(:left)
|
30
36
|
@text = '<'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2020-
|
1
|
+
# Copyright (c) 2020-2022 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
|
@@ -79,12 +79,13 @@ module Glimmer
|
|
79
79
|
def dom
|
80
80
|
input_text = @text
|
81
81
|
input_id = id
|
82
|
-
input_style = css
|
82
|
+
input_style = "min-width: 32px; min-height: 32px; #{css}"
|
83
83
|
input_args = {}
|
84
84
|
input_disabled = @enabled ? {} : {'disabled': 'disabled'}
|
85
85
|
input_args = input_args.merge(type: 'password') if has_style?(:password)
|
86
86
|
@dom ||= html {
|
87
|
-
|
87
|
+
# TODO `:style` key is duplicated twice
|
88
|
+
button(input_args.merge(id: input_id, class: name, style: input_style).merge(input_disabled)) {
|
88
89
|
input_text.to_s == '' ? ' ' : input_text
|
89
90
|
}
|
90
91
|
}.to_s
|
@@ -57,10 +57,11 @@ module Glimmer
|
|
57
57
|
def dom
|
58
58
|
check_text = @text
|
59
59
|
check_id = id
|
60
|
-
check_style = css
|
60
|
+
check_style = "min-width: 27px; #{css}"
|
61
61
|
check_class = name
|
62
62
|
check_selection = @selection
|
63
|
-
|
63
|
+
# TODO `:style` key is duplicated twice
|
64
|
+
options = {type: 'checkbox', id: check_id, name: parent.id, style: check_style, class: check_class, value: check_text}
|
64
65
|
options[checked: 'checked'] if check_selection
|
65
66
|
@dom ||= html {
|
66
67
|
span {
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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/custom/shape'
|
23
|
+
require 'glimmer/swt/swt_proxy'
|
24
|
+
require 'glimmer/swt/display_proxy'
|
25
|
+
require 'glimmer/swt/color_proxy'
|
26
|
+
# require 'glimmer/swt/transform_proxy'
|
27
|
+
|
28
|
+
module Glimmer
|
29
|
+
module SWT
|
30
|
+
module Custom
|
31
|
+
class Shape
|
32
|
+
class Arc < Shape
|
33
|
+
def parameter_names
|
34
|
+
[:x, :y, :width, :height, :start_angle, :arc_angle]
|
35
|
+
end
|
36
|
+
|
37
|
+
def post_add_content
|
38
|
+
@performing_post_add_content = true
|
39
|
+
render
|
40
|
+
@performing_post_add_content = false
|
41
|
+
end
|
42
|
+
|
43
|
+
def background=(value)
|
44
|
+
super(value)
|
45
|
+
self.foreground = value
|
46
|
+
end
|
47
|
+
|
48
|
+
def render(custom_parent_dom_element: nil, brand_new: false)
|
49
|
+
return unless @performing_post_add_content
|
50
|
+
the_parent_element = Native(`document.getElementById(#{parent.id})`)
|
51
|
+
params = { type: `Two.Types.svg` }
|
52
|
+
two = Native(`new Two(#{params})`)
|
53
|
+
two.appendTo(the_parent_element)
|
54
|
+
x = @args[0]
|
55
|
+
y = @args[1]
|
56
|
+
width = @args[2]
|
57
|
+
height = @args[3]
|
58
|
+
start_angle = -1*@args[4]
|
59
|
+
arc_angle = -1*@args[5]
|
60
|
+
end_angle = start_angle + arc_angle
|
61
|
+
rx = width / 2.0
|
62
|
+
ry = height / 2.0
|
63
|
+
cx = x + rx
|
64
|
+
cy = y + ry
|
65
|
+
arc = two.makeArcSegment(cx, cy, 0, ry, 2*`Math.PI`*(start_angle)/360.0, 2*`Math.PI`*(end_angle)/360.0);
|
66
|
+
arc.fill = background.to_css unless background.nil?
|
67
|
+
arc.stroke = foreground.to_css unless foreground.nil?
|
68
|
+
two.update
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# Copyright (c) 2020-2022 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/custom/shape'
|
23
|
+
require 'glimmer/swt/swt_proxy'
|
24
|
+
require 'glimmer/swt/display_proxy'
|
25
|
+
require 'glimmer/swt/color_proxy'
|
26
|
+
require 'glimmer/swt/image_proxy'
|
27
|
+
# require 'glimmer/swt/transform_proxy'
|
28
|
+
|
29
|
+
module Glimmer
|
30
|
+
module SWT
|
31
|
+
module Custom
|
32
|
+
class Shape
|
33
|
+
class Image < Shape
|
34
|
+
def parameter_names
|
35
|
+
if image_whole_parameter_names.size == @args.size
|
36
|
+
@parameter_names = image_whole_parameter_names
|
37
|
+
elsif image_part_parameter_names.size == @args.size
|
38
|
+
@parameter_names = image_part_parameter_names
|
39
|
+
end
|
40
|
+
@parameter_names || image_whole_parameter_names
|
41
|
+
end
|
42
|
+
|
43
|
+
def possible_parameter_names
|
44
|
+
(image_whole_parameter_names + image_part_parameter_names).uniq
|
45
|
+
end
|
46
|
+
|
47
|
+
def image_part_parameter_names
|
48
|
+
[:image, :src_x, :src_y, :src_width, :src_height, :dest_x, :dest_y, :dest_width, :dest_height]
|
49
|
+
end
|
50
|
+
|
51
|
+
def image_whole_parameter_names
|
52
|
+
[:image, :x, :y]
|
53
|
+
end
|
54
|
+
|
55
|
+
def set_parameter_attribute(attribute_name, *args)
|
56
|
+
if @parameter_names.to_a.map(&:to_s).include?(attribute_name.to_s)
|
57
|
+
super(attribute_name, *args)
|
58
|
+
build_dom
|
59
|
+
reattach(dom_element)
|
60
|
+
return
|
61
|
+
end
|
62
|
+
####TODO refactor and improve this method through meta-programming (and share across other shapes)
|
63
|
+
if image_whole_parameter_names.map(&:to_s).include?(attribute_name.to_s)
|
64
|
+
@parameter_names = image_whole_parameter_names
|
65
|
+
elsif image_part_parameter_names.map(&:to_s).include?(attribute_name.to_s)
|
66
|
+
@parameter_names = image_part_parameter_names
|
67
|
+
end
|
68
|
+
super(attribute_name, *args)
|
69
|
+
end
|
70
|
+
|
71
|
+
def reattach(old_element)
|
72
|
+
old_element.attr('href', Element[@dom].attr('href'))
|
73
|
+
old_element.attr('x', Element[@dom].attr('x'))
|
74
|
+
old_element.attr('y', Element[@dom].attr('y'))
|
75
|
+
old_element.attr('width', Element[@dom].attr('width'))
|
76
|
+
old_element.attr('height', Element[@dom].attr('height'))
|
77
|
+
end
|
78
|
+
|
79
|
+
def element
|
80
|
+
'image'
|
81
|
+
end
|
82
|
+
|
83
|
+
def dom
|
84
|
+
shape_id = id
|
85
|
+
shape_class = name
|
86
|
+
href = @args[0].is_a?(Glimmer::SWT::ImageProxy) ? @args[0].file_path : @args[0]
|
87
|
+
width = @args[0].is_a?(Glimmer::SWT::ImageProxy) ? @args[0].width : nil
|
88
|
+
height = @args[0].is_a?(Glimmer::SWT::ImageProxy) ? @args[0].height : nil
|
89
|
+
@dom ||= xml {
|
90
|
+
image(id: shape_id, class: shape_class, href: href, x: @args[1], y: @args[2], width: width, height: height)
|
91
|
+
}.to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|