Compare commits
No commits in common. "8197d0a6f6cfcfef3bde2c95e06fc6911b5ce77e" and "233d3119e51fcc8972b667423658730e43ad1a2a" have entirely different histories.
8197d0a6f6
...
233d3119e5
@ -60,26 +60,6 @@ function Padding:getPaddingBottom()
|
|||||||
return self.bottom
|
return self.bottom
|
||||||
end
|
end
|
||||||
|
|
||||||
local function compareSet(value, default, didChange)
|
|
||||||
return value or default, didChange or (value ~= nil and value ~= default)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Padding:setPadding(opts)
|
|
||||||
if type(opts) ~= "table" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local changed = false
|
|
||||||
self.left, changed = compareSet(opts.left, self.left, changed)
|
|
||||||
self.right, changed = compareSet(opts.right, self.right, changed)
|
|
||||||
self.top, changed = compareSet(opts.top, self.top, changed)
|
|
||||||
self.bottom, changed = compareSet(opts.bottom, self.bottom, changed)
|
|
||||||
|
|
||||||
if changed then
|
|
||||||
self:_reload()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Padding:getInnerWidth()
|
function Padding:getInnerWidth()
|
||||||
return self.element:getWidth()
|
return self.element:getWidth()
|
||||||
end
|
end
|
||||||
|
@ -312,7 +312,6 @@ local PAGES = {
|
|||||||
|
|
||||||
local group = state:getExtra()
|
local group = state:getExtra()
|
||||||
if group == nil then
|
if group == nil then
|
||||||
print("No group passed to GROUP_DETAIL")
|
|
||||||
state:setPage("MAIN")
|
state:setPage("MAIN")
|
||||||
return NOOP
|
return NOOP
|
||||||
end
|
end
|
||||||
@ -418,7 +417,7 @@ local PAGES = {
|
|||||||
bgColor = colors.gray
|
bgColor = colors.gray
|
||||||
},
|
},
|
||||||
onClick = function(e, x, y, s)
|
onClick = function(e, x, y, s)
|
||||||
state:setPage("REQUEST", group)
|
state:setPage("REQUEST")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@ -436,47 +435,19 @@ local PAGES = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
REQUEST = function(state, newPage)
|
REQUEST = function(state, newPage)
|
||||||
local group = state:getExtra()
|
local helloPage = Text:new{
|
||||||
if group == nil then
|
text = "Hello Request"
|
||||||
print("No group passed to REQUEST")
|
|
||||||
state:setPage("MAIN")
|
|
||||||
return NOOP
|
|
||||||
end
|
|
||||||
local paddingSide = 0
|
|
||||||
local paddingTop = 0
|
|
||||||
|
|
||||||
local itemName = fitText(group:getSimpleName(), state.width - (paddingSide * 2))
|
|
||||||
local itemLeftPad, itemRightPad = getCenterPad(#itemName, state.width - (paddingSide * 2))
|
|
||||||
|
|
||||||
local paddedTitle = Padding:new{
|
|
||||||
top = 1,
|
|
||||||
left = itemLeftPad,
|
|
||||||
right = itemRightPad,
|
|
||||||
bottom = 1,
|
|
||||||
element = Text:new{
|
|
||||||
id = "title",
|
|
||||||
text = itemName,
|
|
||||||
bgColor = colors.gray
|
|
||||||
},
|
|
||||||
bgColor = colors.gray,
|
|
||||||
onClick = function(e, x, y, s)
|
|
||||||
local title = e:findById("title")
|
|
||||||
title:setText("Clicked")
|
|
||||||
local newLeftPad, newRightPad = getCenterPad(#("Clicked"), state.width - (paddingSide * 2))
|
|
||||||
e:setPadding{ left = newLeftPad, right = newRightPad }
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local stuffContainer = Container:new{
|
local stuffContainer = Container:new{
|
||||||
[Children:getId()] = {
|
[Children:getId()] = {
|
||||||
paddedTitle
|
helloPage
|
||||||
},
|
},
|
||||||
width = state.width,
|
width = state.width,
|
||||||
height = state.height,
|
height = state.height,
|
||||||
parent = state.monitor,
|
parent = state.monitor,
|
||||||
onClick = function(e, x, y, s)
|
onClick = function(e, x, y, s)
|
||||||
state:setPage("GROUP_DETAIL", group)
|
state:setPage("GROUP_DETAIL")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user