ESOUI SVN ZAMStats

[/] [trunk/] [ZAM_Stats/] [libs/] [LibAddonMenu-2.0/] [controls/] [exampleoptions.lua] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 Seerah-7
local panelData = {
2 Seerah-7
        type = "panel",
3 Seerah-7
        name = "Window Title",
4 Seerah-7
        slashCommand = "/myaddon",      --(optional) will register a keybind to open to this panel
5 Seerah-7
        registerForRefresh = true,      --boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown)
6 Seerah-7
        registerForDefaults = true,     --boolean (optional) (will set all options controls back to default values)
7 Seerah-7
}
8 Seerah-7
 
9 Seerah-7
local optionsTable = {
10 Seerah-7
        [1] = {
11 Seerah-7
                type = "header",
12 Seerah-7
                name = "My Header",
13 Seerah-7
                width = "full", --or "half" (optional)
14 Seerah-7
        },
15 Seerah-7
        [2] = {
16 Seerah-7
                type = "description",
17 Seerah-7
                --title = "My Title",   --(optional)
18 Seerah-7
                title = nil,    --(optional)
19 Seerah-7
                text = "My description text to display. blah blah blah blah blah blah blah - even more sample text!!",
20 Seerah-7
                width = "full", --or "half" (optional)
21 Seerah-7
        },
22 Seerah-7
        [3] = {
23 Seerah-7
                type = "dropdown",
24 Seerah-7
                name = "My Dropdown",
25 Seerah-7
                tooltip = "Dropdown's tooltip text.",
26 Seerah-7
                choices = {"table", "of", "choices"},
27 Seerah-7
                getFunc = function() return "of" end,
28 Seerah-7
                setFunc = function(var) print(var) end,
29 Seerah-7
                width = "half", --or "half" (optional)
30 Seerah-7
                warning = "Will need to reload the UI.",        --(optional)
31 Seerah-7
        },
32 Seerah-7
        [4] = {
33 Seerah-7
                type = "dropdown",
34 Seerah-7
                name = "My Dropdown",
35 Seerah-7
                tooltip = "Dropdown's tooltip text.",
36 Seerah-7
                choices = {"table", "of", "choices"},
37 Seerah-7
                getFunc = function() return "of" end,
38 Seerah-7
                setFunc = function(var) print(var) end,
39 Seerah-7
                width = "half", --or "half" (optional)
40 Seerah-7
                warning = "Will need to reload the UI.",        --(optional)
41 Seerah-7
        },
42 Seerah-7
        [5] = {
43 Seerah-7
                type = "slider",
44 Seerah-7
                name = "My Slider",
45 Seerah-7
                tooltip = "Slider's tooltip text.",
46 Seerah-7
                min = 0,
47 Seerah-7
                max = 20,
48 Seerah-7
                step = 1,       --(optional)
49 Seerah-7
                getFunc = function() return 3 end,
50 Seerah-7
                setFunc = function(value) d(value) end,
51 Seerah-7
                width = "half", --or "half" (optional)
52 Seerah-7
                default = 5,    --(optional)
53 Seerah-7
        },
54 Seerah-7
        [6] = {
55 Seerah-7
                type = "button",
56 Seerah-7
                name = "My Button",
57 Seerah-7
                tooltip = "Button's tooltip text.",
58 Seerah-7
                func = function() d("button pressed!") end,
59 Seerah-7
                width = "half", --or "half" (optional)
60 Seerah-7
                warning = "Will need to reload the UI.",        --(optional)
61 Seerah-7
        },
62 Seerah-7
        [7] = {
63 Seerah-7
                type = "submenu",
64 Seerah-7
                name = "Submenu Title",
65 Seerah-7
                tooltip = "My submenu tooltip", --(optional)
66 Seerah-7
                controls = {
67 Seerah-7
                        [1] = {
68 Seerah-7
                                type = "checkbox",
69 Seerah-7
                                name = "My Checkbox",
70 Seerah-7
                                tooltip = "Checkbox's tooltip text.",
71 Seerah-7
                                getFunc = function() return true end,
72 Seerah-7
                                setFunc = function(value) d(value) end,
73 Seerah-7
                                width = "half", --or "half" (optional)
74 Seerah-7
                                warning = "Will need to reload the UI.",        --(optional)
75 Seerah-7
                        },
76 Seerah-7
                        [2] = {
77 Seerah-7
                                type = "colorpicker",
78 Seerah-7
                                name = "My Color Picker",
79 Seerah-7
                                tooltip = "Color Picker's tooltip text.",
80 Seerah-7
                                getFunc = function() return 1, 0, 0, 1 end,     --(alpha is optional)
81 Seerah-7
                                setFunc = function(r,g,b,a) print(r, g, b, a) end,      --(alpha is optional)
82 Seerah-7
                                width = "half", --or "half" (optional)
83 Seerah-7
                                warning = "warning text",
84 Seerah-7
                        },
85 Seerah-7
                        [3] = {
86 Seerah-7
                                type = "editbox",
87 Seerah-7
                                name = "My Editbox",
88 Seerah-7
                                tooltip = "Editbox's tooltip text.",
89 Seerah-7
                                getFunc = function() return "this is some text" end,
90 Seerah-7
                                setFunc = function(text) print(text) end,
91 Seerah-7
                                isMultiline = false,    --boolean
92 Seerah-7
                                width = "half", --or "half" (optional)
93 Seerah-7
                                warning = "Will need to reload the UI.",        --(optional)
94 Seerah-7
                                default = "",   --(optional)
95 Seerah-7
                        },
96 Seerah-7
                },
97 Seerah-7
        },
98 Seerah-7
        [8] = {
99 Seerah-7
                type = "custom",
100 Seerah-7
                reference = "MyAddonCustomControl",     --unique name for your control to use as reference
101 Seerah-7
                width = "half", --or "half" (optional)
102 Seerah-7
        },
103 Seerah-7
        [9] = {
104 Seerah-7
                type = "texture",
105 Seerah-7
                image = "EsoUI\\Art\\ActionBar\\abilityframe64_up.dds",
106 Seerah-7
                imageWidth = 64,        --max of 250 for half width, 510 for full
107 Seerah-7
                imageHeight = 64,       --max of 100
108 Seerah-7
                tooltip = "Image's tooltip text.",      --(optional)
109 Seerah-7
                width = "half", --or "half" (optional)
110 Seerah-7
        },
111 Seerah-7
}
112 Seerah-7
 
113 Seerah-7
local LAM = LibStub("LibAddonMenu-2.0")
114 Seerah-7
LAM:RegisterAddonPanel("MyAddon", panelData)
115 Seerah-7
LAM:RegisterOptionControls("MyAddon", optionsTable)