local p="\078\101\120\117\115\067\104\101\099\107\066\111\120"local u=(require(script.Parent.Parent.Parent:WaitForChild("\078\101\120\117\115\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107\080\114\111\106\101\099\116"))):GetContext(script)local L=u:GetResource("\078\101\120\117\115\073\110\115\116\097\110\099\101\046\078\101\120\117\115\079\098\106\101\099\116")local i=u:GetResource("\066\097\115\101\046\078\101\120\117\115\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101")local o=(u:GetResource("\068\097\116\097\046\069\110\117\109\046\078\101\120\117\115\069\110\117\109\067\111\108\108\101\099\116\105\111\110")).GetBuiltInEnums()local F=i:Extend()F:SetClassName(p)u:SetContextResource(F)function F.__new(u)u:InitializeSuper("\070\114\097\109\101")u.Name=p u.BorderSizePixel=1 local L=i.GetInstance("\073\109\097\103\101\076\097\098\101\108")L.Hidden=true L.Size=UDim2.new(.9,0,1.26,0)L.Position=UDim2.new(0,0,-0.1,0)L.BackgroundTransparency=1 L.Image="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\076\117\097\067\104\097\116\047\105\099\111\110\115\047\105\099-\099\104\101\099\107\046\112\110\103"L.Visible=false L.Parent=u local F=i.GetInstance("\070\114\097\109\101")F.Hidden=true F.Size=UDim2.new(.9,0,.9,0)F.AnchorPoint=Vector2.new(.5,.5)F.Position=UDim2.new(.5,0,.5,0)F.BorderSizePixel=0 F.Visible=false F.Parent=u:GetWrappedInstance()u:__SetChangedOverride("\067\104\101\099\107\067\111\108\111\114\051",function()L.ImageColor3=u.CheckColor3 end)u:__SetChangedOverride("\077\105\120\101\100\067\111\108\111\114\051",function()F.BackgroundColor3=u.MixedColor3 end)u:__SetChangedOverride("\066\111\120\083\116\097\116\101",function()L.Visible=o.CheckBoxState.Checked:Equals(u.BoxState)F.Visible=o.CheckBoxState.Mixed:Equals(u.BoxState)u.Selected=o.CheckBoxState.Checked:Equals(u.BoxState)end)u.InputBegan:Connect(function(p)if not u:IsEnabled()then return end if p.UserInputType==Enum.UserInputType.MouseButton1 then u:Toggle()end end)u.BoxState=o.CheckBoxState.Unchecked u.BackgroundColor3="\067\104\101\099\107\101\100\070\105\101\108\100\066\097\099\107\103\114\111\117\110\100"u.BorderColor3="\067\104\101\099\107\101\100\070\105\101\108\100\066\111\114\100\101\114"u.CheckColor3="\067\104\101\099\107\101\100\070\105\101\108\100\073\110\100\105\099\097\116\111\114"u.MixedColor3="\067\104\101\099\107\101\100\070\105\101\108\100\073\110\100\105\099\097\116\111\114"end function F.Toggle(p)if o.CheckBoxState.Unchecked:Equals(p.BoxState)then p.BoxState=o.CheckBoxState.Checked else p.BoxState=o.CheckBoxState.Unchecked end end return F
--[[
TheNexusAvenger

Frame that adds checkbox functionality.
--]]

local CLASS_NAME = "NexusCheckBox"



local NexusPluginFramework = require(script.Parent.Parent.Parent:WaitForChild("NexusPluginFrameworkProject")):GetContext(script)
local NexusObject = NexusPluginFramework:GetResource("NexusInstance.NexusObject")
local NexusWrappedInstance = NexusPluginFramework:GetResource("Base.NexusWrappedInstance")
local NexusEnums = NexusPluginFramework:GetResource("Data.Enum.NexusEnumCollection").GetBuiltInEnums()

local NexusCheckBox = NexusWrappedInstance:Extend()
NexusCheckBox:SetClassName(CLASS_NAME)
NexusPluginFramework:SetContextResource(NexusCheckBox)



--[[
Creates a Nexus Check Box object.
--]]
function NexusCheckBox:__new()
	self:InitializeSuper("Frame")
	self.Name = CLASS_NAME
	self.BorderSizePixel = 1
	
	--Create the frames.
	local Checkmark = NexusWrappedInstance.GetInstance("ImageLabel")
	Checkmark.Hidden = true
	Checkmark.Size = UDim2.new(1 * 0.9,0,1.4 * 0.9,0)
	Checkmark.Position = UDim2.new(0,0,-0.1,0)
	Checkmark.BackgroundTransparency = 1
	Checkmark.Image = "rbxasset://textures/ui/LuaChat/icons/ic-check.png"
	Checkmark.Visible = false
	Checkmark.Parent = self
	
	local MixedFill = NexusWrappedInstance.GetInstance("Frame")
	MixedFill.Hidden = true
	MixedFill.Size = UDim2.new(0.9,0,0.9,0)
	MixedFill.AnchorPoint = Vector2.new(0.5,0.5)
	MixedFill.Position = UDim2.new(0.5,0,0.5,0)
	MixedFill.BorderSizePixel = 0
	MixedFill.Visible = false
	MixedFill.Parent = self:GetWrappedInstance()
	
	--Set up the non-frame colors.
	self:__SetChangedOverride("CheckColor3",function()
		Checkmark.ImageColor3 = self.CheckColor3
	end)
	
	self:__SetChangedOverride("MixedColor3",function()
		MixedFill.BackgroundColor3 = self.MixedColor3
	end)
	
	--Set up the state changes.
	self:__SetChangedOverride("BoxState",function()
		Checkmark.Visible = NexusEnums.CheckBoxState.Checked:Equals(self.BoxState)
		MixedFill.Visible = NexusEnums.CheckBoxState.Mixed:Equals(self.BoxState)
		self.Selected = NexusEnums.CheckBoxState.Checked:Equals(self.BoxState)
	end)
	
	--Set up user input.
	self.InputBegan:Connect(function(Input)
		--Return if the frame isn't enabled.
		if not self:IsEnabled() then
			return
		end
		
		--If the mouse button was pressed, toggle the button.
		if Input.UserInputType == Enum.UserInputType.MouseButton1 then
			self:Toggle()
		end
	end)
	
	--Initialize the initial state.
	self.BoxState = NexusEnums.CheckBoxState.Unchecked
	
	--Initialize the colors.
	self.BackgroundColor3 = "CheckedFieldBackground"
	self.BorderColor3 = "CheckedFieldBorder"
	self.CheckColor3 = "CheckedFieldIndicator"
	self.MixedColor3 = "CheckedFieldIndicator"
end

--[[
Toggles the checkbox.
--]]
function NexusCheckBox:Toggle()
	if NexusEnums.CheckBoxState.Unchecked:Equals(self.BoxState) then
		self.BoxState = NexusEnums.CheckBoxState.Checked
	else
		self.BoxState = NexusEnums.CheckBoxState.Unchecked
	end
end



return NexusCheckBox