[−][src]Struct embedded_text::rendering::cursor::Cursor
Internal structure that keeps track of position information while rendering a TextBox
.
Fields
position: Point
Current cursor position
bounds: Rectangle
TextBox bounding rectangle
Implementations
impl<F> Cursor<F> where
F: Font,
[src]
F: Font,
#[must_use]pub fn new(bounds: Rectangle, line_spacing: i32) -> Self
[src]
Creates a new Cursor
object located at the top left of the given bounding Rectangle
.
#[must_use]pub fn line_width(&self) -> u32
[src]
Returns the width of the textbox
pub fn new_line(&mut self)
[src]
Starts a new line.
pub fn carriage_return(&mut self)
[src]
Moves the cursor back to the start of the line.
#[must_use]pub fn in_display_area(&self) -> bool
[src]
Returns whether the cursor is completely in the bounding box.
Completely means, that the line that is marked by the cursor can be drawn without any vertical clipping or drawing outside the bounds.
Note: Only vertical overrun is checked.
#[must_use]pub fn fits_in_line(&self, width: u32) -> bool
[src]
Returns whether the current line has enough space to also include an object of given width.
#[must_use]pub fn space(&self) -> u32
[src]
Returns the amount of empty space in the line.
pub fn advance_unchecked(&mut self, by: u32)
[src]
Advances the cursor by a given amount.
pub fn x_in_line(&self) -> i32
[src]
Returns the current horizontal offset relative to the left side.
pub fn advance(&mut self, by: u32) -> bool
[src]
Advances the cursor by a given amount.
pub fn rewind(&mut self, by: u32) -> bool
[src]
Rewinds the cursor by a given amount.
Trait Implementations
impl<F: Clone> Clone for Cursor<F>
[src]
impl<F: Copy> Copy for Cursor<F>
[src]
impl<F: Debug> Debug for Cursor<F>
[src]
Auto Trait Implementations
impl<F> RefUnwindSafe for Cursor<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for Cursor<F> where
F: Send,
F: Send,
impl<F> Sync for Cursor<F> where
F: Sync,
F: Sync,
impl<F> Unpin for Cursor<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for Cursor<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,