|
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
--[[ This list box does not use a ScrollControl. It is intended for large collections of data when it would be more costly to create a Control-container for each row than it would be to set the data (i.e. text and icons) on each row as the list is scrolled.--]]local DEFAULT_ROW_PADDING = 2 local desiredRowCount = listBox.m_RowCount local existingRowCount = #(listBox.m_Rows) local needRowCount = desiredRowCount - existingRowCount if(needRowCount > 0) then local newRow local rowId local container = listBox.m_Container local template = listBox.m_RowTemplate local previousRow = listBox.m_Rows[existingRowCount] for i = 1, needRowCount do rowId = i + existingRowCount if(newRow) then if(previousRow) then else end end previousRow = newRow end endendfunction ZO_ListBox:New(rowTemplate, container, displayedRowCount, maxRowCount, rowPopulationFunction, scrollUpdateFunction, rowPadding) if(maxRowCount < displayedRowCount) then maxRowCount = displayedRowCount end listBox.m_RowTemplate = rowTemplate listBox.m_RowCount = displayedRowCount listBox.m_MaxRowCount = maxRowCount listBox.m_Rows = {} listBox.m_Container = container listBox.m_ScrollPosition = 1 listBox.m_MaxScrollPosition = listBox.m_MaxRowCount - listBox.m_RowCount + 1 listBox.m_RowPadding = rowPadding or DEFAULT_ROW_PADDING return listBoxendendendend if(newScroll < 1) then newScroll = 1 elseif(newScroll > listObject.m_MaxScrollPosition) then newScroll = listObject.m_MaxScrollPosition end if(newScroll ~= listObject.m_ScrollPosition) then listObject.m_ScrollPosition = newScroll endendendend local currentRow = 1 local currentRowControl do if(currentRowControl) then -- The population function returns whether or not the row should be shown. end currentRow = currentRow + 1 end while(currentRow < rowCount) do currentRow = currentRow + 1 end then endend then then else end then end endend |