|
|
@ -11,7 +11,7 @@ MessageBox.focus_path = 'MessageBox'
|
|
|
|
|
|
|
|
|
|
|
|
MessageBox.ATTRS{
|
|
|
|
MessageBox.ATTRS{
|
|
|
|
frame_style = gui.WINDOW_FRAME,
|
|
|
|
frame_style = gui.WINDOW_FRAME,
|
|
|
|
frame_inset = 1,
|
|
|
|
frame_inset = {l=1, t=1, b=1, r=0},
|
|
|
|
-- new attrs
|
|
|
|
-- new attrs
|
|
|
|
on_accept = DEFAULT_NIL,
|
|
|
|
on_accept = DEFAULT_NIL,
|
|
|
|
on_cancel = DEFAULT_NIL,
|
|
|
|
on_cancel = DEFAULT_NIL,
|
|
|
@ -33,13 +33,14 @@ end
|
|
|
|
function MessageBox:getWantedFrameSize()
|
|
|
|
function MessageBox:getWantedFrameSize()
|
|
|
|
local label = self.subviews.label
|
|
|
|
local label = self.subviews.label
|
|
|
|
local width = math.max(self.frame_width or 0, 20, #(self.frame_title or '') + 4)
|
|
|
|
local width = math.max(self.frame_width or 0, 20, #(self.frame_title or '') + 4)
|
|
|
|
local text_area_width = label:getTextWidth()
|
|
|
|
local text_area_width = label:getTextWidth() + 1
|
|
|
|
if label.frame_inset then
|
|
|
|
local text_height = label:getTextHeight()
|
|
|
|
-- account for scroll icons
|
|
|
|
local sw, sh = dfhack.screen.getWindowSize()
|
|
|
|
text_area_width = text_area_width + (label.frame_inset.l or 0)
|
|
|
|
if text_height > sh - 4 then
|
|
|
|
text_area_width = text_area_width + (label.frame_inset.r or 0)
|
|
|
|
-- account for scrollbar
|
|
|
|
end
|
|
|
|
text_area_width = text_area_width + 2
|
|
|
|
return math.max(width, text_area_width), label:getTextHeight()
|
|
|
|
end
|
|
|
|
|
|
|
|
return math.max(width, text_area_width), text_height
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function MessageBox:onRenderFrame(dc,rect)
|
|
|
|
function MessageBox:onRenderFrame(dc,rect)
|
|
|
|