/trunk/TipTop
## Title: TipTop |
## Author: Seerah |
## Notes: Tooltip enhancement |
## Version: 2.10.3 |
## Version: 2.11 |
## SavedVariables: TipTopDB |
## SavedVariablesPerCharacter: TipTopPCDB |
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets |
ScrollFrame Container |
Plain container that scrolls its content and doesn't grow in height. |
-------------------------------------------------------------------------------]] |
local Type, Version = "ScrollFrame", 21 |
local Type, Version = "ScrollFrame", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local methods = { |
["OnAcquire"] = function(self) |
self:SetScroll(0) |
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate) |
end, |
["OnRelease"] = function(self) |
Label Widget |
Displays text and optionally an icon. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Label", 21 |
local Type, Version = "Label", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
else |
-- image on the left |
image:SetPoint("TOPLEFT") |
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) |
if image:GetHeight() > label:GetHeight() then |
label:SetPoint("LEFT", image, "RIGHT", 4, 0) |
else |
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) |
end |
label:SetWidth(width - imagewidth - 4) |
height = max(image:GetHeight(), label:GetHeight()) |
end |
Keybinding Widget |
Set Keybindings in the Config UI. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Keybinding", 23 |
local Type, Version = "Keybinding", 24 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
msgframe:SetBackdropColor(0,0,0) |
msgframe:SetFrameStrata("FULLSCREEN_DIALOG") |
msgframe:SetFrameLevel(1000) |
msgframe:SetToplevel(true) |
local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal") |
msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.") |
--[[----------------------------------------------------------------------------- |
Checkbox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "CheckBox", 21 |
local Type, Version = "CheckBox", 22 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self.frame:Disable() |
self.text:SetTextColor(0.5, 0.5, 0.5) |
SetDesaturation(self.check, true) |
if self.desc then |
self.desc:SetTextColor(0.5, 0.5, 0.5) |
end |
else |
self.frame:Enable() |
self.text:SetTextColor(1, 1, 1) |
else |
SetDesaturation(self.check, false) |
end |
if self.desc then |
self.desc:SetTextColor(1, 1, 1) |
end |
end |
end, |
--[[ |
--[[ |
Name: LibSharedMedia-3.0 |
Revision: $Revision: 58 $ |
Revision: $Revision: 69 $ |
Author: Elkano (elkano@gmx.de) |
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) |
Website: http://www.wowace.com/projects/libsharedmedia-3-0/ |
License: LGPL v2.1 |
]] |
local MAJOR, MINOR = "LibSharedMedia-3.0", 90000 + tonumber(("$Revision: 58 $"):match("(%d+)")) |
local MAJOR, MINOR = "LibSharedMedia-3.0", 4030402 -- increase manualy on changes |
local lib = LibStub:NewLibrary(MAJOR, MINOR) |
if not lib then return end |
-- populate lib with default Blizzard data |
-- BACKGROUND |
if not lib.MediaTable.background then lib.MediaTable.background = {} end |
lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]] |
lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]] |
lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]] |
lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]] |
lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-Achievement-Parchment]] |
lib.MediaTable.background["Blizzard Tabard Background"] = [[Interface\TabardFrame\TabardFrameBackground]] |
lib.MediaTable.background["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Background]] |
lib.MediaTable.background["Solid"] = [[Interface\Buttons\WHITE8X8]] |
lib.MediaTable.background["None"] = [[]] |
lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]] |
lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]] |
lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]] |
lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]] |
lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]] |
lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]] |
lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]] |
lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]] |
lib.MediaTable.background["Blizzard Rock"] = [[Interface\FrameGeneral\UI-Background-Rock]] |
lib.MediaTable.background["Blizzard Tabard Background"] = [[Interface\TabardFrame\TabardFrameBackground]] |
lib.MediaTable.background["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Background]] |
lib.MediaTable.background["Solid"] = [[Interface\Buttons\WHITE8X8]] |
lib.DefaultMedia.background = "None" |
-- BORDER |
if not lib.MediaTable.border then lib.MediaTable.border = {} end |
lib.MediaTable.border["None"] = [[Interface\None]] |
lib.MediaTable.border["None"] = [[]] |
lib.MediaTable.border["Blizzard Achievement Wood"] = [[Interface\AchievementFrame\UI-Achievement-WoodBorder]] |
lib.MediaTable.border["Blizzard Chat Bubble"] = [[Interface\Tooltips\ChatBubble-Backdrop]] |
lib.MediaTable.border["Blizzard Dialog"] = [[Interface\DialogFrame\UI-DialogBox-Border]] |
lib.MediaTable.border["Blizzard Dialog Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Border]] |
lib.MediaTable.border["Blizzard Party"] = [[Interface\CHARACTERFRAME\UI-Party-Border]] |
lib.MediaTable.border["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Border]] |
lib.DefaultMedia.border = "None" |
-- FONT |
if not lib.MediaTable.font then lib.MediaTable.font = {} end |
elseif locale == "zhCN" then |
LOCALE_MASK = lib.LOCALE_BIT_zhCN |
-- |
SML_MT_font["伤害æ°å"] = [[Fonts\ZYKai_C.ttf]] |
SML_MT_font["é»è®¤"] = [[Fonts\ZYKai_T.ttf]] |
SML_MT_font["è天"] = [[Fonts\ZYHei.ttf]] |
SML_MT_font["伤害æ°å"] = [[Fonts\ARKai_C.ttf]] |
SML_MT_font["é»è®¤"] = [[Fonts\ARKai_T.ttf]] |
SML_MT_font["è天"] = [[Fonts\ARHei.ttf]] |
-- |
lib.DefaultMedia["font"] = "é»è®¤" -- someone from zhCN please adjust if needed |
-- |
-- STATUSBAR |
if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end |
lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]] |
lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]] |
lib.DefaultMedia.statusbar = "Blizzard" |
-- SOUND |
if not lib.MediaTable.sound then lib.MediaTable.sound = {} end |
lib.MediaTable.sound["None"] = [[Interface\Quiet.mp3]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input. |
lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input. |
lib.DefaultMedia.sound = "None" |
local function rebuildMediaList(mediatype) |
if type(key) ~= "string" then |
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) |
end |
mediatype = mediatype:lower() |
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end |
mediatype = mediatype:lower() |
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end |
local mtable = mediaTable[mediatype] |
if mtable[key] then return false end |
local mtt = mediaTable[mediatype] |
local overridekey = overrideMedia[mediatype] |
local result = mtt and ((overridekey and mtt[overridekey] or mtt[key]) or (not noDefault and defaultMedia[mediatype] and mtt[defaultMedia[mediatype]])) or nil |
return result |
return result ~= "" and result or nil |
end |
function lib:IsValid(mediatype, key) |
"BOTTOM", "BOTTOMRIGHT", "BOTTOMLEFT", |
"RIGHT", "LEFT", "CENTER"} |
local formats = {"100/100", "100%", "100/100 (100%)", "1.2k/1.2k"} |
local fontFlags = {"None", "Outline", "Monochrome Outline", "Monochrome"} |
local fontFlags = {"None", "Outline", "Monochrome Outline"} --, "Monochrome"} |
local defaults = { |