Refonte pour utiliser le systeme de GUI #112
3 changed files with 27 additions and 2 deletions
|
@ -83,6 +83,14 @@ function TextWidget:getPadding()
|
||||||
return self.padding
|
return self.padding
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TextWidget:getPaddingLeft()
|
||||||
|
return self.paddingLeft or self:getPadding()
|
||||||
|
end
|
||||||
|
|
||||||
|
function TextWidget:getPaddingRight()
|
||||||
|
return self.paddingRight or self:getPadding()
|
||||||
|
end
|
||||||
|
|
||||||
function TextWidget:drawCanvas()
|
function TextWidget:drawCanvas()
|
||||||
local w, h
|
local w, h
|
||||||
local font = self:getFont()
|
local font = self:getFont()
|
||||||
|
@ -92,9 +100,9 @@ function TextWidget:drawCanvas()
|
||||||
if (complexLabel.position == "center") then
|
if (complexLabel.position == "center") then
|
||||||
w = math.floor(self.width / 2)
|
w = math.floor(self.width / 2)
|
||||||
elseif (complexLabel.position == "left") then
|
elseif (complexLabel.position == "left") then
|
||||||
w = self:getPadding()
|
w = self:getPaddingLeft()
|
||||||
elseif (complexLabel.position == "right") then
|
elseif (complexLabel.position == "right") then
|
||||||
w = math.floor(self.width - self:getPadding())
|
w = math.floor(self.width - self:getPaddingRight())
|
||||||
else
|
else
|
||||||
error("Position " .. complexLabel.position .. " is unknown for label " .. complexLabel.label)
|
error("Position " .. complexLabel.position .. " is unknown for label " .. complexLabel.label)
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,6 +86,15 @@ function TextMenu:getPadding()
|
||||||
return self.padding
|
return self.padding
|
||||||
end
|
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)
|
function TextMenu:addSubmenu(pageName, label, parent, backWidget)
|
||||||
local label = label or pageName
|
local label = label or pageName
|
||||||
local parent = parent or "main"
|
local parent = parent or "main"
|
||||||
|
|
|
@ -49,4 +49,12 @@ function TextMenuWidget:getPadding()
|
||||||
return self.menu:getPadding()
|
return self.menu:getPadding()
|
||||||
end
|
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
|
return TextMenuWidget
|
Loading…
Reference in a new issue