/Tukui/modules/misc/micromenu.lua

http://github.com/Asphyxia/Tukui · Lua · 68 lines · 61 code · 5 blank · 2 comment · 9 complexity · e48e77642516aff0bf3539418c87b4c3 MD5 · raw file

  1. local T, C, L = unpack(select(2, ...))
  2. -- dropdown micromenu
  3. local function CreateMicroMenuDropDown()
  4. local microList = {
  5. {text = CHARACTER_BUTTON,
  6. func = function() ToggleCharacter("PaperDollFrame") end},
  7. {text = SPELLBOOK_ABILITIES_BUTTON,
  8. func = function() ToggleFrame(SpellBookFrame) end},
  9. {text = TALENTS_BUTTON,
  10. func = function()
  11. if not PlayerTalentFrame then
  12. LoadAddOn("Blizzard_TalentUI")
  13. end
  14. if not GlyphFrame then
  15. LoadAddOn("Blizzard_GlyphUI")
  16. end
  17. PlayerTalentFrame_Toggle()
  18. end},
  19. {text = ACHIEVEMENT_BUTTON,
  20. func = function() ToggleAchievementFrame() end},
  21. {text = QUESTLOG_BUTTON,
  22. func = function() ToggleFrame(QuestLogFrame) end},
  23. {text = SOCIAL_BUTTON,
  24. func = function() ToggleFriendsFrame(1) end},
  25. {text = PLAYER_V_PLAYER,
  26. func = function() ToggleFrame(PVPFrame) end},
  27. {text = ACHIEVEMENTS_GUILD_TAB,
  28. func = function()
  29. if IsInGuild() then
  30. if not GuildFrame then LoadAddOn("Blizzard_GuildUI") end
  31. GuildFrame_Toggle()
  32. else
  33. if not LookingForGuildFrame then LoadAddOn("Blizzard_LookingForGuildUI") end
  34. LookingForGuildFrame_Toggle()
  35. end
  36. end},
  37. {text = LFG_TITLE,
  38. func = function() ToggleFrame(LFDParentFrame) end},
  39. {text = LOOKING_FOR_RAID,
  40. func = function() ToggleFrame(LFRParentFrame) end},
  41. {text = HELP_BUTTON,
  42. func = function() ToggleHelpFrame() end},
  43. {text = CALENDAR_VIEW_EVENT,
  44. func = function()
  45. if(not CalendarFrame) then LoadAddOn("Blizzard_Calendar") end
  46. Calendar_Toggle()
  47. end},
  48. {text = ENCOUNTER_JOURNAL,
  49. func = function() if T.toc >= 40200 then ToggleFrame(EncounterJournal) end end},
  50. }
  51. for i=1, 13 do
  52. UIDropDownMenu_AddButton(microList[i])
  53. end
  54. -- spellbook need at least 1 opening else it taint in combat
  55. local taint = CreateFrame("Frame")
  56. taint:RegisterEvent("PLAYER_ENTERING_WORLD")
  57. taint:SetScript("OnEvent", function(self)
  58. ToggleFrame(SpellBookFrame)
  59. ToggleFrame(SpellBookFrame)
  60. end)
  61. end
  62. local MicroMenu = CreateFrame("Frame", "TukuiMicroMenu", UIParent, "UIDropDownMenuTemplate")
  63. UIDropDownMenu_Initialize(MicroMenu, CreateMicroMenuDropDown, 'MENU')