function vdo_cell_missions_button_init()
end
-- Inherited from Vdo_base_object
Vdo_cell_missions_button = Vdo_base_object:new_base()
CELL_MISSIONS_BUTTON_SELECTED_HEIGHT = 120
CELL_MISSIONS_BUTTON_UNSELECTED_HEIGHT = 120
function Vdo_cell_missions_button:init()
self.mission_title = Vdo_base_object:new("mission_title",self.handle, self.doc_handle)
self.contact_name = Vdo_base_object:new("contact_name",self.handle, self.doc_handle)
self.contact_img = Vdo_base_object:new("contact_img",self.handle, self.doc_handle)
self.btn_bg = Vdo_base_object:new("btn_bg",self.handle, self.doc_handle)
self.btn_bar = Vdo_base_object:new("btn_hint_bar", self.handle, self.doc_handle)
self.highlight_grp = Vdo_base_object:new("highlight_grp", self.handle, self.doc_handle)
self.btn_new = Vdo_base_object:new("new_mission", self.handle, self.doc_handle)
self.highlight_grp:set_visible(false)
self.btn_new:set_visible(false)
self.mission_title:set_color(COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.R,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.G,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.B)
self.contact_name:set_color(COLOR_CELL_MENU_HIGHLIGHT_TEXT.R,COLOR_CELL_MENU_HIGHLIGHT_TEXT.G,COLOR_CELL_MENU_HIGHLIGHT_TEXT.B)
end
function Vdo_cell_missions_button:populate_button(title, contact_image, contact_name, is_new)
self.mission_title:set_text(title)
self.contact_name:set_text(contact_name)
self.contact_img:set_image(contact_image)
self.btn_new:set_visible(is_new)
--resize mission title to fit
self.mission_title:set_scale(1,1)
local MAX_WIDTH_TITLE = 275
local text_width_label, text_height_label = element_get_actual_size(self.mission_title.handle)
if text_width_label > MAX_WIDTH_TITLE then
local text_scale_label = MAX_WIDTH_TITLE/text_width_label
self.mission_title:set_scale(text_scale_label,1)
end
end
function Vdo_cell_missions_button:set_highlight(is_highlighted)
if(is_highlighted) then
self.mission_title:set_color(.75,.75,.75)
self.contact_name:set_color(0,0,0)
self.highlight_grp:set_visible(true)
else
self.mission_title:set_color(COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.R,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.G,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.B)
self.contact_name:set_color(COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.R,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.G,COLOR_CELL_MENU_UNHIGHLIGHT_TEXT.B)
self.highlight_grp:set_visible(false)
end
end
function Vdo_cell_missions_button:get_selected_height()
return CELL_MISSIONS_BUTTON_SELECTED_HEIGHT
end
function Vdo_cell_missions_button:get_unselected_height()
return CELL_MISSIONS_BUTTON_UNSELECTED_HEIGHT
end