Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/java/com/cleanroommc/modularui/api/IPanelHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ static IPanelHandler simple(ModularPanel parent, SecondaryPanel.IPanelBuilder pr
@ApiStatus.OverrideOnly
void closePanelInternal();

/**
* Toggles this panel open or closed. Delegates to {@link #openPanel()} and {@link #closePanel()}.
*
* @return {@code true} if the panel was opened, {@code false} if it was closed
*/
default boolean togglePanel() {
if (isPanelOpen()) {
closePanel();
return false;
} else {
openPanel();
return true;
}
}

/**
* Deletes the current cached panel. Should not be used frequently.
* This only works on panels which don't have {@link ItemSlotSH} sync handlers.
Expand Down