Table of Contents

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

contextMenu ContextMenu

The context menu to add pagination to.

maxItems int

The maximum number of non-pagination items to show per page. Must be greater than zero.

currentPage int

The 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 maxItems + 2 non-pagination items will be displayed without pagination.

Exceptions

ArgumentNullException

When this contextMenu is null.

ArgumentOutOfRangeException

When maxItems is 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

contextMenu ContextMenu

The context menu to add pagination to.

maxItems int

The maximum number of non-pagination items to show per page. Must be greater than zero.

currentPage int

The page that should be shown from the start. Can be any integer value, even negative.

back ContextMenuItem

The newly created context menu item to move to the previous page.

forward ContextMenuItem

The 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 maxItems + 2 non-pagination items will be displayed without pagination.

Exceptions

ArgumentNullException

When this contextMenu is null.

ArgumentOutOfRangeException

When maxItems is 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

contextMenu ContextMenu

The context menu to check for pagination.

Returns

bool

true if there is pagination on this context menu; otherwise, false.

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

contextMenu ContextMenu

The context menu to check for pagination.

maxItems int

The maximum number of non-pagination items shown per page if there is pagination; otherwise, MinValue.

currentPage int

The currently shown page if there is pagination; otherwise, MinValue.
This can be -1 if there's only up to maxItems + 2 non-pagination items, so pagination isn't necessary.

Returns

bool

true if there is pagination on this context menu; otherwise, false.

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

contextMenu ContextMenu

The context menu to check for pagination.

maxItems int

The maximum number of non-pagination items shown per page if there is pagination; otherwise, MinValue.

currentPage int

The currently shown page if there is pagination; otherwise, MinValue.
This can be -1 if there's only up to maxItems + 2 non-pagination items, so pagination isn't necessary.

back ContextMenuItem

The context menu item to move to the previous page if there is pagination; otherwise, null.

forward ContextMenuItem

The context menu item to move to the next page if there is pagination; otherwise, null.

Returns

bool

true if there is pagination on this context menu; otherwise, false.

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

contextMenu ContextMenu

The context menu to add pagination to.

maxItems int

The maximum number of non-pagination items to show per page. Must be greater than zero.

currentPage int

The page that should be shown from the start. Can be any integer value, even negative.

Returns

bool

true if this FrooxEngine.ContextMenu is now paginated; otherwise, false.

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 maxItems + 2 non-pagination items will be displayed without pagination.

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

contextMenu ContextMenu

The context menu to add pagination to.

maxItems int

The maximum number of non-pagination items to show per page. Must be greater than zero.

currentPage int

The page that should be shown from the start. Can be any integer value, even negative.

back ContextMenuItem

The newly created or already present context menu item to move to the previous page if the return value is true; otherwise, null.

forward ContextMenuItem

The newly created or already present context menu item to move to the next page if the return value is true; otherwise, null.

Returns

bool

true if this FrooxEngine.ContextMenu is now paginated; otherwise, false.

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 maxItems + 2 non-pagination items will be displayed without pagination.

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

contextMenu ContextMenu

The context menu to add pagination to.

maxItems int

The 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 and forceNew is false.

currentPage int

The 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 and forceNew is false.
This can be -1 if there's only up to maxItems + 2 non-pagination items, so pagination isn't necessary.

forceNew bool

Whether to re-add pagination even if it is already present.

back ContextMenuItem

The newly created or already present context menu item to move to the previous page if the return value is true; otherwise, null.

forward ContextMenuItem

The newly created or already present context menu item to move to the next page if the return value is true; otherwise, null.

Returns

bool

true if this FrooxEngine.ContextMenu is now paginated; otherwise, false.

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 maxItems + 2 non-pagination items will be displayed without pagination.