tekkub / greedbeacon

WoW addon - Track down those needy and greedy party members

greedbeacon / Config.lua
05c6a5cc » tekkub 2009-01-10 Add config instead of relyi... 1 ---------------------
2 -- Panel --
3 ---------------------
4
5 local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
6 frame.name = "GreedBeacon"
7 frame:Hide()
8 frame:SetScript("OnShow", function(frame)
9 local title, subtitle = LibStub("tekKonfig-Heading").new(frame, "GreedBeacon", "This panel allows you to control which chat frame GreedBeacon outputs to.")
10
11
12 local chatframedropdown, chatframedropdowntext, chatframedropdowncontainer = LibStub("tekKonfig-Dropdown").new(frame, "Output to", "TOPLEFT", subtitle, "BOTTOMLEFT", -2, -8)
13 chatframedropdowntext:SetText(GreedBeaconDB.frame)
14 chatframedropdown.tiptext = "Select which chat frame to output to."
15
16 local function OnClick(self)
17 UIDropDownMenu_SetSelectedValue(chatframedropdown, self.value)
18 chatframedropdowntext:SetText(self.value)
19 GreedBeaconDB.frame = self.value
20 end
21 UIDropDownMenu_Initialize(chatframedropdown, function()
22 local selected, info = UIDropDownMenu_GetSelectedValue(chatframedropdown) or GreedBeaconDB.frame, UIDropDownMenu_CreateInfo()
23
24 for i=1,7 do
25 info.text = "ChatFrame"..i
26 info.value = "ChatFrame"..i
27 info.func = OnClick
28 info.checked = ("ChatFrame"..i) == selected
29 UIDropDownMenu_AddButton(info)
30 end
31 end)
32
33
34 local ident = LibStub("tekKonfig-Button").new_small(frame, "TOP", chatframedropdown, "TOP")
35 ident:SetPoint("RIGHT", -16, 0)
36 ident:SetText("Identify")
37 ident.tiptext = "Identify each chat frame"
38 ident:SetScript("OnClick", function(self) for i=1,7 do _G["ChatFrame"..i]:AddMessage("|cFF33FF99GreedBeacon|r: This is ChatFrame"..i) end end)
39
40
41 frame:SetScript("OnShow", nil)
42 end)
43
44 InterfaceOptions_AddCategory(frame)
45 LibStub("tekKonfig-AboutPanel").new("GreedBeacon", "GreedBeacon")
46