pub struct MenuItem<Kind, UserData = (), Api = Default, const REMOVE_ON_DROP: bool = true>(/* private fields */)
where
Kind: Kind,
UserData: Into<Box<UserData>>,
Api: Api;Implementations§
Source§impl<UD, K: Kind, Api: Api, const REM: bool> MenuItem<K, UD, Api, REM>
impl<UD, K: Kind, Api: Api, const REM: bool> MenuItem<K, UD, Api, REM>
Sourcepub fn set_title<S: AsRef<str>>(&self, title: S) -> Result<(), NulError>
pub fn set_title<S: AsRef<str>>(&self, title: S) -> Result<(), NulError>
Sets the display title of the menu item.
pub fn get_userdata(&self) -> Option<&mut UD>
Sourcepub fn set_userdata(&self, userdata: UD) -> Option<UD>
pub fn set_userdata(&self, userdata: UD) -> Option<UD>
Set userdata, replace and return old userdata.
Sourcepub fn value(&self) -> c_int
pub fn value(&self) -> c_int
Gets the integer value of the menu item.
See also MenuItem::set_value.
Equivalent to sys::ffi::playdate_sys::getMenuItemValue
Sourcepub fn set_value(&self, value: c_int)
pub fn set_value(&self, value: c_int)
Sets the integer value of the menu item.
For checkmark menu items (CheckMenuItem), 1 means checked, 0 unchecked.
For option menu items (OptionsMenuItem), the value indicates the array index of the currently selected option.
See also CheckMenuItem::is_checked, OptionsMenuItem::selected_option.
Equivalent to sys::ffi::playdate_sys::setMenuItemValue
Source§impl<UD: Sized, Api: Api, const REM: bool> MenuItem<Check, UD, Api, REM>
impl<UD: Sized, Api: Api, const REM: bool> MenuItem<Check, UD, Api, REM>
pub fn new<S: AsRef<str>>(
title: S,
checked: bool,
callback: Option<fn(userdata: &mut UD)>,
userdata: UD,
) -> Result<Self, ApiError>where
Api: Default,
pub fn new_with<S: AsRef<str>>( api: Api, title: S, checked: bool, callback: Option<fn(userdata: &mut UD)>, userdata: UD, ) -> Result<Self, ApiError>
Source§impl<UD: Sized, Api: Api, const REM: bool> MenuItem<Options, UD, Api, REM>
impl<UD: Sized, Api: Api, const REM: bool> MenuItem<Options, UD, Api, REM>
pub fn new<S: AsRef<str>, O: AsRef<[S]>>(
title: S,
options: O,
callback: Option<fn(userdata: &mut UD)>,
userdata: UD,
) -> Result<Self, ApiError>where
Api: Default,
pub fn new_with<S: AsRef<str>, O: AsRef<[S]>>( api: Api, title: S, options: O, callback: Option<fn(userdata: &mut UD)>, userdata: UD, ) -> Result<Self, ApiError>
Source§impl<UD, Api: Api, const REM: bool> MenuItem<Check, UD, Api, REM>
impl<UD, Api: Api, const REM: bool> MenuItem<Check, UD, Api, REM>
Sourcepub fn is_checked(&self) -> bool
pub fn is_checked(&self) -> bool
Equivalent to sys::ffi::playdate_sys::getMenuItemValue
Source§impl<UD, Api: Api, const REM: bool> MenuItem<Options, UD, Api, REM>
impl<UD, Api: Api, const REM: bool> MenuItem<Options, UD, Api, REM>
Sourcepub fn selected_option(&self) -> i32
pub fn selected_option(&self) -> i32
The array index of the currently selected option.
Equivalent to sys::ffi::playdate_sys::getMenuItemValue
Trait Implementations§
Auto Trait Implementations§
impl<Kind, UserData, Api, const REMOVE_ON_DROP: bool> Freeze for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>where
Api: Freeze,
impl<Kind, UserData, Api, const REMOVE_ON_DROP: bool> RefUnwindSafe for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>where
Api: RefUnwindSafe,
Kind: RefUnwindSafe,
UserData: RefUnwindSafe,
impl<Kind, UserData = (), Api = Default, const REMOVE_ON_DROP: bool = true> !Send for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>
impl<Kind, UserData = (), Api = Default, const REMOVE_ON_DROP: bool = true> !Sync for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>
impl<Kind, UserData, Api, const REMOVE_ON_DROP: bool> Unpin for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>where
Api: Unpin,
Kind: Unpin,
UserData: Unpin,
impl<Kind, UserData, Api, const REMOVE_ON_DROP: bool> UnwindSafe for MenuItem<Kind, UserData, Api, REMOVE_ON_DROP>where
Api: UnwindSafe,
Kind: UnwindSafe,
UserData: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.