pub struct MenuState {
sub_menu: Option<(Id, Arc<RwLock<MenuState>>)>,
pub rect: Rect,
pub response: MenuResponse,
entry_count: usize,
}
Expand description
Components of menu state, public for advanced usage.
Usually you don’t need to use it directly.
Fields§
The opened sub-menu and its Id
rect: Rect
Bounding box of this menu (without the sub-menu), including the frame and everything.
response: MenuResponse
Used to check if any menu in the tree wants to close
entry_count: usize
Used to hash different Id
s for sub-menus
Implementations§
source§impl MenuState
impl MenuState
pub fn new(position: Pos2) -> Self
sourcepub fn area_contains(&self, pos: Pos2) -> bool
pub fn area_contains(&self, pos: Pos2) -> bool
Check if position is in the menu hierarchy’s area.
fn next_entry_index(&mut self) -> usize
Sense button interaction opening and closing submenu.
Check if pointer is moving towards current submenu.
Check if pointer is hovering current submenu.
sourcefn cascade_close_response(&mut self, response: MenuResponse)
fn cascade_close_response(&mut self, response: MenuResponse)
Cascade close response to menu root.
fn is_open(&self, id: Id) -> bool
fn sub_id(&self) -> Option<Id>
Open submenu at position, if not already open.
Auto Trait Implementations§
impl Freeze for MenuState
impl !RefUnwindSafe for MenuState
impl Send for MenuState
impl Sync for MenuState
impl Unpin for MenuState
impl !UnwindSafe for MenuState
Blanket Implementations§
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
Mutably borrows from an owned value. Read more