diff options
| author | ruki <[email protected]> | 2018-01-16 00:30:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-15 21:05:13 +0800 |
| commit | af73bd6d7c07a97d9f02f3a8dc67754ac5c68f23 (patch) | |
| tree | d3db60d43632effe12af4e5dc9e733a1ef059065 | |
| parent | f0cd6845f16de9b6b55925b31e68114c01be2b18 (diff) | |
fix border.draw()
| -rw-r--r-- | tests/ui/dialog.lua | 4 | ||||
| -rw-r--r-- | xmake/core/ui/panel.lua | 6 | ||||
| -rw-r--r-- | xmake/core/ui/view.lua | 16 | ||||
| -rw-r--r-- | xmake/core/ui/window.lua | 3 |
4 files changed, 20 insertions, 9 deletions
diff --git a/tests/ui/dialog.lua b/tests/ui/dialog.lua index 443a1ef4e..6d9c85d0a 100644 --- a/tests/ui/dialog.lua +++ b/tests/ui/dialog.lua @@ -57,8 +57,8 @@ function demo:init() local dialog_hello = textdialog:new("dialog.hello", rect {0, 0, 50, 8}):background_set(dialog_main:frame():background()) dialog_hello:frame():background_set("cyan") dialog_hello:text():text_set("hello xmake! (http://xmake.io)\nA cross-platform build utility based on Lua"):textattr_set("red") - dialog_hello:button_add("yes", "< Yes >", "cm_yes") - dialog_hello:button_add("no", "< No >", "cm_no") + dialog_hello:button_add("yes", "< Yes >", function (v, e) self:remove(dialog_hello) end) + dialog_hello:button_add("no", "< No >", function (v, e) self:remove(dialog_hello) end) self:insert(dialog_hello, {centerx = true, centery = true}) end diff --git a/xmake/core/ui/panel.lua b/xmake/core/ui/panel.lua index 5057fe2bc..b7d9aced3 100644 --- a/xmake/core/ui/panel.lua +++ b/xmake/core/ui/panel.lua @@ -130,6 +130,9 @@ function panel:insert(v, opt) if v:option("selectable") then self:select(v) end + + -- invalidate it + self:invalidate() end -- remove view @@ -147,6 +150,9 @@ function panel:remove(v) self._CURRENT = nil self:select_next() end + + -- invalidate it + self:invalidate() end -- select the child view diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua index d01682f91..de301e795 100644 --- a/xmake/core/ui/view.lua +++ b/xmake/core/ui/view.lua @@ -179,18 +179,20 @@ function view:canvas() end -- draw view -function view:draw() +function view:draw(transparent) -- trace log:print("%s: draw ..", self) -- draw background - local background = self:background() - if background then - background = curses.color_pair(background, background) - self:canvas():attr(background):move(0, 0):putchar(' ', self:width() * self:height()) - else - self:canvas():clear() + if not transparent then + local background = self:background() + if background then + background = curses.color_pair(background, background) + self:canvas():attr(background):move(0, 0):putchar(' ', self:width() * self:height()) + else + self:canvas():clear() + end end -- clear mark diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua index d29d57e47..ff50e3481 100644 --- a/xmake/core/ui/window.lua +++ b/xmake/core/ui/window.lua @@ -101,6 +101,9 @@ function window:border() local border = view:new("window.border", self:frame():bounds()) function border:draw() + -- draw background (transparent) + view.draw(self, true) + -- get corner attribute local cornerattr = self:cornerattr() |
