1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-17 16:57:39 +00:00

package manager update + UI built-in extended char detection

This commit is contained in:
kepler155c@gmail.com
2019-03-26 00:31:25 -04:00
parent 3f9c219f6b
commit daa86d50b2
11 changed files with 57 additions and 71 deletions

View File

@@ -7,9 +7,9 @@ UI.Checkbox = class(UI.Window)
UI.Checkbox.defaults = {
UIElement = 'Checkbox',
nochoice = 'Select',
checkedIndicator = 'X',
leftMarker = '[',
rightMarker = ']',
checkedIndicator = UI.extChars and '\4' or 'X',
leftMarker = UI.extChars and '\124' or '[',
rightMarker = UI.extChars and '\124' or ']',
value = false,
textColor = colors.white,
backgroundColor = colors.black,

View File

@@ -11,8 +11,8 @@ UI.Chooser.defaults = {
nochoice = 'Select',
backgroundFocusColor = colors.lightGray,
textInactiveColor = colors.gray,
leftIndicator = '<',
rightIndicator = '>',
leftIndicator = UI.extChars and '\17' or '<',
rightIndicator = UI.extChars and '\16' or '>',
height = 1,
}
function UI.Chooser:setParent()

View File

@@ -65,9 +65,9 @@ UI.Grid.defaults = {
headerSortColor = colors.yellow,
unfocusedTextSelectedColor = colors.white,
unfocusedBackgroundSelectedColor = colors.gray,
focusIndicator = '>',
focusIndicator = UI.extChars and '\183' or '>',
sortIndicator = ' ',
inverseSortIndicator = '^',
inverseSortIndicator = UI.extChars and '\24' or '^',
values = { },
columns = { },
accelerators = {

View File

@@ -10,7 +10,9 @@ UI.Notification = class(UI.Window)
UI.Notification.defaults = {
UIElement = 'Notification',
backgroundColor = colors.gray,
closeInd = '\215',
height = 3,
timeout = 3,
}
function UI.Notification:draw()
end
@@ -49,8 +51,8 @@ end
function UI.Notification:display(value, timeout)
self.enabled = true
local lines = Util.wordWrap(value, self.width - 2)
self.height = #lines + 1
local lines = Util.wordWrap(value, self.width - 3)
self.height = #lines
self.y = self.parent.height - self.height + 1
if self.canvas then
self.canvas:removeLayer()
@@ -63,9 +65,22 @@ function UI.Notification:display(value, timeout)
for k,v in pairs(lines) do
self:write(2, k, v)
end
self:write(self.width, 1, self.closeInd)
self.timer = Event.onTimeout(timeout or 3, function()
self:cancel()
self:sync()
end)
timeout = timeout or self.timeout
if timeout > 0 then
self.timer = Event.onTimeout(timeout or self.timeout, function()
self:cancel()
self:sync()
end)
end
end
function UI.Notification:eventHandler(event)
if event.type == 'mouse_click' then
if event.x == self.width then
self:cancel()
return true
end
end
end

View File

@@ -8,9 +8,9 @@ UI.ScrollBar = class(UI.Window)
UI.ScrollBar.defaults = {
UIElement = 'ScrollBar',
lineChar = '|',
sliderChar = '#',
upArrowChar = '^',
downArrowChar = 'v',
sliderChar = UI.extChars and '\127' or '#',
upArrowChar = UI.extChars and '\30' or '^',
downArrowChar = UI.extChars and '\31' or 'v',
scrollbarColor = colors.lightGray,
width = 1,
x = -1,

View File

@@ -41,8 +41,8 @@ UI.TitleBar.defaults = {
textColor = colors.white,
backgroundColor = colors.cyan,
title = '',
frameChar = '-',
closeInd = '*',
frameChar = UI.extChars and '\140' or '-',
closeInd = UI.extChars and '\215' or '*',
}
function UI.TitleBar:draw()
local sb = SB(self.width)