vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Paging.lua
3 Scripts for the Paging panel of the Bongos Options menu
4 --]]
5  
6 local list;
7  
8 local function sortList(bar1, bar2)
9 if tonumber(bar1.id) and tonumber(bar2.id) then
10 return bar1.id < bar2.id;
11 elseif not(tonumber(bar1.id) or tonumber(bar2.id)) then
12 return bar1.id < bar2.id;
13 elseif tonumber(bar1.id) then
14 return false;
15 end
16 return true;
17 end
18  
19 function BOptionsPaging_OnMousewheel(scrollframe, direction)
20 local scrollbar = getglobal(scrollframe:GetName() .. "ScrollBar");
21 scrollbar:SetValue(scrollbar:GetValue() - direction * (scrollbar:GetHeight() / 2));
22 BOptionsPagingScrollBar_Update()
23 end
24  
25 function BOptionsPaging_OnLoad()
26 local name = this:GetName()
27  
28 local allButton = CreateFrame("CheckButton", name .. "All", this, "BOptionsPagingButton");
29 allButton:SetPoint("TOPLEFT", this, "TOPLEFT", 4, 4);
30 allButton:SetText("all");
31 allButton:SetScript("OnClick", function()
32 for i = 1, BActionBar.GetNumber() do
33 BActionBar.SetPaging(i, this:GetChecked())
34 end
35 BOptionsPagingScrollBar_Update();
36 end)
37  
38 local firstOfRow;
39 local name = this:GetName();
40 for i = 1, 6 do
41 local button = CreateFrame("CheckButton", name .. (i-1)*3 + 1, this, "BOptionsPagingButton");
42 if not firstOfRow then
43 button:SetPoint("TOPLEFT", allButton, "BOTTOMLEFT");
44 else
45 button:SetPoint("TOPLEFT", firstOfRow, "BOTTOMLEFT");
46 end
47 firstOfRow = button;
48 for j = 2, 3 do
49 local button = CreateFrame("CheckButton", name .. (i-1)*3 + j, this, "BOptionsPagingButton");
50 button:SetPoint("LEFT", name .. (i-1)*3 + j-1, "RIGHT", 34, 0);
51 end
52 end
53 end
54  
55 function BOptionsPaging_OnShow()
56 this.onShow = 1
57 getglobal(this:GetName() .. "Skip"):SetMinMaxValues(0, BActionBar.GetNumber() - 1);
58 getglobal(this:GetName() .. "SkipHigh"):SetText(BActionBar.GetNumber() - 1);
59 getglobal(this:GetName() .. "Skip"):SetValue(BActionSets.g.skip or 0);
60 BOptionsPagingScrollBar_Update();
61 this.onShow = nil
62 end
63  
64 function BOptionsPagingScrollBar_Update()
65 local size = BActionBar.GetNumber();
66 local offset = BOptionsPanelPagingScrollFrame.offset;
67 FauxScrollFrame_Update(BOptionsPanelPagingScrollFrame, size - 1, 18, 18);
68  
69 for index = 1, 18 do
70 local rIndex = index + offset;
71 local button = getglobal("BOptionsPanelPaging".. index);
72  
73 if rIndex <= size then
74 button:SetText(rIndex);
75 button:SetChecked(BActionBar.CanPage(rIndex));
76 button:Show();
77 else
78 button:Hide();
79 end
80 end
81 end