function vdo_grid_button_check_init()
end
function vdo_grid_button_check_cleanup()
end
-- Inherited from Vdo_base_object
Vdo_grid_button_check = Vdo_base_object:new_base()
function Vdo_grid_button_check:init()
self.bg_highlight = Vdo_base_object:new("bg_highlight", self.handle, self.doc_handle)
self.bg_highlight:set_visible(false)
self.highlight_color = COLOR_STORE_WEAPON_PRIMARY
local icon2 = Vdo_base_object:new("grid_icon2", self.handle, self.doc_handle)
icon2:set_visible(false)
local checkbox = Vdo_base_object:new("checkbox", self.handle, self.doc_handle)
local checkbox_shadow = Vdo_base_object:new("checkbox_shadow", self.handle, self.doc_handle)
checkbox:set_visible(false)
checkbox_shadow:set_visible(false)
end
--sets the lock icon for the grid button
function Vdo_grid_button_check:set_lock(is_locked)
end
--sets the icon for the grid button
function Vdo_grid_button_check:set_icon(new_icon, dual_is_visible)
local icon = Vdo_base_object:new("grid_icon", self.handle, self.doc_handle)
local icon2 = Vdo_base_object:new("grid_icon2", self.handle, self.doc_handle)
icon:set_property("image", new_icon)
icon2:set_property("image", new_icon)
if dual_is_visible == true then
icon2:set_visible(true)
end
end
--sets the icon for the grid button using a crc of the image name
--Used by the mp badge selection screen
function Vdo_grid_button_check:set_icon_crc(new_icon_crc)
local icon = Vdo_base_object:new("grid_icon", self.handle, self.doc_handle)
icon:set_property("image_crc", new_icon_crc)
end
-- Sets the width of the grid button
function Vdo_grid_button_check:set_size(width,height)
--[[local bg = vint_object_find("bg", self.handle, self.doc_handle)
local checkbox = Vdo_base_object:new("checkbox", self.handle, self.doc_handle)
element_set_actual_size(bg, width, height)
-- Reposition checkbox to fit bg size
local CHECKBOX_BUFFER = 40
checkbox:set_anchor((width * 0.5) - CHECKBOX_BUFFER, (width * 0.5) - CHECKBOX_BUFFER)
]]--
end
-- Sets the highlighted state of the grid button to on or off
function Vdo_grid_button_check:set_highlight(is_highlighted, dual_is_visible)
local icon = Vdo_base_object:new("grid_icon", self.handle, self.doc_handle)
local icon2 = Vdo_base_object:new("grid_icon2", self.handle, self.doc_handle)
local bg = Vdo_base_object:new("bg", self.handle, self.doc_handle)
local main = Vdo_base_object:new("safe_frame", self.handle, self.doc_handle)
if dual_is_visible == true then
icon2:set_visible(true)
end
if is_highlighted then
icon:set_alpha(1.0)
icon2:set_alpha(1.0)
self.bg_highlight:set_color(self.highlight_color.R,self.highlight_color.G,self.highlight_color.B)
self.bg_highlight:set_visible(true)
main:set_property("alpha",1.0)
main:set_property("scale",1.1,1.1)
else
main:set_property("scale",1,1)
self.bg_highlight:set_visible(false)
end
end
-- Set checkbox status
-- -1 -Hidden
-- 0 -Empty Box
-- 1 -Checked
-- 2 -Locked
function Vdo_grid_button_check:set_checkbox(check_status,color)
local checkbox = Vdo_base_object:new("checkbox", self.handle, self.doc_handle)
local checkbox_shadow = Vdo_base_object:new("checkbox_shadow", self.handle, self.doc_handle)
if color ~= nil then
checkbox:set_color(color.R,color.G,color.B)
end
if check_status == -1 then
checkbox:set_visible(false)
checkbox_shadow:set_visible(false)
elseif check_status == 0 then
checkbox:set_image("ui_store_icon_box")
checkbox_shadow:set_image("ui_store_icon_box")
checkbox:set_visible(true)
checkbox_shadow:set_visible(true)
elseif check_status == 1 then
checkbox:set_image("ui_store_icon_checkbox")
checkbox_shadow:set_image("ui_store_icon_checkbox")
checkbox:set_visible(true)
checkbox_shadow:set_visible(true)
elseif check_status == 2 then
checkbox:set_image("ui_store_icon_lock_sm")
checkbox_shadow:set_image("ui_store_icon_checkbox")
checkbox:set_visible(true)
checkbox_shadow:set_visible(true)
end
end
function Vdo_grid_button_check:set_highlight_color(color)
self.highlight_color = color
self.bg_highlight:set_color(color.R,color.G,color.B)
end