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
@@ -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
|
@@ -41,9 +41,9 @@ module Glimmer
|
|
41
41
|
def initialize(parent, args, block)
|
42
42
|
super(parent, args, block)
|
43
43
|
# TODO check if there is a need to remove this observer when removing widget from table upon items update
|
44
|
-
on_widget_selected
|
44
|
+
on_widget_selected do |event|
|
45
45
|
parent.select(parent.index_of(self), (event.meta? if event.respond_to?(:meta?)))
|
46
|
-
|
46
|
+
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def get_text(index)
|
@@ -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
|
@@ -128,7 +128,7 @@ module Glimmer
|
|
128
128
|
|
129
129
|
DEFAULT_INITIALIZERS = {
|
130
130
|
# TODO remove if built in class initializer is taking care of this
|
131
|
-
composite:
|
131
|
+
composite: proc do |composite_proxy|
|
132
132
|
if composite_proxy.get_layout.nil?
|
133
133
|
the_layout = GridLayoutProxy.new(composite_proxy, [])
|
134
134
|
composite_proxy.layout = the_layout
|
@@ -136,18 +136,18 @@ module Glimmer
|
|
136
136
|
the_layout.margin_height = 15
|
137
137
|
end
|
138
138
|
end,
|
139
|
-
# scrolled_composite:
|
139
|
+
# scrolled_composite: proc do |scrolled_composite|
|
140
140
|
# scrolled_composite.expand_horizontal = true
|
141
141
|
# scrolled_composite.expand_vertical = true
|
142
142
|
# end,
|
143
|
-
# table:
|
143
|
+
# table: proc do |table|
|
144
144
|
# table.setHeaderVisible(true)
|
145
145
|
# table.setLinesVisible(true)
|
146
146
|
# end,
|
147
|
-
table_column:
|
147
|
+
table_column: proc do |table_column_proxy|
|
148
148
|
table_column_proxy.width = 80
|
149
149
|
end,
|
150
|
-
# group:
|
150
|
+
# group: proc do |group_proxy|
|
151
151
|
# group_proxy.layout = GridLayoutProxy.new(group_proxy, []) if group.get_layout.nil?
|
152
152
|
# end,
|
153
153
|
}
|
@@ -235,7 +235,7 @@ module Glimmer
|
|
235
235
|
event_handler = mapping[:event_handler]
|
236
236
|
event_element_css_selector = mapping[:event_element_css_selector]
|
237
237
|
the_listener_dom_element = event_element_css_selector ? Element[event_element_css_selector] : listener_dom_element
|
238
|
-
the_listener_dom_element.off(event)
|
238
|
+
the_listener_dom_element.off(event, event_listener)
|
239
239
|
# TODO improve to precisely remove the listeners that were added, no more no less. (or use the event_listener_proxies method instead or in collaboration)
|
240
240
|
end
|
241
241
|
end
|
@@ -295,6 +295,7 @@ module Glimmer
|
|
295
295
|
end
|
296
296
|
|
297
297
|
def font=(value)
|
298
|
+
return if value.nil?
|
298
299
|
@font = value.is_a?(FontProxy) ? value : FontProxy.new(self, value)
|
299
300
|
dom_element.css('font-family', @font.name) unless @font.nil?
|
300
301
|
dom_element.css('font-style', 'italic') if @font&.style == :italic || [@font&.style].flatten.compact.include?(:italic)
|
@@ -877,7 +878,7 @@ module Glimmer
|
|
877
878
|
event_element_css_selector = mapping[:event_element_css_selector]
|
878
879
|
potential_event_listener = event_handler&.call(original_event_listener)
|
879
880
|
event_listener = potential_event_listener || original_event_listener
|
880
|
-
async_event_listener =
|
881
|
+
async_event_listener = proc do |event|
|
881
882
|
# TODO look into the issue with using async::task.new here. maybe put it in event listener (like not being able to call preventDefault or return false successfully )
|
882
883
|
# maybe consider pushing inside the widget classes instead where needed only or implement universal doit support correctly to bypass this issue
|
883
884
|
# Async::Task.new do
|
@@ -943,7 +944,7 @@ module Glimmer
|
|
943
944
|
end
|
944
945
|
|
945
946
|
def property_type_converters
|
946
|
-
color_converter =
|
947
|
+
color_converter = proc do |value|
|
947
948
|
if value.is_a?(Symbol) || value.is_a?(String)
|
948
949
|
ColorProxy.new(value)
|
949
950
|
else
|
@@ -952,7 +953,7 @@ module Glimmer
|
|
952
953
|
end
|
953
954
|
@property_type_converters ||= {
|
954
955
|
:background => color_converter,
|
955
|
-
# :background_image =>
|
956
|
+
# :background_image => proc do |value|
|
956
957
|
# if value.is_a?(String)
|
957
958
|
# if value.start_with?('uri:classloader')
|
958
959
|
# value = value.sub(/^uri\:classloader\:\//, '')
|
@@ -972,7 +973,7 @@ module Glimmer
|
|
972
973
|
# end
|
973
974
|
# end,
|
974
975
|
:foreground => color_converter,
|
975
|
-
# :font =>
|
976
|
+
# :font => proc do |value|
|
976
977
|
# if value.is_a?(Hash)
|
977
978
|
# font_properties = value
|
978
979
|
# FontProxy.new(self, font_properties).swt_font
|
@@ -980,14 +981,14 @@ module Glimmer
|
|
980
981
|
# value
|
981
982
|
# end
|
982
983
|
# end,
|
983
|
-
:text =>
|
984
|
+
:text => proc do |value|
|
984
985
|
# if swt_widget.is_a?(Browser)
|
985
986
|
# value.to_s
|
986
987
|
# else
|
987
988
|
value.to_s
|
988
989
|
# end
|
989
990
|
end,
|
990
|
-
# :visible =>
|
991
|
+
# :visible => proc do |value|
|
991
992
|
# !!value
|
992
993
|
# end,
|
993
994
|
}
|
@@ -996,7 +997,7 @@ module Glimmer
|
|
996
997
|
def widget_property_listener_installers
|
997
998
|
@swt_widget_property_listener_installers ||= {
|
998
999
|
# WidgetProxy => {
|
999
|
-
# :focus =>
|
1000
|
+
# :focus => proc do |observer|
|
1000
1001
|
# on_focus_gained { |focus_event|
|
1001
1002
|
# observer.call(true)
|
1002
1003
|
# }
|
@@ -1006,7 +1007,7 @@ module Glimmer
|
|
1006
1007
|
# end,
|
1007
1008
|
# },
|
1008
1009
|
MenuItemProxy => {
|
1009
|
-
:selection =>
|
1010
|
+
:selection => proc do |observer|
|
1010
1011
|
on_widget_selected { |selection_event|
|
1011
1012
|
# TODO look into validity of this and perhaps move toggle logic to MenuItemProxy
|
1012
1013
|
if check?
|
@@ -1018,33 +1019,33 @@ module Glimmer
|
|
1018
1019
|
end
|
1019
1020
|
},
|
1020
1021
|
ScaleProxy => {
|
1021
|
-
:selection =>
|
1022
|
+
:selection => proc do |observer|
|
1022
1023
|
on_widget_selected { |selection_event|
|
1023
1024
|
observer.call(selection)
|
1024
1025
|
}
|
1025
1026
|
end
|
1026
1027
|
},
|
1027
1028
|
SliderProxy => {
|
1028
|
-
:selection =>
|
1029
|
+
:selection => proc do |observer|
|
1029
1030
|
on_widget_selected { |selection_event|
|
1030
1031
|
observer.call(selection)
|
1031
1032
|
}
|
1032
1033
|
end
|
1033
1034
|
},
|
1034
1035
|
SpinnerProxy => {
|
1035
|
-
:selection =>
|
1036
|
+
:selection => proc do |observer|
|
1036
1037
|
on_widget_selected { |selection_event|
|
1037
1038
|
observer.call(selection)
|
1038
1039
|
}
|
1039
1040
|
end
|
1040
1041
|
},
|
1041
1042
|
TextProxy => {
|
1042
|
-
:text =>
|
1043
|
+
:text => proc do |observer|
|
1043
1044
|
on_modify_text { |modify_event|
|
1044
1045
|
observer.call(text)
|
1045
1046
|
}
|
1046
1047
|
end,
|
1047
|
-
# :caret_position =>
|
1048
|
+
# :caret_position => proc do |observer|
|
1048
1049
|
# on_event_keydown { |event|
|
1049
1050
|
# observer.call(getCaretPosition)
|
1050
1051
|
# }
|
@@ -1058,7 +1059,7 @@ module Glimmer
|
|
1058
1059
|
# observer.call(getCaretPosition)
|
1059
1060
|
# }
|
1060
1061
|
# end,
|
1061
|
-
# :selection =>
|
1062
|
+
# :selection => proc do |observer|
|
1062
1063
|
# on_event_keydown { |event|
|
1063
1064
|
# observer.call(getSelection)
|
1064
1065
|
# }
|
@@ -1072,7 +1073,7 @@ module Glimmer
|
|
1072
1073
|
# observer.call(getSelection)
|
1073
1074
|
# }
|
1074
1075
|
# end,
|
1075
|
-
# :selection_count =>
|
1076
|
+
# :selection_count => proc do |observer|
|
1076
1077
|
# on_event_keydown { |event|
|
1077
1078
|
# observer.call(getSelectionCount)
|
1078
1079
|
# }
|
@@ -1086,7 +1087,7 @@ module Glimmer
|
|
1086
1087
|
# observer.call(getSelectionCount)
|
1087
1088
|
# }
|
1088
1089
|
# end,
|
1089
|
-
# :top_index =>
|
1090
|
+
# :top_index => proc do |observer|
|
1090
1091
|
# @last_top_index = getTopIndex
|
1091
1092
|
# on_paint_control { |event|
|
1092
1093
|
# if getTopIndex != @last_top_index
|
@@ -1097,35 +1098,35 @@ module Glimmer
|
|
1097
1098
|
# end,
|
1098
1099
|
},
|
1099
1100
|
# Java::OrgEclipseSwtCustom::StyledText => {
|
1100
|
-
# :text =>
|
1101
|
+
# :text => proc do |observer|
|
1101
1102
|
# on_modify_text { |modify_event|
|
1102
1103
|
# observer.call(getText)
|
1103
1104
|
# }
|
1104
1105
|
# end,
|
1105
1106
|
# },
|
1106
1107
|
DateTimeProxy => {
|
1107
|
-
:date_time =>
|
1108
|
+
:date_time => proc do |observer|
|
1108
1109
|
on_widget_selected { |selection_event|
|
1109
1110
|
observer.call(date_time)
|
1110
1111
|
}
|
1111
1112
|
end
|
1112
1113
|
},
|
1113
1114
|
RadioProxy => { #radio?
|
1114
|
-
:selection =>
|
1115
|
+
:selection => proc do |observer|
|
1115
1116
|
on_widget_selected { |selection_event|
|
1116
1117
|
observer.call(selection)
|
1117
1118
|
}
|
1118
1119
|
end
|
1119
1120
|
},
|
1120
1121
|
TableProxy => {
|
1121
|
-
:selection =>
|
1122
|
+
:selection => proc do |observer|
|
1122
1123
|
on_widget_selected { |selection_event|
|
1123
1124
|
observer.call(selection_event.table_item.get_data) # TODO ensure selection doesn't conflict with editing
|
1124
1125
|
}
|
1125
1126
|
end,
|
1126
1127
|
},
|
1127
1128
|
# Java::OrgEclipseSwtWidgets::MenuItem => {
|
1128
|
-
# :selection =>
|
1129
|
+
# :selection => proc do |observer|
|
1129
1130
|
# on_widget_selected { |selection_event|
|
1130
1131
|
# observer.call(getSelection)
|
1131
1132
|
# }
|
data/lib/glimmer/swt.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
|
@@ -101,10 +101,6 @@ module Glimmer
|
|
101
101
|
body_root.visible?
|
102
102
|
end
|
103
103
|
|
104
|
-
def center
|
105
|
-
body_root.center
|
106
|
-
end
|
107
|
-
|
108
104
|
def start_event_loop
|
109
105
|
body_root.start_event_loop
|
110
106
|
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
|
@@ -285,10 +285,10 @@ module Glimmer
|
|
285
285
|
end
|
286
286
|
|
287
287
|
alias local_respond_to? respond_to?
|
288
|
-
def respond_to?(
|
289
|
-
super or
|
290
|
-
can_handle_observation_request?(
|
291
|
-
body_root.respond_to?(
|
288
|
+
def respond_to?(method_name, include_private = false)
|
289
|
+
super(method_name, include_private) or
|
290
|
+
can_handle_observation_request?(method_name) or
|
291
|
+
body_root.respond_to?(method_name, include_private)
|
292
292
|
end
|
293
293
|
|
294
294
|
private
|
@@ -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
|
@@ -42,8 +42,8 @@ module Glimmer
|
|
42
42
|
!!@called
|
43
43
|
end
|
44
44
|
|
45
|
-
def respond_to?(
|
46
|
-
%w[owner invoked_from called?].include?(
|
45
|
+
def respond_to?(method_name, include_private = false)
|
46
|
+
%w[owner invoked_from called?].include?(method_name.to_s) || super(method_name, include_private)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -4,23 +4,23 @@ require 'time'
|
|
4
4
|
class DateTime < Date
|
5
5
|
def initialize(*args, &block)
|
6
6
|
@time = Time.new(*args, &block)
|
7
|
-
methods_to_exclude = [:to_date, :to_time, :==, :eql?, :class]
|
7
|
+
methods_to_exclude = [:to_date, :to_time, :==, :eql?, :class] + Object.new.methods
|
8
8
|
methods_to_define = @time.methods - methods_to_exclude
|
9
|
-
methods_to_define.each do |
|
10
|
-
singleton_class.define_method(
|
11
|
-
@time.send(
|
9
|
+
methods_to_define.each do |method_name|
|
10
|
+
singleton_class.define_method(method_name) do |*args, &block|
|
11
|
+
@time.send(method_name, *args, &block)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def to_date
|
17
17
|
@time.to_date
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def to_time
|
21
21
|
@time
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def ==(other)
|
25
25
|
return false if other.class != self.class
|
26
26
|
year == other.year and
|
@@ -51,7 +51,7 @@ class Time
|
|
51
51
|
new_original(*args)
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def to_datetime
|
56
56
|
# TODO support timezone
|
57
57
|
DateTime.new(year, month, day, hour, min, sec)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
1
|
+
# Copyright (c) 2007-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,10 +25,54 @@ class Tetris
|
|
25
25
|
include Glimmer::UI::CustomWidget
|
26
26
|
|
27
27
|
options :game_playfield, :block_size, :row, :column
|
28
|
+
|
29
|
+
attr_accessor :bevel_pixel_size
|
30
|
+
|
31
|
+
before_body do
|
32
|
+
self.bevel_pixel_size = 0.16*block_size.to_f
|
33
|
+
end
|
28
34
|
|
29
35
|
body {
|
30
36
|
canvas { |canvas_proxy|
|
31
37
|
background <= [game_playfield[row][column], :color]
|
38
|
+
polygon(0, 0, block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
|
39
|
+
background <= [game_playfield[row][column], :color, on_read: ->(color_value) {
|
40
|
+
unless color_value.nil?
|
41
|
+
color = color(color_value)
|
42
|
+
rgb(color.red + 4*BEVEL_CONSTANT, color.green + 4*BEVEL_CONSTANT, color.blue + 4*BEVEL_CONSTANT)
|
43
|
+
end
|
44
|
+
}]
|
45
|
+
}
|
46
|
+
polygon(block_size, 0, block_size - bevel_pixel_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size, block_size) {
|
47
|
+
background <= [game_playfield[row][column], :color, on_read: ->(color_value) {
|
48
|
+
unless color_value.nil?
|
49
|
+
color = color(color_value)
|
50
|
+
rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
|
51
|
+
end
|
52
|
+
}]
|
53
|
+
}
|
54
|
+
polygon(block_size, block_size, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size, block_size - bevel_pixel_size) {
|
55
|
+
background <= [game_playfield[row][column], :color, on_read: ->(color_value) {
|
56
|
+
unless color_value.nil?
|
57
|
+
color = color(color_value)
|
58
|
+
rgb(color.red - 2*BEVEL_CONSTANT, color.green - 2*BEVEL_CONSTANT, color.blue - 2*BEVEL_CONSTANT)
|
59
|
+
end
|
60
|
+
}]
|
61
|
+
}
|
62
|
+
polygon(0, 0, 0, block_size, bevel_pixel_size, block_size - bevel_pixel_size, bevel_pixel_size, bevel_pixel_size) {
|
63
|
+
background <= [game_playfield[row][column], :color, on_read: ->(color_value) {
|
64
|
+
unless color_value.nil?
|
65
|
+
color = color(color_value)
|
66
|
+
rgb(color.red - BEVEL_CONSTANT, color.green - BEVEL_CONSTANT, color.blue - BEVEL_CONSTANT)
|
67
|
+
end
|
68
|
+
}]
|
69
|
+
}
|
70
|
+
rectangle(0, 0, block_size, block_size) {
|
71
|
+
foreground <= [game_playfield[row][column], :color, on_read: ->(color_value) {
|
72
|
+
color_value == Model::Block::COLOR_CLEAR ? :gray : color_value
|
73
|
+
}]
|
74
|
+
}
|
75
|
+
|
32
76
|
}
|
33
77
|
}
|
34
78
|
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
|
@@ -29,7 +29,7 @@ require_relative 'tetris/view/tetris_menu_bar'
|
|
29
29
|
class Tetris
|
30
30
|
include Glimmer::UI::CustomShell
|
31
31
|
|
32
|
-
BLOCK_SIZE =
|
32
|
+
BLOCK_SIZE = 37
|
33
33
|
FONT_NAME = 'Menlo'
|
34
34
|
FONT_TITLE_HEIGHT = 32
|
35
35
|
FONT_TITLE_STYLE = :bold
|
@@ -143,7 +143,7 @@ class Tetris
|
|
143
143
|
def show_about_dialog
|
144
144
|
message_box {
|
145
145
|
text 'Glimmer Tetris'
|
146
|
-
message "Glimmer Tetris\n\nGlimmer DSL for SWT Sample\n\
|
146
|
+
message "Glimmer Tetris\n\nGlimmer DSL for SWT Sample\n\nLeft is A\nRight is D\nDown is S\nUp is W\nRotate Left is Q\nRotate Right is E\nAlternatively:\nUse arrow keys for movement\nand right/left alt/shift keys for rotation\n\nCopyright (c) 2007-2022 Andy Maleh"
|
147
147
|
}.open
|
148
148
|
end
|
149
149
|
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
|
@@ -70,9 +70,10 @@ class Weather
|
|
70
70
|
text temp_unit
|
71
71
|
background DEFAULT_BACKGROUND
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
# TODO enable once Canvas Shape DSL is supported under any widget (not just canvas)
|
74
|
+
# rectangle(0, 0, [:default, -2], [:default, -2], 15, 15) {
|
75
|
+
# foreground DEFAULT_FOREGROUND
|
76
|
+
# }
|
76
77
|
|
77
78
|
%w[temp temp_min temp_max feels_like].each do |field_name|
|
78
79
|
temp_field(field_name, temp_unit)
|