/branches/preview/Aloft/AloftFu
return |
end |
if not LibStub:GetLibrary("LibFuBarPlugin-3.0", true) then DEFAULT_CHAT_FRAME:AddMessage("Aloft: no LibFuBarPlugin-3.0") return end |
-- if not LibStub:GetLibrary("AceGUI-3.0", true) then return end |
if not LibStub:GetLibrary("AceConfigDialog-3.0", true) then return end |
if not LibStub:GetLibrary("AceDB-3.0", true) then return end |
local AloftFu = Aloft:NewModule("Fu", Aloft, "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0", "LibFuBarPlugin-3.0") |
AloftFu.dynamic = "AloftFu" |
-- local AceGUI = LibStub("AceGUI-3.0") |
local AceDialog = LibStub("AceConfigDialog-3.0") |
local AceDB = LibStub("AceDB-3.0") |
-- local dewdrop = AceLibrary:HasInstance("Dewdrop-2.0") and AceLibrary("Dewdrop-2.0") |
-- local F = AceGUI:Create("Frame") |
local N = L["Aloft"] .. "-" .. Aloft.version |
----------------------------------------------------------------------------- |
-- separate options database |
self:SetFuBarOption("iconPath", "Interface\\Icons\\Spell_Frost_Wisp") |
self:SetFuBarOption("tooltipType", "GameTooltip") |
self:SetFuBarOption("configType", "AceConfigDialog-3.0") |
self:SetFuBarOption("aceConfig30", N) |
self:SetFuBarOption("configType", "None") -- configType needs to be "None", in order to get RightButtonUp semantices to work correctly with AceConfigDialog-3.0 |
self:SetFuBarOption("cannotDetachTooltip", true) |
self:SetFuBarOption("hideWithoutStandby", true) |
self:SetFuBarOption("hasNoColor", true) |
-- these are not necessary, should be "None" |
-- self:SetFuBarOption("configType", "AceConfigDialog-3.0") |
-- self:SetFuBarOption("aceConfig30", N) |
if self.db ~= Aloft.AloftDB:GetNamespace(self.namespace, true) then self.db = Aloft.AloftDB:RegisterNamespace(self.namespace, self.defaults) end |
-- if not self.db then self.db = AceDB:New("AloftFuDB", nil, "Default") end |
----------------------------------------------------------------------------- |
-- TODO: this is not really generic... AceConfigDialog does not provide a way to determine if an application's dialog is open |
-- TODO: this is kludgy... but AceConfigDialog does not provide a way to determine if an application's dialog is open; IceHUD does it exactly the same way (basically) |
local function isDialogOpen(appName) |
return AceDialog.OpenFrames[appName] |
end |
end |
function AloftFu:OnFuBarClick(button) |
-- ChatFrame7:AddMessage("AloftFu:OnFuBarClick(): " .. tostring(button)) |
if button == "LeftButton" and not IsControlKeyDown() and not IsAltKeyDown() then |
if not IsShiftKeyDown() then |
AceDialog:Close(N) |
end |
elseif button == "RightButton" and not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown() then |
GameTooltip:Hide() |
-- ChatFrame7:AddMessage("AloftFu:OnFuBarClick(): " .. tostring(N)) |
if isDialogOpen(N) then |
AceDialog:Close(N) |
else |