Submenu

data class Submenu(val actionId: String, val id: Int, val contentDescription: String, val icon: ToolbarIcon = ToolbarIcon.None, val state: ToolbarItemState = ToolbarItemState.Default, val position: ToolbarItem.ItemEdge = ItemEdge.Start, val overflowBehavior: ToolbarItem.OverflowBehavior = OverflowBehavior.IfRoom, val children: PersistentList<ToolbarItem> = persistentListOf(), val closesSubmenuOnChildClick: Boolean = true, val opensSubmenuOnClick: Boolean = false, val runsSoleEnabledChildOnClick: Boolean = false, val showsSubmenuIndicator: Boolean = true) : ToolbarItem

A toolbar item that opens a submenu of nested children when tapped.

Constructors

Link copied to clipboard
constructor(actionId: String, id: Int, contentDescription: String, icon: ToolbarIcon = ToolbarIcon.None, state: ToolbarItemState = ToolbarItemState.Default, position: ToolbarItem.ItemEdge = ItemEdge.Start, overflowBehavior: ToolbarItem.OverflowBehavior = OverflowBehavior.IfRoom, children: PersistentList<ToolbarItem> = persistentListOf(), closesSubmenuOnChildClick: Boolean = true, opensSubmenuOnClick: Boolean = false, runsSoleEnabledChildOnClick: Boolean = false, showsSubmenuIndicator: Boolean = true)

Properties

Link copied to clipboard
open override val actionId: String

Stable string identifier used for action dispatch and state save/restore.

Link copied to clipboard
val children: PersistentList<ToolbarItem>

Nested items shown when this submenu is opened.

Link copied to clipboard

Whether tapping a child dismisses the submenu. The View ContextualToolbarMenuItem.setCloseSubmenuOnItemClick equivalent — the undo/redo group keeps its submenu open so undo can be tapped repeatedly.

Link copied to clipboard
open override val contentDescription: String

Accessibility label and overflow-menu text for this item.

Link copied to clipboard
open override val icon: ToolbarIcon

How this item renders its icon.

Link copied to clipboard
@get:IdRes
open override val id: Int

Resource id (R.id.pspdf__menu_option_*) preserving the legacy test identity of this item.

Link copied to clipboard

Whether a tap opens this submenu instead of activating its representative child. false (the default) is the tool-group behavior: tap activates the child the group's icon shows, long-press opens the submenu. true is the View "More options" group behavior: the group is a pure container whose children are independent actions, so a tap opens the submenu directly.

Link copied to clipboard

Whether this item shows in the row, collapses into overflow, or is always pinned to overflow.

Link copied to clipboard
open override val position: ToolbarItem.ItemEdge

Which edge of the toolbar this item is grouped against.

Link copied to clipboard

Whether a tap runs the group's only enabled child directly instead of opening the submenu. With more than one enabled child the tap falls back to the other click rules. The undo/redo group: with only undo (or only redo) possible a tap just undoes (or redoes), and the submenu opens only when there is a choice to make.

Link copied to clipboard

Whether the group draws the small corner triangle that marks it as a submenu. The undo/redo group opts out: its compound icon already shows both actions.

Link copied to clipboard
open override val state: ToolbarItemState

Per-item dynamic state (enabled / selected / visible).