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