---------------------------------------------------------------------------
-- Vdo_pause_header
--
-- 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 = Vdo_base_object:new_base()
--Colors -
COLOR_PAUSE_HEADER = {R = 218/255, G = 226/255; B = 230/255}
local PAUSE_PADDING = 23
PAUSE_PADDING = 23
--Standard Init
function Vdo_pause_header_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_cleanup()
end
---------------------------------------------------------------------------
-- Initializes VDO Object
---------------------------------------------------------------------------
function Vdo_pause_header: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)
end
---------------------------------------------------------------------------
-- Sets the text of the header and causes
--
-- @param new_text_string Text string for header
---------------------------------------------------------------------------
function Vdo_pause_header:set_text(new_text_string, max_width)
local text_obj = Vdo_base_object:new("text", self.handle)
text_obj:set_text(new_text_string)
--text_obj:set_scale(.95,.95)
local text_width,text_height = self:get_size()
--leave room for padding
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)
if max_width ~= nil and text_width > max_width then
local text_scale = (max_width/(text_width+PAUSE_PADDING))
vint_set_property(move_grp_h, "scale", text_scale,text_scale)
text_width,text_height = self:get_size()
local new_width_scaled = (text_width + PAUSE_PADDING)
element_set_actual_size(bot_line_h, -max_width, 2/text_scale)
else
vint_set_property(move_grp_h, "scale", 1,1)
if max_width ~= nil then
local line_corner = Vdo_base_object:new("line_corner", self.handle)
local corner_size_w, corner_size_h = line_corner:get_actual_size()
element_set_actual_size(bot_line_h, -max_width - corner_size_w, 6)
end
end
text_obj:set_alpha(1.0)
text_obj:set_anchor(-6,4)
local crumb_obj = Vdo_base_object:new("text_crumb", self.handle)
crumb_obj:set_visible(false)
--local bot_line_width, bot_line_height = element_get_actual_size(bot_line_h)
--element_set_actual_size(bot_line_h, bot_line_width, 2)
--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)
text_width,text_height = self:get_size()
local new_width = (text_width + PAUSE_PADDING)
element_set_actual_size(top_line_h, -new_width, 2)
element_set_actual_size(fill_h, -new_width, 81)
vint_set_property(right_line_h, "anchor", -new_width, 0)
end
function Vdo_pause_header:set_crumb(new_text_string)
local crumb_obj = Vdo_base_object:new("text_crumb", self.handle)
if new_text_string ~= nil or new_text_string ~= "" then
crumb_obj:set_visible(true)
crumb_obj:set_text(new_text_string)
else
crumb_obj:set_visible(false)
crumb_obj:set_text("")
end
end
function Vdo_pause_header:reset_width()
local bot_line_h = vint_object_find("bot_line", self.handle, self.doc_handle)
if vint_is_std_res() then
element_set_actual_size(bot_line_h, -750, 6)
else
element_set_actual_size(bot_line_h, -840, 6)
end
end
function Vdo_pause_header:set_alignment(alignment)
local text_obj_h = vint_object_find("text", self.handle)
vint_set_property(text_obj_h, "auto_offset", alignment)
end
function Vdo_pause_header:set_text_scale(scale)
local text_obj_h = vint_object_find("text", self.handle)
vint_set_property(text_obj_h, "text_scale", scale, scale)
end
function Vdo_pause_header:get_size()
local text_obj_h = vint_object_find("text", self.handle)
return element_get_actual_size(text_obj_h)
end
-------------------------------------------------------------------------------
-- Function to hide this object... used by the silverlink menu...
function Vdo_pause_header:show_me(is_visible)
local move_grp_h = vint_object_find("adjust_grp", self.handle, self.doc_handle)
vint_set_property(move_grp_h, "visible", is_visible)
end