glimmer-dsl-swt 4.17.4.0 → 4.17.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +191 -29
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +18 -5
- data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +2 -0
- data/lib/glimmer/dsl/swt/dsl.rb +2 -0
- data/lib/glimmer/dsl/swt/expand_item_expression.rb +60 -0
- data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +61 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +1 -0
- data/lib/glimmer/swt/custom/checkbox_group.rb +160 -0
- data/lib/glimmer/swt/custom/code_text.rb +20 -13
- data/lib/glimmer/swt/custom/radio_group.rb +155 -0
- data/lib/glimmer/swt/expand_item_proxy.rb +97 -0
- data/lib/glimmer/swt/image_proxy.rb +5 -0
- data/lib/glimmer/swt/menu_proxy.rb +1 -1
- data/lib/glimmer/swt/sash_form_proxy.rb +1 -1
- data/lib/glimmer/swt/styled_text_proxy.rb +43 -0
- data/lib/glimmer/swt/tab_item_proxy.rb +1 -1
- data/lib/glimmer/swt/widget_proxy.rb +94 -35
- data/lib/glimmer/ui/custom_widget.rb +3 -0
- data/samples/elaborate/meta_sample.rb +36 -31
- data/samples/hello/hello_checkbox.rb +85 -0
- data/samples/hello/hello_checkbox_group.rb +68 -0
- data/samples/hello/hello_combo.rb +12 -12
- data/samples/hello/hello_expand_bar.rb +110 -0
- data/samples/hello/hello_list_multi_selection.rb +23 -23
- data/samples/hello/hello_list_single_selection.rb +14 -13
- data/samples/hello/hello_radio.rb +108 -0
- data/samples/hello/hello_radio_group.rb +84 -0
- data/samples/hello/hello_styled_text.rb +138 -0
- metadata +17 -4
@@ -0,0 +1,97 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/swt/widget_proxy'
|
23
|
+
require 'glimmer/swt/swt_proxy'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module SWT
|
27
|
+
# Proxy for org.eclipse.swt.widgets.ExpandItem
|
28
|
+
#
|
29
|
+
# Functions differently from other widget proxies.
|
30
|
+
#
|
31
|
+
# Glimmer instantiates an SWT Composite alongside the SWT ExpandItem
|
32
|
+
# and returns it for `#swt_widget` to allow adding widgets into it.
|
33
|
+
#
|
34
|
+
# In order to get the SWT ExpandItem object, one must call `#swt_expand_item`.
|
35
|
+
#
|
36
|
+
# Behind the scenes, this creates a tab item widget proxy separately from a composite that
|
37
|
+
# is set as the control of the tab item and `#swt_widget`.
|
38
|
+
#
|
39
|
+
# In order to retrieve the tab item widget proxy, one must call `#widget_proxy`
|
40
|
+
#
|
41
|
+
# Follows the Proxy Design Pattern
|
42
|
+
class ExpandItemProxy < WidgetProxy
|
43
|
+
ATTRIBUTES = ['text', 'height', 'expanded']
|
44
|
+
|
45
|
+
include_package 'org.eclipse.swt.widgets'
|
46
|
+
|
47
|
+
attr_reader :widget_proxy, :swt_expand_item
|
48
|
+
|
49
|
+
def initialize(parent, style, &contents)
|
50
|
+
super("composite", parent, style, &contents)
|
51
|
+
layout = FillLayout.new(SWTProxy[:vertical])
|
52
|
+
layout.marginWidth = 0
|
53
|
+
layout.marginHeight = 0
|
54
|
+
layout.spacing = 0
|
55
|
+
swt_widget.layout = layout
|
56
|
+
@widget_proxy = SWT::WidgetProxy.new('expand_item', parent, style)
|
57
|
+
@swt_expand_item = @widget_proxy.swt_widget
|
58
|
+
@swt_expand_item.control = swt_widget
|
59
|
+
@swt_expand_item.expanded = true
|
60
|
+
end
|
61
|
+
|
62
|
+
def post_add_content
|
63
|
+
@swt_expand_item.setHeight(swt_widget.computeSize(SWTProxy[:default], SWTProxy[:default]).y) unless @swt_expand_item.getHeight > 0
|
64
|
+
end
|
65
|
+
|
66
|
+
def has_attribute?(attribute_name, *args)
|
67
|
+
if ATTRIBUTES.include?(attribute_name.to_s)
|
68
|
+
true
|
69
|
+
else
|
70
|
+
super(attribute_name, *args)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def set_attribute(attribute_name, *args)
|
75
|
+
if ATTRIBUTES.include?(attribute_name.to_s)
|
76
|
+
@widget_proxy.set_attribute(attribute_name, *args)
|
77
|
+
else
|
78
|
+
super(attribute_name, *args)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def get_attribute(attribute_name)
|
83
|
+
if ATTRIBUTES.include?(attribute_name.to_s)
|
84
|
+
@widget_proxy.get_attribute(attribute_name)
|
85
|
+
else
|
86
|
+
super(attribute_name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def dispose
|
91
|
+
swt_expand_item.setControl(nil)
|
92
|
+
swt_widget.dispose
|
93
|
+
swt_expand_item.dispose
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -58,6 +58,11 @@ module Glimmer
|
|
58
58
|
elsif @file_path
|
59
59
|
@image_data = ImageData.new(input_stream || @file_path)
|
60
60
|
@swt_image = Image.new(DisplayProxy.instance.swt_display, @image_data)
|
61
|
+
width = options[:width]
|
62
|
+
height = options[:height]
|
63
|
+
height = (@image_data.height.to_f / @image_data.width.to_f)*width.to_f if !width.nil? && height.nil?
|
64
|
+
width = (@image_data.width.to_f / @image_data.height.to_f)*height.to_f if !height.nil? && width.nil?
|
65
|
+
scale_to(width, height) unless width.nil? || height.nil?
|
61
66
|
else
|
62
67
|
@swt_image = Image.new(*@args)
|
63
68
|
@image_data = @swt_image.image_data
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2007-2020 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer/swt/widget_proxy'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module SWT
|
26
|
+
# Proxy for org.eclipse.swt.custom.StyledText
|
27
|
+
#
|
28
|
+
# Follows the Proxy Design Pattern
|
29
|
+
class StyledTextProxy < WidgetProxy
|
30
|
+
def set_attribute(attribute_name, *args)
|
31
|
+
if attribute_name.to_s == 'selection'
|
32
|
+
if args.first
|
33
|
+
async_exec { @swt_widget.setCaretOffset(args.first.x) }
|
34
|
+
async_exec { @swt_widget.setSelection(args.first) }
|
35
|
+
end
|
36
|
+
else
|
37
|
+
super(attribute_name, *args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -47,7 +47,7 @@ module Glimmer
|
|
47
47
|
super("composite", parent, style, &contents)
|
48
48
|
@widget_proxy = SWT::WidgetProxy.new('tab_item', parent, style)
|
49
49
|
@swt_tab_item = @widget_proxy.swt_widget
|
50
|
-
@
|
50
|
+
@swt_tab_item.control = swt_widget
|
51
51
|
end
|
52
52
|
|
53
53
|
def has_attribute?(attribute_name, *args)
|
@@ -44,26 +44,29 @@ module Glimmer
|
|
44
44
|
include Packages
|
45
45
|
|
46
46
|
DEFAULT_STYLES = {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
'arrow' => [:arrow],
|
48
|
+
'button' => [:push],
|
49
|
+
'checkbox' => [:check],
|
50
|
+
'check' => [:check],
|
51
|
+
'drag_source' => [:drop_copy],
|
52
|
+
'drop_target' => [:drop_copy],
|
53
|
+
'expand_bar' => [:v_scroll],
|
54
|
+
'list' => [:border, :v_scroll],
|
55
|
+
'menu_item' => [:push],
|
56
|
+
'radio' => [:radio],
|
57
|
+
'scrolled_composite' => [:border, :h_scroll, :v_scroll],
|
58
|
+
'spinner' => [:border],
|
59
|
+
'styled_text' => [:border, :multi, :v_scroll, :h_scroll],
|
60
|
+
'table' => [:virtual, :border, :full_selection],
|
61
|
+
'text' => [:border],
|
62
|
+
'toggle' => [:toggle],
|
63
|
+
'tool_bar' => [:push],
|
64
|
+
'tool_item' => [:push],
|
65
|
+
'tree' => [:virtual, :border, :h_scroll, :v_scroll],
|
63
66
|
}
|
64
67
|
|
65
68
|
DEFAULT_INITIALIZERS = {
|
66
|
-
|
69
|
+
'composite' => lambda do |composite|
|
67
70
|
if composite.get_layout.nil?
|
68
71
|
layout = GridLayout.new
|
69
72
|
layout.marginWidth = 15
|
@@ -71,28 +74,28 @@ module Glimmer
|
|
71
74
|
composite.layout = layout
|
72
75
|
end
|
73
76
|
end,
|
74
|
-
|
77
|
+
'scrolled_composite' => lambda do |scrolled_composite|
|
75
78
|
scrolled_composite.expand_horizontal = true
|
76
79
|
scrolled_composite.expand_vertical = true
|
77
80
|
end,
|
78
|
-
|
81
|
+
'table' => lambda do |table|
|
79
82
|
table.setHeaderVisible(true)
|
80
83
|
table.setLinesVisible(true)
|
81
84
|
end,
|
82
|
-
|
85
|
+
'table_column' => lambda do |table_column|
|
83
86
|
table_column.setWidth(80)
|
84
87
|
end,
|
85
|
-
|
88
|
+
'group' => lambda do |group|
|
86
89
|
group.layout = GridLayout.new if group.get_layout.nil?
|
87
90
|
end,
|
88
91
|
}
|
89
92
|
|
90
93
|
KEYWORD_ALIASES = {
|
91
|
-
'
|
94
|
+
'arrow' => 'button',
|
92
95
|
'checkbox' => 'button',
|
93
96
|
'check' => 'button',
|
97
|
+
'radio' => 'button',
|
94
98
|
'toggle' => 'button',
|
95
|
-
'arrow' => 'button',
|
96
99
|
}
|
97
100
|
|
98
101
|
class << self
|
@@ -216,7 +219,11 @@ module Glimmer
|
|
216
219
|
def get_attribute(attribute_name)
|
217
220
|
widget_custom_attribute = widget_custom_attribute_mapping[attribute_name.to_s]
|
218
221
|
if widget_custom_attribute
|
219
|
-
|
222
|
+
if widget_custom_attribute[:getter][:invoker]
|
223
|
+
widget_custom_attribute[:getter][:invoker].call(@swt_widget, [])
|
224
|
+
else
|
225
|
+
@swt_widget.send(widget_custom_attribute[:getter][:name])
|
226
|
+
end
|
220
227
|
else
|
221
228
|
@swt_widget.send(attribute_getter(attribute_name))
|
222
229
|
end
|
@@ -329,6 +336,56 @@ module Glimmer
|
|
329
336
|
observer.call(@swt_widget.getText)
|
330
337
|
}
|
331
338
|
end,
|
339
|
+
:caret_position => lambda do |observer|
|
340
|
+
on_swt_keyup { |event|
|
341
|
+
observer.call(@swt_widget.getCaretOffset)
|
342
|
+
}
|
343
|
+
on_swt_mouseup { |event|
|
344
|
+
observer.call(@swt_widget.getCaretOffset)
|
345
|
+
}
|
346
|
+
end,
|
347
|
+
:caret_offset => lambda do |observer|
|
348
|
+
on_swt_keyup { |event|
|
349
|
+
observer.call(@swt_widget.getCaretOffset)
|
350
|
+
}
|
351
|
+
on_swt_mouseup { |event|
|
352
|
+
observer.call(@swt_widget.getCaretOffset)
|
353
|
+
}
|
354
|
+
end,
|
355
|
+
:selection => lambda do |observer|
|
356
|
+
on_swt_keyup { |event|
|
357
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getSelection.x == 0 && @swt_widget.getSelection.y == 0
|
358
|
+
}
|
359
|
+
on_swt_mouseup { |event|
|
360
|
+
observer.call(@swt_widget.getSelection) unless @swt_widget.getSelection.x == 0 && @swt_widget.getSelection.y == 0
|
361
|
+
}
|
362
|
+
end,
|
363
|
+
:selection_count => lambda do |observer|
|
364
|
+
on_swt_keyup { |event|
|
365
|
+
observer.call(@swt_widget.getSelectionCount)
|
366
|
+
}
|
367
|
+
on_swt_mouseup { |event|
|
368
|
+
observer.call(@swt_widget.getSelectionCount)
|
369
|
+
}
|
370
|
+
end,
|
371
|
+
:top_index => lambda do |observer|
|
372
|
+
@last_top_index = @swt_widget.getTopIndex
|
373
|
+
on_paint_control { |event|
|
374
|
+
if @swt_widget.getTopIndex != @last_top_index
|
375
|
+
@last_top_index = @swt_widget.getTopIndex
|
376
|
+
observer.call(@last_top_index)
|
377
|
+
end
|
378
|
+
}
|
379
|
+
end,
|
380
|
+
:top_pixel => lambda do |observer|
|
381
|
+
@last_top_pixel = @swt_widget.getTopPixel
|
382
|
+
on_paint_control { |event|
|
383
|
+
if @swt_widget.getTopPixel != @last_top_pixel
|
384
|
+
@last_top_pixel = @swt_widget.getTopPixel
|
385
|
+
observer.call(@last_top_pixel)
|
386
|
+
end
|
387
|
+
}
|
388
|
+
end,
|
332
389
|
},
|
333
390
|
Java::OrgEclipseSwtWidgets::Button => {
|
334
391
|
:selection => lambda do |observer|
|
@@ -609,18 +666,22 @@ module Glimmer
|
|
609
666
|
end
|
610
667
|
|
611
668
|
def widget_custom_attribute_mapping
|
669
|
+
# TODO scope per widget class type just like other mappings
|
612
670
|
@swt_widget_custom_attribute_mapping ||= {
|
613
671
|
'focus' => {
|
614
672
|
getter: {name: 'isFocusControl'},
|
615
673
|
setter: {name: 'setFocus', invoker: lambda { |widget, args| @swt_widget.setFocus if args.first }},
|
616
674
|
},
|
617
675
|
'caret_position' => {
|
618
|
-
getter: {name: 'getCaretPosition'},
|
676
|
+
getter: {name: 'getCaretPosition', invoker: lambda { |widget, args| @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset}},
|
619
677
|
setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(args.first) if args.first }},
|
620
678
|
},
|
621
679
|
'selection_count' => {
|
622
680
|
getter: {name: 'getSelectionCount'},
|
623
|
-
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
681
|
+
setter: {name: 'setSelection', invoker: lambda { |widget, args|
|
682
|
+
caret_position = @swt_widget.respond_to?(:getCaretPosition) ? @swt_widget.getCaretPosition : @swt_widget.getCaretOffset
|
683
|
+
@swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
|
684
|
+
}},
|
624
685
|
},
|
625
686
|
}
|
626
687
|
end
|
@@ -658,11 +719,9 @@ module Glimmer
|
|
658
719
|
end
|
659
720
|
|
660
721
|
def apply_property_type_converters(attribute_name, args)
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
args[0] = converter.call(value) if converter
|
665
|
-
end
|
722
|
+
value = args
|
723
|
+
converter = property_type_converters[attribute_name.to_sym]
|
724
|
+
args[0..-1] = [converter.call(*value)] if converter
|
666
725
|
if args.count == 1 && args.first.is_a?(ColorProxy)
|
667
726
|
g_color = args.first
|
668
727
|
args[0] = g_color.swt_color
|
@@ -683,8 +742,8 @@ module Glimmer
|
|
683
742
|
SWTProxy[*value]
|
684
743
|
},
|
685
744
|
:background => color_converter,
|
686
|
-
:background_image => lambda do
|
687
|
-
image_proxy = ImageProxy.create(value)
|
745
|
+
:background_image => lambda do |*value|
|
746
|
+
image_proxy = ImageProxy.create(*value)
|
688
747
|
|
689
748
|
if image_proxy&.file_path&.end_with?('.gif')
|
690
749
|
image = image_proxy.swt_image
|
@@ -742,8 +801,8 @@ module Glimmer
|
|
742
801
|
value
|
743
802
|
end
|
744
803
|
end,
|
745
|
-
:image => lambda do
|
746
|
-
ImageProxy.create(value).swt_image
|
804
|
+
:image => lambda do |*value|
|
805
|
+
ImageProxy.create(*value).swt_image
|
747
806
|
end,
|
748
807
|
:images => lambda do |array|
|
749
808
|
array.to_a.map do |value|
|
@@ -213,6 +213,7 @@ module Glimmer
|
|
213
213
|
def has_instance_method?(method_name)
|
214
214
|
respond_to?(method_name) and
|
215
215
|
!swt_widget&.respond_to?(method_name) and
|
216
|
+
(method(method_name) rescue nil) and
|
216
217
|
!method(method_name)&.source_location&.first&.include?('glimmer/dsl/engine.rb') and
|
217
218
|
!method(method_name)&.source_location&.first&.include?('glimmer/swt/widget_proxy.rb')
|
218
219
|
end
|
@@ -255,6 +256,8 @@ module Glimmer
|
|
255
256
|
end
|
256
257
|
|
257
258
|
def method_missing(method, *args, &block)
|
259
|
+
# TODO Consider supporting a glimmer error silencing option for methods defined here
|
260
|
+
# but fail the glimmer DSL for the right reason to avoid seeing noise in the log output
|
258
261
|
if can_handle_observation_request?(method)
|
259
262
|
handle_observation_request(method, &block)
|
260
263
|
else
|
@@ -20,7 +20,7 @@ class Sample
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def content
|
23
|
-
@content
|
23
|
+
@content = File.read(file)
|
24
24
|
end
|
25
25
|
|
26
26
|
def launch
|
@@ -58,12 +58,12 @@ class SampleDirectory
|
|
58
58
|
|
59
59
|
def all_samples
|
60
60
|
@all_samples ||= sample_directories.map(&:samples).reduce(:+)
|
61
|
-
end
|
61
|
+
end
|
62
62
|
end
|
63
63
|
|
64
64
|
include Glimmer # used for observe syntax
|
65
65
|
|
66
|
-
attr_accessor :file
|
66
|
+
attr_accessor :file, :selected_sample_name
|
67
67
|
|
68
68
|
def initialize(file)
|
69
69
|
self.file = file
|
@@ -92,7 +92,20 @@ class SampleDirectory
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
@samples
|
95
|
-
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def selected_sample_name_options
|
98
|
+
samples.map(&:name)
|
99
|
+
end
|
100
|
+
|
101
|
+
def selected_sample_name=(selected_name)
|
102
|
+
@selected_sample_name = selected_name
|
103
|
+
unless selected_name.nil?
|
104
|
+
(self.class.sample_directories - [self]).each { |sample_dir| sample_dir.selected_sample_name = nil }
|
105
|
+
self.class.selected_sample = samples.detect { |sample| sample.name == @selected_sample_name }
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
96
109
|
end
|
97
110
|
|
98
111
|
class MetaSampleApplication
|
@@ -100,6 +113,7 @@ class MetaSampleApplication
|
|
100
113
|
|
101
114
|
def launch
|
102
115
|
shell {
|
116
|
+
minimum_size 1280, 768
|
103
117
|
text 'Glimmer Meta-Sample (The Sample of Samples)'
|
104
118
|
|
105
119
|
on_swt_show {
|
@@ -109,42 +123,33 @@ class MetaSampleApplication
|
|
109
123
|
sash_form {
|
110
124
|
composite {
|
111
125
|
grid_layout 1, false
|
112
|
-
|
113
|
-
scrolled_composite {
|
114
|
-
layout_data(:fill, :fill, true, true)
|
115
126
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
label {
|
129
|
-
text sample.name
|
130
|
-
font height: 30
|
131
|
-
|
132
|
-
on_mouse_up {
|
133
|
-
sample.selected = true
|
134
|
-
}
|
135
|
-
}
|
127
|
+
expand_bar {
|
128
|
+
layout_data(:fill, :fill, true, true)
|
129
|
+
font height: 30
|
130
|
+
|
131
|
+
SampleDirectory.sample_directories.each { |sample_directory|
|
132
|
+
expand_item {
|
133
|
+
layout_data(:fill, :fill, true, true)
|
134
|
+
text "#{sample_directory.name} Samples"
|
135
|
+
|
136
|
+
radio_group { |radio_group_proxy|
|
137
|
+
row_layout(:vertical) {
|
138
|
+
fill true
|
136
139
|
}
|
140
|
+
selection bind(sample_directory, :selected_sample_name)
|
141
|
+
font height: 24
|
137
142
|
}
|
138
143
|
}
|
139
144
|
}
|
140
145
|
}
|
141
146
|
|
142
147
|
button {
|
143
|
-
layout_data(:
|
144
|
-
height_hint
|
148
|
+
layout_data(:fill, :center, true, false) {
|
149
|
+
height_hint 120
|
145
150
|
}
|
146
151
|
text 'Launch Sample'
|
147
|
-
font height:
|
152
|
+
font height: 30
|
148
153
|
on_widget_selected {
|
149
154
|
SampleDirectory.selected_sample.launch
|
150
155
|
}
|
@@ -157,7 +162,7 @@ class MetaSampleApplication
|
|
157
162
|
caret nil
|
158
163
|
}
|
159
164
|
|
160
|
-
weights
|
165
|
+
weights 4, 9
|
161
166
|
}
|
162
167
|
}.open
|
163
168
|
end
|