pub struct InputText<'ui, 'p, L, H = &'static str, T = PassthroughCallback> { /* private fields */ }
Implementations§
Source§impl<'ui, 'p, L> InputText<'ui, 'p, L>
impl<'ui, 'p, L> InputText<'ui, 'p, L>
Sourcepub fn new(ui: &'ui Ui, label: L, buf: &'p mut String) -> InputText<'ui, 'p, L>
pub fn new(ui: &'ui Ui, label: L, buf: &'p mut String) -> InputText<'ui, 'p, L>
Creates a new input text widget to edit the given string.
§String Editing
Please note, ImGui requires this string to be null-terminated. We accomplish this
by appending and then removing a null terminator (\0
) from the String you pass in.
This has several consequences:
- The string’s backing buffer may be resized and relocated even without edits as result of this pushed char.
- The string will appear truncated if the string contains
\0
inside it. This will not cause memory unsafety, but it will limit your usage. If that’s the case, please pre-process your string. - Truncations by ImGui appear to be done primarily by insertions of
\0
to the truncation point. We will handle this for you and edit the string “properly” too, but this might show up in callbacks.
Source§impl<'ui, 'p, T, L, H> InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, T, L, H> InputText<'ui, 'p, L, H, T>
Sourcepub fn hint<H2>(self, hint: H2) -> InputText<'ui, 'p, L, H2, T>
pub fn hint<H2>(self, hint: H2) -> InputText<'ui, 'p, L, H2, T>
Sets the hint displayed in the input text background.
pub fn flags(self, flags: InputTextFlags) -> InputText<'ui, 'p, L, H, T>
pub fn chars_decimal(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn chars_hexadecimal(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn chars_uppercase(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn chars_noblank(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn auto_select_all(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn enter_returns_true(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn allow_tab_input(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn no_horizontal_scroll(self, value: bool) -> InputText<'ui, 'p, L, H, T>
Sourcepub fn always_insert_mode(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn always_insert_mode(self, value: bool) -> InputText<'ui, 'p, L, H, T>
Note: this is equivalent to always_overwrite
pub fn always_overwrite(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn read_only(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn password(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn no_undo_redo(self, value: bool) -> InputText<'ui, 'p, L, H, T>
pub fn callback<T2>(
self,
callbacks: InputTextCallback,
callback: T2,
) -> InputText<'ui, 'p, L, H, T2>where
T2: InputTextCallbackHandler,
Sourcepub fn build(self) -> bool
pub fn build(self) -> bool
Builds the string editor, performing string editing operations.
§String Editing
Please note, ImGui requires this string to be null-terminated. We accomplish this
by appending and then removing a null terminator (\0
) from the String you pass in.
This has several consequences:
- The string’s backing buffer may be resized and relocated even without edits as result of this pushed char.
- The string will appear truncated if the string contains
\0
inside it. This will not cause memory unsafety, but it will limit your usage. If that’s the case, please pre-process your string. - Truncations by ImGui appear to be done primarily by insertions of
\0
to the truncation point. We will handle this for you and edit the string “properly” too, but this might show up in callbacks.
Auto Trait Implementations§
impl<'ui, 'p, L, H, T> Freeze for InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, L, H = &'static str, T = PassthroughCallback> !RefUnwindSafe for InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, L, H = &'static str, T = PassthroughCallback> !Send for InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, L, H = &'static str, T = PassthroughCallback> !Sync for InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, L, H, T> Unpin for InputText<'ui, 'p, L, H, T>
impl<'ui, 'p, L, H = &'static str, T = PassthroughCallback> !UnwindSafe for InputText<'ui, 'p, L, H, T>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more