lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [OptionPanel.lua] - Rev 138

Compare with Previous | Blame | View Log

--Option Panel

--[[This works from the "options" section and just works as the slash commands would. I am going to use this for *all* of my plugins eventually, as the Turbine option page doesn't really fit what I want.]]

if plugin==nil then plugin=Plugins["SortPackLoad"] end --This line can probably disappear on monday!

        plugin.GetOptionsPanel = function( self )
                optionsPanel = Turbine.UI.Control()
                optionsPanel:SetSize( 200, 600 )
                
                optionsPanel.ListBox=Turbine.UI.ListBox()
                optionsPanel.ListBox:SetParent(optionsPanel)
                
                local options={
                                [1] = 
                                {
                                        ["Text"] = "Sort the pack",
                                        ["Command"] = "sort"
                                },
                                [2] = 
                                {
                                        ["Text"] = "Open the SortBag",
                                        ["Command"] = "openbag"
                                },
                                [3] = 
                                {
                                        ["Text"] = "Open the Sort Options",
                                        ["Command"] = "sortoption"
                                },
                                [4] = 
                                {
                                        ["Text"] = "Create/Edit custom Categories",
                                        ["Command"] = "SortCat"
                                },
                                [5] = 
                                {
                                        ["Text"] = "Open the Sort Debug window",
                                        ["Command"] = "SortDebug"
                                },
                                [6] =
                                {
                                        ["Text"] = "Show/Hide Counter",
                                        ["Command"] = "SortCounter"
                                }
                                }       
                        
                        local optionsPanelButton={}
                        local height=0
                        
                        for i=1,#options do
                        
                        optionsPanelButton[i] = Turbine.UI.Control()

                                optionsPanelButton[i].shortcut = Turbine.UI.Lotro.Shortcut()
                                        optionsPanelButton[i].shortcut:SetType(Turbine.UI.Lotro.ShortcutType.Alias)
                                        optionsPanelButton[i].shortcut:SetData("/"..options[i].Command) 

                                optionsPanelButton[i].quickslot=Turbine.UI.Lotro.Quickslot()
                                        optionsPanelButton[i].quickslot:SetParent(optionsPanelButton[i])
                                        optionsPanelButton[i].quickslot:SetShortcut(optionsPanelButton[i].shortcut)
                                        optionsPanelButton[i].quickslot:SetVisible(true)
                                        optionsPanelButton[i].quickslot:SetOpacity(0)
                                        optionsPanelButton[i].quickslot:SetUseOnRightClick(false)
                        
                                optionsPanelButton[i].Button=Turbine.UI.Lotro.Button()
                                        optionsPanelButton[i].Button:SetParent(optionsPanelButton[i])
                                        optionsPanelButton[i].Button:SetBackColor(Turbine.UI.Color(1,0,0,0))
                                        optionsPanelButton[i].Button:SetText(options[i].Text)
                                        optionsPanelButton[i].Button:SetEnabled(false)          --If I don't do this then the next line still doesn't work! Therefore - will look odd, but I can live with that.
                                        optionsPanelButton[i].Button:SetMouseVisible(false)
                                        
                                optionsPanelButton[i].SizeChanged=function()
                                        optionsPanelButton[i].Button:SetSize(optionsPanelButton[i]:GetWidth(),22)
                                        optionsPanelButton[i].quickslot:SetSize(optionsPanelButton[i].Button:GetWidth(),20)
                                end
                                
                                optionsPanelButton[i]:SetSize(optionsPanelButton[i]:GetWidth(),22)
                                        
                                optionsPanel.ListBox:AddItem(optionsPanelButton[i])
                                height=height+optionsPanelButton[i]:GetHeight()
                        end
                        
                optionsPanel.ListBox:SetSize(optionsPanel:GetWidth(),height)
                        
                optionsPanel.SizeChanged = function( sender, args )
                        optionsPanel.ListBox:SetWidth(optionsPanel:GetWidth())
                        for i=1,optionsPanel.ListBox:GetItemCount() do
                                optionsPanel.ListBox:GetItem(i):SetWidth(optionsPanel:GetWidth())
                        end
                end
                
                return optionsPanel
        end

Compare with Previous | Blame


All times are GMT -5. The time now is 08:33 PM.


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