comparison Libs/DF/panel.lua @ 17:0c160948ac5e

- ToC Update.
author Tercio
date Tue, 23 Jun 2015 14:16:13 -0300
parents f635adb94909
children 680465749fc7
comparison
equal deleted inserted replaced
16:d5c8e2c42e04 17:0c160948ac5e
649 else 649 else
650 row.row_widgets [i]:SetText (results [i]) 650 row.row_widgets [i]:SetText (results [i])
651 end 651 end
652 652
653 else 653 else
654 --< text 654 --> text
655 row.row_widgets [i]:SetText (results [i]) 655 row.row_widgets [i]:SetText (results [i])
656 if (panel.rows [i].type == "entry") then
657 row.row_widgets [i]:SetCursorPosition (0)
658 end
656 659
657 end 660 end
658 end 661 end
659 662
660 else 663 else
678 end 681 end
679 end 682 end
680 683
681 function panel:Refresh() 684 function panel:Refresh()
682 local filled_lines = total_lines() 685 local filled_lines = total_lines()
683 local scroll_total_lines = #panel.scrollframe 686 local scroll_total_lines = #panel.scrollframe.lines
684 local line_height = options.rowheight 687 local line_height = options.rowheight
685 688
686 FauxScrollFrame_Update (panel.scrollframe, filled_lines, scroll_total_lines, line_height) 689 FauxScrollFrame_Update (panel.scrollframe, filled_lines, scroll_total_lines, line_height)
687 refresh_fillbox (panel.scrollframe) 690 refresh_fillbox (panel.scrollframe)
688 end 691 end
702 local amount = math.floor (((h-21) / size)) 705 local amount = math.floor (((h-21) / size))
703 706
704 707
705 for i = 1, amount do 708 for i = 1, amount do
706 709
707 local row = DF:NewPanel (parent, nil, "$parentRow_" .. i, nil, 1, size) 710 local row = DF:NewPanel (panel, nil, "$parentRow_" .. i, nil, 1, size)
708 row.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]]} 711 row.backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]]}
709 row.color = {1, 1, 1, .2} 712 row.color = {1, 1, 1, .2}
710 row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1) 713 row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1)
711 row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1) 714 row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1)
712 tinsert (scrollframe.lines, row) 715 tinsert (scrollframe.lines, row)
1212 self:StopMovingOrSizing() 1215 self:StopMovingOrSizing()
1213 if (self.db and self.db.position) then 1216 if (self.db and self.db.position) then
1214 DF:SavePositionOnScreen (self) 1217 DF:SavePositionOnScreen (self)
1215 end 1218 end
1216 end 1219 end
1217 self:Hide() 1220 if (not self.DontRightClickClose) then
1221 self:Hide()
1222 end
1218 return 1223 return
1219 end 1224 end
1220 if (not self.IsMoving and not self.IsLocked) then 1225 if (not self.IsMoving and not self.IsLocked) then
1221 self.IsMoving = true 1226 self.IsMoving = true
1222 self:StartMoving() 1227 self:StartMoving()
1286 self:SetMovable (true) 1291 self:SetMovable (true)
1287 self:EnableMouse (true) 1292 self:EnableMouse (true)
1288 self.Lock:GetNormalTexture():SetTexCoord (32/128, 48/128, 0, 1) 1293 self.Lock:GetNormalTexture():SetTexCoord (32/128, 48/128, 0, 1)
1289 self.Lock:GetHighlightTexture():SetTexCoord (32/128, 48/128, 0, 1) 1294 self.Lock:GetHighlightTexture():SetTexCoord (32/128, 48/128, 0, 1)
1290 self.Lock:GetPushedTexture():SetTexCoord (32/128, 48/128, 0, 1) 1295 self.Lock:GetPushedTexture():SetTexCoord (32/128, 48/128, 0, 1)
1296 if (self.OnUnlock) then
1297 self:OnUnlock()
1298 end
1299 if (self.db) then
1300 self.db.IsLocked = self.IsLocked
1301 end
1291 else 1302 else
1292 self.IsLocked = true 1303 self.IsLocked = true
1293 self:SetMovable (false) 1304 self:SetMovable (false)
1294 self:EnableMouse (false) 1305 self:EnableMouse (false)
1295 self.Lock:GetNormalTexture():SetTexCoord (16/128, 32/128, 0, 1) 1306 self.Lock:GetNormalTexture():SetTexCoord (16/128, 32/128, 0, 1)
1296 self.Lock:GetHighlightTexture():SetTexCoord (16/128, 32/128, 0, 1) 1307 self.Lock:GetHighlightTexture():SetTexCoord (16/128, 32/128, 0, 1)
1297 self.Lock:GetPushedTexture():SetTexCoord (16/128, 32/128, 0, 1) 1308 self.Lock:GetPushedTexture():SetTexCoord (16/128, 32/128, 0, 1)
1309 if (self.OnLock) then
1310 self:OnLock()
1311 end
1312 if (self.db) then
1313 self.db.IsLocked = self.IsLocked
1314 end
1298 end 1315 end
1299 end 1316 end
1300 local Panel1PxOnClickLock = function (self) 1317 local Panel1PxOnClickLock = function (self)
1301 local f = self:GetParent() 1318 local f = self:GetParent()
1302 Panel1PxOnToggleLock (f) 1319 Panel1PxOnToggleLock (f)
1355 f:SetScript ("OnMouseUp", simple_panel_mouse_up) 1372 f:SetScript ("OnMouseUp", simple_panel_mouse_up)
1356 1373
1357 f:SetBackdrop (Panel1PxBackdrop) 1374 f:SetBackdrop (Panel1PxBackdrop)
1358 f:SetBackdropColor (0, 0, 0, 0.5) 1375 f:SetBackdropColor (0, 0, 0, 0.5)
1359 1376
1360 f.IsLocked = false 1377 f.IsLocked = (config and config.IsLocked ~= nil and config.IsLocked) or false
1361 f:SetMovable (true) 1378 f:SetMovable (true)
1362 f:EnableMouse (true) 1379 f:EnableMouse (true)
1363 f:SetUserPlaced (true) 1380 f:SetUserPlaced (true)
1364 1381
1365 f.db = config 1382 f.db = config
1407 1424
1408 f.SetTitle = Panel1PxSetTitle 1425 f.SetTitle = Panel1PxSetTitle
1409 f.Title = title_string 1426 f.Title = title_string
1410 f.Lock = lock 1427 f.Lock = lock
1411 f.Close = close 1428 f.Close = close
1429
1430 f.IsLocked = not f.IsLocked
1431 Panel1PxOnToggleLock (f)
1412 1432
1413 return f 1433 return f
1414 end 1434 end
1415 1435
1416 ------------------------------------------------------------------------------------------------------------------------------------------------ 1436 ------------------------------------------------------------------------------------------------------------------------------------------------