glimmer-dsl-swt 4.18.7.6 → 4.20.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +34 -21
  4. data/RUBY_VERSION +1 -1
  5. data/VERSION +1 -1
  6. data/bin/girb +10 -9
  7. data/bin/girb_runner.rb +8 -3
  8. data/bin/glimmer +10 -1
  9. data/bin/glimmer-setup +58 -0
  10. data/bin/glimmer_runner.rb +4 -0
  11. data/docs/reference/GLIMMER_COMMAND.md +19 -30
  12. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +39 -10
  13. data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +7 -1
  14. data/docs/reference/GLIMMER_SAMPLES.md +27 -0
  15. data/glimmer-dsl-swt.gemspec +0 -0
  16. data/lib/glimmer-dsl-swt.rb +8 -0
  17. data/lib/glimmer/data_binding/shine.rb +41 -26
  18. data/lib/glimmer/data_binding/widget_binding.rb +1 -1
  19. data/lib/glimmer/dsl/swt/c_tab_item_expression.rb +58 -0
  20. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +2 -1
  21. data/lib/glimmer/dsl/swt/dsl.rb +2 -1
  22. data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +49 -0
  23. data/lib/glimmer/dsl/swt/tab_item_expression.rb +7 -3
  24. data/lib/glimmer/dsl/swt/widget_expression.rb +1 -1
  25. data/lib/glimmer/launcher.rb +33 -51
  26. data/lib/glimmer/rake_task.rb +1 -1
  27. data/lib/glimmer/rake_task/package.rb +7 -2
  28. data/lib/glimmer/rake_task/scaffold.rb +227 -254
  29. data/lib/glimmer/swt/c_tab_item_proxy.rb +53 -0
  30. data/lib/glimmer/swt/custom/code_text.rb +17 -9
  31. data/lib/glimmer/swt/custom/shape.rb +15 -1
  32. data/lib/glimmer/swt/sash_form_proxy.rb +6 -0
  33. data/lib/glimmer/swt/shell_proxy.rb +3 -1
  34. data/lib/glimmer/swt/tab_folder_proxy.rb +1 -0
  35. data/lib/glimmer/swt/tab_item_proxy.rb +17 -18
  36. data/lib/glimmer/swt/widget_proxy.rb +9 -0
  37. data/samples/elaborate/contact_manager.rb +7 -5
  38. data/samples/elaborate/login.rb +7 -7
  39. data/samples/elaborate/mandelbrot_fractal.rb +13 -8
  40. data/samples/elaborate/meta_sample.rb +4 -2
  41. data/samples/elaborate/metronome.rb +4 -4
  42. data/samples/elaborate/stock_ticker.rb +2 -2
  43. data/samples/elaborate/tic_tac_toe.rb +2 -2
  44. data/samples/hello/hello_button.rb +1 -1
  45. data/samples/hello/hello_c_combo.rb +69 -0
  46. data/samples/hello/hello_c_tab.rb +174 -0
  47. data/samples/hello/hello_c_tab/denmark.png +0 -0
  48. data/samples/hello/hello_c_tab/finland.png +0 -0
  49. data/samples/hello/hello_c_tab/france.png +0 -0
  50. data/samples/hello/hello_c_tab/germany.png +0 -0
  51. data/samples/hello/hello_c_tab/italy.png +0 -0
  52. data/samples/hello/hello_c_tab/mexico.png +0 -0
  53. data/samples/hello/hello_c_tab/netherlands.png +0 -0
  54. data/samples/hello/hello_c_tab/norway.png +0 -0
  55. data/samples/hello/hello_c_tab/usa.png +0 -0
  56. data/samples/hello/hello_canvas.rb +5 -5
  57. data/samples/hello/hello_canvas_animation_data_binding.rb +1 -1
  58. data/samples/hello/hello_canvas_data_binding.rb +16 -16
  59. data/samples/hello/hello_checkbox.rb +4 -4
  60. data/samples/hello/hello_code_text.rb +3 -57
  61. data/samples/hello/hello_color_dialog.rb +1 -1
  62. data/samples/hello/hello_combo.rb +1 -1
  63. data/samples/hello/hello_computed.rb +5 -5
  64. data/samples/hello/hello_custom_widget.rb +1 -1
  65. data/samples/hello/hello_date_time.rb +4 -4
  66. data/samples/hello/hello_dialog.rb +3 -2
  67. data/samples/hello/hello_drag_and_drop.rb +1 -1
  68. data/samples/hello/hello_file_dialog.rb +1 -1
  69. data/samples/hello/hello_font_dialog.rb +3 -3
  70. data/samples/hello/hello_group.rb +6 -6
  71. data/samples/hello/hello_link.rb +56 -50
  72. data/samples/hello/hello_list_multi_selection.rb +1 -1
  73. data/samples/hello/hello_list_single_selection.rb +1 -1
  74. data/samples/hello/hello_progress_bar.rb +10 -10
  75. data/samples/hello/hello_radio.rb +6 -6
  76. data/samples/hello/hello_sash_form.rb +4 -4
  77. data/samples/hello/hello_shape.rb +1 -0
  78. data/samples/hello/hello_spinner.rb +6 -2
  79. data/samples/hello/hello_styled_text.rb +11 -11
  80. data/samples/hello/hello_tab.rb +2 -0
  81. data/vendor/swt/linux/swt.jar +0 -0
  82. data/vendor/swt/linux_aarch64/swt.jar +0 -0
  83. data/vendor/swt/mac/swt.jar +0 -0
  84. data/vendor/swt/mac_aarch64/swt.jar +0 -0
  85. data/vendor/swt/windows/swt.jar +0 -0
  86. metadata +76 -32
@@ -56,22 +56,22 @@ class HelloCheckbox
56
56
  composite {
57
57
  checkbox {
58
58
  text 'Skiing'
59
- selection bind(@person, :skiing)
59
+ selection <=> [@person, :skiing]
60
60
  }
61
61
 
62
62
  checkbox {
63
63
  text 'Snowboarding'
64
- selection bind(@person, :snowboarding)
64
+ selection <=> [@person, :snowboarding]
65
65
  }
66
66
 
67
67
  checkbox {
68
68
  text 'Snowmobiling'
69
- selection bind(@person, :snowmobiling)
69
+ selection <=> [@person, :snowmobiling]
70
70
  }
71
71
 
72
72
  checkbox {
73
73
  text 'Snowshoeing'
74
- selection bind(@person, :snowshoeing)
74
+ selection <=> [@person, :snowshoeing]
75
75
  }
76
76
  }
77
77
 
@@ -83,47 +83,14 @@ class HelloCodeText
83
83
  tab_folder {
84
84
  tab_item {
85
85
  fill_layout
86
- text 'Ruby (glimmer)'
86
+ text 'Ruby (glimmer theme)'
87
87
  code_text(language: 'ruby', theme: 'glimmer', lines: true) {
88
88
  text bind(self, :ruby_code)
89
89
  }
90
90
  }
91
91
  tab_item {
92
92
  fill_layout
93
- text 'Ruby (pastie)'
94
- code_text(language: 'ruby', theme: 'pastie', lines: {width: 2}) {
95
- text bind(self, :ruby_code)
96
- }
97
- }
98
- tab_item {
99
- fill_layout
100
- text 'Ruby (github)'
101
- code_text(language: 'ruby', theme: 'github', lines: false) {
102
- text bind(self, :ruby_code)
103
- }
104
- }
105
- tab_item {
106
- fill_layout
107
- text 'JavaScript (glimmer)'
108
- # No border (SWT styles are passed explicitly)
109
- code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'glimmer', lines: true) {
110
- # With lines, the custom widget has a root composite, which can be configured separately
111
- root {
112
- grid_layout(2, false) {
113
- margin_width 2
114
- }
115
- background :white
116
- }
117
- # With lines, the line numbers widget can be configured separately
118
- line_numbers {
119
- background :white
120
- }
121
- text bind(self, :js_code)
122
- }
123
- }
124
- tab_item {
125
- fill_layout
126
- text 'JavaScript (pastie)'
93
+ text 'JavaScript (pastie theme)'
127
94
  code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'pastie', lines: {width: 2}) {
128
95
  root {
129
96
  grid_layout(2, false) {
@@ -139,28 +106,7 @@ class HelloCodeText
139
106
  }
140
107
  tab_item {
141
108
  fill_layout
142
- text 'JavaScript (github)'
143
- code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'github') { # default is lines: false
144
- text bind(self, :js_code)
145
- }
146
- }
147
- tab_item {
148
- fill_layout
149
- text 'HTML (glimmer)'
150
- code_text(language: 'html', theme: 'glimmer', lines: true) {
151
- text bind(self, :html_code)
152
- }
153
- }
154
- tab_item {
155
- fill_layout
156
- text 'HTML (pastie)'
157
- code_text(language: 'html', theme: 'pastie', lines: {width: 2}) {
158
- text bind(self, :html_code)
159
- }
160
- }
161
- tab_item {
162
- fill_layout
163
- text 'HTML (github)'
109
+ text 'HTML (github theme)'
164
110
  code_text(language: 'html', theme: 'github') { # default is lines: false
165
111
  text bind(self, :html_code)
166
112
  }
@@ -45,7 +45,7 @@ class HelloColorDialog
45
45
 
46
46
  canvas(:border) {
47
47
  layout_data :center, :center, true, false
48
- background bind(self, :selected_color)
48
+ background <=> [self, :selected_color]
49
49
 
50
50
  on_mouse_up {
51
51
  self.selected_color = color_dialog.open
@@ -50,7 +50,7 @@ class HelloCombo
50
50
  text 'Hello, Combo!'
51
51
 
52
52
  combo(:read_only) {
53
- selection bind(@person, :country) # also binds to country_options by convention
53
+ selection <=> [@person, :country] # also binds to country_options by convention
54
54
  }
55
55
 
56
56
  button {
@@ -48,7 +48,7 @@ class HelloComputed
48
48
 
49
49
  label {text 'First &Name: '}
50
50
  text {
51
- text bind(@contact, :first_name)
51
+ text <=> [@contact, :first_name]
52
52
  layout_data {
53
53
  horizontal_alignment :fill
54
54
  grab_excess_horizontal_space true
@@ -57,7 +57,7 @@ class HelloComputed
57
57
 
58
58
  label {text '&Last Name: '}
59
59
  text {
60
- text bind(@contact, :last_name)
60
+ text <=> [@contact, :last_name]
61
61
  layout_data {
62
62
  horizontal_alignment :fill
63
63
  grab_excess_horizontal_space true
@@ -66,7 +66,7 @@ class HelloComputed
66
66
 
67
67
  label {text '&Year of Birth: '}
68
68
  text {
69
- text bind(@contact, :year_of_birth)
69
+ text <=> [@contact, :year_of_birth]
70
70
  layout_data {
71
71
  horizontal_alignment :fill
72
72
  grab_excess_horizontal_space true
@@ -75,7 +75,7 @@ class HelloComputed
75
75
 
76
76
  label {text 'Name: '}
77
77
  label {
78
- text bind(@contact, :name, computed_by: [:first_name, :last_name])
78
+ text <= [@contact, :name, computed_by: [:first_name, :last_name]]
79
79
  layout_data {
80
80
  horizontal_alignment :fill
81
81
  grab_excess_horizontal_space true
@@ -84,7 +84,7 @@ class HelloComputed
84
84
 
85
85
  label {text 'Age: '}
86
86
  label {
87
- text bind(@contact, :age, on_write: :to_i, computed_by: [:year_of_birth])
87
+ text <= [@contact, :age, on_write: :to_i, computed_by: [:year_of_birth]]
88
88
  layout_data {
89
89
  horizontal_alignment :fill
90
90
  grab_excess_horizontal_space true
@@ -55,7 +55,7 @@ class GreetingLabel
55
55
  label(swt_style) {
56
56
  text "#{greeting}, #{name}!"
57
57
  font @font
58
- foreground bind(self, :color)
58
+ foreground <=> [self, :color]
59
59
  }
60
60
  }
61
61
 
@@ -46,19 +46,19 @@ class HelloDateTime
46
46
  }
47
47
 
48
48
  date { # alias for date_time(:date)
49
- date_time bind(@person, :date_of_birth)
49
+ date_time <=> [@person, :date_of_birth]
50
50
  }
51
51
 
52
52
  date_drop_down { # alias for date_time(:date, :drop_down)
53
- date_time bind(@person, :date_of_birth)
53
+ date_time <=> [@person, :date_of_birth]
54
54
  }
55
55
 
56
56
  time { # alias for date_time(:time)
57
- date_time bind(@person, :date_of_birth)
57
+ date_time <=> [@person, :date_of_birth]
58
58
  }
59
59
 
60
60
  calendar { # alias for date_time(:calendar)
61
- date_time bind(@person, :date_of_birth)
61
+ date_time <=> [@person, :date_of_birth]
62
62
  }
63
63
  }
64
64
  }
@@ -23,7 +23,7 @@ require 'glimmer-dsl-swt'
23
23
 
24
24
  include Glimmer
25
25
 
26
- shell {
26
+ shell { |shell_proxy|
27
27
  row_layout :vertical
28
28
 
29
29
  text 'Hello, Dialog!'
@@ -39,7 +39,8 @@ shell {
39
39
  text "Dialog #{dialog_number}"
40
40
 
41
41
  on_widget_selected {
42
- dialog { |dialog_proxy|
42
+ # pass the shell proxy as a parent to make the dialog support hitting the escape button for closing alone without closing app
43
+ dialog(shell_proxy) { |dialog_proxy|
43
44
  row_layout(:vertical) {
44
45
  center true
45
46
  }
@@ -36,7 +36,7 @@ include Glimmer
36
36
  shell {
37
37
  text 'Hello, Drag and Drop!'
38
38
  list {
39
- selection bind(@location, :country)
39
+ selection <=> [@location, :country]
40
40
  on_drag_set_data { |event|
41
41
  list = event.widget.getControl
42
42
  event.data = list.getSelection.first
@@ -44,7 +44,7 @@ class HelloFileDialog
44
44
 
45
45
  label {
46
46
  layout_data :fill, :center, true, false
47
- text bind(self, :selected_file)
47
+ text <=> [self, :selected_file]
48
48
  font height: 14
49
49
  }
50
50
 
@@ -51,8 +51,8 @@ class HelloFontDialog
51
51
  height_hint 200
52
52
  }
53
53
  background :white
54
- font bind(self, 'selected_font_data')
55
- text bind(self, 'selected_font_data') {|font_data|
54
+ font <=> [self, 'selected_font_data']
55
+ text <=> [self, 'selected_font_data', on_read: ->(font_data) {
56
56
  style = case font_data.style
57
57
  when swt(:normal)
58
58
  'Normal'
@@ -64,7 +64,7 @@ class HelloFontDialog
64
64
  'Bold Italic'
65
65
  end
66
66
  "#{font_data.name}\n#{font_data.height}\n#{style}"
67
- }
67
+ }]
68
68
  }
69
69
 
70
70
  button {
@@ -58,12 +58,12 @@ class HelloGroup
58
58
 
59
59
  radio {
60
60
  text 'Male'
61
- selection bind(@person, :male)
61
+ selection <=> [@person, :male]
62
62
  }
63
63
 
64
64
  radio {
65
65
  text 'Female'
66
- selection bind(@person, :female)
66
+ selection <=> [@person, :female]
67
67
  }
68
68
  }
69
69
 
@@ -75,22 +75,22 @@ class HelloGroup
75
75
 
76
76
  radio {
77
77
  text 'Child'
78
- selection bind(@person, :child)
78
+ selection <=> [@person, :child]
79
79
  }
80
80
 
81
81
  radio {
82
82
  text 'Teen'
83
- selection bind(@person, :teen)
83
+ selection <=> [@person, :teen]
84
84
  }
85
85
 
86
86
  radio {
87
87
  text 'Adult'
88
- selection bind(@person, :adult)
88
+ selection <=> [@person, :adult]
89
89
  }
90
90
 
91
91
  radio {
92
92
  text 'Senior'
93
- selection bind(@person, :senior)
93
+ selection <=> [@person, :senior]
94
94
  }
95
95
  }
96
96
 
@@ -21,62 +21,68 @@
21
21
 
22
22
  require 'glimmer-dsl-swt'
23
23
 
24
- include Glimmer
25
-
26
- shell { |main_shell|
27
- grid_layout {
28
- margin_width 20
29
- margin_height 10
30
- }
24
+ class HelloLink
25
+ include Glimmer::UI::CustomShell
31
26
 
32
- background :white
33
- text 'Hello, Link!'
34
-
35
- @link = link {
36
- background :white
37
- link_foreground :dark_green
38
- font height: 16
39
- text <<~MULTI_LINE_STRING
40
-
41
- You may click on any <a>link</a> to get help.
27
+ body {
28
+ shell { |main_shell|
29
+ grid_layout {
30
+ margin_width 20
31
+ margin_height 10
32
+ }
42
33
 
43
- How do you know <a href="which-link-href-value">which link</a> you clicked?
34
+ background :white
35
+ text 'Hello, Link!'
44
36
 
45
- Just keep clicking <a href="all links">links</a> to find out!
46
- MULTI_LINE_STRING
37
+ @link = link {
38
+ background :white
39
+ link_foreground :dark_green
40
+ font height: 16
41
+ text <<~MULTI_LINE_STRING
47
42
 
48
- on_widget_selected { |selection_event|
49
- # This retrieves the clicked link href (or contained text if no href is set)
50
- @selected_link = selection_event.text
51
- }
52
- on_mouse_up { |mouse_event|
53
- unless @selected_link.nil?
54
- @help_shell.close unless @help_shell.nil? || @help_shell.disposed?
55
- @help_shell = shell(:no_trim) {
56
- grid_layout {
57
- margin_width 10
58
- margin_height 10
59
- }
43
+ You may click on any <a>link</a> to get help.
60
44
 
61
- background :yellow
45
+ How do you know <a href="which-link-href-value">which link</a> you clicked?
62
46
 
63
- label {
64
- background :yellow
65
- text "Did someone ask for help about \"#{@selected_link}\"?\nYou don't really need help. You did it!"
66
- }
67
-
68
- on_swt_show {
69
- x = main_shell.location.x + @link.location.x + mouse_event.x
70
- y = main_shell.location.y + @link.location.y + mouse_event.y + 20
71
- @help_shell.location = Point.new(x, y)
72
- }
73
- on_focus_lost {
74
- @selected_link = nil
75
- @help_shell.close
76
- }
47
+ Just keep clicking <a href="all links">links</a> to find out!
48
+ MULTI_LINE_STRING
49
+
50
+ on_widget_selected { |selection_event|
51
+ # This retrieves the clicked link href (or contained text if no href is set)
52
+ @selected_link = selection_event.text
53
+ }
54
+ on_mouse_up { |mouse_event|
55
+ unless @selected_link.nil?
56
+ @help_shell.close unless @help_shell.nil? || @help_shell.disposed?
57
+ @help_shell = shell(:no_trim) {
58
+ grid_layout {
59
+ margin_width 10
60
+ margin_height 10
61
+ }
62
+
63
+ background :yellow
64
+
65
+ label {
66
+ background :yellow
67
+ text "Did someone ask for help about \"#{@selected_link}\"?\nYou don't really need help. You did it!"
68
+ }
69
+
70
+ on_swt_show {
71
+ x = main_shell.location.x + @link.location.x + mouse_event.x
72
+ y = main_shell.location.y + @link.location.y + mouse_event.y + 20
73
+ @help_shell.location = Point.new(x, y)
74
+ }
75
+ on_focus_lost {
76
+ @selected_link = nil
77
+ @help_shell.close
78
+ }
79
+ }
80
+ @help_shell.open
81
+ end
77
82
  }
78
- @help_shell.open
79
- end
83
+ }
80
84
  }
81
85
  }
82
- }.open
86
+ end
87
+
88
+ HelloLink.launch
@@ -63,7 +63,7 @@ class HelloListMultiSelection
63
63
  text 'Hello, List Multi Selection!'
64
64
 
65
65
  list(:multi) {
66
- selection bind(@person, :provinces) # also binds to provinces_options by convention
66
+ selection <=> [@person, :provinces] # also binds to provinces_options by convention
67
67
  }
68
68
 
69
69
  button {
@@ -48,7 +48,7 @@ class HelloListSingleSelection
48
48
  text 'Hello, List Single Selection!'
49
49
 
50
50
  list {
51
- selection bind(@person, :country) # also binds to country_options by convention
51
+ selection <=> [@person, :country] # also binds to country_options by convention
52
52
  }
53
53
 
54
54
  button {