ConfirmBox: add widgets (#10364)

This commit is contained in:
hius07
2023-05-02 08:25:34 +03:00
committed by GitHub
parent 64b0f5e7cf
commit 9db74f1f01
5 changed files with 70 additions and 30 deletions

View File

@@ -38,8 +38,8 @@ local CheckButton = InputContainer:extend{
background = Blitbuffer.COLOR_WHITE,
text = nil,
parent = nil, -- parent widget, must be set by the caller
width = nil, -- default value: parent widget's input widget width
-- If the parent widget has no input widget, the width must be set by the caller.
width = nil, -- default value: parent widget's added widgets available width
-- If the parent widget has no getAddedWidgetAvailableWidth() method, the width must be set by the caller.
}
function CheckButton:init()
@@ -70,7 +70,7 @@ function CheckButton:initCheckButton(checked)
self._textwidget = TextBoxWidget:new{
text = self.text,
face = self.face,
width = (self.width or self.parent._input_widget.width) - self._checkmark.dimen.w,
width = (self.width or self.parent:getAddedWidgetAvailableWidth()) - self._checkmark.dimen.w,
fgcolor = self.enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY,
}
local textbox_shift = math.max(0, self._checkmark.baseline - self._textwidget:getBaseline())