Refonte pour utiliser le systeme de GUI #112

Merged
kazhnuz merged 102 commits from feat/gui into master 2022-01-06 19:15:16 +01:00
3 changed files with 27 additions and 2 deletions
Showing only changes of commit 73fc3160dd - Show all commits

View file

@ -83,6 +83,14 @@ function TextWidget:getPadding()
return self.padding
end
function TextWidget:getPaddingLeft()
return self.paddingLeft or self:getPadding()
end
function TextWidget:getPaddingRight()
return self.paddingRight or self:getPadding()
end
function TextWidget:drawCanvas()
local w, h
local font = self:getFont()
@ -92,9 +100,9 @@ function TextWidget:drawCanvas()
if (complexLabel.position == "center") then
w = math.floor(self.width / 2)
elseif (complexLabel.position == "left") then
w = self:getPadding()
w = self:getPaddingLeft()
elseif (complexLabel.position == "right") then
w = math.floor(self.width - self:getPadding())
w = math.floor(self.width - self:getPaddingRight())
else
error("Position " .. complexLabel.position .. " is unknown for label " .. complexLabel.label)
end

View file

@ -86,6 +86,15 @@ function TextMenu:getPadding()
return self.padding
end
function TextMenu:getPaddingLeft()
return self.paddingLeft or self:getPadding()
end
function TextMenu:getPaddingRight()
return self.paddingRight or self:getPadding()
end
function TextMenu:addSubmenu(pageName, label, parent, backWidget)
local label = label or pageName
local parent = parent or "main"

View file

@ -49,4 +49,12 @@ function TextMenuWidget:getPadding()
return self.menu:getPadding()
end
function TextWidget:getPaddingLeft()
return self.menu:getPaddingLeft() or self:getPadding()
end
function TextWidget:getPaddingRight()
return self.menu:getPaddingRight() or self:getPadding()
end
return TextMenuWidget