|
|
@ -499,18 +499,23 @@ impl SoftwareKeyboard { |
|
|
|
/// use ctru::applets::swkbd::SoftwareKeyboard;
|
|
|
|
/// use ctru::applets::swkbd::SoftwareKeyboard;
|
|
|
|
/// let mut keyboard = SoftwareKeyboard::default();
|
|
|
|
/// let mut keyboard = SoftwareKeyboard::default();
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// keyboard.set_initial_text("Write here what you like!");
|
|
|
|
/// keyboard.set_initial_text(Some("Write here what you like!"));
|
|
|
|
/// #
|
|
|
|
/// #
|
|
|
|
/// # }
|
|
|
|
/// # }
|
|
|
|
#[doc(alias = "swkbdSetInitialText")] |
|
|
|
#[doc(alias = "swkbdSetInitialText")] |
|
|
|
pub fn set_initial_text(&mut self, text: &str) { |
|
|
|
pub fn set_initial_text(&mut self, text: Option<&str>) { |
|
|
|
unsafe { |
|
|
|
if let Some(text) = text { |
|
|
|
self.initial_text = Some(CString::new(text).unwrap()); |
|
|
|
let initial_text = CString::new(text).unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
ctru_sys::swkbdSetInitialText( |
|
|
|
unsafe { |
|
|
|
self.state.as_mut(), |
|
|
|
ctru_sys::swkbdSetInitialText(self.state.as_mut(), initial_text.as_ptr()); |
|
|
|
self.initial_text.as_ref().unwrap().as_ptr(), |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
self.initial_text = Some(initial_text); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
unsafe { ctru_sys::swkbdSetInitialText(self.state.as_mut(), std::ptr::null()) }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.initial_text = None; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|