--------------------------------------------------------------------------
-- MobileLootFrame.lua 
--------------------------------------------------------------------------
--[[
Mobile LootFrame

author: AnduinLothar    <karlkfi@yahoo.com>

Addon version based on cosmos FrameXML hack.

]]--


MLF_ShowUIPanel = nil;
MLF_HideUIPanel = nil;

function MLF_StartMoving(button)
	if ( ( not LootFrame.isLocked ) or ( LootFrame.isLocked == 0 ) ) and ( ( not button ) or ( button == "LeftButton" ) ) then
		if ( not LootFrame.isMoving ) then
			LootFrame:StartMoving();
			LootFrame.isMoving = true;
		end
	end
end

function MLF_StopMoving()
	if ( LootFrame.isMoving ) then
		LootFrame:StopMovingOrSizing();
		LootFrame.isMoving = false;
	end
end

function MobileLootFrame_OnLoad()
    if (ShowUIPanel ~= SavedShowUIPanel) then
        SavedShowUIPanel = ShowUIPanel;
        ShowUIPanel = MLF_ShowUIPanel;
    end
    if (HideUIPanel ~= SavedHideUIPanel) then
        SavedHideUIPanel = HideUIPanel;
        HideUIPanel = MLF_HideUIPanel;
    end
    if (LootFrame_PageUp ~= SavedLootFrame_PageUp) then
        SavedLootFrame_PageUp = LootFrame_PageUp;
        LootFrame_PageUp = MLF_LootFrame_PageUp;
    end
    if (LootFrame_PageDown ~= SavedLootFrame_PageDown) then
        SavedLootFrame_PageDown = LootFrame_PageDown;
        LootFrame_PageDown = MLF_LootFrame_PageDown;
    end
end

function MLF_ShowUIPanel(panel)
    SavedShowUIPanel(panel);
    if panel == LootFrame then
        SavedShowUIPanel(MobileLootFrame);
    end
end

function MLF_HideUIPanel(panel)
    SavedHideUIPanel(panel);
    if panel == LootFrame then
        SavedHideUIPanel(MobileLootFrame);
    end
end

function MLF_LootFrame_PageUp()
	SavedLootFrame_PageUp();
	MLF_StopMoving();
end

function MLF_LootFrame_PageDown()
	SavedLootFrame_PageDown();
	MLF_StopMoving();
end

