pub struct TextInputData {
pub editor: Box<PlainEditor<TextBrush>>,
pub is_multiline: bool,
pub scroll_offset: f32,
}Fields§
§editor: Box<PlainEditor<TextBrush>>A parley TextEditor instance
is_multiline: boolWhether the input is a singleline or multiline input
scroll_offset: f32The scroll offset of the text content within the input, in CSS (unscaled) pixels.
For single-line inputs this is a horizontal offset; for multi-line inputs it is a vertical offset. It is kept up to date so that the caret remains visible within the input’s content box.
Implementations§
Source§impl TextInputData
impl TextInputData
pub fn new(is_multiline: bool) -> Self
pub fn set_text( &mut self, font_ctx: &mut FontContext, layout_ctx: &mut LayoutContext<TextBrush>, text: &str, )
Sourcepub fn clamp_scroll_offset(
&mut self,
content_box_width: f32,
content_box_height: f32,
)
pub fn clamp_scroll_offset( &mut self, content_box_width: f32, content_box_height: f32, )
Recompute Self::scroll_offset so that the caret stays visible within the input’s
content box.
content_box_width and content_box_height are the dimensions of the input’s content
box in CSS (unscaled) pixels.
Sourcepub fn max_scroll_offset(
&self,
content_box_width: f32,
content_box_height: f32,
) -> f32
pub fn max_scroll_offset( &self, content_box_width: f32, content_box_height: f32, ) -> f32
The maximum valid value of Self::scroll_offset (in CSS pixels) given the input’s
content box, i.e. the extent by which the text content overflows the content box along
the input’s scroll axis.
content_box_width and content_box_height are the dimensions of the input’s content
box in CSS (unscaled) pixels.
Sourcepub fn scroll_by(
&mut self,
delta: f32,
content_box_width: f32,
content_box_height: f32,
) -> f32
pub fn scroll_by( &mut self, delta: f32, content_box_width: f32, content_box_height: f32, ) -> f32
Scroll the input’s text content by delta CSS pixels along its scroll axis (horizontal
for single-line inputs, vertical for multi-line inputs), clamping to the scrollable
range.
Returns the portion of delta that could not be consumed (because the input was already
scrolled to its limit), so the caller can bubble it up to an ancestor scroller.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TextInputData
impl !UnwindSafe for TextInputData
impl Freeze for TextInputData
impl Send for TextInputData
impl Sync for TextInputData
impl Unpin for TextInputData
impl UnsafeUnpin for TextInputData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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