vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 BKeyBar
3 Makes the keyring button movable
4  
5 Saved Variables:
6 Bongos.keys = {
7 <All variables from BBar>
8 space
9 The spacing between action buttons, in pixels. A nil value means that the bar is using default spacing
10 rows
11 How many rows the bar is organized into.
12 }
13 --]]
14  
15 --[[ Rightclick Menu Functions ]]--
16  
17 local function CreateConfigMenu(name)
18 local menu = CreateFrame("Button", name, UIParent, "BongosRightClickMenu");
19 menu:SetText("Key Bar");
20 menu:SetWidth(220);
21 menu:SetHeight(152);
22  
23 local hideButton = CreateFrame("CheckButton", name .. "Hide", menu, "BongosHideButtonTemplate");
24  
25 local scaleSlider = CreateFrame("Slider", name .. "Scale", menu, "BongosScaleSlider");
26 scaleSlider:SetPoint("TOPLEFT", hideButton, "BOTTOMLEFT", 2, -10);
27  
28 local opacitySlider = CreateFrame("Slider", name .. "Opacity", menu, "BongosOpacitySlider");
29 opacitySlider:SetPoint("TOP", scaleSlider, "BOTTOM", 0, -24);
30 end
31  
32 --Called when the right click menu is shown, loads the correct values to the checkbuttons/sliders/text
33 local function ShowMenu(bar)
34 if not BongosKeyBarMenu then
35 CreateConfigMenu("BongosKeyBarMenu");
36 end
37  
38 BongosKeyBarMenu.onShow = 1;
39 BongosKeyBarMenu.frame = bar;
40  
41 BongosKeyBarMenuHide:SetChecked(not bar.sets.vis);
42 BongosKeyBarMenuScale:SetValue(bar:GetScale() * 100);
43 BongosKeyBarMenuOpacity:SetValue(bar:GetAlpha() * 100);
44  
45 BMenu.ShowMenuForBar(BongosKeyBarMenu, bar);
46 BongosKeyBarMenu.onShow = nil;
47 end
48  
49 BScript.AddStartupAction(function()
50 local bar = BBar.Create("key", "BKeyBar", "BActionSets.key", ShowMenu);
51 bar:SetWidth(19);
52 bar:SetHeight(37);
53 if not bar:IsUserPlaced() then
54 bar:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -210, 0);
55 end
56  
57 KeyRingButton:ClearAllPoints();
58 KeyRingButton:SetPoint("TOPLEFT", bar);
59 KeyRingButton:SetParent(bar);
60 KeyRingButton:SetAlpha(bar:GetAlpha());
61 KeyRingButton:Show();
62 end)