Class: Toybox.WatchUi.CustomMenu
- Inherits:
-
Toybox.WatchUi.Menu2
Overview
A representation of a custom menu.
A CustomMenu is a specialized Menu2 View that presents the user with a list of custom rendered options. After an option is selected, the registered onSelect() method will be called.
A CustomMenu is pushed using pushView(), which provides a Menu2InputDelegate as the input delegate.
See Also:
Instance Method Summary collapse
-
addItem(item as WatchUi.CustomMenuItem) as Void
Add a CustomMenuItem to a CustomMenu.
-
drawFooter(dc as Graphics.Dc) as Void
Draw the CustomMenu footer.
-
drawForeground(dc as Graphics.Dc) as Void
Draw the CustomMenu foreground.
-
drawTitle(dc as Graphics.Dc) as Void
Draw the CustomMenu title.
-
initialize(itemHeight as Lang.Number, backgroundColor as Graphics.ColorType, options as { :focus as Lang.Number, :focusItemHeight as Lang.Number or Null, :title as WatchUi.Drawable, :footer as WatchUi.Drawable, :foreground as WatchUi.Drawable, :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.ResourceId, :titleItemHeight as Lang.Number or Null, :footerItemHeight as Lang.Number or Null, :theme as WatchUi.MenuTheme or Null, :dividerType as Menu2.DividerType or Null } or Null)
Constructor.
-
setBackgroundColor(color as Graphics.ColorType) as Void
Set the background color.
-
setDividerType(divider as Menu2.DividerType or Null) as Void
Set or change the desired divider type.
-
setFooter(drawable as WatchUi.Drawable or Null) as Void
Set the footer drawable.
-
setForeground(drawable as WatchUi.Drawable or Null) as Void
Set the foreground drawable.
-
setTitle(drawable as WatchUi.Drawable or Null) as Void
Set the title drawable.
Instance Method Details
addItem(item as WatchUi.CustomMenuItem) as Void
Add a CustomMenuItem to a CustomMenu.
drawFooter(dc as Graphics.Dc) as Void
Draw the CustomMenu footer.
This is called to render the menu footer region.
drawForeground(dc as Graphics.Dc) as Void
Draw the CustomMenu foreground.
This is called after a menu's items and title have been rendered. It can be used to draw overlay content for the menu.
drawTitle(dc as Graphics.Dc) as Void
Draw the CustomMenu title.
This is called to render the menu title region.
initialize(itemHeight as Lang.Number, backgroundColor as Graphics.ColorType, options as { :focus as Lang.Number, :focusItemHeight as Lang.Number or Null, :title as WatchUi.Drawable, :footer as WatchUi.Drawable, :foreground as WatchUi.Drawable, :icon as Graphics.BitmapType or WatchUi.Drawable or Lang.ResourceId, :titleItemHeight as Lang.Number or Null, :footerItemHeight as Lang.Number or Null, :theme as WatchUi.MenuTheme or Null, :dividerType as Menu2.DividerType or Null } or Null)
Constructor
The options :titleItemHeight
and :footerItemHeight
are only supported with ConnectIQ 4.0.0 and later.
The :icon
option is only used on ConnectIQ 3.4.0 devices with subscreen support.
The :theme
option is only used on ConnectIQ 4.1.8 devices with menu theme support. The background color will not be used if themes are supported and the theme is non-null.
The :dividerType
option is only used on ConnectIQ 5.0.1 devices with divider support.
setBackgroundColor(color as Graphics.ColorType) as Void
Set the background color.
setDividerType(divider as Menu2.DividerType or Null) as Void
Set or change the desired divider type.
If set to Menu2.DIVIDER_TYPE_ICON. Icon from CustomMenuItem.setDividerIcon will be rendered on the left side of the divider.
Set to null
to disable divider which may also disable MenuTheme,
CustomMenuItem.draw will be called
with full width of menu item.
Menu2.DIVIDER_TYPE_DEFAULT will be used if not set for devices that support divider.
setFooter(drawable as WatchUi.Drawable or Null) as Void
Set the footer drawable.
setForeground(drawable as WatchUi.Drawable or Null) as Void
Set the foreground drawable.
setTitle(drawable as WatchUi.Drawable or Null) as Void
Set the title drawable.