import "Turbine.UI";
SetupQuickslots = class(Turbine.UI.ListBox);
-- helper functions
local tt = function(width, height, control, text)
local tooltip = KragenPlugs.UI.Tooltip();
tooltip:SetText(text);
tooltip:SetControl(control);
tooltip:SetSize(width, height);
end
local holder = function(parent, height)
local container = Turbine.UI.Control();
container:SetSize(400, height);
parent:AddItem(container);
return container;
end
local setShortcut = function(quickslot, shortcutType, shortcutData)
local setter = function()
if (shortcutData ~= "") then
local shortcut = Turbine.UI.Lotro.Shortcut(shortcutType, shortcutData);
quickslot:SetShortcut(shortcut);
else
quickslot:SetShortcut(nil);
end
end
if (not pcall(setter)) then
quickslot:SetShortcut(nil);
end
end
function SetupQuickslots:Constructor()
Turbine.UI.ListBox.Constructor(self);
self.current = nil;
self:SetOrientation(Turbine.UI.Orientation.Horizontal);
self:SetMaxItemsPerLine(1);
local line = holder(self, 35);
self.barTitle = KragenPlugs.UI.PanelDivider();
self.barTitle:SetPosition(0,0);
self.barTitle:SetParent(line);
self.barTitle:SetText("Quickslots");
self.barTitle:SetSize(400, 30);
line = holder(self, 20);
self.labelclear = KragenPlugs.UI.Label();
self.labelclear:SetParent(line);
self.labelclear:SetSize(400, 20);
self.labelclear:SetPosition(0,0);
self.labelclear:SetText("Alt+Rt. Click to Clear Quickslot");
self.labelclear:SetVisible(true);
line = holder(self, 40);
self.quickslot1 = Turbine.UI.Lotro.Quickslot();
self.quickslot1:SetParent(line);
self.quickslot1:SetSize(36, 36);
self.quickslot1:SetPosition(120, 0);
self.quickslot1:SetVisible(false);
self.quickslot1:SetUseOnRightClick(false);
self.quickslot1.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot1:IsAltKeyDown()) then
self.quickslot1:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
self.quickslot2 = Turbine.UI.Lotro.Quickslot();
self.quickslot2:SetParent(line);
self.quickslot2:SetSize(36, 36);
self.quickslot2:SetPosition(245, 0);
self.quickslot2:SetVisible(false);
self.quickslot2:SetUseOnRightClick(false);
self.quickslot2.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot2:IsAltKeyDown()) then
self.quickslot2:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
line = holder(self, 20);
self.quickslot1cb = KragenPlugs.UI.CheckBox();
self.quickslot1cb:SetParent(line);
self.quickslot1cb:SetSize(180, 20);
self.quickslot1cb:SetPosition(0,0);
self.quickslot1cb:SetText("Checkboxf1");
self.quickslot1cb:SetVisible(false);
self.quickslot2cb = KragenPlugs.UI.CheckBox();
self.quickslot2cb:SetParent(line);
self.quickslot2cb:SetSize(180,20);
self.quickslot2cb:SetPosition(220,0);
self.quickslot2cb:AlignLeft(true);
self.quickslot2cb:SetText("Checkboxf2");
self.quickslot2cb:SetVisible(false);
line = holder(self, 40);
self.quickslot3 = Turbine.UI.Lotro.Quickslot();
self.quickslot3:SetParent(line);
self.quickslot3:SetSize(36, 36);
self.quickslot3:SetPosition(120, 0);
self.quickslot3:SetVisible(false);
self.quickslot3:SetUseOnRightClick(false);
self.quickslot3.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot3:IsAltKeyDown()) then
self.quickslot3:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
self.quickslot4 = Turbine.UI.Lotro.Quickslot();
self.quickslot4:SetParent(line);
self.quickslot4:SetSize(36, 36);
self.quickslot4:SetPosition(245, 0);
self.quickslot4:SetVisible(false);
self.quickslot4:SetUseOnRightClick(false);
self.quickslot4.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot4:IsAltKeyDown()) then
self.quickslot4:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
line = holder(self, 20);
self.quickslot3cb = KragenPlugs.UI.CheckBox();
self.quickslot3cb:SetParent(line);
self.quickslot3cb:SetSize(180, 20);
self.quickslot3cb:SetPosition(0,0);
self.quickslot3cb:SetText("Checkboxf1");
self.quickslot3cb:SetVisible(false);
self.quickslot4cb = KragenPlugs.UI.CheckBox();
self.quickslot4cb:SetParent(line);
self.quickslot4cb:SetSize(180,20);
self.quickslot4cb:SetPosition(220,0);
self.quickslot4cb:AlignLeft(true);
self.quickslot4cb:SetText("Checkboxf2");
self.quickslot4cb:SetVisible(false);
line = holder(self, 40);
self.quickslot5 = Turbine.UI.Lotro.Quickslot();
self.quickslot5:SetParent(line);
self.quickslot5:SetSize(36, 36);
self.quickslot5:SetPosition(120, 0);
self.quickslot5:SetVisible(false);
self.quickslot5:SetUseOnRightClick(false);
self.quickslot5.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot5:IsAltKeyDown()) then
self.quickslot5:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
self.quickslot6 = Turbine.UI.Lotro.Quickslot();
self.quickslot6:SetParent(line);
self.quickslot6:SetSize(36, 36);
self.quickslot6:SetPosition(245, 0);
self.quickslot6:SetVisible(false);
self.quickslot6:SetUseOnRightClick(false);
self.quickslot6.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot6:IsAltKeyDown()) then
self.quickslot6:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
line = holder(self, 20);
self.quickslot5cb = KragenPlugs.UI.CheckBox();
self.quickslot5cb:SetParent(line);
self.quickslot5cb:SetSize(180, 20);
self.quickslot5cb:SetPosition(0,0);
self.quickslot5cb:SetText("Checkboxf1");
self.quickslot5cb:SetVisible(false);
self.quickslot6cb = KragenPlugs.UI.CheckBox();
self.quickslot6cb:SetParent(line);
self.quickslot6cb:SetSize(180,20);
self.quickslot6cb:SetPosition(220,0);
self.quickslot6cb:AlignLeft(true);
self.quickslot6cb:SetText("Checkboxf2");
self.quickslot6cb:SetVisible(false);
line = holder(self, 40);
self.quickslot7 = Turbine.UI.Lotro.Quickslot();
self.quickslot7:SetParent(line);
self.quickslot7:SetSize(36, 36);
self.quickslot7:SetPosition(120, 0);
self.quickslot7:SetVisible(false);
self.quickslot7:SetUseOnRightClick(false);
self.quickslot7.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot7:IsAltKeyDown()) then
self.quickslot7:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
self.quickslot8 = Turbine.UI.Lotro.Quickslot();
self.quickslot8:SetParent(line);
self.quickslot8:SetSize(36, 36);
self.quickslot8:SetPosition(245, 0);
self.quickslot8:SetVisible(false);
self.quickslot8:SetUseOnRightClick(false);
self.quickslot8.MouseClick = function(sender, args)
if(args.Button == Turbine.UI.MouseButton.Right and self.quickslot8:IsAltKeyDown()) then
self.quickslot8:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
end
end
line = holder(self, 20);
self.quickslot7cb = KragenPlugs.UI.CheckBox();
self.quickslot7cb:SetParent(line);
self.quickslot7cb:SetSize(180, 20);
self.quickslot7cb:SetPosition(0,0);
self.quickslot7cb:SetText("Checkboxf1");
self.quickslot7cb:SetVisible(false);
self.quickslot8cb = KragenPlugs.UI.CheckBox();
self.quickslot8cb:SetParent(line);
self.quickslot8cb:SetSize(180,20);
self.quickslot8cb:SetPosition(220,0);
self.quickslot8cb:AlignLeft(true);
self.quickslot8cb:SetText("Checkboxf2");
self.quickslot8cb:SetVisible(false);
end
function SetupQuickslots:EnableControls(enable)
-- self.checkboxf1:SetEnabled(enable);
-- self.checkboxf2:SetEnabled(enable);
end
function SetupQuickslots:Destroy()
-- cleanup the quickslots so the client doesn't crash
end