diff options
| author | ruki <[email protected]> | 2018-01-05 21:09:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-05 00:55:43 +0800 |
| commit | acfd73c79e9c406161ed022b40fe4d0ac7b2ad42 (patch) | |
| tree | cb4322ac69de54c11a899ad36ef0c636abf63c05 | |
| parent | c5435a4c499fbf1ff2d09b4250881a04c351f705 (diff) | |
adjust border and shadow bounds
| -rw-r--r-- | xmake/core/ui/window.lua | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua index 41f637967..83720f205 100644 --- a/xmake/core/ui/window.lua +++ b/xmake/core/ui/window.lua @@ -75,19 +75,20 @@ function window:draw() -- draw border local border = self:border() if border then + local fbounds = self:frame():bounds() self:canvas():attr(curses.color_pair(border, self:frame():background())) - self:canvas():move(0, self:height() - 2):putchar(' ') - self:canvas():move(1, self:height() - 2):putchar("hline", self:width() - 4) - self:canvas():move(self:width() - 3, 0):putchar('urcorner') - self:canvas():move(self:width() - 3, 1):putchar('vline', self:height() - 3, true) - self:canvas():move(self:width() - 3, self:height() - 2):putchar('lrcorner') + self:canvas():move(0, fbounds.ey):putchar(' ') + self:canvas():move(1, fbounds.ey):putchar("hline", fbounds.ex) + self:canvas():move(fbounds.ex, 0):putchar('urcorner') + self:canvas():move(fbounds.ex, 1):putchar('vline', fbounds.ey, true) + self:canvas():move(fbounds.ex, fbounds.ey):putchar('lrcorner') 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 = panel:new("window.panel", rect{0, 0, self:width(), self:height()}) self._FRAME:background_set("white") self._FRAME:insert(self:title(), {centerx = true}) end @@ -106,6 +107,11 @@ end -- set shadow function window:shadow_set(shadow) + if not self._SHADOW and shadow then + self:frame():bounds():movee(-2, -1) + elseif self._SHADOW and not shadow then + self:frame():bounds():movee(2, 1) + end self._SHADOW = shadow self:invalidate() end @@ -117,6 +123,11 @@ end -- set border function window:border_set(border) + if not self._BORDER and border then + self:frame():bounds():movee(-1, -1) + elseif self._BORDER and not border then + self:frame():bounds():movee(1, 1) + end self._BORDER = border self:invalidate() end |
