pub struct SimplePopupState { /* private fields */ }Expand description
Simple implementation of PopupState for prototyping
This struct provides a minimal state implementation for external projects that don’t need complex state management integration.
Tracks state for multiple popups using HashMap<String, T>.
§Usage
ⓘ
use popup::state::{PopupState, SimplePopupState};
let mut state = SimplePopupState::new();
// Open popup at position
state.set_open("context_menu", true);
state.set_position("context_menu", (100.0, 200.0));
assert!(state.is_open("context_menu"));
assert_eq!(state.position("context_menu"), (100.0, 200.0));
// Close popup
state.set_open("context_menu", false);
assert!(!state.is_open("context_menu"));For production, implement PopupState for your app’s state manager instead.
Implementations§
Trait Implementations§
Source§impl Clone for SimplePopupState
impl Clone for SimplePopupState
Source§fn clone(&self) -> SimplePopupState
fn clone(&self) -> SimplePopupState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimplePopupState
impl Debug for SimplePopupState
Source§impl Default for SimplePopupState
impl Default for SimplePopupState
Source§fn default() -> SimplePopupState
fn default() -> SimplePopupState
Returns the “default value” for a type. Read more
Source§impl PopupState for SimplePopupState
impl PopupState for SimplePopupState
Source§fn selected_item(&self, popup_id: &str) -> Option<usize>
fn selected_item(&self, popup_id: &str) -> Option<usize>
Get selected menu item index (ContextMenu) Read more
Source§fn selected_color(&self, popup_id: &str) -> Option<String>
fn selected_color(&self, popup_id: &str) -> Option<String>
Get selected color (ColorPicker) Read more
Source§fn is_custom_mode(&self, popup_id: &str) -> bool
fn is_custom_mode(&self, popup_id: &str) -> bool
Check if custom color mode is active (ColorPicker) Read more
Source§fn set_selected_item(&mut self, popup_id: &str, index: Option<usize>)
fn set_selected_item(&mut self, popup_id: &str, index: Option<usize>)
Set selected menu item (ContextMenu) Read more
Auto Trait Implementations§
impl Freeze for SimplePopupState
impl RefUnwindSafe for SimplePopupState
impl Send for SimplePopupState
impl Sync for SimplePopupState
impl Unpin for SimplePopupState
impl UnsafeUnpin for SimplePopupState
impl UnwindSafe for SimplePopupState
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