summaryrefslogtreecommitdiff
path: root/xmake/core/ui/window.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-13 00:28:57 +0800
committerruki <[email protected]>2018-01-12 20:53:47 +0800
commitbcb58d536cb131be4358d8893cfd1db77f72d942 (patch)
treedc283ebaf56f2f6f8555f0c030275dd17ed9c024 /xmake/core/ui/window.lua
parent5d8d758fa2fb4a8e9691dae010b97725c6b736c0 (diff)
add box dialog
Diffstat (limited to 'xmake/core/ui/window.lua')
-rw-r--r--xmake/core/ui/window.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua
index 0a5b56783..d29d57e47 100644
--- a/xmake/core/ui/window.lua
+++ b/xmake/core/ui/window.lua
@@ -101,14 +101,20 @@ function window:border()
local border = view:new("window.border", self:frame():bounds())
function border:draw()
+ -- get corner attribute
+ local cornerattr = self:cornerattr()
+
-- the left-upper attribute
- local attr_ul = curses.color_pair("white", self:background())
- if self:background() == "white" then
+ local attr_ul = curses.color_pair(cornerattr[1], self:background())
+ if self:background() == cornerattr[1] then
attr_ul = {attr_ul, "standout"}
end
-- the right-lower attribute
- local attr_rl = curses.color_pair("black", self:background())
+ local attr_rl = curses.color_pair(cornerattr[2], self:background())
+ if self:background() == cornerattr[2] then
+ attr_rl = {attr_rl, "standout"}
+ end
-- the border characters
-- @note acs character will use 2 width on windows (pdcurses), so we use acsii characters instead of them.
@@ -134,6 +140,12 @@ function window:border()
self:canvas():move(self:width() - 1, 1):putchar(vline, self:height() - 1, true)
self:canvas():move(self:width() - 1, self:height() - 1):putchar(lrcorner)
end
+ function border:cornerattr()
+ return self._CORNERATTR or {"white", "black"}
+ end
+ function border:cornerattr_set(attr_ul, attr_rl)
+ self._CORNERATTR = {attr_ul or "white", attr_rl or attr_ul or "black"}
+ end
self._BORDER = border
end
return self._BORDER