TrayMenuBuilder

interface TrayMenuBuilder

Interface for building tray menus in a platform-independent manner. Implementations of this interface allow the creation of tray menus with items, checkable items, submenus, and dividers, and provide a mechanism for disposing resources when the menu is no longer needed.

Functions

Link copied to clipboard
open fun CheckableItem(label: String, checked: Boolean = false, isEnabled: Boolean = true, onToggle: (Boolean) -> Unit)

Adds a checkable item to the tray menu with the legacy API.

abstract fun CheckableItem(label: String, checked: Boolean, onCheckedChange: (Boolean) -> Unit, isEnabled: Boolean = true)

Adds a checkable item to the tray menu. This follows Compose's idiomatic pattern for stateful components.

abstract fun CheckableItem(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), checked: Boolean, onCheckedChange: (Boolean) -> Unit, isEnabled: Boolean = true)

Adds a checkable item to the tray menu with a DrawableResource icon. This allows calling code like: CheckableItem(label, icon = Res.drawable.icon, checked = ..., ...)

abstract fun CheckableItem(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), checked: Boolean, onCheckedChange: (Boolean) -> Unit, isEnabled: Boolean = true)

Adds a checkable item to the tray menu with a Painter icon.

abstract fun CheckableItem(label: String, iconContent: () -> Unit, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), checked: Boolean, onCheckedChange: (Boolean) -> Unit, isEnabled: Boolean = true)

Adds a checkable item to the tray menu with a Composable icon.

abstract fun CheckableItem(label: String, icon: <Error class: unknown class>, iconTint: <Error class: unknown class>? = null, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), checked: Boolean, onCheckedChange: (Boolean) -> Unit, isEnabled: Boolean = true)

Adds a checkable item to the tray menu with an ImageVector icon.

Link copied to clipboard
abstract fun dispose()

Disposes of the resources associated with the tray menu. This method should be called when the tray menu is no longer in use to release any system resources held by it.

Link copied to clipboard
abstract fun Divider()

Adds a visual separator (divider) to the tray menu. This method is used to group or separate menu items, providing better organization and clarity within the menu structure.

Link copied to clipboard
abstract fun Item(label: String, isEnabled: Boolean = true, onClick: () -> Unit = {})

Adds an item to the tray menu.

abstract fun Item(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, onClick: () -> Unit = {})

Adds an item to the tray menu with a DrawableResource icon. This allows calling code like: Item(label, icon = Res.drawable.icon, ...)

abstract fun Item(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, onClick: () -> Unit = {})

Adds an item to the tray menu with a Painter icon.

abstract fun Item(label: String, iconContent: () -> Unit, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, onClick: () -> Unit = {})

Adds an item to the tray menu with a Composable icon.

abstract fun Item(label: String, icon: <Error class: unknown class>, iconTint: <Error class: unknown class>? = null, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, onClick: () -> Unit = {})

Adds an item to the tray menu with an ImageVector icon.

Link copied to clipboard
abstract fun SubMenu(label: String, isEnabled: Boolean = true, submenuContent: TrayMenuBuilder.() -> Unit?)

Adds a submenu to the tray menu.

abstract fun SubMenu(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, submenuContent: TrayMenuBuilder.() -> Unit?)

Adds a submenu to the tray menu with a DrawableResource icon. This allows calling code like: SubMenu(label, icon = Res.drawable.icon) { ... }

abstract fun SubMenu(label: String, icon: <Error class: unknown class>, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, submenuContent: TrayMenuBuilder.() -> Unit?)

Adds a submenu to the tray menu with a Painter icon.

abstract fun SubMenu(label: String, iconContent: () -> Unit, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, submenuContent: TrayMenuBuilder.() -> Unit?)

Adds a submenu to the tray menu with a Composable icon.

abstract fun SubMenu(label: String, icon: <Error class: unknown class>, iconTint: <Error class: unknown class>? = null, iconRenderProperties: IconRenderProperties = IconRenderProperties.forMenuItem(), isEnabled: Boolean = true, submenuContent: TrayMenuBuilder.() -> Unit?)

Adds a submenu to the tray menu with an ImageVector icon.