vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Context.lua |
||
3 | Scripts for the Context panel of the Bongos Options menu |
||
4 | --]] |
||
5 | |||
6 | function BOptionsContext_OnMousewheel(scrollframe, direction) |
||
7 | local scrollbar = getglobal(scrollframe:GetName() .. "ScrollBar"); |
||
8 | scrollbar:SetValue(scrollbar:GetValue() - direction * (scrollbar:GetHeight() / 2)); |
||
9 | BOptionsContextScrollBar_Update() |
||
10 | end |
||
11 | |||
12 | function BOptionsContext_OnLoad() |
||
13 | local name = this:GetName() |
||
14 | |||
15 | local allButton = CreateFrame("CheckButton", name .. "All", this, "BOptionsContextButton"); |
||
16 | allButton:SetPoint("TOPLEFT", this, "TOPLEFT", 4, 4); |
||
17 | allButton:SetText("all"); |
||
18 | allButton:SetScript("OnClick", function() |
||
19 | for i = 1, BActionBar.GetNumber() do |
||
20 | BActionBar.SetContextPaging(i, this:GetChecked()) |
||
21 | end |
||
22 | BOptionsContextScrollBar_Update(); |
||
23 | end) |
||
24 | |||
25 | local firstOfRow; |
||
26 | local name = this:GetName(); |
||
27 | for i = 1, 7 do |
||
28 | local button = CreateFrame("CheckButton", name .. (i-1)*3 + 1, this, "BOptionsContextButton"); |
||
29 | if not firstOfRow then |
||
30 | button:SetPoint("TOPLEFT", allButton, "BOTTOMLEFT", 0, -4); |
||
31 | else |
||
32 | button:SetPoint("TOPLEFT", firstOfRow, "BOTTOMLEFT"); |
||
33 | end |
||
34 | firstOfRow = button; |
||
35 | for j = 2, 3 do |
||
36 | local button = CreateFrame("CheckButton", name .. (i-1)*3 + j, this, "BOptionsContextButton"); |
||
37 | button:SetPoint("LEFT", name .. (i-1)*3 + j-1, "RIGHT", 34, 0); |
||
38 | end |
||
39 | end |
||
40 | end |
||
41 | |||
42 | function BOptionsContextScrollBar_Update() |
||
43 | local size = BActionBar.GetNumber(); |
||
44 | local offset = BOptionsPanelContextScrollFrame.offset; |
||
45 | FauxScrollFrame_Update(BOptionsPanelContextScrollFrame, size - 1, 21, 21); |
||
46 | |||
47 | for index = 1, 21 do |
||
48 | local rIndex = index + offset; |
||
49 | local button = getglobal("BOptionsPanelContext".. index); |
||
50 | |||
51 | if rIndex <= size then |
||
52 | button:SetText(rIndex); |
||
53 | button:SetChecked(BActionBar.CanContextPage(rIndex)); |
||
54 | button:Show(); |
||
55 | else |
||
56 | button:Hide(); |
||
57 | end |
||
58 | end |
||
59 | end |