Menu¶
morphui.uix.menu
¶
MorphDropdownMenuItem(**kwargs)
¶
Bases: MorphHoverBehavior, MorphRippleBehavior, MorphButtonBehavior, MorphColorThemeBehavior, MorphInteractionLayerBehavior, MorphIconLabelIconContainer
A single item within the MorphDropdownMenu widget.
This widget represents a menu item with support for leading icon,
text label, and trailing icon. It inherits from
:class:~morphui.uix.container.MorphIconLabelIconContainer which
provides the layout structure and child widget management.
rv_index = NumericProperty(0)
class-attribute
instance-attribute
¶
The index of this label within the RecycleView data.
:attr:rv_index is a :class:~kivy.properties.NumericProperty
and defaults to 0.
rv = ObjectProperty(None)
class-attribute
instance-attribute
¶
The RecycleView instance managing this label.
:attr:rv is a :class:~kivy.properties.ObjectProperty
and defaults to None.
refresh_view_attrs(rv, index, data)
¶
Refreshes the view attributes of this menu item.
| PARAMETER | DESCRIPTION |
|---|---|
rv
|
The RecycleView instance managing this menu item.
TYPE:
|
index
|
The index of this menu item within the RecycleView data.
TYPE:
|
data
|
The data list containing the attributes for all menu items.
TYPE:
|
MenuRecycleBoxLayout(**kwargs)
¶
Bases: MorphAutoSizingBehavior, RecycleBoxLayout
A RecycleBoxLayout specifically for use within the MorphMenu widget to layout menu items in a vertical list.
MorphDropdownMenu(**kwargs)
¶
Bases: MorphDeclarativeBehavior, MorphAutoSizingBehavior, MorphColorThemeBehavior, MorphSurfaceLayerBehavior, MorphElevationBehavior, MorphMenuMotionBehavior, RecycleView
A MorphUI Menu widget that displays a list of items in a dropdown menu. Inherits from multiple behaviors to provide a rich set of features including elevation, color theming, and auto-sizing.
filter_value = ObjectProperty('')
class-attribute
instance-attribute
¶
The current filter value used to filter menu items.
This property holds the value used to filter the menu items. Items
that do not match the filter criteria will be excluded from the
displayed list. Override the :meth:should_filter_item method to
customize the filtering behavior.
:attr:filter_value is an :class:~kivy.properties.ObjectProperty
and defaults to an empty string.
item_release_callback = ObjectProperty(None)
class-attribute
instance-attribute
¶
Callback function called when a menu item is released.
This callback is triggered when a user releases a menu item after clicking or tapping it. The callback should accept two parameters: the menu item widget instance and its index.
items = AliasProperty(_get_items, _set_items, bind=['_all_items', 'filter_value'])
class-attribute
instance-attribute
¶
List of menu items available for the dropdown menu.
This property allows getting and setting the list of menu items.
Items that are filtered out based on the current filter value
will not be included in the returned list. This property is used to
dynamically update the menu contents. Override the
:meth:should_filter_item method to customize filtering behavior.
:attr:items is an :class:~kivy.properties.AliasProperty and
is bound to changes in the _all_items and filter_value properties.
default_config = dict(size_hint=(None, None), auto_size=(True, True), elevation=2)
class-attribute
instance-attribute
¶
Default configuration for the MorphDropdownMenu widget.
should_filter_item(item)
¶
Determine if a menu item should be filtered out based on the current filter value.
This method checks if the provided menu item matches the filter criteria. If it does not match, the item is considered filtered out and will not be displayed in the menu. Override this method to implement custom filtering logic.
| PARAMETER | DESCRIPTION |
|---|---|
item
|
A dictionary representing a single menu item.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|