PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

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