PageRenderTime 2571ms CodeModel.GetById 2551ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/datatext/micromenu.lua

http://github.com/Asphyxia/Tukui
Lua | 43 lines | 24 code | 7 blank | 12 comment | 3 complexity | 654cfb0c173e7bcc923138919377184d MD5 | raw file
  1. local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
  2. -----------------------------------------
  3. -- Tukui Micro Menu
  4. --
  5. -- By: Rian Quinn
  6. -- Date: 12-17-2010
  7. --
  8. -- Notes: This datatext is designed to
  9. -- show the same micromenu that
  10. -- is shown when you use the
  11. -- middle mouse key on the mini
  12. -- map.
  13. -----------------------------------------
  14. if C["datatext"].micromenu and C["datatext"].micromenu > 0 then
  15. local Stat = CreateFrame("Frame")
  16. Stat:EnableMouse(true)
  17. Stat:SetFrameStrata("HIGH")
  18. Stat:SetFrameLevel(3)
  19. local Text = TukuiInfoLeft:CreateFontString(nil, "OVERLAY")
  20. Text:SetFont(C.media.pixelfont, C["datatext"].fontsize, "MONOCHROMEOUTLINE")
  21. T.PP(C["datatext"].micromenu, Text)
  22. local function OnEvent(self, event, ...)
  23. Text:SetText(T.datacolor.."Micromenu")
  24. self:SetAllPoints(Text)
  25. end
  26. local function OpenMenu()
  27. if not TukuiMicroMenu or not TukuiMinimap then return end
  28. local xoff = 0
  29. local position = TukuiMinimap:GetPoint()
  30. if position:match("CENTER") then xoff = T.Scale(-14) end
  31. ToggleDropDownMenu(1, nil, TukuiMicroMenu, TukuiMinimap, xoff, T.Scale(-2))
  32. end
  33. Stat:RegisterEvent("PLAYER_LOGIN")
  34. Stat:SetScript("OnEvent", OnEvent)
  35. Stat:SetScript("OnMouseDown", function() OpenMenu() end)
  36. end