lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [trunk/] [JackdawPlugins/] [SortPack/] [OptionPanel.lua] - Blame information for rev 138

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 135 MrJackdaw-1942
--Option Panel
2 MrJackdaw-1942
 
3 136 MrJackdaw-1942
--[[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.]]
4 MrJackdaw-1942
 
5 135 MrJackdaw-1942
if plugin==nil then plugin=Plugins["SortPackLoad"] end --This line can probably disappear on monday!
6 MrJackdaw-1942
 
7 MrJackdaw-1942
        plugin.GetOptionsPanel = function( self )
8 MrJackdaw-1942
                optionsPanel = Turbine.UI.Control()
9 MrJackdaw-1942
                optionsPanel:SetSize( 200, 600 )
10 MrJackdaw-1942
 
11 MrJackdaw-1942
                optionsPanel.ListBox=Turbine.UI.ListBox()
12 MrJackdaw-1942
                optionsPanel.ListBox:SetParent(optionsPanel)
13 MrJackdaw-1942
 
14 138 MrJackdaw-1942
                local options={
15 MrJackdaw-1942
                                [1] =
16 MrJackdaw-1942
                                {
17 MrJackdaw-1942
                                        ["Text"] = "Sort the pack",
18 MrJackdaw-1942
                                        ["Command"] = "sort"
19 MrJackdaw-1942
                                },
20 MrJackdaw-1942
                                [2] =
21 MrJackdaw-1942
                                {
22 MrJackdaw-1942
                                        ["Text"] = "Open the SortBag",
23 MrJackdaw-1942
                                        ["Command"] = "openbag"
24 MrJackdaw-1942
                                },
25 MrJackdaw-1942
                                [3] =
26 MrJackdaw-1942
                                {
27 MrJackdaw-1942
                                        ["Text"] = "Open the Sort Options",
28 MrJackdaw-1942
                                        ["Command"] = "sortoption"
29 MrJackdaw-1942
                                },
30 MrJackdaw-1942
                                [4] =
31 MrJackdaw-1942
                                {
32 MrJackdaw-1942
                                        ["Text"] = "Create/Edit custom Categories",
33 MrJackdaw-1942
                                        ["Command"] = "SortCat"
34 MrJackdaw-1942
                                },
35 MrJackdaw-1942
                                [5] =
36 MrJackdaw-1942
                                {
37 MrJackdaw-1942
                                        ["Text"] = "Open the Sort Debug window",
38 MrJackdaw-1942
                                        ["Command"] = "SortDebug"
39 MrJackdaw-1942
                                },
40 MrJackdaw-1942
                                [6] =
41 MrJackdaw-1942
                                {
42 MrJackdaw-1942
                                        ["Text"] = "Show/Hide Counter",
43 MrJackdaw-1942
                                        ["Command"] = "SortCounter"
44 MrJackdaw-1942
                                }
45 MrJackdaw-1942
                                }
46 135 MrJackdaw-1942
 
47 MrJackdaw-1942
                        local optionsPanelButton={}
48 MrJackdaw-1942
                        local height=0
49 MrJackdaw-1942
 
50 MrJackdaw-1942
                        for i=1,#options do
51 MrJackdaw-1942
 
52 MrJackdaw-1942
                        optionsPanelButton[i] = Turbine.UI.Control()
53 MrJackdaw-1942
 
54 MrJackdaw-1942
                                optionsPanelButton[i].shortcut = Turbine.UI.Lotro.Shortcut()
55 MrJackdaw-1942
                                        optionsPanelButton[i].shortcut:SetType(Turbine.UI.Lotro.ShortcutType.Alias)
56 MrJackdaw-1942
                                        optionsPanelButton[i].shortcut:SetData("/"..options[i].Command)
57 MrJackdaw-1942
 
58 138 MrJackdaw-1942
                                optionsPanelButton[i].quickslot=Turbine.UI.Lotro.Quickslot()
59 135 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetParent(optionsPanelButton[i])
60 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetShortcut(optionsPanelButton[i].shortcut)
61 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetVisible(true)
62 138 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetOpacity(0)
63 135 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetUseOnRightClick(false)
64 MrJackdaw-1942
 
65 MrJackdaw-1942
                                optionsPanelButton[i].Button=Turbine.UI.Lotro.Button()
66 MrJackdaw-1942
                                        optionsPanelButton[i].Button:SetParent(optionsPanelButton[i])
67 138 MrJackdaw-1942
                                        optionsPanelButton[i].Button:SetBackColor(Turbine.UI.Color(1,0,0,0))
68 135 MrJackdaw-1942
                                        optionsPanelButton[i].Button:SetText(options[i].Text)
69 MrJackdaw-1942
                                        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.
70 MrJackdaw-1942
                                        optionsPanelButton[i].Button:SetMouseVisible(false)
71 MrJackdaw-1942
 
72 MrJackdaw-1942
                                optionsPanelButton[i].SizeChanged=function()
73 MrJackdaw-1942
                                        optionsPanelButton[i].Button:SetSize(optionsPanelButton[i]:GetWidth(),22)
74 MrJackdaw-1942
                                        optionsPanelButton[i].quickslot:SetSize(optionsPanelButton[i].Button:GetWidth(),20)
75 MrJackdaw-1942
                                end
76 MrJackdaw-1942
 
77 MrJackdaw-1942
                                optionsPanelButton[i]:SetSize(optionsPanelButton[i]:GetWidth(),22)
78 MrJackdaw-1942
 
79 MrJackdaw-1942
                                optionsPanel.ListBox:AddItem(optionsPanelButton[i])
80 MrJackdaw-1942
                                height=height+optionsPanelButton[i]:GetHeight()
81 MrJackdaw-1942
                        end
82 MrJackdaw-1942
 
83 MrJackdaw-1942
                optionsPanel.ListBox:SetSize(optionsPanel:GetWidth(),height)
84 MrJackdaw-1942
 
85 MrJackdaw-1942
                optionsPanel.SizeChanged = function( sender, args )
86 MrJackdaw-1942
                        optionsPanel.ListBox:SetWidth(optionsPanel:GetWidth())
87 MrJackdaw-1942
                        for i=1,optionsPanel.ListBox:GetItemCount() do
88 MrJackdaw-1942
                                optionsPanel.ListBox:GetItem(i):SetWidth(optionsPanel:GetWidth())
89 MrJackdaw-1942
                        end
90 MrJackdaw-1942
                end
91 MrJackdaw-1942
 
92 MrJackdaw-1942
                return optionsPanel
93 136 MrJackdaw-1942
        end

All times are GMT -5. The time now is 06:21 PM.


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