blob: 43212060eb243a40c2deb80a999aae758fa74717 (
plain)
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
|
loadmodule "luaiup"
loadmodule "luahandle"
loadmodule "lualibs"
if not iupep then iupep = {} end
iupep.dbuffer = {
map_cb = function (self)
self.cv = cd.CreateCanvas(cd.IUP, self)
if not self.cv then return iup.DEFAULT end
local cvdb = cd.CreateCanvas(cd.DBUFFER, self.cv)
self.cvdb = cvdb
return iup.DEFAULT
end,
unmap_cb = function(self)
if self.cv then cd.KillCanvas(self.cv) end
if self.cvdb then cd.KillCanvas(self.cvdb) end
end,
resize_cb = function(self, width, height)
local cv = self.cv
local cvdb = self.cvdb
if not cvdb then
cv:Activate()
self.cvdb = cd.CreateCanvas(cd.DBUFFER, cv)
cvdb = self.cvdb
end
self.width = width
self.height = height
if not cvdb then return iup.DEFAULT end
cvdb:Activate()
return self:draw()
end,
action = function(self, posx, posy)
local cvdb = self.cvdb
if not cvdb then return end
cvdb:Flush()
return iup.DEFAULT
end,
}
|