---------------------------------------------------------------------------
-- Vdo_pause_header_mini
--
-- The header for each screen in the pause menu. This object gets included
-- manually in those documents that need a header.
---------------------------------------------------------------------------
-- Inherited from Vdo_base_object
Vdo_pause_header_mini = Vdo_base_object:new_base()
--Colors -
COLOR_PAUSE_HEADER = {R = 218/255, G = 226/255; B = 230/255}
--Standard Init
function Vdo_pause_header_mini_init()
--Hide the object from displaying crap on the first frame
local text = vint_object_find("text")
vint_set_property(text, "text_tag", "")
end
--Standard Cleanup
function Vdo_pause_header_mini_cleanup()
end
---------------------------------------------------------------------------
-- Initializes VDO Object
---------------------------------------------------------------------------
function Vdo_pause_header_mini:init()
--Reset color to script value
local text_obj = Vdo_base_object:new("text", self.handle)
--text_obj:set_color(COLOR_PAUSE_HEADER.R, COLOR_PAUSE_HEADER.G, COLOR_PAUSE_HEADER.B)
--Store off fill height...
local fill_h = vint_object_find("fill", self.handle, self.doc_handle)
local w, h = element_get_actual_size(fill_h)
self.fill_height = h
--Bottom Line is always the same length of the screen.
local bot_line_h = vint_object_find("bot_line", self.handle, self.doc_handle)
if vint_is_std_res() then
--Standard Def
self.max_width = 587
else
--Widescreen
self.max_width = 678
end
--Set width of bottom line, this never changes.
element_set_actual_size(bot_line_h, self.max_width, 2)
end
---------------------------------------------------------------------------
-- Sets the text of the header and causes
--
-- @param new_text_string Text string for header
---------------------------------------------------------------------------
function Vdo_pause_header_mini:set_text(new_text_string)
local text_h = vint_object_find("header_txt", self.handle)
--Set text
vint_set_property(text_h, "text_tag", new_text_string)
--Reset text scale
vint_set_property(text_h, "scale", 1, 1)
--Get text size
local text_width, text_height = element_get_actual_size(text_h)
--leave room for padding
local max_width = 10000
if self.max_width ~= nil then
max_width = self.max_width - 100
end
local move_grp_h = vint_object_find("adjust_grp", self.handle, self.doc_handle)
local bot_line_h = vint_object_find("bot_line", self.handle, self.doc_handle)
--This is standard width of the box...
local new_width = (text_width + 23)
--Check if the text width is larger than max width...
if max_width ~= nil and text_width > max_width then
local text_scale = max_width / text_width
vint_set_property(text_h, "scale", text_scale, text_scale)
--Scale down the width by our new text scale...
new_width = (text_width * text_scale) + 23
end
--Set bg box
local top_line_h = vint_object_find("top_line", self.handle, self.doc_handle)
local right_line_h = vint_object_find("right_line", self.handle, self.doc_handle)
local fill_h = vint_object_find("fill", self.handle, self.doc_handle)
element_set_actual_size(top_line_h, new_width + 2, 2)
element_set_actual_size(fill_h, new_width, self.fill_height)
vint_set_property(right_line_h, "anchor", new_width, 2)
end