/TelUI_AddonSkins/skins/QBar.lua

http://github.com/Asphyxia/Tukui · Lua · 60 lines · 46 code · 2 blank · 12 comment · 11 complexity · ac0d8e92767f4e8255de8a8d9d669311 MD5 · raw file

  1. --[[
  2. QBar Skin by Darth Android / Telroth - The Venture Co.
  3. Skins QBar to look like TelUI.
  4. Todo:
  5. + Reorganize to support skin subclass overrides
  6. + Reorganize to support layout subclass overrides
  7. (C)2010 Darth Android / Telroth - The Venture Co.
  8. File version v91.109
  9. ]]
  10. if not Mod_AddonSkins or not QBar then return end
  11. local QBar = _G["QBar"]
  12. local db = _G["QBar_Config"] or {error = true}
  13. Mod_AddonSkins:RegisterSkin("QBar",function(Skin,skin,Layout,layout,config)
  14. QBar.UpdateButtons_ = QBar.UpdateButtons
  15. QBar.UpdateButtons = function()
  16. local self = QBar
  17. db.padding = config.buttonSpacing
  18. db.scale = 1
  19. db.btnSize = config.buttonSize
  20. if not InCombatLockdown() then
  21. self:SetScale(db.scale)
  22. end
  23. self:UpdateButtons_()
  24. if not self.bg and #self.items > 0 then
  25. self.bg = CreateFrame("Frame",nil,self.items[1])
  26. skin:SkinBackgroundFrame(self.bg)
  27. self.bg:SetFrameStrata("BACKGROUND")
  28. if not db.mirrored then
  29. self.bg:SetPoint("TOPLEFT",self.items[1],"TOPLEFT",-config.buttonSpacing,config.buttonSpacing)
  30. else
  31. self.bg:SetPoint("BOTTOMRIGHT",self.items[1],"BOTTOMRIGHT",config.buttonSpacing,-config.buttonSpacing)
  32. end
  33. end
  34. local visible = 0
  35. for i,k in ipairs(self.items) do
  36. if k:IsVisible() then
  37. visible = visible + 1
  38. skin:SkinFrame(k)
  39. k.icon:ClearAllPoints()
  40. k.icon:SetPoint("TOPLEFT",k,"TOPLEFT",config.borderWidth,-config.borderWidth)
  41. k.icon:SetPoint("BOTTOMRIGHT",k,"BOTTOMRIGHT",-config.borderWidth,config.borderWidth)
  42. k.icon:SetTexCoord(unpack(config.buttonZoom))
  43. end
  44. end
  45. if self.bg then
  46. if db.vertical then
  47. self.bg:SetWidth(config.buttonSpacing * 2 + config.buttonSize)
  48. self.bg:SetHeight(config.buttonSpacing + (config.buttonSize + config.buttonSpacing) * visible)
  49. else
  50. self.bg:SetHeight(config.buttonSpacing * 2 + config.buttonSize)
  51. self.bg:SetWidth(config.buttonSpacing + (config.buttonSize + config.buttonSpacing) * visible)
  52. end
  53. end
  54. end
  55. end)