Pad tab buttons

This commit is contained in:
Gabriel Tofvesson 2024-10-08 18:31:04 +02:00
parent 10ea229fbf
commit 741ec36d84

View File

@ -81,7 +81,6 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage)
text = " < ", text = " < ",
bgColor = state.tab == 1 and colors.black or colors.gray, bgColor = state.tab == 1 and colors.black or colors.gray,
fgColor = state.tab == 1 and colors.red or colors.white, fgColor = state.tab == 1 and colors.red or colors.white,
x = 1,
onClick = function(e, x, y, s) onClick = function(e, x, y, s)
if state.tab > 1 then if state.tab > 1 then
state.tab = state.tab - 1 state.tab = state.tab - 1
@ -90,11 +89,10 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage)
end end
} }
local btnNext = Text:new{ local _btnNext = Text:new{
text = " > ", text = " > ",
bgColor = state.tab == pages and colors.black or colors.gray, bgColor = state.tab == pages and colors.black or colors.gray,
fgColor = state.tab == pages and colors.red or colors.white, fgColor = state.tab == pages and colors.red or colors.white,
x = wBudget - 3,
onClick = function(e, x, y, s) onClick = function(e, x, y, s)
if state.tab < pages then if state.tab < pages then
state.tab = state.tab + 1 state.tab = state.tab + 1
@ -102,6 +100,10 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage)
end end
end end
} }
local btnNext = Padding:new{
left = wBudget - _btnNext:getWidth() - btnPrev:getWidth(),
element = _btnNext
}
local tabLine = List:new{ local tabLine = List:new{
children = { children = {
@ -162,7 +164,7 @@ local function itemList(groups, wBudget, hBudget, savedState, onClick, setPage)
end end
local tabLinePad = Padding:new{ local tabLinePad = Padding:new{
top = hBudget - (entryEnd - entryStart), top = hBudget - (entryEnd - entryStart) - 1 - tabLine:getHeight(),
element = tabLine element = tabLine
} }