3 local TourGuide
= TourGuide
4 local OptionHouse
= LibStub("OptionHouse-1.1")
5 local ww
= WidgetWarlock
9 local NUMROWS
, COLWIDTH
= 16, 210
10 local ROWHEIGHT
= 305/NUMROWS
18 local function OnShow(self
)
19 TourGuide
:UpdateGuidesPanel()
22 self
:SetScript("OnUpdate", ww
.FadeIn
)
26 local function OnClick(self
)
27 local text
= self
.text
:GetText()
28 if not text
then self
:SetChecked(false)
30 TourGuide
:LoadGuide(text
)
31 TourGuide
:UpdateGuidesPanel()
32 TourGuide
:UpdateStatusFrame()
37 function TourGuide
:CreateGuidesPanel()
38 frame
= CreateFrame("Frame", nil, UIParent
)
42 local anchor
, point
= rows
[i
-1], "BOTTOMLEFT"
43 if i
== 1 then anchor
, point
= frame
, "TOPLEFT"
44 elseif i
== (NUMROWS
+ 1) then anchor
, point
= rows
[1], "TOPRIGHT"
45 elseif i
== (NUMROWS
*2 + 1) then anchor
, point
= rows
[NUMROWS
+ 1], "TOPRIGHT" end
47 local row
= CreateFrame("CheckButton", nil, frame
)
48 row
:SetPoint("TOPLEFT", anchor
, point
)
49 row
:SetHeight(ROWHEIGHT
)
50 row
:SetWidth(COLWIDTH
)
52 local highlight
= ww
.SummonTexture(row
, nil, nil, nil, "Interface\\HelpFrame\\HelpFrameButton-Highlight")
53 highlight
:SetTexCoord(0, 1, 0, 0.578125)
54 highlight
:SetAllPoints()
55 row
:SetHighlightTexture(highlight
)
56 row
:SetCheckedTexture(highlight
)
58 local text
= ww
.SummonFontString(row
, nil, "GameFontNormal", nil, "LEFT", 6, 0)
60 row
:SetScript("OnClick", OnClick
)
66 frame
:EnableMouseWheel()
67 frame
:SetScript("OnMouseWheel", function(f
, val
)
68 offset
= offset
- val
*NUMROWS
69 if (offset
+ NUMROWS
*2) > #self
.guidelist
then offset
= offset
- NUMROWS
end
70 if offset
< 0 then offset
= 0 end
71 self
:UpdateGuidesPanel()
74 frame
:SetScript("OnShow", OnShow
)
75 ww
.SetFadeTime(frame
, 0.5)
81 function TourGuide
:UpdateGuidesPanel()
82 if not frame
or not frame
:IsVisible() then return end
83 for i
,row
in ipairs(rows
) do
86 local name
= self
.guidelist
[i
+ offset
]
88 row
.text
:SetText(name
)
89 row
:SetChecked(self
.db
.char
.currentguide
== name
)