forked from koreader/kindlepdfviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.lua
43 lines (38 loc) · 835 Bytes
/
dialog.lua
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
require "widget"
require "font"
InfoMessage = {
face = Font:getFace("infofont", 25)
}
function InfoMessage:show(text)
local dialog = CenterContainer:new({
dimen = { w = G_width, h = G_height },
FrameContainer:new({
margin = 2,
background = 0,
HorizontalGroup:new({
align = "center",
ImageWidget:new({
file = "resources/info-i.png"
}),
Widget:new({
dimen = { w = 10, h = 0 }
}),
TextWidget:new({
text = text,
face = Font:getFace("cfont", 30)
})
})
})
})
dialog:paintTo(fb.bb, 0, 0)
dialog:free()
end
function showInfoMsgWithDelay(text, msec, refresh_mode)
if not refresh_mode then refresh_mode = 0 end
Screen:saveCurrentBB()
InfoMessage:show(text)
fb:refresh(refresh_mode)
util.usleep(msec*1000)
Screen:restoreFromSavedBB()
fb:refresh(refresh_mode)
end