Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/panel.lua @ 18:680465749fc7
- framework update.
| author | Tercio |
|---|---|
| date | Fri, 26 Jun 2015 14:03:10 -0300 |
| parents | 0c160948ac5e |
| children | 215f0dd37a6c |
comparison
equal
deleted
inserted
replaced
| 17:0c160948ac5e | 18:680465749fc7 |
|---|---|
| 1 | |
| 2 | |
| 3 | 1 |
| 4 local DF = _G ["DetailsFramework"] | 2 local DF = _G ["DetailsFramework"] |
| 5 local _ | 3 local _ |
| 4 | |
| 5 if (not DF) then -- or not DetailsFrameWorkLoadValid | |
| 6 return | |
| 7 end | |
| 6 | 8 |
| 7 --> lua locals | 9 --> lua locals |
| 8 local _rawset = rawset --> lua local | 10 local _rawset = rawset --> lua local |
| 9 local _rawget = rawget --> lua local | 11 local _rawget = rawget --> lua local |
| 10 local _setmetatable = setmetatable --> lua local | 12 local _setmetatable = setmetatable --> lua local |
| 1333 end | 1335 end |
| 1334 | 1336 |
| 1335 function DF:SavePositionOnScreen (frame) | 1337 function DF:SavePositionOnScreen (frame) |
| 1336 if (frame.db and frame.db.position) then | 1338 if (frame.db and frame.db.position) then |
| 1337 local x, y = DF:GetPositionOnScreen (frame) | 1339 local x, y = DF:GetPositionOnScreen (frame) |
| 1340 --print ("saving...", x, y, frame:GetName()) | |
| 1338 frame.db.position.x, frame.db.position.y = x, y | 1341 frame.db.position.x, frame.db.position.y = x, y |
| 1339 end | 1342 end |
| 1340 end | 1343 end |
| 1341 | 1344 |
| 1342 function DF:GetPositionOnScreen (frame) | 1345 function DF:GetPositionOnScreen (frame) |
| 1357 frame:ClearAllPoints() | 1360 frame:ClearAllPoints() |
| 1358 frame:SetPoint ("center", UIParent, "center", frame.db.position.x * UIscale / scale, frame.db.position.y * UIscale / scale) | 1361 frame:SetPoint ("center", UIParent, "center", frame.db.position.x * UIscale / scale, frame.db.position.y * UIscale / scale) |
| 1359 end | 1362 end |
| 1360 end | 1363 end |
| 1361 | 1364 |
| 1365 local Panel1PxHasPosition = function (self) | |
| 1366 local db = self.db | |
| 1367 if (db) then | |
| 1368 if (db.position and db.position.x and (db.position.x ~= 0 or db.position.y ~= 0)) then | |
| 1369 return true | |
| 1370 end | |
| 1371 end | |
| 1372 end | |
| 1373 | |
| 1362 function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame) | 1374 function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame) |
| 1363 local f = CreateFrame ("frame", name, parent or UIParent) | 1375 local f = CreateFrame ("frame", name, parent or UIParent) |
| 1364 f:SetSize (w or 100, h or 75) | 1376 f:SetSize (w or 100, h or 75) |
| 1365 f:SetPoint ("center", UIParent, "center") | 1377 f:SetPoint ("center", UIParent, "center") |
| 1366 | 1378 |
| 1378 f:SetMovable (true) | 1390 f:SetMovable (true) |
| 1379 f:EnableMouse (true) | 1391 f:EnableMouse (true) |
| 1380 f:SetUserPlaced (true) | 1392 f:SetUserPlaced (true) |
| 1381 | 1393 |
| 1382 f.db = config | 1394 f.db = config |
| 1395 --print (config.position.x, config.position.x) | |
| 1383 Panel1PxReadConfig (f) | 1396 Panel1PxReadConfig (f) |
| 1384 | 1397 |
| 1385 local close = CreateFrame ("button", name and name .. "CloseButton", f) | 1398 local close = CreateFrame ("button", name and name .. "CloseButton", f) |
| 1386 close:SetSize (16, 16) | 1399 close:SetSize (16, 16) |
| 1387 close:SetNormalTexture (DF.folder .. "icons") | 1400 close:SetNormalTexture (DF.folder .. "icons") |
| 1424 | 1437 |
| 1425 f.SetTitle = Panel1PxSetTitle | 1438 f.SetTitle = Panel1PxSetTitle |
| 1426 f.Title = title_string | 1439 f.Title = title_string |
| 1427 f.Lock = lock | 1440 f.Lock = lock |
| 1428 f.Close = close | 1441 f.Close = close |
| 1442 f.HasPosition = Panel1PxHasPosition | |
| 1429 | 1443 |
| 1430 f.IsLocked = not f.IsLocked | 1444 f.IsLocked = not f.IsLocked |
| 1431 Panel1PxOnToggleLock (f) | 1445 Panel1PxOnToggleLock (f) |
| 1432 | 1446 |
| 1433 return f | 1447 return f |
