vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 path: /BGInvite/
3 filename: BGInvite_BlacklistFrame.lua
4 author: Jeff Parker <jeff3parker@gmail.com>
5 created: Tue, 22 Jan 2005 14:15:00 -0800
6 updated: Tue, 22 Jan 2005 21:39:00 -0800
7  
8 Pet Feeder: a GUI interface allowing you configure happiness level for your pet &
9 drag/drop foods you wish your pet to eat. When the pet happiness drops below
10 the selected threshold will automatically feed your pet.
11 To remove a food from the list, simply click on it.
12 ]]
13  
14 --[[
15 =============================================================================
16 Called when we want to display a list of foods
17 =============================================================================
18 ]]
19 function BGInvite_BlackListFrame_OnShow()
20 BGInvite_BlackListFrame_Update();
21 end
22  
23 --[[
24 =============================================================================
25 Called when we want to display a list of foods
26 =============================================================================
27 ]]
28 function BGInvite_BlackListFrame_Update()
29  
30 table.sort( BGvar_BlackList, function(a,b) return a.name < b.name end );
31 local numEntries = table.getn(BGvar_BlackList);
32  
33 --FauxScrollFrame_Update(BGInvite_BlackListFrameListScrollFrame, numEntries, BGInvite_ITEMS_SHOWN, nil, nil, nil, nil, nil, nil, BGInvite_ITEM_HEIGHT);
34 FauxScrollFrame_Update(BGInvite_BlackListFrameListScrollFrame, numEntries, BGInvite_ITEMS_SHOWN, BGInvite_ITEM_HEIGHT, nil, nil, nil, nil, nil, BGInvite_ITEM_HEIGHT);
35  
36 local scrollFrameOffset = FauxScrollFrame_GetOffset(BGInvite_BlackListFrameListScrollFrame);
37  
38 local iItem;
39 for iItem = 1, BGInvite_ITEMS_SHOWN, 1 do
40 local itemIndex = iItem + scrollFrameOffset;
41 local buttonItem = getglobal("BGInvite_BlackListFrameItem"..iItem);
42 if ( itemIndex > numEntries ) then
43 buttonItem:Hide();
44 else
45 local value = BGvar_BlackList[itemIndex];
46 local text = value.name..BGINVITE_RETRIES..":"..value.retries.." ("..value.reason..")";
47 buttonItem:SetText(text);
48 buttonItem:Show();
49 end
50 end
51 end
52  
53 --[[
54 =============================================================================
55 Called when Clear Foods button is clicked
56 =============================================================================
57 ]]
58 function BGInvite_BlackListFrameClearBlackListButton_Update()
59 BGInviteClearBlackList();
60 BGInvite_BlackListFrame_Update();
61 end
62  
63 function BGInvite_BlackList_Clear_Update()
64 BGInviteClearBlackList();
65 BGInvite_BlackListFrame_Update();
66 end
67  
68 --[[
69 =============================================================================
70 Called when the button item is clicked
71 =============================================================================
72 ]]
73 function BGInvite_BlackListFrameItemButton_OnClick(button,name)
74 if ( button == "LeftButton" ) then
75 playerName = string.sub(name, 1,string.find(name," ")-1);
76 local index = findPlayerIndexInList(BGvar_BlackList, playerName);
77 if ( index ) then
78 table.remove(BGvar_BlackList, index);
79 end
80 BGInvite_BlackListFrame_Update();
81 end
82 end
83  
84  
85  
86