<Ui>


	<Button name="TellMeWhen_Event" motionScriptsWhileDisabled="true" inherits="TellMeWhen_BorderedFrame" virtual="true" >
		<Size y="31"/>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentEventName" parentKey="EventName" inherits="GameFontNormalSmall" justifyH="LEFT">
					<Anchors>
						<Anchor point="TOPLEFT" x="15" y="-4"/>
						<Anchor point="RIGHT" x="-15"/>
					</Anchors>
				</FontString>
				<FontString name="$parentDataText" parentKey="DataText" inherits="GameFontHighlightSmall" justifyH="LEFT" justifyV="TOP" wordwrap="false">
					<Anchors>
						<Anchor point="BOTTOMLEFT" x="15" y="4"/>
						<Anchor point="RIGHT" x="-15"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Frames>
			<Button name="$parentDelete" parentKey="Delete">
				<Size x="20" y="20"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeto="$parent" x="-2" y="2"/>
				</Anchors>
				<Scripts>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn")

						local Events = TMW.CI.ics.Events
						tremove(Events, self:GetParent():GetID())
						Events.n = Events.n - 1
						
						TMW.IE:ScheduleIconSetup()

						TMW.EVENTS:LoadConfig()
					</OnClick>
				</Scripts>

				<NormalTexture urgency="5" file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/>
				<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
				<HighlightTexture urgency="5" file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
			</Button>

			<Button name="$parentPlay" parentKey="Play">
				<Size x="15" y="15"/>
				<Anchors>
					<!--Anchor point="TOPRIGHT" x="-2" y="-3"/-->
					<Anchor point="RIGHT" x="-2" y="0"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						self:SetScale(0.8)
						TMW:TT(self, "EVENTS_HANDLERS_PLAY", "EVENTS_HANDLERS_PLAY_DESC")
					</OnLoad>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn")

						local ID = self:GetParent():GetID()
						local Module = TMW.EVENTS:GetEventHandlerForEventSettings(ID)
						if Module then
							if not Module:TestEvent(ID) then
								TMW:Print("Event test failed, unknown reason.")
							end
						end
					</OnClick>
					<OnDisable>
						self:GetNormalTexture():SetDesaturated(1)
					</OnDisable>
					<OnEnable>
						self:GetNormalTexture():SetDesaturated(nil)
					</OnEnable>
					<OnEnter>
						self:GetParent():LockHighlight()
					</OnEnter>
					<OnLeave>
						if not self:GetParent().selected then
							self:GetParent():UnlockHighlight()
						end
					</OnLeave>
				</Scripts>
				<NormalTexture urgency="5" file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up" alphaMode="ADD">
					<TexCoords left="0.3125" right="0.625" top="0.3" bottom="0.71857"/>
				</NormalTexture>
				<HighlightTexture urgency="5" file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up" alphaMode="ADD">
					<TexCoords left="0.3125" right="0.625" top="0.3" bottom="0.71857"/>
				</HighlightTexture>
			</Button>
		
			<Frame name="$parentDD" parentKey="DD" inherits="TMW_DropDownMenuTemplate" hidden="true">
				<Scripts>
					<OnLoad>
						TMW:CInit(self, {
							func = TMW.EVENTS.ChangeEvent_Dropdown,
						})
					</OnLoad>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
				self:RegisterForDrag("LeftButton", "RightButton")
			</OnLoad>
			<OnDragStart>
				local parent = self:GetParent()
				
				parent.draggingFrame = self
				parent.ScrollFrame.AllowEdgeScrolling = true
			</OnDragStart>
			<OnDragStop>
				local parent = self:GetParent()
				
				parent.draggingFrame = nil
				parent.ScrollFrame.AllowEdgeScrolling = false
			</OnDragStop>
			<OnUpdate>
				local parent = self:GetParent()
				
				if self:IsMouseOver() and parent.draggingFrame and self ~= parent.draggingFrame then
					local selfSettings = TMW.CI.ics.Events[self:GetID()]
					local dragSettings = TMW.CI.ics.Events[parent.draggingFrame:GetID()]

					TMW.CI.ics.Events[self:GetID()] = dragSettings
					TMW.CI.ics.Events[parent.draggingFrame:GetID()] = selfSettings
					parent.draggingFrame = self
					TMW.EVENTS:LoadConfig()
				end
			</OnUpdate>
			
			<OnMouseUp>
				-- This is handled in OnMouseUp so that it will still fire when the button is disabled.

				local EventHandler = TMW.EVENTS:GetEventHandlerForEventSettings(self:GetID())
				if button == "RightButton" then
					PlaySound("igMainMenuOptionCheckBoxOn")
					ToggleDropDownMenu(1, nil, self.DD, self, 0, 0)
				end
			</OnMouseUp>
			<OnClick>
				if button ~= "RightButton" then
					PlaySound("igMainMenuOptionCheckBoxOn")

					TMW.IE:SaveSettings()
					
					TMW.EVENTS:LoadEventID(self:GetID())
				end
			</OnClick>
			<OnDisable>
				self.EventName:SetFontObject(GameFontDisableSmall)
				self.DataText:SetFontObject(GameFontDisableSmall)
				if self.Play then
					self.Play:Disable()
				end
			</OnDisable>
			<OnEnable>
				self.EventName:SetFontObject(GameFontNormalSmall)
				self.DataText:SetFontObject(GameFontHighlightSmall)
				if self.Play then
					self.Play:Enable()
				end
			</OnEnable>
		</Scripts>
		<NormalFont style="GameFontNormal"/>
		<HighlightFont style="GameFontHighlight"/>
		<HighlightTexture alphaMode="ADD" alpha="0.1">
			<Color r="1" g="1" b="1"/>
			<Anchors>
				<Anchor point="TOPLEFT" x="0.5" y="-0.5"/>
				<Anchor point="BOTTOMRIGHT" x="-0.5" y="0.5"/>
			</Anchors>
		</HighlightTexture>
	</Button>


	<Button name="TellMeWhen_HandlerPicker" motionScriptsWhileDisabled="true" inherits="TellMeWhen_BorderedFrame" virtual="true" >
		<Size y="70"/>
		<Anchors>
			<Anchor point="LEFT" x="2" y="0"/>
			<Anchor point="RIGHT" x="-2" y="0"/>
		</Anchors>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentTitle" parentKey="Title" inherits="GameFontNormalLarge" justifyH="CENTER">
					<Anchors>
						<Anchor point="TOPLEFT" x="7" y="-5"/>
						<Anchor point="RIGHT" x="-7"/>
					</Anchors>
				</FontString>
				<FontString name="$parentDesc" parentKey="Desc" wordwrap="true" inherits="GameFontHighlightSmall" justifyH="CENTER" justifyV="CENTER" >
					<Size x="1" y="1"/>
					<Anchors>
						<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT" x="0" y="-0"/>
						<Anchor point="BOTTOMRIGHT" x="-7" y="3"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<HighlightTexture alphaMode="ADD" alpha="0.1">
			<Color r="1" g="1" b="1"/>
			<Anchors>
				<Anchor point="TOPLEFT" x="0.5" y="-0.5"/>
				<Anchor point="BOTTOMRIGHT" x="-0.5" y="0.5"/>
			</Anchors>
		</HighlightTexture>

		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
			</OnLoad>
			<OnClick>
				PlaySound("igMainMenuOptionCheckBoxOn")

				TMW.EVENTS.pickedHandler = self.handlerIdentifier
				TMW.EVENTS:ShowEventPickerButtons()
			</OnClick>
		</Scripts>
	</Button>

	<Button name="TellMeWhen_EventPicker" motionScriptsWhileDisabled="true" inherits="TellMeWhen_BorderedFrame" virtual="true" >
		<Size y="20"/>
		<Anchors>
			<Anchor point="LEFT" x="2" y="0"/>
			<Anchor point="RIGHT" x="-2" y="0"/>
		</Anchors>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentTitle" parentKey="Title" inherits="GameFontHighlight" justifyH="LEFT">
					<Anchors>
						<Anchor point="TOPLEFT" x="7" y="-5"/>
						<Anchor point="RIGHT" x="-7"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		
		<HighlightTexture alphaMode="ADD" alpha="0.1">
			<Color r="1" g="1" b="1"/>
			<Anchors>
				<Anchor point="TOPLEFT" x="0.5" y="-0.5"/>
				<Anchor point="BOTTOMRIGHT" x="-0.5" y="0.5"/>
			</Anchors>
		</HighlightTexture>

		<Scripts>
			<OnLoad>
				self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
			</OnLoad>
			<OnClick>
				PlaySound("igMainMenuOptionCheckBoxOn")

				TMW.EVENTS:PickEvent(self.event)
			</OnClick>
		</Scripts>
	</Button>

	<Button name="TellMeWhen_EventHandler_SubHandlerListButton" inherits="TellMeWhen_BorderedFrame" virtual="true" >
		<Size y="14"/>
		<Layers>
			<Layer level="OVERLAY">
				<FontString name="$parentName" parentKey="Name" inherits="GameFontHighlightSmall" justifyH="LEFT">
					<Anchors>
						<Anchor point="LEFT" x="3"/>
						<Anchor point="RIGHT" x="-1"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Scripts>
			<OnClick>
				PlaySound("igMainMenuOptionCheckBoxOn")

				self.EventHandler:SetSubHandler(self.subHandlerIdentifier)
			</OnClick>
		</Scripts>
		<HighlightTexture file="Interface\QuestFrame\UI-QuestLogTitleHighlight" alphaMode="ADD">
			<Anchors>
				<Anchor point="TOPLEFT" y="-1"/>
				<Anchor point="BOTTOMRIGHT" y="1"/>
			</Anchors>
		</HighlightTexture>
	</Button>

	
	<CheckButton name="TellMeWhen_EventSettings_CheckTemplate" inherits="TellMeWhen_CheckTemplate" virtual="true">
		<Size x="26" y="26"/>

		<Attributes>
			<Attribute name="tmw-class" type="string" value="Config_CheckButton_Event"/>
		</Attributes>
	</CheckButton>

	<CheckButton name="TellMeWhen_EventHandler_ColumnConfig_CheckTemplate" inherits="TellMeWhen_CheckTemplate" virtual="true">
		<Anchors>
			<Anchor point="LEFT" x="10" />
		</Anchors>
		<Scripts>
			<OnClick>
				PlaySound("igMainMenuOptionCheckBoxOn")

				if TMW.CI.ics then
					TMW.EVENTS:GetEventSettings()[self.setting] = not not self:GetChecked()
					TMW.IE:ScheduleIconSetup()
				end
				TMW.EVENTS:LoadEventSettings()
			</OnClick>
		</Scripts>
	</CheckButton>

	<Slider name="TellMeWhen_EventHandler_ColumnConfig_SliderTemplate" inherits="TellMeWhen_SliderTemplate" virtual="true">

		<Attributes>
			<Attribute name="tmw-class" type="string" value="Config_Slider_Event"/>
		</Attributes>

		<Size y="17"/>
		<Anchors>
			<Anchor point="LEFT" x="10" />
			<Anchor point="RIGHT" x="-20"/>
		</Anchors>
		<Scripts>
			<OnLoad>
				TMW:CInit(self, {})

				self:SetMode(self.MODE_ADJUSTING)
				self:SetRange(10)
			</OnLoad>
		</Scripts>
	</Slider>

	<Frame name="TellMeWhen_EventContainer" parent="TellMeWhen_IconEditorEvents" hidden="true" virtual="true">
		<Anchors>
			<Anchor point="TOPLEFT" relativeTo="$parentAddEvent" relativePoint="TOPRIGHT" x="16" y="0"/>
			<Anchor point="RIGHT"/>
			<Anchor point="BOTTOM"/>
		</Anchors>
		<Scripts>
			<OnLoad>
				local EventHandler
				for k, v in pairs(self:GetParent()) do
					if self == v then
						EventHandler = TMW.EVENTS:GetEventHandler(k)
						break
					end
				end
				
				if not EventHandler then
					error(("TellMeWhen: Couldn't match an EventHandler instance to the TellMeWhen_EventContainer %q"):format(self:GetName()))
				end

				EventHandler.ConfigContainer = self
				self:RegisterForDrag("LeftButton")
				self:Hide()

				--[[for k, v in pairs(self) do
					if k ~= 0 then
						EventHandler[k] = v
					end
				end]]
			</OnLoad>
		</Scripts>
	</Frame>

	
	<Frame name="$parentEvents" parent="TellMeWhen_IconEditor" setAllPoints="true" parentKey="Events">
		<Anchors>
			<Anchor point="TOPLEFT" y="-26"/>
			<Anchor point="BOTTOMRIGHT" y="26"/>
		</Anchors>
		
		<Frames>					
			<Frame name="$parentEventHandlerFrames" parentKey="EventHandlerFrames">
				<Size x="210" y="10"/>
				<Anchors>
					<Anchor point="TOPLEFT" x="12" y="-50"/>
					<Anchor point="BOTTOM" relativePoint="LEFT" y="0"/>
				</Anchors>
				<Scripts>
					<OnLoad>
						self.originalParent = self:GetParent()
						
						TMW:ConvertContainerToScrollFrame(self, true, nil, 8)
						self.ScrollFrame.scrollStep = 20
						
						self.ScrollFrame.edgeScrollScrollDistancePerSecond = 100
						
						self.ScrollFrame:HookScript("OnScrollRangeChanged", function(self)
							TMW.EVENTS:AdjustScrollFrame()
						end)
					</OnLoad>
					<OnUpdate>
						local numChildren = #self
						local lastShownChild
						for i = 1, numChildren do
							if self[i]:IsShown() then
								lastShownChild = self[i]
							else
								break
							end
						end
						
						if lastShownChild then
							if lastShownChild:GetBottom() > self.ScrollFrame:GetBottom() + 5 then
								self.originalParent.EventSettingsContainer.ScrollFrame:SetPoint("TOP", lastShownChild, "BOTTOM", 0, -36)
							else
								self.originalParent.EventSettingsContainer.ScrollFrame:SetPoint("TOP", self.ScrollFrame, "BOTTOM", 0, -36)
							end		
						else
							self.originalParent.EventSettingsContainer.ScrollFrame:SetPoint("TOP", self.ScrollFrame, "TOP", 0, -36)						
						end
					</OnUpdate>
				</Scripts>
			</Frame>

			<Button name="$parentAddEvent" inherits="TellMeWhen_BorderedFrame" parentKey="AddEvent">
				<Size y="30"/>
				<Anchors>
					<Anchor point="BOTTOMLEFT" relativeTo="$parentEventHandlerFramesScrollFrame" relativePoint="TOPLEFT" y="2"/>
					<Anchor point="BOTTOMRIGHT" relativeTo="$parentEventHandlerFramesScrollFrame" relativePoint="TOPRIGHT" y="2"/>
				</Anchors>
				<Layers>
					<Layer level="OVERLAY">
						<Texture name="$parentPlus" file="Interface\PaperDollInfoFrame\Character-Plus">
							<Size x="20" y="20"/>
							<Anchors>
								<Anchor point="LEFT" x="5"/>
							</Anchors>
						</Texture>
						<FontString name="$parentEventName" parentKey="EventName" inherits="GameFontNormalSmall" justifyH="LEFT">
							<Anchors>
								<Anchor point="LEFT" relativeTo="$parentPlus" relativePoint="RIGHT" x="5"/>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>

				<Scripts>
					<OnLoad>
						self.EventName:SetText(TMW.L["EVENTS_HANDLERS_ADD"])
						TMW:TT(self, "EVENTS_HANDLERS_ADD", "EVENTS_HANDLERS_ADD_DESC", nil, nil, "ShouldShowTooltip")

						function self:ShouldShowTooltip()
							return not self:GetParent().HandlerPickers:IsShown()
						end

						-- Fix text wrapping:
						self.EventName:SetPoint("RIGHT", self, "RIGHT")
						-- Have to do this or else the text won't multiline/wordwrap when it should.
						-- 30 is just an arbitrarily large number.
						self.EventName:SetHeight(30)
						self.EventName:SetMaxLines(3)


					</OnLoad>
					<OnClick>
						PlaySound("igMainMenuOptionCheckBoxOn")

						TMW.EVENTS:ShowHandlerPickerButtons()
						TMW:TT_Update(self)
					</OnClick>
				</Scripts>
				<HighlightTexture alphaMode="ADD" alpha="0.1">
					<Color r="1" g="1" b="1"/>
					<Anchors>
						<Anchor point="TOPLEFT" x="0.5" y="-0.5"/>
						<Anchor point="BOTTOMRIGHT" x="-0.5" y="0.5"/>
					</Anchors>
				</HighlightTexture>
			</Button>

			<!-- <Frame name="$parentHelpText" inherits="TellMeWhen_BorderedFrame" hidden="true" parentKey="HelpText">
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentAddEvent" relativePoint="BOTTOMLEFT" y="-15"/>
					<Anchor point="TOPRIGHT" relativeTo="$parentAddEvent" relativePoint="BOTTOMRIGHT" y="-15"/>
				</Anchors>
				<Size y="50"/>
				<Layers>
					<Layer level="ARTWORK">
						<FontString name="$parentText" parentKey="text" wordwrap="true" inherits="GameFontHighlightSmall">
							<Anchors>
								<Anchor point="TOP" y="-10"/>
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
				<Scripts>
					<OnLoad>
						self.text:SetText(TMW.L["EVENTS_INSTRUCTIONS"])
						
						self.text:SetWidth(self:GetWidth() - 15)
						self:SetHeight(self.text:GetStringHeight() + 22)
					</OnLoad>
					<OnSizeChanged>
						self:SetHeight(self.text:GetStringHeight() + 22)
					</OnSizeChanged>
				</Scripts>
			</Frame> -->

			<Frame name="$parentHandlerPickers" hidden="true" parentKey="HandlerPickers">
				<Size y="50"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentAddEvent" relativePoint="TOPRIGHT" x="15" y="0"/>
					<Anchor point="RIGHT" x="-15"/>
					<Anchor point="BOTTOM" y="0"/>
				</Anchors>

				<Layers>
					<Layer level="OVERLAY">
						<FontString inherits="GameFontNormalLarge" parentKey="Header" justifyH="CENTER" hidden="true" text=""/>
					</Layer>
				</Layers>

				<Scripts>
					<OnLoad>
						self.originalParent = self:GetParent()
						
						TMW:ConvertContainerToScrollFrame(self, true, nil, 8)
						self.ScrollFrame.scrollStep = 20

						self.Header:SetParent(self.ScrollFrame)
						self.Header:SetText(TMW.L["EVENTS_CHOOSE_HANDLER"])
						self.Header:SetPoint("BOTTOM", self.ScrollFrame, "TOP", 0, 1)

					</OnLoad>
					<OnShow>
						self.Header:Show()
					</OnShow>
					<OnHide>
						self.Header:Hide()
					</OnHide>
				</Scripts>
			</Frame>

			<Frame name="$parentEventPickers" hidden="true" parentKey="EventPickers">
				<Size y="50"/>
				<Anchors>
					<Anchor point="TOPLEFT" relativeTo="$parentAddEvent" relativePoint="TOPRIGHT" x="15" y="0"/>
					<Anchor point="RIGHT" x="-15"/>
					<Anchor point="BOTTOM" y="0"/>
				</Anchors>

				<Layers>
					<Layer level="OVERLAY">
						<FontString inherits="GameFontNormalLarge" parentKey="Header" justifyH="CENTER" hidden="true" text=""/>
					</Layer>
				</Layers>

				<Scripts>
					<OnLoad>
						self.originalParent = self:GetParent()
						
						TMW:ConvertContainerToScrollFrame(self, true, nil, 8)
						self.ScrollFrame.scrollStep = 20

						self.Header:SetParent(self.ScrollFrame)
						self.Header:SetText(TMW.L["EVENTS_CHOOSE_EVENT"])
						self.Header:SetPoint("BOTTOM", self.ScrollFrame, "TOP", 0, 1)

					</OnLoad>
					<OnShow>
						self.Header:Show()
					</OnShow>
					<OnHide>
						self.Header:Hide()
					</OnHide>
				</Scripts>
			</Frame>

			<Frame name="$parentEventSettingsContainer" parentKey="EventSettingsContainer">
				<Size x="210" y="10"/>
				<Anchors>
					<Anchor point="TOP" relativeTo="$parentEventHandlerFramesScrollFrame" relativePoint="BOTTOM" y="-36"/>
					<Anchor point="LEFT" relativeTo="$parentEventHandlerFramesScrollFrame" />
					<Anchor point="RIGHT" relativeTo="$parentEventHandlerFramesScrollFrame" />
					<Anchor point="BOTTOM" y="0"/>
				</Anchors>
				<Frames>
					<CheckButton name="$parentPassThrough" inherits="TellMeWhen_EventSettings_CheckTemplate" parentKey="PassThrough" motionScriptsWhileDisabled="true">
						<Anchors>
							<Anchor point="TOPLEFT" y="-3"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "PassThrough",
									title = TMW.L["EVENTS_SETTINGS_PASSTHROUGH"],
									tooltip = TMW.L["EVENTS_SETTINGS_PASSTHROUGH_DESC"],
								})

								self:ConstrainLabel(self:GetParent(), "RIGHT")
							</OnLoad>
						</Scripts>
					</CheckButton>

					<CheckButton name="$parentSimplyShown" inherits="TellMeWhen_EventSettings_CheckTemplate" parentKey="SimplyShown" motionScriptsWhileDisabled="true">
						<Anchors>
							<Anchor point="TOPLEFT" y="-3"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "OnlyShown",
									title = TMW.L["EVENTS_SETTINGS_SIMPLYSHOWN"],
									tooltip = TMW.L["EVENTS_SETTINGS_SIMPLYSHOWN_DESC"],
								})
								
								self:ConstrainLabel(self:GetParent(), "RIGHT")
							</OnLoad>
						</Scripts>
					</CheckButton>

					<CheckButton name="$parentOnlyShown" inherits="TellMeWhen_EventSettings_CheckTemplate" parentKey="OnlyShown" motionScriptsWhileDisabled="true">
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentPassThrough" relativePoint="BOTTOM" y="4"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "OnlyShown",
									title = TMW.L["EVENTS_SETTINGS_ONLYSHOWN"],
									tooltip = TMW.L["EVENTS_SETTINGS_ONLYSHOWN_DESC"],
								})
								
								self:ConstrainLabel(self:GetParent(), "RIGHT")
							</OnLoad>
						</Scripts>
					</CheckButton>

					<CheckButton name="$parentPassingCndt" inherits="TellMeWhen_EventSettings_CheckTemplate" parentKey="PassingCndt" motionScriptsWhileDisabled="true">
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentOnlyShown" relativePoint="BOTTOM" y="4"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "PassingCndt",
									title = TMW.L["EVENTS_SETTINGS_PASSINGCNDT"],
									tooltip = TMW.L["EVENTS_SETTINGS_PASSINGCNDT_DESC"],
								})
								
								self:ConstrainLabel(self:GetParent(), "RIGHT")
							</OnLoad>
						</Scripts>
					</CheckButton>

					<Frame name="$parentOperator" parentKey="Operator" inherits="TMW_DropDownMenuTemplate">
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentPassingCndt" relativePoint="BOTTOM" x="105" y="3"/>
						</Anchors>
						<Layers>
							<Layer level="OVERLAY">
								<FontString name="$parentValueLabel" inherits="GameFontHighlight" parentKey="ValueLabel" justifyH="RIGHT">
									<Anchors>
										<Anchor point="RIGHT" relativePoint="LEFT" x="-5" y="3"/>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									--title = TMW.L[""],
									--tooltip = TMW.L[""],
									func = TMW.EVENTS.OperatorMenu_DropDown,
								})

								self:SetWidth(63)
								self.Text:SetFontObject(GameFontHighlightLarge)
							</OnLoad>
						</Scripts>
					</Frame>

					<EditBox name="$parentValue" inherits="TellMeWhen_TimeEditBoxTemplate" parentKey="Value" autoFocus="false">
						<Size x="45" y="18"/>
						<Anchors>
							<Anchor point="LEFT" relativeTo="$parentOperator" relativePoint="RIGHT" x="12" y="4"/>
						</Anchors>
						<Layers>
							<Layer level="OVERLAY">
								<FontString name="$parentValueLabel" inherits="GameFontHighlightLarge" parentKey="ValueLabel" justifyH="RIGHT">
									<Anchors>
										<Anchor point="RIGHT" relativePoint="RIGHT" x="-3" y="0"/>
									</Anchors>
								</FontString>
							</Layer>
						</Layers>
						<Scripts>
							<OnLoad>
								TMW:RegisterCallback("TMW_CONFIG_SAVE_SETTINGS", self, "ClearFocus")
							</OnLoad>
							<OnEditFocusLost>
								EditBox_ClearHighlight(self)

								local t = TMW:CleanString(self)
								if strfind(t, ":") then
									t = TMW.toSeconds(t)
								end
								t = tonumber(t) or 0
								self:SetText(t)

								if TMW.CI.ics then
									TMW.EVENTS:GetEventSettings().Value = t
									TMW.IE:ScheduleIconSetup()
								end

								self:GetScript("OnTextChanged")(self)
							</OnEditFocusLost>
							<OnEnable>
								self:SetAlpha(1)
							</OnEnable>
							<OnDisable>
								self:SetAlpha(.4)
							</OnDisable>
						</Scripts>
					</EditBox>

					<CheckButton name="$parentCndtJustPassed" inherits="TellMeWhen_EventSettings_CheckTemplate" parentKey="CndtJustPassed" motionScriptsWhileDisabled="true">
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentPassingCndt" relativePoint="BOTTOM" y="-15" x="8"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "CndtJustPassed",
									title = TMW.L["EVENTS_SETTINGS_CNDTJUSTPASSED"],
									tooltip = TMW.L["EVENTS_SETTINGS_CNDTJUSTPASSED_DESC"],
								})
								
								self:ConstrainLabel(self:GetParent(), "RIGHT")
							</OnLoad>
						</Scripts>
					</CheckButton>


					<Button name="$parentIconEventWhileCondition" parentKey="IconEventWhileCondition" inherits="TellMeWhen_ButtonTemplate">
						<Size x="175" y="16"/>
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentSimplyShown" relativePoint="BOTTOM" y="-7"/>
							<Anchor point="LEFT" />
							<Anchor point="RIGHT" />
						</Anchors>
						<Scripts>
							<OnLoad>
								self:SetFrameLevel(self:GetParent():GetFrameLevel()+2)
								self.Background:SetAlpha(0.7)
								self:SetScale(0.9)
								
								TMW:TT(self, "EVENT_WHILECONDITIONS", "EVENT_WHILECONDITIONS_DESC")
								
							</OnLoad>
							<OnUpdate>
								local text = TMW.CNDT:GetTabText("IconEventWhileCondition")
								
								self:SetText(text)
								self:SetWidth(self:GetTextWidth()+10)
							</OnUpdate>
							<OnClick>
								TMW.CNDT:LoadConfig("IconEventWhileCondition")
							</OnClick>
						</Scripts>
					</Button>


					<Slider name="$parentFrequency" parentKey="Frequency" inherits="TellMeWhen_SliderTemplate" valuestep="0.1" >

						<Attributes>
							<Attribute name="tmw-class" type="string" value="Config_Slider_Event"/>
						</Attributes>

						<Size x="170" y="17"/>
						<Anchors>
							<Anchor point="TOP" relativeTo="$parentIconEventWhileCondition" relativePoint="BOTTOM" y="-18"/>
						</Anchors>
						<Scripts>
							<OnLoad>
								TMW:CInit(self, {
									setting = "Frequency",
									title = TMW.L["EVENT_FREQUENCY"],
									tooltip = TMW.L["EVENT_FREQUENCY_DESC"],
								})
								
								self:SetTextFormatter(TMW.C.Formatter.S_SECONDS, TMW.C.Formatter.F_1)
								self:SetMode(self.MODE_ADJUSTING)
								self:SetMinMaxValues(0.1, math.huge)
								self:SetRange(2)

							</OnLoad>
						</Scripts>
					</Slider>

					
				</Frames>
				<Scripts>
					<OnLoad>
						self.originalParent = self:GetParent()
						TMW:ConvertContainerToScrollFrame(self, true, nil, 8)
					</OnLoad>
					<OnHide>
						self.originalParent.EventSettingsContainerHeader:Hide()
						self.originalParent.EventSettingsContainerEventName:Hide()
					</OnHide>
					<OnShow>
						self.originalParent.EventSettingsContainerHeader:Show()
						self.originalParent.EventSettingsContainerEventName:Show()
					</OnShow>
				</Scripts>
			</Frame>
		</Frames>
		
		<Layers>
			<Layer level="OVERLAY">
				<FontString inherits="GameFontNormalLarge" parentKey="EventListHeader" justifyH="LEFT" text="">
					<Anchors>
						<Anchor point="BOTTOM" relativeKey="$parent.AddEvent" relativePoint="TOP" y="1"/>
					</Anchors>
				</FontString>
				<FontString hidden="true" inherits="GameFontNormalLarge" parentKey="EventSettingsContainerHeader" justifyH="CENTER">
					<Anchors>
						<Anchor point="TOP" relativeTo="$parentEventSettingsContainerScrollFrame" y="30"/>
					</Anchors>
				</FontString>
				<FontString inherits="GameFontDisableSmall" hidden="true" parentKey="EventSettingsContainerEventName" justifyH="CENTER">
					<Anchors>
						<Anchor point="TOP" relativeKey="$parent.EventSettingsContainerHeader" relativePoint="BOTTOM" y="-3"/>
					</Anchors>
				</FontString>
			</Layer>
		</Layers>
		<Scripts>
			<OnLoad>
				self.EventListHeader:SetText(TMW.L["EVENTS_HANDLERS_HEADER"])
				self.EventSettingsContainerHeader:SetText(TMW.L["EVENTS_SETTINGS_HEADER"])
				
				self:RegisterForDrag("LeftButton")
				self:Hide()

				TMW.IE.Events = self
				
				TMW.EVENTS.EventHandlerFrames = self.EventHandlerFrames
				TMW.EVENTS.EventSettingsContainer = self.EventSettingsContainer
				
			</OnLoad>
			<OnShow>
				TMW.EVENTS:LoadConfig()
			</OnShow>
		</Scripts>
	</Frame>
		
</Ui>