diff options
| author | ruki <[email protected]> | 2018-01-04 00:34:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-03 21:29:24 +0800 |
| commit | 4b51f53356778c4fa3242814e79fd493cbc729ad (patch) | |
| tree | 66f05a2fb7eb5accb5b82056b3598235cb0a0a79 | |
| parent | 37dfc1033f906883a3e7815a879be9286286d5b3 (diff) | |
draw shadow for window
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | xmake/core/ui/window.lua | 41 |
2 files changed, 40 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f8d9d13cd..ff64eb032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Improve to detect vs environment * Upgrade luajit to 2.1.0-beta3 * Support to run xmake on linux (arm, arm64) +* Improve to generate vs201x project plugin ## v2.1.9 @@ -426,6 +427,7 @@ * 改进vs环境探测,支持加密文件系统下vs环境的探测 * 升级luajit到最新2.1.0-beta3 * 增加对linux/arm, arm64的支持,可以在arm linux上运行xmake +* 改进vs201x工程生成插件,更好的includedirs设置支持 ## v2.1.9 diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua index b782a1f38..4a3344057 100644 --- a/xmake/core/ui/window.lua +++ b/xmake/core/ui/window.lua @@ -38,15 +38,50 @@ function window:init(name, bounds, title) -- init panel panel.init(self, name, bounds) - -- init background - self:background_set("white") + -- TODO check bounds -- init title if title then self._TITLE = label:new("window.title", rect{0, 0, #title, 1}, title) - self:insert(self:title(), {centerx = true}) self:title():textattr_set("blue bold") end + + -- insert frame + self:insert(self:frame()) +end + +-- draw window +function window:draw() + + -- draw background + panel.draw(self) + + -- draw shadow + local shadow = curses.color_pair("black", "black") + self:canvas():attr(shadow):move(2, self:height() - 1):write(string.rep(' ', self:width() - 2)) + for y = 1, self:height() - 1 do + self:canvas():move(self:width() - 2, y):write(' ') + end + + -- TODO draw line + -- draw border + local border = curses.color_pair("black", "white") + self:canvas():attr(border):move(0, self:height() - 2):write(' ') + self:canvas():move(1, self:height() - 2):write(string.rep('-', self:width() - 4)) + self:canvas():move(self:width() - 3, 0):write('-') + for y = 1, self:height() - 2 do + self:canvas():move(self:width() - 3, y):write('|') + end +end + +-- get frame +function window:frame() + if not self._FRAME then + self._FRAME = panel:new("window.panel", rect{0, 0, self:width() - 3, self:height() - 2}) + self._FRAME:background_set("white") + self._FRAME:insert(self:title(), {centerx = true}) + end + return self._FRAME end -- get title |
