Enum bevy_ui_navigation::menu::MenuBuilder
source · pub enum MenuBuilder {
NamedParent(Name),
EntityParent(Entity),
Root,
}Expand description
Tell the navigation system to turn this UI node into a menu.
Note that MenuBuilder is replaced by a private component when encoutered.
Variants§
NamedParent(Name)
Create a menu as reachable from a Focusable
with a [Name] component.
This is useful if, for example, you just want to spawn your UI without keeping track of entity ids of buttons that leads to submenus.
See MenuBuilder::from_named for an easier to use method
if you don’t have a [Name] ready to use.
Important
You must ensure this doesn’t create a cycle. Eg: you shouldn’t be able
to reach MenuSetting X from Focusable Y if there is a path from
MenuSetting X to Focusable Y.
EntityParent(Entity)
Create a menu as reachable from a given Focusable.
When requesting NavRequest::Action when Entity is focused,
the focus will be changed to a focusable within this menu.
Important
You must ensure this doesn’t create a cycle. Eg: you shouldn’t be able
to reach MenuSetting X from Focusable Y if there is a path from
MenuSetting X to Focusable Y.
Root
Create a menu with no parents.
No Focusable will “lead to” this menu.
You either need to programmatically give focus to this menu tree
with NavRequest::FocusOn
or have only one root menu.
Implementations§
source§impl MenuBuilder
impl MenuBuilder
sourcepub fn from_named(parent: impl Into<Cow<'static, str>>) -> Self
pub fn from_named(parent: impl Into<Cow<'static, str>>) -> Self
Create a MenuBuilder::NamedParent directly from String or &str.
Trait Implementations§
source§impl Clone for MenuBuilder
impl Clone for MenuBuilder
source§fn clone(&self) -> MenuBuilder
fn clone(&self) -> MenuBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MenuBuilder
impl Debug for MenuBuilder
source§impl From<Option<Entity>> for MenuBuilder
impl From<Option<Entity>> for MenuBuilder
Auto Trait Implementations§
impl RefUnwindSafe for MenuBuilder
impl Send for MenuBuilder
impl Sync for MenuBuilder
impl Unpin for MenuBuilder
impl UnwindSafe for MenuBuilder
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T [ShaderType] for self. When used in [AsBindGroup]
derives, it is safe to assume that all images in self exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.