lotrointerface.com
Search Downloads

LoTROInterface SVN KragenBars

[/] [trunk/] [KragenPlugs/] [KragenBars/] [SetupQuickslots.lua] - Rev 65

Compare with Previous | Blame | View Log

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


function SetupQuickslots:Constructor()
    Turbine.UI.ListBox.Constructor(self);

    self.current = nil;
        self.titlebars = { };
        self.quickslots = { };
        
    self:SetOrientation(Turbine.UI.Orientation.Horizontal);
    self:SetMaxItemsPerLine(1);

        self:AddTitleBar("Quickslots");
        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);

        for i = 1,4 do  self:AddQuickslotRow(self.quickslots) end -- Adds 2 quickslots each row therefore #quickslots = for-end x 2
                
end


function SetupQuickslots: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 SetupQuickslots: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 SetupQuickslots: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 SetupQuickslots: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 SetupQuickslots:AddQuickslotRow(option)
        local index = #option + 1;
    local line = holder(self, 40);

        for i = 1,2 do
                option[index] = { };
                option[index].quickslot = Turbine.UI.Lotro.Quickslot();
                option[index].quickslot:SetParent(line);
                option[index].quickslot:SetSize(36, 36);
                if math.mod(index, 2) == 0 then
                        option[index].quickslot:SetPosition(245, 0);
                else
                        option[index].quickslot:SetPosition(120, 0);
                end
                option[index].quickslot:SetVisible(false);
                option[index].quickslot:SetUseOnRightClick(false);
                index = #option + 1;
        end
        
    line = holder(self, 20);
    index = #option - 1;
        
        for i = 1,2 do 
                option[index].checkbox = KragenPlugs.UI.CheckBox();
                option[index].checkbox:SetParent(line);
                option[index].checkbox:SetSize(180, 20);
                if math.mod(index, 2) == 0 then
                        option[index].checkbox:SetPosition(220,0);
                        option[index].checkbox:AlignLeft(true);
                else
                        option[index].checkbox:SetPosition(0,0);
                end
                option[index].checkbox:SetText("Checkbox");
                option[index].checkbox:SetVisible(false);
                index = index + 1;
        end

end

function SetupQuickslots:ActivateQuickslot(option, name, active, qstype, qsdata)
        pcall(function() option.quickslot:SetShortcut(Turbine.UI.Lotro.Shortcut( qstype, qsdata ) ); end);
        option.quickslot:SetVisible(true);
        option.quickslot.MouseClick = function(sender, args)
                if(args.Button == Turbine.UI.MouseButton.Right and option.quickslot:IsAltKeyDown()) then
                        option.quickslot:SetShortcut(Turbine.UI.Lotro.Shortcut( Turbine.UI.Lotro.ShortcutType.Undefined, "" ) );
                end
        end
        option.checkbox:SetText(name);
        option.checkbox:SetChecked(active);
        option.checkbox:SetVisible(true);

        
        
end

function SetupQuickslots:Destroy()
    -- cleanup the quickslots so the client doesn't crash

end

Compare with Previous | Blame


All times are GMT -5. The time now is 07:44 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui