Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/panel.lua @ 53:36b4d9559b69 v7.3.0.053
- framework update.
| author | Tercio |
|---|---|
| date | Sat, 14 Oct 2017 17:09:17 -0300 |
| parents | 7d5934415ad0 |
| children | 307f5af3ad02 |
comparison
equal
deleted
inserted
replaced
| 52:20225ee9762c | 53:36b4d9559b69 |
|---|---|
| 1221 DF.IconPickFrame:SetPoint ("center", UIParent, "center") | 1221 DF.IconPickFrame:SetPoint ("center", UIParent, "center") |
| 1222 DF.IconPickFrame:SetWidth (350) | 1222 DF.IconPickFrame:SetWidth (350) |
| 1223 DF.IconPickFrame:SetHeight (227) | 1223 DF.IconPickFrame:SetHeight (227) |
| 1224 DF.IconPickFrame:EnableMouse (true) | 1224 DF.IconPickFrame:EnableMouse (true) |
| 1225 DF.IconPickFrame:SetMovable (true) | 1225 DF.IconPickFrame:SetMovable (true) |
| 1226 DF.IconPickFrame:SetBackdrop ({bgFile = DF.folder .. "background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", | 1226 |
| 1227 tile = true, tileSize = 32, edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}}) | 1227 DF.IconPickFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) |
| 1228 | 1228 |
| 1229 DF.IconPickFrame:SetBackdropBorderColor (170/255, 170/255, 170/255) | 1229 DF.IconPickFrame:SetBackdropBorderColor (0, 0, 0) |
| 1230 DF.IconPickFrame:SetBackdropColor (24/255, 24/255, 24/255, .8) | 1230 DF.IconPickFrame:SetBackdropColor (24/255, 24/255, 24/255, .8) |
| 1231 DF.IconPickFrame:SetFrameLevel (1) | 1231 DF.IconPickFrame:SetFrameLevel (1) |
| 1232 | |
| 1233 DF.IconPickFrame:SetScript ("OnMouseDown", function (self) | |
| 1234 if (not self.isMoving) then | |
| 1235 DF.IconPickFrame:StartMoving() | |
| 1236 self.isMoving = true | |
| 1237 end | |
| 1238 end) | |
| 1239 | |
| 1240 DF.IconPickFrame:SetScript ("OnMouseUp", function (self) | |
| 1241 if (self.isMoving) then | |
| 1242 DF.IconPickFrame:StopMovingOrSizing() | |
| 1243 self.isMoving = nil | |
| 1244 end | |
| 1245 end) | |
| 1232 | 1246 |
| 1233 DF.IconPickFrame.emptyFunction = function() end | 1247 DF.IconPickFrame.emptyFunction = function() end |
| 1234 DF.IconPickFrame.callback = DF.IconPickFrame.emptyFunction | 1248 DF.IconPickFrame.callback = DF.IconPickFrame.emptyFunction |
| 1235 | 1249 |
| 1236 DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent) | 1250 DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent) |
| 1265 close_button:SetHeight (32) | 1279 close_button:SetHeight (32) |
| 1266 close_button:SetPoint ("TOPRIGHT", DF.IconPickFrame, "TOPRIGHT", -8, -7) | 1280 close_button:SetPoint ("TOPRIGHT", DF.IconPickFrame, "TOPRIGHT", -8, -7) |
| 1267 close_button:SetFrameLevel (close_button:GetFrameLevel()+2) | 1281 close_button:SetFrameLevel (close_button:GetFrameLevel()+2) |
| 1268 | 1282 |
| 1269 local MACRO_ICON_FILENAMES = {} | 1283 local MACRO_ICON_FILENAMES = {} |
| 1284 local SPELLNAMES_CACHE = {} | |
| 1285 | |
| 1270 DF.IconPickFrame:SetScript ("OnShow", function() | 1286 DF.IconPickFrame:SetScript ("OnShow", function() |
| 1271 | 1287 |
| 1272 MACRO_ICON_FILENAMES = {}; | 1288 MACRO_ICON_FILENAMES [1] = "INV_MISC_QUESTIONMARK"; |
| 1273 MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK"; | |
| 1274 local index = 2; | 1289 local index = 2; |
| 1275 | 1290 |
| 1276 for i = 1, GetNumSpellTabs() do | 1291 for i = 1, GetNumSpellTabs() do |
| 1277 local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo(i); | 1292 local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo (i) |
| 1278 offset = offset + 1; | 1293 offset = offset + 1 |
| 1279 local tabEnd = offset + numSpells; | 1294 local tabEnd = offset + numSpells |
| 1295 | |
| 1280 for j = offset, tabEnd - 1 do | 1296 for j = offset, tabEnd - 1 do |
| 1281 --to get spell info by slot, you have to pass in a pet argument | 1297 --to get spell info by slot, you have to pass in a pet argument |
| 1282 local spellType, ID = GetSpellBookItemInfo(j, "player"); | 1298 local spellType, ID = GetSpellBookItemInfo (j, "player") |
| 1283 if (spellType ~= "FUTURESPELL") then | 1299 if (spellType ~= "FUTURESPELL") then |
| 1284 local spellTexture = strupper(GetSpellBookItemTexture(j, "player")); | 1300 MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture (j, "player") or 0 |
| 1285 if ( not string.match( spellTexture, "INTERFACE\\BUTTONS\\") ) then | 1301 index = index + 1; |
| 1286 MACRO_ICON_FILENAMES[index] = gsub( spellTexture, "INTERFACE\\ICONS\\", ""); | 1302 |
| 1287 index = index + 1; | 1303 elseif (spellType == "FLYOUT") then |
| 1288 end | 1304 local _, _, numSlots, isKnown = GetFlyoutInfo (ID) |
| 1289 end | |
| 1290 if (spellType == "FLYOUT") then | |
| 1291 local _, _, numSlots, isKnown = GetFlyoutInfo(ID); | |
| 1292 if (isKnown and numSlots > 0) then | 1305 if (isKnown and numSlots > 0) then |
| 1293 for k = 1, numSlots do | 1306 for k = 1, numSlots do |
| 1294 local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(ID, k) | 1307 local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo (ID, k) |
| 1295 if (isKnown) then | 1308 if (isKnown) then |
| 1296 MACRO_ICON_FILENAMES[index] = gsub( strupper(GetSpellTexture(spellID)), "INTERFACE\\ICONS\\", ""); | 1309 MACRO_ICON_FILENAMES [index] = GetSpellTexture (spellID) or 0 |
| 1297 index = index + 1; | 1310 index = index + 1; |
| 1298 end | 1311 end |
| 1299 end | 1312 end |
| 1300 end | 1313 end |
| 1314 | |
| 1301 end | 1315 end |
| 1302 end | 1316 end |
| 1303 end | 1317 end |
| 1304 | 1318 |
| 1305 GetLooseMacroItemIcons (MACRO_ICON_FILENAMES) | 1319 GetLooseMacroItemIcons (MACRO_ICON_FILENAMES) |
| 1306 GetLooseMacroIcons (MACRO_ICON_FILENAMES) | 1320 GetLooseMacroIcons (MACRO_ICON_FILENAMES) |
| 1307 GetMacroIcons (MACRO_ICON_FILENAMES) | 1321 GetMacroIcons (MACRO_ICON_FILENAMES) |
| 1308 GetMacroItemIcons (MACRO_ICON_FILENAMES ) | 1322 GetMacroItemIcons (MACRO_ICON_FILENAMES) |
| 1309 | 1323 |
| 1310 end) | 1324 end) |
| 1311 | 1325 |
| 1312 DF.IconPickFrame:SetScript ("OnHide", function() | 1326 DF.IconPickFrame:SetScript ("OnHide", function() |
| 1313 MACRO_ICON_FILENAMES = nil; | 1327 wipe (MACRO_ICON_FILENAMES) |
| 1314 collectgarbage() | 1328 collectgarbage() |
| 1315 end) | 1329 end) |
| 1316 | 1330 |
| 1317 DF.IconPickFrame.buttons = {} | 1331 DF.IconPickFrame.buttons = {} |
| 1318 | 1332 |
| 1452 local texture | 1466 local texture |
| 1453 local filter | 1467 local filter |
| 1454 if (DF.IconPickFrame.searching) then | 1468 if (DF.IconPickFrame.searching) then |
| 1455 filter = string_lower (DF.IconPickFrame.searching) | 1469 filter = string_lower (DF.IconPickFrame.searching) |
| 1456 end | 1470 end |
| 1471 | |
| 1472 local pool | |
| 1473 local shown = 0 | |
| 1457 | 1474 |
| 1458 if (filter and filter ~= "") then | 1475 if (filter and filter ~= "") then |
| 1459 | 1476 if (#SPELLNAMES_CACHE == 0) then |
| 1460 local ignored = 0 | 1477 --build name cache |
| 1461 local tryed = 0 | 1478 local GetSpellInfo = GetSpellInfo |
| 1462 local found = 0 | 1479 for i = 1, #MACRO_ICON_FILENAMES do |
| 1463 local type = type | 1480 local spellName = GetSpellInfo (MACRO_ICON_FILENAMES [i]) |
| 1464 local buttons = DF.IconPickFrame.buttons | 1481 SPELLNAMES_CACHE [i] = spellName or "NULL" |
| 1465 index = 1 | |
| 1466 | |
| 1467 for i = 1, 60 do | |
| 1468 | |
| 1469 macroPopupIcon = buttons[i].icon | |
| 1470 macroPopupButton = buttons[i] | |
| 1471 | |
| 1472 for o = index, numMacroIcons do | |
| 1473 | |
| 1474 tryed = tryed + 1 | |
| 1475 | |
| 1476 texture = MACRO_ICON_FILENAMES [o] | |
| 1477 if (type (texture) == "number") then | |
| 1478 macroPopupIcon:SetToFileData (texture) | |
| 1479 texture = macroPopupIcon:GetTexture() | |
| 1480 macroPopupIcon:SetTexture (nil) | |
| 1481 else | |
| 1482 texture = "INTERFACE\\ICONS\\" .. texture | |
| 1483 end | |
| 1484 | |
| 1485 if (texture and texture:find (filter)) then | |
| 1486 macroPopupIcon:SetTexture (texture) | |
| 1487 macroPopupButton:Show() | |
| 1488 found = found + 1 | |
| 1489 DF.IconPickFrame.last_filter_index = o | |
| 1490 index = o+1 | |
| 1491 break | |
| 1492 else | |
| 1493 ignored = ignored + 1 | |
| 1494 end | |
| 1495 | |
| 1496 end | 1482 end |
| 1497 end | 1483 end |
| 1484 | |
| 1485 --do the filter | |
| 1486 pool = {} | |
| 1487 for i = 1, #SPELLNAMES_CACHE do | |
| 1488 if (SPELLNAMES_CACHE [i]:find (filter)) then | |
| 1489 pool [#pool+1] = MACRO_ICON_FILENAMES [i] | |
| 1490 shown = shown + 1 | |
| 1491 end | |
| 1492 end | |
| 1493 else | |
| 1494 shown = nil | |
| 1495 end | |
| 1498 | 1496 |
| 1499 for o = found+1, 60 do | 1497 if (not pool) then |
| 1500 macroPopupButton = _G ["DetailsFrameworkIconPickFrameButton"..o] | 1498 pool = MACRO_ICON_FILENAMES |
| 1499 end | |
| 1500 | |
| 1501 for i = 1, 60 do | |
| 1502 macroPopupIcon = _G ["DetailsFrameworkIconPickFrameButton"..i.."Icon"] | |
| 1503 macroPopupButton = _G ["DetailsFrameworkIconPickFrameButton"..i] | |
| 1504 index = (macroPopupOffset * 10) + i | |
| 1505 texture = pool [index] | |
| 1506 if ( index <= numMacroIcons and texture ) then | |
| 1507 | |
| 1508 if (type (texture) == "number") then | |
| 1509 macroPopupIcon:SetTexture (texture) | |
| 1510 else | |
| 1511 macroPopupIcon:SetTexture ("INTERFACE\\ICONS\\" .. texture) | |
| 1512 end | |
| 1513 | |
| 1514 macroPopupIcon:SetTexCoord (4/64, 60/64, 4/64, 60/64) | |
| 1515 macroPopupButton.IconID = index | |
| 1516 macroPopupButton:Show() | |
| 1517 else | |
| 1501 macroPopupButton:Hide() | 1518 macroPopupButton:Hide() |
| 1502 end | 1519 end |
| 1503 else | |
| 1504 for i = 1, 60 do | |
| 1505 macroPopupIcon = _G ["DetailsFrameworkIconPickFrameButton"..i.."Icon"] | |
| 1506 macroPopupButton = _G ["DetailsFrameworkIconPickFrameButton"..i] | |
| 1507 index = (macroPopupOffset * 10) + i | |
| 1508 texture = MACRO_ICON_FILENAMES [index] | |
| 1509 if ( index <= numMacroIcons and texture ) then | |
| 1510 | |
| 1511 if (type (texture) == "number") then | |
| 1512 macroPopupIcon:SetToFileData (texture) | |
| 1513 else | |
| 1514 macroPopupIcon:SetTexture ("INTERFACE\\ICONS\\" .. texture) | |
| 1515 end | |
| 1516 | |
| 1517 macroPopupIcon:SetTexCoord (4/64, 60/64, 4/64, 60/64) | |
| 1518 macroPopupButton.IconID = index | |
| 1519 macroPopupButton:Show() | |
| 1520 else | |
| 1521 macroPopupButton:Hide() | |
| 1522 end | |
| 1523 end | |
| 1524 end | 1520 end |
| 1521 | |
| 1522 pool = nil | |
| 1525 | 1523 |
| 1526 -- Scrollbar stuff | 1524 -- Scrollbar stuff |
| 1527 FauxScrollFrame_Update (scroll, ceil (numMacroIcons / 10) , 5, 20 ) | 1525 FauxScrollFrame_Update (scroll, ceil ((shown or numMacroIcons) / 10) , 5, 20 ) |
| 1528 end | 1526 end |
| 1529 | 1527 |
| 1530 DF.IconPickFrame.updateFunc = ChecksFrame_Update | 1528 DF.IconPickFrame.updateFunc = ChecksFrame_Update |
| 1531 | 1529 |
| 1532 scroll:SetPoint ("topleft", DF.IconPickFrame, "topleft", -18, -37) | 1530 scroll:SetPoint ("topleft", DF.IconPickFrame, "topleft", -18, -37) |
| 3122 local spellicon = f:CreateTexture (nil, "artwork") | 3120 local spellicon = f:CreateTexture (nil, "artwork") |
| 3123 spellicon:SetPoint ("bottom", b, "bottom", 0, 10) | 3121 spellicon:SetPoint ("bottom", b, "bottom", 0, 10) |
| 3124 spellicon:SetSize (16, 16) | 3122 spellicon:SetSize (16, 16) |
| 3125 f.spellicon = spellicon | 3123 f.spellicon = spellicon |
| 3126 | 3124 |
| 3125 local text = f:CreateFontString (nil, "overlay", "GameFontNormal") | |
| 3126 local textBackground = f:CreateTexture (nil, "artwork") | |
| 3127 textBackground:SetSize (30, 16) | |
| 3128 textBackground:SetColorTexture (0, 0, 0, 0.5) | |
| 3129 textBackground:SetPoint ("bottom", f.ball, "top", 0, -6) | |
| 3130 text:SetPoint ("center", textBackground, "center") | |
| 3131 DF:SetFontSize (text, 10) | |
| 3132 f.text = text | |
| 3133 f.textBackground = textBackground | |
| 3134 | |
| 3127 local timeline = f:CreateFontString (nil, "overlay", "GameFontNormal") | 3135 local timeline = f:CreateFontString (nil, "overlay", "GameFontNormal") |
| 3128 timeline:SetPoint ("bottomright", f, "bottomright", -2, 0) | 3136 timeline:SetPoint ("bottomright", f, "bottomright", -2, 0) |
| 3129 DF:SetFontSize (timeline, 8) | 3137 DF:SetFontSize (timeline, 8) |
| 3130 f.timeline = timeline | 3138 f.timeline = timeline |
| 3131 | 3139 |
| 3192 | 3200 |
| 3193 line.ball:SetPoint ("bottomleft", self, "bottomleft", (o*linewidth)-8, pvalue-8) | 3201 line.ball:SetPoint ("bottomleft", self, "bottomleft", (o*linewidth)-8, pvalue-8) |
| 3194 line.spellicon:SetTexture (nil) | 3202 line.spellicon:SetTexture (nil) |
| 3195 line.timeline:SetText (data.text) | 3203 line.timeline:SetText (data.text) |
| 3196 line.timeline:Show() | 3204 line.timeline:Show() |
| 3205 | |
| 3206 if (data.utext) then | |
| 3207 line.text:Show() | |
| 3208 line.textBackground:Show() | |
| 3209 line.text:SetText (data.utext) | |
| 3210 else | |
| 3211 line.text:Hide() | |
| 3212 line.textBackground:Hide() | |
| 3213 end | |
| 3197 | 3214 |
| 3198 line.data = data | 3215 line.data = data |
| 3199 | 3216 |
| 3200 o = o + 1 | 3217 o = o + 1 |
| 3201 end | 3218 end |
| 3599 | 3616 |
| 3600 | 3617 |
| 3601 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 3618 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 3602 -- ~scrollbox | 3619 -- ~scrollbox |
| 3603 | 3620 |
| 3604 | |
| 3605 -- preciso de uma fauxscroll que seja facil de lidar | |
| 3606 -- ele cria scroll aqui, preciso falar a função que cria a linha e a função que atualiza | |
| 3607 -- precisa passsar o tamanho em height width quantas barras vai mostrar | |
| 3608 -- search box incluso opcionalmente | |
| 3609 | |
| 3610 | |
| 3611 DF.SortFunctions = {} | 3621 DF.SortFunctions = {} |
| 3612 | 3622 |
| 3613 local SortMember = "" | 3623 local SortMember = "" |
| 3614 local SortByMember = function (t1, t2) | 3624 local SortByMember = function (t1, t2) |
| 3615 return t1[SortMember] > t2[SortMember] | 3625 return t1[SortMember] > t2[SortMember] |
| 3640 if (self.IsFauxScroll) then | 3650 if (self.IsFauxScroll) then |
| 3641 FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight+1) | 3651 FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight+1) |
| 3642 offset = FauxScrollFrame_GetOffset (self) | 3652 offset = FauxScrollFrame_GetOffset (self) |
| 3643 end | 3653 end |
| 3644 | 3654 |
| 3645 local okay, totalLines = pcall (self.refresh_func, self, self.data, offset, #self.Frames) | 3655 local okay, totalLines = pcall (self.refresh_func, self, self.data, offset, self.LineAmount) |
| 3646 if (not okay) then | 3656 if (not okay) then |
| 3647 error ("Details! FrameWork: Refresh(): " .. totalLines) | 3657 error ("Details! FrameWork: Refresh(): " .. totalLines) |
| 3648 end | 3658 end |
| 3649 | 3659 |
| 3650 for _, frame in ipairs (self.Frames) do | 3660 for _, frame in ipairs (self.Frames) do |
| 3655 end | 3665 end |
| 3656 end | 3666 end |
| 3657 | 3667 |
| 3658 self:Show() | 3668 self:Show() |
| 3659 | 3669 |
| 3670 if (self.HideScrollBar) then | |
| 3671 local frameName = self:GetName() | |
| 3672 if (frameName) then | |
| 3673 local scrollBar = _G [frameName .. "ScrollBar"] | |
| 3674 if (scrollBar) then | |
| 3675 scrollBar:Hide() | |
| 3676 end | |
| 3677 else | |
| 3678 | |
| 3679 end | |
| 3680 | |
| 3681 end | |
| 3682 | |
| 3660 return self.Frames | 3683 return self.Frames |
| 3661 end | 3684 end |
| 3662 | 3685 |
| 3663 DF.ScrollBoxFunctions.OnVerticalScroll = function (self, offset) | 3686 DF.ScrollBoxFunctions.OnVerticalScroll = function (self, offset) |
| 3664 FauxScrollFrame_OnVerticalScroll (self, offset, self.LineHeight, self.Refresh) | 3687 FauxScrollFrame_OnVerticalScroll (self, offset, self.LineHeight, self.Refresh) |
| 3665 return true | 3688 return true |
| 3666 end | 3689 end |
| 3667 | 3690 |
| 3668 DF.ScrollBoxFunctions.CreateLine = function (self, func) | 3691 DF.ScrollBoxFunctions.CreateLine = function (self, func) |
| 3692 if (not func) then | |
| 3693 func = self.CreateLineFunc | |
| 3694 end | |
| 3669 local okay, newLine = pcall (func, self, #self.Frames+1) | 3695 local okay, newLine = pcall (func, self, #self.Frames+1) |
| 3670 if (okay) then | 3696 if (okay) then |
| 3671 tinsert (self.Frames, newLine) | 3697 tinsert (self.Frames, newLine) |
| 3698 newLine.Index = #self.Frames | |
| 3672 return newLine | 3699 return newLine |
| 3673 else | 3700 else |
| 3674 error ("Details! FrameWork: CreateLine(): " .. newLine) | 3701 error ("Details! FrameWork: CreateLine(): " .. newLine) |
| 3675 end | 3702 end |
| 3676 end | 3703 end |
| 3688 end | 3715 end |
| 3689 DF.ScrollBoxFunctions.GetData = function (self) | 3716 DF.ScrollBoxFunctions.GetData = function (self) |
| 3690 return self.data | 3717 return self.data |
| 3691 end | 3718 end |
| 3692 | 3719 |
| 3693 function DF:CreateScrollBox (parent, name, refresh_func, data, width, height, line_amount, line_height) | 3720 DF.ScrollBoxFunctions.GetFrames = function (self) |
| 3721 return self.Frames | |
| 3722 end | |
| 3723 | |
| 3724 DF.ScrollBoxFunctions.GetNumFramesCreated = function (self) | |
| 3725 return #self.Frames | |
| 3726 end | |
| 3727 | |
| 3728 DF.ScrollBoxFunctions.GetNumFramesShown = function (self) | |
| 3729 return self.LineAmount | |
| 3730 end | |
| 3731 | |
| 3732 DF.ScrollBoxFunctions.SetNumFramesShown = function (self, new_amount) | |
| 3733 --> hide frames which won't be used | |
| 3734 if (new_amount < #self.Frames) then | |
| 3735 for i = new_amount+1, #self.Frames do | |
| 3736 self.Frames [i]:Hide() | |
| 3737 end | |
| 3738 end | |
| 3739 | |
| 3740 --> set the new amount | |
| 3741 self.LineAmount = new_amount | |
| 3742 end | |
| 3743 | |
| 3744 DF.ScrollBoxFunctions.SetFramesHeight = function (self, new_height) | |
| 3745 self.LineHeight = new_height | |
| 3746 self:OnSizeChanged() | |
| 3747 self:Refresh() | |
| 3748 end | |
| 3749 | |
| 3750 DF.ScrollBoxFunctions.OnSizeChanged = function (self) | |
| 3751 if (self.ReajustNumFrames) then | |
| 3752 --> how many lines the scroll can show | |
| 3753 local amountOfFramesToShow = floor (self:GetHeight() / self.LineHeight) | |
| 3754 | |
| 3755 --> how many lines the scroll already have | |
| 3756 local totalFramesCreated = self:GetNumFramesCreated() | |
| 3757 | |
| 3758 --> how many lines are current shown | |
| 3759 local totalFramesShown = self:GetNumFramesShown() | |
| 3760 | |
| 3761 --> the amount of frames increased | |
| 3762 if (amountOfFramesToShow > totalFramesShown) then | |
| 3763 for i = totalFramesShown+1, amountOfFramesToShow do | |
| 3764 --> check if need to create a new line | |
| 3765 if (i > totalFramesCreated) then | |
| 3766 self:CreateLine (self.CreateLineFunc) | |
| 3767 end | |
| 3768 end | |
| 3769 | |
| 3770 --> the amount of frames decreased | |
| 3771 elseif (amountOfFramesToShow < totalFramesShown) then | |
| 3772 --> hide all frames above the new amount to show | |
| 3773 for i = totalFramesCreated, amountOfFramesToShow, -1 do | |
| 3774 if (self.Frames [i]) then | |
| 3775 self.Frames [i]:Hide() | |
| 3776 end | |
| 3777 end | |
| 3778 end | |
| 3779 | |
| 3780 --> set the new amount of frames | |
| 3781 self:SetNumFramesShown (amountOfFramesToShow) | |
| 3782 | |
| 3783 --> refresh lines | |
| 3784 self:Refresh() | |
| 3785 end | |
| 3786 end | |
| 3787 | |
| 3788 function DF:CreateScrollBox (parent, name, refresh_func, data, width, height, line_amount, line_height, create_line_func, auto_amount, no_scroll) | |
| 3694 local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate") | 3789 local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate") |
| 3695 | 3790 |
| 3696 scroll:SetSize (width, height) | 3791 scroll:SetSize (width, height) |
| 3697 scroll.LineAmount = line_amount | 3792 scroll.LineAmount = line_amount |
| 3698 scroll.LineHeight = line_height | 3793 scroll.LineHeight = line_height |
| 3699 scroll.IsFauxScroll = true | 3794 scroll.IsFauxScroll = true |
| 3795 scroll.HideScrollBar = no_scroll | |
| 3700 scroll.Frames = {} | 3796 scroll.Frames = {} |
| 3797 scroll.ReajustNumFrames = auto_amount | |
| 3798 scroll.CreateLineFunc = create_line_func | |
| 3701 | 3799 |
| 3702 DF:Mixin (scroll, DF.SortFunctions) | 3800 DF:Mixin (scroll, DF.SortFunctions) |
| 3703 DF:Mixin (scroll, DF.ScrollBoxFunctions) | 3801 DF:Mixin (scroll, DF.ScrollBoxFunctions) |
| 3704 | 3802 |
| 3705 scroll.refresh_func = refresh_func | 3803 scroll.refresh_func = refresh_func |
| 3706 scroll.data = data | 3804 scroll.data = data |
| 3707 | 3805 |
| 3708 scroll:SetScript ("OnVerticalScroll", scroll.OnVerticalScroll) | 3806 scroll:SetScript ("OnVerticalScroll", scroll.OnVerticalScroll) |
| 3807 scroll:SetScript ("OnSizeChanged", DF.ScrollBoxFunctions.OnSizeChanged) | |
| 3709 | 3808 |
| 3710 return scroll | 3809 return scroll |
| 3711 end | 3810 end |
| 3712 | 3811 |
| 3713 | 3812 |
| 3714 | 3813 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 3814 -- ~resizers | |
| 3815 | |
| 3816 function DF:CreateResizeGrips (parent) | |
| 3817 if (parent) then | |
| 3818 local parentName = parent:GetName() | |
| 3819 | |
| 3820 local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent) | |
| 3821 local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent) | |
| 3822 | |
| 3823 leftResizer:SetPoint ("bottomleft", parent, "bottomleft") | |
| 3824 rightResizer:SetPoint ("bottomright", parent, "bottomright") | |
| 3825 leftResizer:SetSize (16, 16) | |
| 3826 rightResizer:SetSize (16, 16) | |
| 3827 | |
| 3828 rightResizer:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) | |
| 3829 rightResizer:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) | |
| 3830 rightResizer:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) | |
| 3831 leftResizer:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) | |
| 3832 leftResizer:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) | |
| 3833 leftResizer:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) | |
| 3834 | |
| 3835 leftResizer:GetNormalTexture():SetTexCoord (1, 0, 0, 1) | |
| 3836 leftResizer:GetHighlightTexture():SetTexCoord (1, 0, 0, 1) | |
| 3837 leftResizer:GetPushedTexture():SetTexCoord (1, 0, 0, 1) | |
| 3838 | |
| 3839 return leftResizer, rightResizer | |
| 3840 end | |
| 3841 end |
