diff --git a/exec/load/DDLightbarMenu.js b/exec/load/DDLightbarMenu.js index 3022e12433de57e7fd22a1ce3fa799c7f9c704e2..7e3cce6a4ec6dc3c7302415a4caf6b0ae2d8bf43 100644 --- a/exec/load/DDLightbarMenu.js +++ b/exec/load/DDLightbarMenu.js @@ -248,6 +248,9 @@ function DDLightbarMenu(pX, pY, pWidth, pHeight) this.RemoveAllItemHotkeys = DDLightbarMenu_RemoveAllItemHotkeys; this.GetVal = DDLightbarMenu_GetVal; this.SetBorderChars = DDLightbarMenu_SetBorderChars; + this.GetNumItemsPerPage = DDLightbarMenu_GetNumItemsPerPage; + this.GetTopItemIdxToTopOfLastPage = DDLightbarMenu_GetTopItemIdxToTopOfLastPage; + this.SetTopItemIdxToTopOfLastPage = DDLightbarMenu_SetTopItemIdxToTopOfLastPage; // Set some things based on the parameters passed in if ((typeof(pX) == "number") && (typeof(pY) == "number")) @@ -1113,6 +1116,33 @@ function DDLightbarMenu_SetBorderChars(pBorderChars) } } +// Returns the number of (possible) items per page +function DDLightbarMenu_GetNumItemsPerPage() +{ + var numItemsPerPage = this.size.height; + if (this.borderEnabled) + numItemsPerPage -= 2; + return numItemsPerPage; +} + +// Gets the top item index of the last page of items +function DDLightbarMenu_GetTopItemIdxToTopOfLastPage() +{ + var numItemsPerPage = this.size.height; + if (this.borderEnabled) + numItemsPerPage -= 2; + return this.items.length - numItemsPerPage; +} + +// Sets the top item index to the top item of the last page of items +function DDLightbarMenu_SetTopItemIdxToTopOfLastPage() +{ + var numItemsPerPage = this.size.height; + if (this.borderEnabled) + numItemsPerPage -= 2; + this.topItemIdx = this.items.length - numItemsPerPage; +} + // Inputs a keypress from the user and handles some ESC-based // characters such as PageUp, PageDown, and ESC. If PageUp // or PageDown are pressed, this function will return the