Mercurial > wow > squawk
changeset 20:22178ac75587
Changing to libqtipclick1.1
author | wobin |
---|---|
date | Wed, 22 Jul 2009 22:04:16 +1000 |
parents | 431f2fce08f2 |
children | e066473450c2 |
files | .pkgmeta Libs/LibQTipClick-1.1/LibQTipClick-1.1.lua Libs/LibQTipClick-1.1/LibQTipClick-1.1.toc Libs/LibQTipClick-1.1/lib.xml Squawk.lua embeds.xml |
diffstat | 6 files changed, 170 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/.pkgmeta Tue May 12 00:57:59 2009 +1000 +++ b/.pkgmeta Wed Jul 22 22:04:16 2009 +1000 @@ -19,6 +19,9 @@ Libs/AceEvent-3.0: url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0 tag: latest + Libs/LibQTip-1.0: + url: svn://svn.wowace.com/wow/libqtip-1-0/mainline/trunk + tag: latest Libs/LibQTipClick-1.0: - url: svn://svn.wowace.com/wow/libqtipclick-1-0/mainline/trunk + url: svn://svn.wowace.com/wow/libqtipclick-1-1/mainline/trunk tag: latest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Libs/LibQTipClick-1.1/LibQTipClick-1.1.lua Wed Jul 22 22:04:16 2009 +1000 @@ -0,0 +1,135 @@ +local MAJOR = "LibQTipClick-1.1" +local MINOR = 3 +assert(LibStub, MAJOR.." requires LibStub") + +local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR) + +if not lib then return end -- No upgrade needed + +local QTip = LibStub:GetLibrary("LibQTip-1.0") +assert(QTip, MAJOR.." requires LibQTip-1.0") + +local CBH = LibStub:GetLibrary("CallbackHandler-1.0") +assert(CBH, MAJOR.." requires CallbackHandler-1.0") + +------------------------------------------------------------------------------- +-- Local variables +------------------------------------------------------------------------------- +lib.LabelProvider, lib.LabelPrototype, lib.BaseProvider = QTip:CreateCellProvider(QTip.LabelProvider) +local cell_provider, cell_prototype, cell_base = lib.LabelProvider, lib.LabelPrototype, lib.BaseProvider + +------------------------------------------------------------------------------- +-- Public library API +------------------------------------------------------------------------------- +local highlighter = CreateFrame("Frame", nil, UIParent) +highlighter:SetFrameStrata("TOOLTIP") +highlighter:Hide() + +local cell_highlight = highlighter:CreateTexture(nil, "BACKGROUND") +cell_highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") +cell_highlight:SetBlendMode("ADD") +cell_highlight:SetAllPoints(highlighter) + +function lib.OnEnter(event, cell, arg) + highlighter:SetAllPoints(cell) + highlighter:SetFrameLevel(cell:GetFrameLevel()) + highlighter:Show() +end + +function lib.OnLeave(event, cell, arg) + highlighter:ClearAllPoints() + highlighter:Hide() +end + +function lib.OnMouseDown(event, cell, arg, button) PlaySound("igMainMenuOpen") end +function lib.OnMouseUp(event, cell, arg, button) end + +local function Cell_OnEnter(cell) cell.callbacks:Fire("OnEnter", cell, cell.arg) end +local function Cell_OnLeave(cell) cell.callbacks:Fire("OnLeave", cell, cell.arg) end +local function Cell_OnMouseDown(cell, button) cell.callbacks:Fire("OnMouseDown", cell, cell.arg, button) end +local function Cell_OnMouseUp(cell, button) cell.callbacks:Fire("OnMouseUp", cell, cell.arg, button) end + +function cell_prototype:InitializeCell() cell_base.InitializeCell(self) end + +function cell_prototype:SetupCell(tooltip, value, justification, font, arg, ...) + local width, height = cell_base.SetupCell(self, tooltip, value, justification, font, ...) + self:EnableMouse(true) + self.arg = arg + self.callbacks = tooltip.callbacks + self:SetScript("OnEnter", Cell_OnEnter) + self:SetScript("OnLeave", Cell_OnLeave) + self:SetScript("OnMouseDown", Cell_OnMouseDown) + self:SetScript("OnMouseUp", Cell_OnMouseUp) + + return width, height +end + +function cell_prototype:ReleaseCell() + self:EnableMouse(false) + self:SetScript("OnEnter", nil) + self:SetScript("OnLeave", nil) + self:SetScript("OnMouseDown", nil) + self:SetScript("OnMouseUp", nil) + self.arg = nil + self.callbacks = nil +end + +------------------------------------------------------------------------------- +-- LibQTip wrapper API +------------------------------------------------------------------------------- +local function AddNormalLine(tooltip, ...) + local oldProvider = tooltip:GetDefaultProvider() + tooltip:SetDefaultProvider(QTip.LabelProvider) + local lineNum, colNum = tooltip:AddLine(...) + tooltip:SetDefaultProvider(oldProvider) + return lineNum, colNum +end + +local function AddNormalHeader(tooltip, ...) + local oldProvider = tooltip:GetDefaultProvider() + tooltip:SetDefaultProvider(QTip.LabelProvider) + local lineNum, colNum = tooltip:AddHeader(...) + tooltip:SetDefaultProvider(oldProvider) + return lineNum, colNum +end + +local function SetNormalCell(tooltip, ...) + local oldProvider = tooltip:GetDefaultProvider() + tooltip:SetDefaultProvider(QTip.LabelProvider) + local lineNum, colNum = tooltip:SetCell(...) + tooltip:SetDefaultProvider(oldProvider) + return lineNum, colNum +end + +function lib:Acquire(key, ...) + local tooltip = QTip:Acquire(key, ...) + tooltip:EnableMouse(true) + + tooltip.callbacks = CBH:New(tooltip, "SetCallback", "UnSetCallback", "UnSetAllCallbacks" or false) + tooltip:SetCallback("OnEnter", self.OnEnter) + tooltip:SetCallback("OnLeave", self.OnLeave) + tooltip:SetCallback("OnMouseDown", self.OnMouseDown) + tooltip:SetCallback("OnMouseUp", self.OnMouseUp) + + tooltip.AddNormalLine = AddNormalLine + tooltip.AddNormalHeader = AddNormalHeader + tooltip.SetNormalCell = SetNormalCell + tooltip:SetDefaultProvider(cell_provider) + return tooltip +end + +function lib:IsAcquired(key) return QTip:IsAcquired(key) end + +function lib:Release(tooltip) + if not tooltip then return end + tooltip:EnableMouse(false) + tooltip:UnSetAllCallbacks(tooltip) + tooltip.callbacks = nil + tooltip["SetCallback"] = nil + tooltip["UnSetCallback"] = nil + tooltip["UnSetAllCallbacks"] = nil + QTip:Release(tooltip) +end + +function lib:IterateTooltips() return QTip:IterateTooltips() end +function lib:CreateCellProvider(baseProvider) return QTip:CreateCellProvider(baseProvider) end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Libs/LibQTipClick-1.1/LibQTipClick-1.1.toc Wed Jul 22 22:04:16 2009 +1000 @@ -0,0 +1,17 @@ +## Interface: 30100 +## Title: Lib: QTipClick-1.1 +## Notes: Library providing mouse-click support for LibQTip-1.0. +## Author: Torhal +## Version: r8 +## X-Date: 2009-05-31T22:22:40Z +## X-Category: Library, Tooltip +## X-License: Ace3 BSD-like license +## OptionalDeps: LibQTip-1.0 +## X-Curse-Packaged-Version: r8 +## X-Curse-Project-Name: LibQTipClick-1.1 +## X-Curse-Project-ID: libqtipclick-1-1 +## X-Curse-Repository-ID: wow/libqtipclick-1-1/mainline + +LibStub\LibStub.lua +CallbackHandler-1.0\CallbackHandler-1.0.lua +lib.xml \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Libs/LibQTipClick-1.1/lib.xml Wed Jul 22 22:04:16 2009 +1000 @@ -0,0 +1,4 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ +..\FrameXML\UI.xsd"> + <Script file="LibQTipClick-1.1.lua"/> +</Ui> \ No newline at end of file
--- a/Squawk.lua Tue May 12 00:57:59 2009 +1000 +++ b/Squawk.lua Wed Jul 22 22:04:16 2009 +1000 @@ -38,6 +38,7 @@ Settings.Requested = Model.db.profile.Requested Settings.Blocked = Model.db.profile.Blocked Settings.Private = Model.db.profile.Private + Settings.Trendsetter = Model.db.profile.Trendsetter LibStub("AceComm-3.0"):Embed(Controller) LibStub("AceTimer-3.0"):Embed(Controller) @@ -49,4 +50,12 @@ _, Controller.Class = UnitClass("player") Model.Squawks.Reload(Model.Squawks) -- Retrain the table lookups + + -- Now setup the SquawkTrends channel if opted in + if Settings.Trendsetter then + if #{GetChannelList()} > 17 then -- if we have a spare channel to use... + View:Print("Due to custom channel limitation, Squawk cannot transmit/recieve trending details") + end + end + end
--- a/embeds.xml Tue May 12 00:57:59 2009 +1000 +++ b/embeds.xml Wed Jul 22 22:04:16 2009 +1000 @@ -3,7 +3,7 @@ <Script file="Libs\Ace3\LibStub\LibStub.lua"/> <Script file="Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/> <Include file="Libs\LibQTip-1.0\lib.xml"/> - <Include file="Libs\LibQTipClick-1.0\lib.xml"/> + <Include file="Libs\LibQTipClick-1.1\lib.xml"/> <Include file="Libs\Ace3\CallbackHandler-1.0\CallbackHandler-1.0.xml"/> <Include file="Libs\Ace3\AceTimer-3.0\AceTimer-3.0.xml"/> <Include file="Libs\Ace3\AceEvent-3.0\AceEvent-3.0.xml"/>