Skip to content
Snippets Groups Projects
Commit 2831748a authored by nightfox's avatar nightfox
Browse files

Added the functions GetNumItemsPerPage, GetTopItemIdxToTopOfLastPage, and...

Added the functions GetNumItemsPerPage, GetTopItemIdxToTopOfLastPage, and SetTopItemIdxToTopOfLastPage.
parent 3151912a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment