<Ui>

	<Frame name="TellMeWhen_ConditionIconSettings" inherits="TellMeWhen_OptionsModuleContainer" virtual="true">
		<Size y="95"/>
		<Frames>
			<EditBox name="$parentConditionDur" parentKey="ConditionDur" inherits="TellMeWhen_TimeEditBoxTemplate">
				<Size x="60" y="15"/>
				<Anchors>
					<Anchor point="TOPLEFT" x="33" y="-17"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						self.text:SetText(TMW.L["ICONMENU_ONSUCCEED"])
						
						TMW:CInit(self, {
							setting = "ConditionDur",
							title = TMW.L["ICONMENU_ONSUCCEED"],
							tooltip = TMW.L["CONDITION_TIMERS_SUCCEED_DESC"],
							disabled = function(self)
								return not TMW.CI.ics.ConditionDurEnabled
							end,
							ModifySettingValue = function(self, value)
								return tonumber(value) or 0
							end,
						})
					</OnLoad>
				</Scripts>
			</EditBox>
			<EditBox name="$parentUnConditionDur" parentKey="UnConditionDur" inherits="TellMeWhen_TimeEditBoxTemplate">
				<Size x="60" y="15"/>
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentConditionDur" relativePoint="RIGHT" x="35"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						self.text:SetText(TMW.L["ICONMENU_ONFAIL"])
						
						TMW:CInit(self, {
							setting = "UnConditionDur",
							title = MAXIMUM,
							title = TMW.L["ICONMENU_ONFAIL"],
							tooltip = TMW.L["CONDITION_TIMERS_FAIL_DESC"],
							disabled = function(self)
								return not TMW.CI.ics.UnConditionDurEnabled
							end,
							ModifySettingValue = function(self, value)
								return tonumber(value) or 0
							end,
						})
					</OnLoad>
				</Scripts>

			</EditBox>
			<CheckButton name="$parentConditionDurEnabled" parentKey="ConditionDurEnabled" inherits="TellMeWhen_CheckTemplate">
				<Size x="26" y="26"/>
				<Anchors>
					<Anchor point="RIGHT" relativeto="$parentConditionDur" relativePoint="LEFT" x="-1" y="-0.5"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						local ConditionDur = self:GetParent().ConditionDur
						ConditionDur.text:SetParent(self) -- This is evil and lazy. So, so lazy.
						ConditionDur.text:SetPoint("LEFT", 2, 0)
						ConditionDur.text:SetPoint("RIGHT", ConditionDur)
						
						TMW:CInit(self, {
							setting = "ConditionDurEnabled",
							label = "",
							title = ENABLE,
							tooltip = TMW.L["GENERIC_NUMREQ_CHECK_DESC"]:format(TMW.L["CONDITION_TIMERS_SUCCEED_DESC"]:gsub("^%u", strlower)),
						})
					</OnLoad>
				</Scripts>
			</CheckButton>
			<CheckButton name="$parentUnConditionDurEnabled" parentKey="UnConditionDurEnabled" inherits="TellMeWhen_CheckTemplate">
				<Size x="26" y="26"/>
				<Anchors>
					<Anchor point="RIGHT" relativeto="$parentUnConditionDur" relativePoint="LEFT" x="-1" y="-0.5"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						local UnConditionDur = self:GetParent().UnConditionDur
						UnConditionDur.text:SetParent(self) -- This is evil and lazy. So, so lazy.
						UnConditionDur.text:SetPoint("LEFT", 2, 0)
						UnConditionDur.text:SetPoint("RIGHT", UnConditionDur)
						
						TMW:CInit(self, {
							setting = "UnConditionDurEnabled",
							label = "",
							title = ENABLE,
							tooltip = TMW.L["GENERIC_NUMREQ_CHECK_DESC"]:format(TMW.L["CONDITION_TIMERS_FAIL_DESC"]:gsub("^%u", strlower)),
						})
					</OnLoad>
				</Scripts>
			</CheckButton>
			
			<CheckButton name="$parentOnlyIfCounting" inherits="TellMeWhen_CheckTemplate" parentKey="OnlyIfCounting">
				<Size x="28" y="28"/>
				<Anchors>
					<Anchor point="LEFT" x="5" />
					<Anchor point="TOP" relativeTo="$parentConditionDurEnabled" relativePoint="BOTTOM" y="-1"/>
				</Anchors>
				<Scripts>
					<OnLoad>						
						TMW:CInit(self, {
							setting = "OnlyIfCounting",
							title = TMW.L["ICONMENU_ONLYIFCOUNTING"],
							tooltip = TMW.L["ICONMENU_ONLYIFCOUNTING_DESC"],
							
							OnState = function(self)
								if TMW.CI.ics.OnlyIfCounting then
									TMW.CI.ics.OnlyIfNotCounting = false
								end
							end,
						})
						
						self:ConstrainLabel(self:GetParent(), "RIGHT")
					</OnLoad>
				</Scripts>
			</CheckButton>
			
			<CheckButton name="$parentOnlyIfNotCounting" inherits="TellMeWhen_CheckTemplate" parentKey="OnlyIfNotCounting">
				<Size x="28" y="28"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentOnlyIfCounting" relativePoint="BOTTOMLEFT" x="0" y="2"/>
				</Anchors>
				<Scripts>
					<OnLoad>						
						TMW:CInit(self, {
							setting = "OnlyIfNotCounting",
							title = TMW.L["ICONMENU_ONLYIFNOTCOUNTING"],
							tooltip = TMW.L["ICONMENU_ONLYIFNOTCOUNTING_DESC"],
							
							OnState = function(self)
								if TMW.CI.ics.OnlyIfNotCounting then
									TMW.CI.ics.OnlyIfCounting = false
								end
							end,
						})
						
						self:ConstrainLabel(self:GetParent(), "RIGHT")
					</OnLoad>
				</Scripts>
			</CheckButton>

		</Frames>
		<Scripts>
			<OnLoad>
				self.Header:SetText(TMW.L["CONFIGPANEL_CNDTTIMERS_HEADER"])
			</OnLoad>
		</Scripts>
	</Frame>
	
</Ui>