/
splash.rb
44 lines (39 loc) · 1.25 KB
/
splash.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'glimmer-dsl-swt'
class AreWeThereYet
class Splash
include Glimmer
display # pre-initialize SWT Display before any threads are later created, so they would auto-reuse it
class << self
attr_reader :shell_proxy
def open
sync_exec {
@splash_image = image(File.expand_path(File.join('..', '..', '..', '..', 'are-we-there-yet-splash.gif'), __FILE__)).scale_to(118, 118)
@shell_styles = OS.windows? ? [swt(:no_resize)] : [:no_trim, :on_top]
@shell_proxy = shell(*@shell_styles) {
minimum_size 128, 128
# background rgb(33, 44, 186)
background :white
grid_layout(1, false) {
margin_width 0
margin_height 0
}
composite {
layout_data(:center, :center, true, true) {
width_hint 118
height_hint 118
}
background_image @splash_image
}
cursor display.swt_display.get_system_cursor(swt(:cursor_appstarting))
}
@shell_proxy.open
}
end
def close
async_exec {
@shell_proxy&.swt_widget&.close
}
end
end
end
end