-
Notifications
You must be signed in to change notification settings - Fork 5
/
ImprovedTalentLoadoutsCreateDialog.lua
56 lines (42 loc) · 1.62 KB
/
ImprovedTalentLoadoutsCreateDialog.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
local addonName, TalentLoadouts = ...
ImprovedTalentLoadoutsCreateDialogMixin = {};
function ImprovedTalentLoadoutsCreateDialogMixin:OnLoad()
self.exclusive = true;
self.AcceptButton:SetOnClickHandler(GenerateClosure(self.OnAccept, self));
self.CancelButton:SetOnClickHandler(GenerateClosure(self.OnCancel, self));
ImprovedTalentLoadoutsDialogMixin.OnLoad(self);
end
function ImprovedTalentLoadoutsCreateDialogMixin:UpdateAcceptButtonEnabledState()
local nameTextFilled = self.NameControl:HasText();
self.AcceptButton:SetEnabled(nameTextFilled);
end
function ImprovedTalentLoadoutsCreateDialogMixin:OnTextChanged()
self:UpdateAcceptButtonEnabledState();
end
function ImprovedTalentLoadoutsCreateDialogMixin:OnAccept()
if self.AcceptButton:IsEnabled() then
local loadoutName = self.NameControl:GetText();
StaticPopupSpecial_Hide(self);
self.acceptCallback(loadoutName);
end
end
function ImprovedTalentLoadoutsCreateDialogMixin:OnCancel()
StaticPopupSpecial_Hide(self);
end
function ImprovedTalentLoadoutsCreateDialogMixin:ShowDialog()
StaticPopupSpecial_Show(self);
end
ImprovedTalentLoadoutsCreateDialogNameControlMixin = {};
function ImprovedTalentLoadoutsCreateDialogNameControlMixin:OnShow()
ImprovedTalentLoadoutsDialogNameControlMixin.OnShow(self);
self:GetEditBox():SetFocus();
end
function ImprovedTalentLoadoutsCreateDialogNameControlMixin:OnEnterPressed()
self:GetParent():OnAccept();
end
function ImprovedTalentLoadoutsCreateDialogNameControlMixin:OnEscapePressed()
self:GetParent():OnCancel();
end
function ImprovedTalentLoadoutsCreateDialogNameControlMixin:OnTextChanged()
self:GetParent():OnTextChanged();
end