Class ContextMenuPaginationExtensions
- Namespace
- MonkeyLoader.Resonite.UI
- Assembly
- MonkeyLoader.Resonite.Core.dll
Contains extension methods to add pagination to and check for pagination on FrooxEngine.ContextMenus.
public static class ContextMenuPaginationExtensions
- Inheritance
-
ContextMenuPaginationExtensions
- Inherited Members
Methods
AddPagination(ContextMenu, int, int)
Adds pagination with the given configuration to this context menu.
If there already is pagination, it will be replaced.
public static void AddPagination(this ContextMenu contextMenu, int maxItems, int currentPage = 0)
Parameters
contextMenuContextMenuThe context menu to add pagination to.
maxItemsintThe maximum number of non-pagination items to show per page. Must be greater than zero.
currentPageintThe page that should be shown from the start. Can be any integer value, even negative.
Remarks
The maximum number of non-pagination items to show per page does not include the paging buttons.
This means that up to non-pagination items will be displayed without pagination.maxItems + 2
Exceptions
- ArgumentNullException
When this
contextMenuis null.- ArgumentOutOfRangeException
When
maxItemsis not greater than zero.- InvalidOperationException
When adding the pagination failed for other reasons.
AddPagination(ContextMenu, int, int, out ContextMenuItem, out ContextMenuItem)
Adds pagination with the given configuration to this context menu.
If there already is pagination, it will be replaced.
public static void AddPagination(this ContextMenu contextMenu, int maxItems, int currentPage, out ContextMenuItem back, out ContextMenuItem forward)
Parameters
contextMenuContextMenuThe context menu to add pagination to.
maxItemsintThe maximum number of non-pagination items to show per page. Must be greater than zero.
currentPageintThe page that should be shown from the start. Can be any integer value, even negative.
backContextMenuItemThe newly created context menu item to move to the previous page.
forwardContextMenuItemThe newly created context menu item to move to the next page.
Remarks
The maximum number of non-pagination items to show per page does not include the paging buttons.
This means that up to non-pagination items will be displayed without pagination.maxItems + 2
Exceptions
- ArgumentNullException
When this
contextMenuis null.- ArgumentOutOfRangeException
When
maxItemsis not greater than zero.- InvalidOperationException
When adding the pagination failed for other reasons.
HasPagination(ContextMenu)
Checks if this context menu already has pagination.
public static bool HasPagination(this ContextMenu contextMenu)
Parameters
contextMenuContextMenuThe context menu to check for pagination.
Returns
HasPagination(ContextMenu, out int, out int)
Checks if this context menu already has pagination and returns its configuration if so.
public static bool HasPagination(this ContextMenu contextMenu, out int maxItems, out int currentPage)
Parameters
contextMenuContextMenuThe context menu to check for pagination.
maxItemsintThe maximum number of non-pagination items shown per page if there is pagination; otherwise, MinValue.
currentPageintThe currently shown page if there is pagination; otherwise, MinValue.
This can be-1if there's only up tonon-pagination items, so pagination isn't necessary.maxItems+ 2
Returns
HasPagination(ContextMenu, out int, out int, out ContextMenuItem?, out ContextMenuItem?)
Checks if this context menu already has pagination and returns its configuration and menu items if so.
public static bool HasPagination(this ContextMenu contextMenu, out int maxItems, out int currentPage, out ContextMenuItem? back, out ContextMenuItem? forward)
Parameters
contextMenuContextMenuThe context menu to check for pagination.
maxItemsintThe maximum number of non-pagination items shown per page if there is pagination; otherwise, MinValue.
currentPageintThe currently shown page if there is pagination; otherwise, MinValue.
This can be-1if there's only up tonon-pagination items, so pagination isn't necessary.maxItems+ 2backContextMenuItemThe context menu item to move to the previous page if there is pagination; otherwise, null.
forwardContextMenuItemThe context menu item to move to the next page if there is pagination; otherwise, null.
Returns
TryAddPagination(ContextMenu, int, int)
Tries to add pagination with the given configuration to this context menu.
If there already is pagination, nothing happens.
public static bool TryAddPagination(this ContextMenu contextMenu, int maxItems, int currentPage = 0)
Parameters
contextMenuContextMenuThe context menu to add pagination to.
maxItemsintThe maximum number of non-pagination items to show per page. Must be greater than zero.
currentPageintThe page that should be shown from the start. Can be any integer value, even negative.
Returns
Remarks
This method will not throw exceptions, even if the contextMenu is null,
or maxItems is set to an invalid number.
Any ref and out parameters only have
valid or updated values if the return value is true.
The maximum number of non-pagination items to show per page does not include the paging buttons.
This means that up to non-pagination items will be displayed without pagination.
maxItems + 2
TryAddPagination(ContextMenu, int, int, out ContextMenuItem?, out ContextMenuItem?)
Tries to add pagination with the given configuration to this context menu.
If there already is pagination, the out parameters will
be set to its menu items.
public static bool TryAddPagination(this ContextMenu contextMenu, int maxItems, int currentPage, out ContextMenuItem? back, out ContextMenuItem? forward)
Parameters
contextMenuContextMenuThe context menu to add pagination to.
maxItemsintThe maximum number of non-pagination items to show per page. Must be greater than zero.
currentPageintThe page that should be shown from the start. Can be any integer value, even negative.
backContextMenuItemThe newly created or already present context menu item to move to the previous page if the return value is true; otherwise, null.
forwardContextMenuItemThe newly created or already present context menu item to move to the next page if the return value is true; otherwise, null.
Returns
Remarks
This method will not throw exceptions, even if the contextMenu is null,
or maxItems is set to an invalid number.
Any ref and out parameters only have
valid or updated values if the return value is true.
The maximum number of non-pagination items to show per page does not include the paging buttons.
This means that up to non-pagination items will be displayed without pagination.
maxItems + 2
TryAddPagination(ContextMenu, ref int, ref int, bool, out ContextMenuItem?, out ContextMenuItem?)
Tries to add pagination with the given configuration to this context menu.
If forceNew is not true and there already is pagination,
the ref and out parameters will be set to its
configuration and menu items.
public static bool TryAddPagination(this ContextMenu contextMenu, ref int maxItems, ref int currentPage, bool forceNew, out ContextMenuItem? back, out ContextMenuItem? forward)
Parameters
contextMenuContextMenuThe context menu to add pagination to.
maxItemsintThe maximum number of non-pagination items to show per page. Must be greater than zero.
Will be set to the already configured value if pagination was already set up andforceNewis false.currentPageintThe page that should be shown from the start. Can be any integer value, even negative.
Will be set to the clamped value after set up or the current value if pagination was already set up andforceNewis false.
This can be-1if there's only up tonon-pagination items, so pagination isn't necessary.maxItems+ 2forceNewboolWhether to re-add pagination even if it is already present.
backContextMenuItemThe newly created or already present context menu item to move to the previous page if the return value is true; otherwise, null.
forwardContextMenuItemThe newly created or already present context menu item to move to the next page if the return value is true; otherwise, null.
Returns
Remarks
This method will not throw exceptions, even if the contextMenu is null,
or maxItems is set to an invalid number.
Any ref and out parameters only have
valid or updated values if the return value is true.
The maximum number of non-pagination items to show per page does not include the paging buttons.
This means that up to non-pagination items will be displayed without pagination.
maxItems + 2