import "Turbine.UI";
SetupHelp = 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
function SetupHelp:Constructor()
Turbine.UI.ListBox.Constructor(self);
self.current = nil;
self.titlebars = { };
self.helptext = { };
self:SetOrientation(Turbine.UI.Orientation.Horizontal);
self:SetMaxItemsPerLine(1);
self:AddTitleBar("Help");
local line = holder(self,10);
local keymods = self:NewHelpText(self.helptext, 8, "-- KEY MODIFIERS --\n\n");
self.helptext[keymods]:AppendText("Hover+Alt+Ctrl = Show hidden skill\n");
self.helptext[keymods]:AppendText("Alt+Drag off bar = Removes skill from bar*\n");
self.helptext[keymods]:AppendText("Alt+Scroll$ = Change layer of layered multislots\n\n");
self.helptext[keymods]:AppendText("* If bars are unlocked\n");
self.helptext[keymods]:AppendText("$ Or Rt.Click if enabled\n");
end
function SetupHelp:NewHelpText(option, rows, text)
local index = #option + 1;
local line = holder(self, 14 * rows);
option[index] = KragenPlugs.UI.Label();
option[index]:SetVisible(true);
option[index]:SetParent(line);
option[index]:SetPosition(10,0);
option[index]:SetSize(380, 14* rows);
option[index]:SetMultiline(true);
option[index]:SetTextAlignment(Turbine.UI.ContentAlignment.TopLeft);
option[index]:SetFont(Turbine.UI.Lotro.Font.Verdana14);
option[index]:SetText(text);
return index;
end
function SetupHelp:AddTitleBar(text)
local index = #self.titlebars + 1;
local line = holder(self, 35);
self.titlebars[index] = KragenPlugs.UI.PanelDivider();
self.titlebars[index]:SetPosition(0,0);
self.titlebars[index]:SetParent(line);
self.titlebars[index]:SetText(text);
self.titlebars[index]:SetSize(400, 30);
end
function SetupHelp:AddCheckboxRow(option)
local index = #option + 1;
local line = holder(self, 20);
for i = 1,2 do
option[index] = KragenPlugs.UI.CheckBox();
option[index]:SetParent(line);
option[index]:SetSize(180, 20);
if math.mod(index, 2) == 0 then
option[index]:SetPosition(220,0);
option[index]:AlignLeft(true);
else
option[index]:SetPosition(0,0);
end
option[index]:SetText("Checkbox");
option[index]:SetVisible(false);
index = #option + 1;
end
end
function SetupHelp:AddSlider(option, mini, maxi, step, text)
local index = #option + 1;
local line = holder(self, 50);
option[index] = KragenPlugs.UI.Slider();
option[index]:SetParent(line);
option[index]:SetText(text);
option[index]:SetPosition(49, 0);
option[index]:SetSize(350, 40);
option[index]:SetStep(step);
option[index]:SetMin(mini);
option[index]:SetMax(maxi);
end
function SetupHelp:AddComboBox(option)
local index = #option + 1;
local line = holder(self, 30);
option[index] = { };
option[index].label = KragenPlugs.UI.Label();
option[index].label:SetParent(line);
option[index].label:SetSize(190, 20);
option[index].label:SetPosition(20, 0);
option[index].label:SetText("Label");
option[index].label:SetVisible(false);
option[index].combobox = KragenPlugs.UI.ComboBox();
option[index].combobox:SetParent(line);
option[index].combobox:SetSize(190, 20);
option[index].combobox:SetPosition(210, 0);
option[index].combobox:SetVisible(false);
end
function SetupHelp:Destroy()
-- cleanup the quickslots so the client doesn't crash
end