-- This file is part of AutoInvite
--
-- (C) 2014 Scott Yeskie (Sasky)
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

AutoInviteUI = AutoInviteUI or {}
local ui = AutoInviteUI
local wm = WINDOW_MANAGER

function AutoInviteUI.create()
--    local pre = "AutoInviteUI"
--    ui.main = wm:CreateControl(nil, ZO_GroupList, CT_CONTROL)
--    ui.main:SetAnchor(TOPRIGHT, ZO_SharedRightBackground, TOPLEFT, -50, 50)
--    ui.main:SetDimensions(280,450)
--
--    ui.bg = wm:CreateControl(pre .. "bg", ui.main, CT_BACKDROP)
--    ui.bg:SetDimensions(280,450)
--    ui.bg:SetAnchor(TOPLEFT, ui.main, TOPLEFT, 0, 0)
--    ui.bg:SetCenterColor( 0, 0, 0, .7 )
--    ui.bg:SetEdgeColor( 1, 1, 1, 0 )
--
--    AutoInviteUI.addControls(ui, pre)
end

function AutoInviteUI.addControls(ui)
--    ui.main:SetDimensions(280,450)
--    ui.scroll = ui.main -- For using LAM controls
--    ui.data = {}
--
--    ui.title = LAMCreateControl.header(ui, {
--        type = "header",
--        name = "AutoInvite Options",
--        width = "half"
--    })
--    ui.title:SetAnchor(TOPLEFT, ui.main, TOPLEFT, 5, 5)
--    ui.title:SetWidth(270)
--    ui.title.divider:ClearAnchors()
--    ui.title.divider:SetAnchor(BOTTOM)
--    ui.title.header:ClearAnchors()
--    ui.title.header:SetAnchor(TOPLEFT)





--    ui.hide = wm:CreateControlFromVirtual(nil, ui.main, "ZO_DefaultButton")
--    ui.hide:SetAnchor(TOPRIGHT, ui.main, TOPRIGHT, 7, 2)
--    ui.hide:SetWidth(40)
--    ui.hide:SetText("X")
--    ui.hide:SetScale(0.8)
--    ui.hide:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
--    ui.hide:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
--    ui.hide:SetHandler("OnClicked", AutoInviteUI.menuHide)
--
--    ui.show = wm:CreateControlFromVirtual(nil, ZO_GroupList, "ZO_DefaultButton")
--    ui.show:SetAnchor(TOPLEFT, ZO_GroupList, TOPLEFT, 120, -40)
--    ui.show:SetWidth(160)
--    ui.show:SetText("AutoInvite Settings")
--    ui.show:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
--    ui.show:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
--    ui.show:SetHandler("OnClicked", AutoInviteUI.menuShow)
end

function AutoInviteUI.menuShow()
--    ui.main:SetHidden(false)
--    ui.show:SetHidden(true)
--    AutoInvite.cfg.showPanel = true
end

function AutoInviteUI.menuHide()
--    ui.main:SetHidden(true)
--    ui.show:SetHidden(false)
--    AutoInvite.cfg.showPanel = false
end

function AutoInviteUI.refresh()
    ui.enabled:UpdateValue()
    ui.cyr:UpdateValue()
    ui.restart:UpdateValue()
    ui.max:UpdateValue()
    ui.text:UpdateValue()
end

function AutoInviteUI.init()
    if ui.created then return end
    ui.created = true
    AutoInviteUI:CreateEnabledFragment()
    AutoInviteUI:CreateOptionFragment()
    AutoInviteUI:CreateScene()
end

SLASH_COMMANDS["/zzg"] = function()
    d(ZO_GroupList:IsHidden())
end