glimmer-dsl-opal 0.9.3 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +114 -49
  5. data/VERSION +1 -1
  6. data/lib/display.rb +1 -1
  7. data/lib/glimmer-dsl-opal.rb +3 -2
  8. data/lib/glimmer-dsl-opal/ext/file.rb +1 -1
  9. data/lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb +8 -4
  10. data/lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_repository.rb +4 -4
  11. data/lib/glimmer-dsl-opal/samples/elaborate/login.rb +7 -7
  12. data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +3 -3
  13. data/lib/glimmer-dsl-opal/samples/hello/hello_browser.rb +1 -1
  14. data/lib/glimmer-dsl-opal/samples/hello/hello_button.rb +2 -2
  15. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb +5 -5
  16. data/lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb +1 -1
  17. data/lib/glimmer-dsl-opal/samples/hello/hello_combo.rb +2 -2
  18. data/lib/glimmer-dsl-opal/samples/hello/hello_computed.rb +6 -6
  19. data/lib/glimmer-dsl-opal/samples/hello/hello_computed/contact.rb +1 -1
  20. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb +1 -1
  21. data/lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb +1 -1
  22. data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +5 -5
  23. data/lib/glimmer-dsl-opal/samples/hello/hello_dialog.rb +78 -0
  24. data/lib/glimmer-dsl-opal/samples/hello/hello_group.rb +7 -7
  25. data/lib/glimmer-dsl-opal/samples/hello/hello_list_multi_selection.rb +2 -2
  26. data/lib/glimmer-dsl-opal/samples/hello/hello_list_single_selection.rb +2 -2
  27. data/lib/glimmer-dsl-opal/samples/hello/hello_menu_bar.rb +1 -1
  28. data/lib/glimmer-dsl-opal/samples/hello/hello_message_box.rb +1 -1
  29. data/lib/glimmer-dsl-opal/samples/hello/hello_pop_up_context_menu.rb +1 -1
  30. data/lib/glimmer-dsl-opal/samples/hello/hello_radio.rb +7 -7
  31. data/lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb +1 -1
  32. data/lib/glimmer-dsl-opal/samples/hello/hello_tab.rb +1 -1
  33. data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +1 -1
  34. data/lib/glimmer-dsl-opal/samples/hello/hello_world.rb +1 -1
  35. data/lib/glimmer-dsl-swt.rb +1 -1
  36. data/lib/glimmer/data_binding/table_items_binding.rb +2 -1
  37. data/lib/glimmer/dsl/opal/async_exec_expression.rb +1 -1
  38. data/lib/glimmer/dsl/opal/bind_expression.rb +24 -25
  39. data/lib/glimmer/dsl/opal/block_property_expression.rb +1 -1
  40. data/lib/glimmer/dsl/opal/checkbox_group_selection_data_binding_expression.rb +1 -1
  41. data/lib/glimmer/dsl/opal/color_expression.rb +1 -1
  42. data/lib/glimmer/dsl/opal/custom_widget_expression.rb +7 -7
  43. data/lib/glimmer/dsl/opal/dialog_expression.rb +20 -0
  44. data/lib/glimmer/dsl/opal/display_expression.rb +1 -1
  45. data/lib/glimmer/dsl/opal/dsl.rb +5 -1
  46. data/lib/glimmer/dsl/opal/exec_expression.rb +1 -1
  47. data/lib/glimmer/dsl/opal/font_expression.rb +1 -1
  48. data/lib/glimmer/dsl/opal/menu_bar_expression.rb +1 -1
  49. data/lib/glimmer/dsl/opal/menu_expression.rb +2 -2
  50. data/lib/glimmer/dsl/opal/message_box_expression.rb +1 -1
  51. data/lib/glimmer/dsl/opal/property_expression.rb +2 -1
  52. data/lib/glimmer/dsl/opal/radio_group_selection_data_binding_expression.rb +1 -1
  53. data/lib/glimmer/dsl/opal/rgb_expression.rb +1 -1
  54. data/lib/glimmer/dsl/opal/rgba_expression.rb +1 -1
  55. data/lib/glimmer/dsl/opal/shape_expression.rb +26 -0
  56. data/lib/glimmer/dsl/opal/shell_expression.rb +1 -1
  57. data/lib/glimmer/dsl/opal/shine_data_binding_expression.rb +49 -0
  58. data/lib/glimmer/dsl/opal/swt_expression.rb +4 -4
  59. data/lib/glimmer/dsl/opal/sync_exec_expression.rb +1 -1
  60. data/lib/glimmer/dsl/opal/widget_expression.rb +1 -1
  61. data/lib/glimmer/swt.rb +1 -1
  62. data/lib/glimmer/swt/color_proxy.rb +1 -1
  63. data/lib/glimmer/swt/combo_proxy.rb +1 -0
  64. data/lib/glimmer/swt/composite_proxy.rb +18 -2
  65. data/lib/glimmer/swt/control_editor.rb +1 -1
  66. data/lib/glimmer/swt/custom/checkbox_group.rb +1 -1
  67. data/lib/glimmer/swt/custom/radio_group.rb +1 -1
  68. data/lib/glimmer/swt/dialog_proxy.rb +188 -0
  69. data/lib/glimmer/swt/display_proxy.rb +132 -9
  70. data/lib/glimmer/swt/font_proxy.rb +1 -1
  71. data/lib/glimmer/swt/grid_layout_proxy.rb +28 -33
  72. data/lib/glimmer/swt/label_proxy.rb +1 -1
  73. data/lib/glimmer/swt/latest_dialog_proxy.rb +44 -0
  74. data/lib/glimmer/swt/latest_message_box_proxy.rb +4 -2
  75. data/lib/glimmer/swt/latest_shell_proxy.rb +7 -3
  76. data/lib/glimmer/swt/layout_data_proxy.rb +4 -0
  77. data/lib/glimmer/swt/layout_proxy.rb +9 -6
  78. data/lib/glimmer/swt/make_shift_shell_proxy.rb +1 -1
  79. data/lib/glimmer/swt/menu_item_proxy.rb +1 -1
  80. data/lib/glimmer/swt/menu_proxy.rb +1 -1
  81. data/lib/glimmer/swt/message_box_proxy.rb +23 -17
  82. data/lib/glimmer/swt/row_layout_proxy.rb +34 -7
  83. data/lib/glimmer/swt/shell_proxy.rb +43 -9
  84. data/lib/glimmer/swt/style_constantizable.rb +1 -1
  85. data/lib/glimmer/swt/swt_proxy.rb +1 -1
  86. data/lib/glimmer/swt/tab_folder_proxy.rb +1 -1
  87. data/lib/glimmer/swt/table_editor.rb +1 -1
  88. data/lib/glimmer/swt/table_item_proxy.rb +1 -1
  89. data/lib/glimmer/swt/table_proxy.rb +1 -1
  90. data/lib/glimmer/swt/widget_proxy.rb +53 -21
  91. data/lib/glimmer/ui/custom_shell.rb +17 -3
  92. data/lib/glimmer/ui/custom_widget.rb +1 -1
  93. data/lib/glimmer/util/proc_tracker.rb +17 -6
  94. data/lib/net/http.rb +1 -1
  95. data/lib/os.rb +1 -1
  96. metadata +17 -11
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,36 +1,35 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
1
22
  require 'glimmer/dsl/static_expression'
23
+ require 'glimmer/dsl/bind_expression'
2
24
  require 'glimmer/data_binding/model_binding'
3
25
 
4
26
  module Glimmer
5
27
  module DSL
6
28
  module Opal
7
29
  # Responsible for setting up the return value of the bind keyword (command symbol)
8
- # as a ModelBinding. It is then used by another command handler like
9
- # DataBindingCommandHandler for text and selection properties on Text and Spinner
10
- # or TableItemsDataBindingCommandHandler for items in a Table
30
+ # as a ModelBinding. It is then used by other data-binding expressions
11
31
  class BindExpression < StaticExpression
12
- def can_interpret?(parent, keyword, *args, &block)
13
- (
14
- keyword == 'bind' and
15
- (
16
- (
17
- (args.size == 2) and
18
- textual?(args[1])
19
- ) ||
20
- (
21
- (args.size == 3) and
22
- textual?(args[1]) and
23
- (args[2].is_a?(Hash))
24
- )
25
- )
26
- )
27
- end
28
-
29
- def interpret(parent, keyword, *args, &block)
30
- binding_options = args[2] || {}
31
- binding_options[:on_read] = binding_options.delete(:on_read) || binding_options.delete('on_read') || block
32
- DataBinding::ModelBinding.new(args[0], args[1].to_s, binding_options)
33
- end
32
+ include Glimmer::DSL::BindExpression
34
33
  end
35
34
  end
36
35
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -51,7 +51,7 @@ module Glimmer
51
51
  custom_widget_class = UI::CustomWidget.for(keyword)
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
- if Glimmer::SWT::DisplayProxy.instance.shells.empty?
54
+ if Glimmer::SWT::DisplayProxy.instance.shells.empty? || Glimmer::SWT::DisplayProxy.open_custom_shells_in_current_window?
55
55
  custom_widget_class.new(parent, *args, {}, &block)
56
56
  else
57
57
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -80,12 +80,12 @@ module Glimmer
80
80
  end
81
81
  end
82
82
 
83
- def add_content(parent, &content)
84
- content.call(parent) if parent.is_a?(Glimmer::SWT::ShellProxy) || parent.is_a?(Glimmer::UI::CustomShell)
85
- end
86
-
83
+ # TODO delete if no longer needed
84
+ # def add_content(parent, &content)
85
+ # content.call(parent) if parent.is_a?(Glimmer::SWT::ShellProxy) || parent.is_a?(Glimmer::UI::CustomShell)
86
+ # end
87
87
 
88
- def add_content(parent, &block)
88
+ def add_content(parent, keyword, *args, &block)
89
89
  return unless parent.is_a?(Glimmer::UI::CustomWidget)
90
90
  # TODO consider avoiding source_location
91
91
  if block.source_location == parent.content&.__getobj__.source_location
@@ -0,0 +1,20 @@
1
+ require 'glimmer/dsl/static_expression'
2
+ require 'glimmer/dsl/top_level_expression'
3
+ require 'glimmer/dsl/parent_expression'
4
+ require 'glimmer/swt/dialog_proxy'
5
+
6
+ module Glimmer
7
+ module DSL
8
+ module Opal
9
+ class DialogExpression < StaticExpression
10
+ include TopLevelExpression
11
+ include ParentExpression
12
+
13
+ def interpret(parent, keyword, *args, &block)
14
+ parent = args.delete_at(0)
15
+ Glimmer::SWT::DialogProxy.new(parent, args)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -27,7 +27,9 @@ require 'glimmer/dsl/opal/radio_group_selection_data_binding_expression'
27
27
  require 'glimmer/dsl/opal/checkbox_group_selection_data_binding_expression'
28
28
  require 'glimmer/dsl/opal/block_property_expression'
29
29
  require 'glimmer/dsl/opal/menu_expression'
30
- # require 'glimmer/dsl/opal/menu_bar_expression'
30
+ require 'glimmer/dsl/opal/dialog_expression'
31
+ require 'glimmer/dsl/opal/shape_expression'
32
+ require 'glimmer/dsl/opal/shine_data_binding_expression'
31
33
 
32
34
  module Glimmer
33
35
  module DSL
@@ -47,6 +49,8 @@ module Glimmer
47
49
  layout
48
50
  block_property
49
51
  property
52
+ shine_data_binding
53
+ shape
50
54
  widget
51
55
  ]
52
56
  )
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -47,7 +47,7 @@ module Glimmer
47
47
  Glimmer::SWT::MenuProxy.new(parent, args)
48
48
  end
49
49
 
50
- def add_content(parent, &block)
50
+ def add_content(parent, keyword, *args, &block)
51
51
  super(parent, &block)
52
52
  parent.post_add_content
53
53
  end
@@ -11,7 +11,7 @@ module Glimmer
11
11
  include ParentExpression
12
12
 
13
13
  def interpret(parent, keyword, *args, &block)
14
- parent = args.delete_at(0)
14
+ parent = args.delete_at(0) if !textual?(args.first)
15
15
  Glimmer::SWT::MessageBoxProxy.new(parent, args)
16
16
  end
17
17
  end
@@ -6,8 +6,9 @@ module Glimmer
6
6
  class PropertyExpression < StaticExpression
7
7
  include TopLevelExpression
8
8
 
9
- def can_interpret?(parent, keyword, *args, &block)
9
+ def can_interpret?(parent, keyword, *args, &block)
10
10
  parent and
11
+ (!args.empty?) and
11
12
  parent.respond_to?(:set_attribute) and
12
13
  parent.respond_to?(keyword, *args) and
13
14
  keyword and
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -0,0 +1,26 @@
1
+ require 'glimmer/dsl/expression'
2
+ require 'glimmer/dsl/parent_expression'
3
+
4
+ module Glimmer
5
+ module DSL
6
+ module Opal
7
+ class ShapeExpression < Expression
8
+ include ParentExpression
9
+
10
+ INCLUDED_KEYWORDS = %w[rectangle polygon]
11
+
12
+ def can_interpret?(parent, keyword, *args, &block)
13
+ INCLUDED_KEYWORDS.include?(keyword)
14
+ end
15
+
16
+ def interpret(parent, keyword, *args, &block)
17
+ # TODO
18
+ end
19
+
20
+ def add_content(parent, keyword, *args, &block)
21
+ # TODO
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -27,7 +27,7 @@ module Glimmer
27
27
  end
28
28
  end
29
29
 
30
- def add_content(parent, &block)
30
+ def add_content(parent, keyword, *args, &block)
31
31
  super(parent, &block)
32
32
  parent.post_add_content
33
33
  end
@@ -0,0 +1,49 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer/dsl/expression'
23
+ require 'glimmer/data_binding/model_binding'
24
+ require 'glimmer/swt/table_proxy'
25
+ require 'glimmer/data_binding/shine'
26
+
27
+ module Glimmer
28
+ module DSL
29
+ module Opal
30
+ class ShineDataBindingExpression < Expression
31
+ def can_interpret?(parent, keyword, *args, &block)
32
+ args.size == 0 and
33
+ block.nil? and
34
+ (
35
+ (parent.respond_to?(:set_attribute) and parent.respond_to?(keyword)) or
36
+ (parent.is_a?(Glimmer::SWT::TableProxy)) # TODO support tree element
37
+ )
38
+ # TODO support canvas elements
39
+ # and
40
+ # !(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
41
+ end
42
+
43
+ def interpret(parent, keyword, *args, &block)
44
+ Glimmer::DataBinding::Shine.new(parent, keyword)
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
- # Copyright (c) 2007-2020 Andy Maleh
2
- #
1
+ # Copyright (c) 2020-2021 Andy Maleh
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,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -20,7 +20,7 @@ module Glimmer
20
20
  Glimmer::SWT::WidgetProxy.for(keyword, parent, args, block)
21
21
  end
22
22
 
23
- def add_content(parent, &block)
23
+ def add_content(parent, keyword, *args, &block)
24
24
  if parent.rendered? || parent.skip_content_on_render_blocks?
25
25
  super(parent, &block)
26
26
  parent.post_add_content
data/lib/glimmer/swt.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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
@@ -6,6 +6,7 @@ module Glimmer
6
6
  class ComboProxy < WidgetProxy
7
7
  include Glimmer::DataBinding::ObservableElement
8
8
  attr_reader :text, :items
9
+ attr_accessor :selection # virtual attribute just to pass the shine data-binding test (TODO THINK OF A BETTER WAY OF HANDLING THIS)
9
10
 
10
11
  def initialize(parent, args, block)
11
12
  super(parent, args, block)
@@ -4,8 +4,6 @@ require 'glimmer/swt/widget_proxy'
4
4
  module Glimmer
5
5
  module SWT
6
6
  class CompositeProxy < WidgetProxy
7
- attr_reader :layout
8
-
9
7
  def initialize(parent, args, block)
10
8
  super(parent, args, block)
11
9
  @layout = default_layout
@@ -27,9 +25,27 @@ module Glimmer
27
25
  def layout=(the_layout)
28
26
  @layout = the_layout
29
27
  end
28
+ alias set_layout layout=
29
+ alias setLayout layout=
30
30
 
31
+ def get_layout
32
+ @layout
33
+ end
34
+ alias getLayout get_layout #TODO consider pregenerating these aliases with an easy method in the future
35
+
36
+ def pack(*args)
37
+ # No Op (just a shim) TODO consider if it should be implemented
38
+ end
39
+
40
+ def layout​(changed = nil, all = nil)
41
+ # TODO implement layout(changed = nil, all = nil) just as per SWT API
42
+ @layout&.layout(self, changed)
43
+ end
44
+
31
45
  end
32
46
 
47
+ CanvasProxy = CompositeProxy # TODO implement fully eventually
48
+
33
49
  end
34
50
 
35
51
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Andy Maleh
1
+ # Copyright (c) 2020-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