2013-10-18 20:38:07 +00:00
|
|
|
local TextWidget = require("ui/widget/textwidget")
|
|
|
|
local Geom = require("ui/geometry")
|
|
|
|
|
|
|
|
--[[
|
|
|
|
FixedTextWidget
|
|
|
|
--]]
|
|
|
|
local FixedTextWidget = TextWidget:new{}
|
|
|
|
|
2019-10-21 13:20:40 +00:00
|
|
|
function FixedTextWidget:updateSize()
|
|
|
|
TextWidget.updateSize(self)
|
|
|
|
-- Only difference from TextWidget:
|
|
|
|
-- no vertical padding, baseline is height
|
2014-03-13 13:52:43 +00:00
|
|
|
self._height = self.face.size
|
2019-10-21 13:20:40 +00:00
|
|
|
self._baseline_h = self.face.size
|
2013-10-18 20:38:07 +00:00
|
|
|
end
|
|
|
|
|
2019-10-21 13:20:40 +00:00
|
|
|
function FixedTextWidget:getSize()
|
|
|
|
self:updateSize()
|
|
|
|
if self._length == 0 then
|
|
|
|
return Geom:new{}
|
|
|
|
end
|
|
|
|
return TextWidget.getSize(self)
|
2013-10-18 20:38:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return FixedTextWidget
|