/trunk
button:LockHighlight(); |
end |
button.topDropHandler.destLoc = lineplusoffset; |
button.bottomDropHandler.destLoc = lineplusoffset + 1; |
button:Show(); |
else |
button:Hide(); |
PlaySound("INTERFACESOUND_CURSORDROPOBJECT"); |
TortaDragThingy:Hide(); |
if GetMouseFocus().tortaDropType == "CLTASK" then |
UIErrorsFrame:AddMessage("This is a valid drop area!"); |
Torta.cl3:MoveTask(self.dragSrcID, GetMouseFocus().destLoc); |
GetMouseFocus():Hide(); -- If this line isn't here, the drop handler under the mouse will fail to hide |
end |
self:clHideDropHandlers(); |
end |
function Torta.gui:clexShowDropHandlers() |
for _, button in pairs(self.exListButtons) do |
button.topDropHandler:Show(); |
button.bottomDropHandler:Show(); |
UIFrameFadeOut(button.text, 0.3, button.text:GetAlpha(), 0.5); |
end |
end |
function Torta.gui:clexHideDropHandlers() |
for _, button in pairs(self.exListButtons) do |
button.topDropHandler:Hide(); |
button.bottomDropHandler:Hide(); |
UIFrameFadeIn(button.text, 0.3, button.text:GetAlpha(), 1); |
end |
end |
function Torta.gui:clListDragStart(listButton) |
PlaySound("INTERFACESOUND_CURSORGRABOBJECT"); |
local text = listButton.text:GetText(); |
TortaCLListDragThingy.text:SetText(text); |
TortaCLListDragThingy:Show(); |
UIFrameFadeIn(TortaCLListDragThingy, 0.25, 0, 1); |
self:clexShowDropHandlers(); |
self.dragSrcID = listButton:GetID(); |
end |
function Torta.gui:clListDragStop() |
PlaySound("INTERFACESOUND_CURSORDROPOBJECT"); |
TortaCLListDragThingy:Hide(); |
if GetMouseFocus().tortaDropType == "CLLIST" then |
Torta.cl3:MoveList(self.dragSrcID, GetMouseFocus().destLoc); |
GetMouseFocus():Hide(); -- If this line isn't here, the drop handler under the mouse will fail to hide |
end |
self:clexHideDropHandlers(); |
end |
-- Note: |
-- Add all UI management functions ABOVE! |
end |
</OnClick> |
<OnLoad> |
self:RegisterForClicks("LeftButtonDown", "RightButtonDown"); |
self:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
local fs = self:CreateFontString(nil, "ARTWORK", "GameFontHighlight"); |
fs:SetPoint("LEFT", self, "LEFT", 5); |
fs:SetPoint("RIGHT", self, "RIGHT", -5); |
if GameTooltip:IsOwned(self) then |
GameTooltip:Hide(); |
end |
if self.dragFlag then |
Torta.gui:clListDragStart(self); |
self.dragFlag = false; |
end |
</OnLeave> |
<OnMouseDown> |
self.dragFlag = true; |
</OnMouseDown> |
<OnMouseUp> |
if not self.dragFlag then |
Torta.gui:clListDragStop(); |
end |
self.dragFlag = false; |
</OnMouseUp> |
</Scripts> |
<Frames> |
<!-- Drop areas --> |
<Button name="$parentTopDropHandler" hidden="true" alpha="0"> |
<NormalFont style="GameFontNormal"/> |
<Anchors> |
<Anchor point="TOPLEFT"/> |
<Anchor point="BOTTOMRIGHT" relativePoint="RIGHT"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
self.tortaDropType = "CLLIST"; |
self:GetParent().topDropHandler = self; |
</OnLoad> |
<OnEnter> |
UIFrameFadeIn(self, 0.3, self:GetAlpha(), 1); |
</OnEnter> |
<OnLeave> |
UIFrameFadeOut(self, 0.3, self:GetAlpha(), 0); |
</OnLeave> |
</Scripts> |
</Button> |
<Button name="$parentBottomDropHandler" hidden="true" alpha="0"> |
<NormalFont style="GameFontNormal"/> |
<Anchors> |
<Anchor point="TOPLEFT" relativePoint="LEFT"/> |
<Anchor point="BOTTOMRIGHT"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
self.tortaDropType = "CLLIST"; |
self:GetParent().bottomDropHandler = self; |
</OnLoad> |
<OnEnter> |
UIFrameFadeIn(self, 0.3, self:GetAlpha(), 1); |
</OnEnter> |
<OnLeave> |
UIFrameFadeOut(self, 0.3, self:GetAlpha(), 0); |
</OnLeave> |
</Scripts> |
</Button> |
</Frames> |
</Button> |
<FontString name="TortaCLFontStringTemplate" inherits="GameFontHighlight" maxLines="3" virtual="true"/> |
</Button> |
</Frames> |
</Frame> |
<Frame name="TortaCLListDragThingy" inherits="TortaTooltipStyleFrameTemplate" parent="UIParent" |
frameStrata="TOOLTIP" hidden="true"> |
<Size x="200" y="40"/> |
<Anchors> |
<Anchor point="CENTER"/> |
</Anchors> |
<Scripts> |
<OnUpdate> |
xPos, yPos = GetCursorPosition(); |
local scale = UIParent:GetScale(); |
self:ClearAllPoints(); |
self:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (xPos + 1) / scale, (yPos + 1) / scale); |
</OnUpdate> |
<OnLoad> |
self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, |
TOOLTIP_DEFAULT_COLOR.g, |
TOOLTIP_DEFAULT_COLOR.b); |
self:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, |
TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, |
TOOLTIP_DEFAULT_BACKGROUND_COLOR.b); |
local fs = self:CreateFontString(nil, "ARTWORK", "GameFontHighlight"); |
fs:SetPoint("LEFT", self, "LEFT", 5); |
fs:SetPoint("RIGHT", self, "RIGHT", -5); |
fs:SetText("Hello, World!"); |
fs:SetJustifyH("LEFT"); |
fs:SetJustifyV("TOP"); |
self.text = fs; |
</OnLoad> |
</Scripts> |
</Frame> |
</Ui> |
DestID = #list.text; |
end |
tinsert(list.text, DestID, text); |
tinsert(list.stat, DestID, stat); |
if DestID < SrcID then |
SrcID = SrcID + 1; |
end |
tremove(list.text, SrcID); |
tremove(list.stat, SrcID); |
tinsert(list.text, DestID, text); |
tinsert(list.stat, DestID, stat); |
gui:UpdateCLScrollBar(); |
end |
function Checklist3:MoveList(SrcID, DestID) |
local listsTbl = Torta.db.profile.lists; |
local list = listsTbl[SrcID]; |
if DestID > #listsTbl then -- If the button was dragged to be below the last item |
DestID = #listsTbl; |
end |
tinsert(listsTbl, DestID, list); |
if DestID < SrcID then |
SrcID = SrcID + 1; |
end |
tremove(listsTbl, SrcID); |
gui:UpdateExplorerScrollBar(); |
end |