Mercurial > wow > askmrrobot
comparison ui/AmrUiTextarea.lua @ 61:cf2b6b9a8337 v23
6.2 update, shopping list bug fixes, ui scale option
| author | yellowfive |
|---|---|
| date | Tue, 23 Jun 2015 00:27:21 -0700 |
| parents | 01b63b8ed811 |
| children | 0515882856f1 |
comparison
equal
deleted
inserted
replaced
| 60:017c05f42fd4 | 61:cf2b6b9a8337 |
|---|---|
| 58 self:SetCursorPosition(self:GetNumLetters()) | 58 self:SetCursorPosition(self:GetNumLetters()) |
| 59 self = self.obj | 59 self = self.obj |
| 60 self:Fire("OnTextSet", self.editbox:GetText()) | 60 self:Fire("OnTextSet", self.editbox:GetText()) |
| 61 end | 61 end |
| 62 | 62 |
| 63 local function editboxEnterPressed(self) | |
| 64 self.obj:Fire("OnEnterPressed") | |
| 65 end | |
| 66 | |
| 63 -- works for both the scrollframe and the editbox, handles e.g. dragging a spell link into the textarea | 67 -- works for both the scrollframe and the editbox, handles e.g. dragging a spell link into the textarea |
| 64 local function onReceiveDrag(self) | 68 local function onReceiveDrag(self) |
| 65 local type, id, info = GetCursorInfo() | 69 local type, id, info = GetCursorInfo() |
| 66 if type == "spell" then | 70 if type == "spell" then |
| 67 info = GetSpellInfo(id, info) | 71 info = GetSpellInfo(id, info) |
| 84 local methods = { | 88 local methods = { |
| 85 ["OnAcquire"] = function(self) | 89 ["OnAcquire"] = function(self) |
| 86 -- restore default values | 90 -- restore default values |
| 87 self:SetWidth(200) | 91 self:SetWidth(200) |
| 88 self:SetHeight(24) | 92 self:SetHeight(24) |
| 93 self:SetMultiLine(true) | |
| 89 self:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.Text)) | 94 self:SetFont(Amr.CreateFont("Regular", 16, Amr.Colors.Text)) |
| 90 self:SetText("") | 95 self:SetText("") |
| 91 self.frame:ClearAllPoints() | 96 self.frame:ClearAllPoints() |
| 92 end, | 97 end, |
| 93 | 98 |
| 120 self.editbox:SetHeight(height) | 125 self.editbox:SetHeight(height) |
| 121 end, | 126 end, |
| 122 | 127 |
| 123 ["ClearFocus"] = function(self) | 128 ["ClearFocus"] = function(self) |
| 124 self.editbox:ClearFocus() | 129 self.editbox:ClearFocus() |
| 130 self.editbox:HighlightText(0, 0) | |
| 125 self.frame:SetScript("OnShow", nil) | 131 self.frame:SetScript("OnShow", nil) |
| 132 end, | |
| 133 | |
| 134 ["SetMultiLine"] = function(self, multi) | |
| 135 self.editbox:SetMultiLine(multi) | |
| 126 end, | 136 end, |
| 127 | 137 |
| 128 ["SetFocus"] = function(self, highlight) | 138 ["SetFocus"] = function(self, highlight) |
| 129 self.editbox:SetFocus() | 139 self.editbox:SetFocus() |
| 130 if highlight then | 140 if highlight then |
| 165 editbox:SetScript("OnMouseDown", onReceiveDrag) | 175 editbox:SetScript("OnMouseDown", onReceiveDrag) |
| 166 editbox:SetScript("OnReceiveDrag", onReceiveDrag) | 176 editbox:SetScript("OnReceiveDrag", onReceiveDrag) |
| 167 | 177 |
| 168 editbox:SetScript("OnCursorChanged", editboxCursorChanged) | 178 editbox:SetScript("OnCursorChanged", editboxCursorChanged) |
| 169 editbox:SetScript("OnEscapePressed", editbox.ClearFocus) | 179 editbox:SetScript("OnEscapePressed", editbox.ClearFocus) |
| 180 editbox:SetScript("OnEnterPressed", editboxEnterPressed) | |
| 170 editbox:SetScript("OnEditFocusLost", editboxEditFocusLost) | 181 editbox:SetScript("OnEditFocusLost", editboxEditFocusLost) |
| 171 editbox:SetScript("OnTextChanged", editboxTextChanged) | 182 editbox:SetScript("OnTextChanged", editboxTextChanged) |
| 172 editbox:SetScript("OnTextSet", editboxTextSet) | 183 editbox:SetScript("OnTextSet", editboxTextSet) |
| 173 editbox:SetScript("OnEditFocusGained", editboxEditFocusGained) | 184 editbox:SetScript("OnEditFocusGained", editboxEditFocusGained) |
| 174 | 185 |
