local _, ns = ...

local hasItem = false

local oneEventUpdateF = CreateFrame("Frame")
local function onUpdateFunc()
    local cursorType,itemID,itemLink = GetCursorInfo()
    if cursorType == "item" then
        --print(itemID,itemLink)
        hasItem = true
        if not ns.isbagWithIconsAndNumbersOpened() then
            ns.setCombatFrameInteriorFullIconList()
        end
    else
        --print("clear cursor")
        if ns.isbagWithIconsAndNumbersOpened() then
            ns.setCombatFrameInteriorIconsAndQuantities()
        end
        hasItem = false
    end
    oneEventUpdateF:SetScript("OnUpdate",nil)
end

function ns.cursorChangeEvent()
    oneEventUpdateF:SetScript("OnUpdate",onUpdateFunc)
end

function ns.cursorHasItem()
    return hasItem
end