Struct FieldFace
pub struct FieldFace<'a> { /* private fields */ }Expand description
An immediate-mode text field: the TextInput look for a painted host
(a formula bar, a cell editor) that shapes and edits its own text.
Size the rect from the face: FieldFace::height for a field of a
ControlSize, FieldFace::text_rect for where its text goes.
paint_chrome paints only the frame, for a host that draws its own
text (or hosts a TextInput with plain chrome inside it); paint
adds the value, or the placeholder in the weaker placeholder ink.
Implementations§
§impl<'a> FieldFace<'a>
impl<'a> FieldFace<'a>
pub fn placeholder(self, placeholder: &'a str) -> FieldFace<'a>
pub fn placeholder(self, placeholder: &'a str) -> FieldFace<'a>
Shown, in the placeholder ink, while the text is empty.
pub fn text_role(self, role: TextRole) -> FieldFace<'a>
pub fn text_role(self, role: TextRole) -> FieldFace<'a>
What the text is (default TextRole::Body).
pub fn hovered(self, hovered: bool) -> FieldFace<'a>
pub fn focused(self, focused: bool) -> FieldFace<'a>
pub fn invalid(self, invalid: bool) -> FieldFace<'a>
pub fn invalid(self, invalid: bool) -> FieldFace<'a>
The value was rejected: the edge takes danger ink.
pub fn disabled(self, disabled: bool) -> FieldFace<'a>
pub fn height(size: ControlSize, theme: &Theme) -> f64
pub fn height(size: ControlSize, theme: &Theme) -> f64
The height of a single-line field of size in theme, the height of
a button of the same size, grown with a Body line at large text.
pub fn text_rect(&self, theme: &Theme) -> Rect
pub fn text_rect(&self, theme: &Theme) -> Rect
Where the text goes: the field inset by the field’s text inset.
pub fn paint_chrome(&self, scene: &mut Scene, transform: Affine, theme: &Theme)
pub fn paint_chrome(&self, scene: &mut Scene, transform: Affine, theme: &Theme)
Paint only the frame.
pub fn paint(
&self,
scene: &mut Scene,
transform: Affine,
text: &mut TextRenderer,
theme: &Theme,
)
pub fn paint( &self, scene: &mut Scene, transform: Affine, text: &mut TextRenderer, theme: &Theme, )
Paint the frame and the text (or the placeholder), elided to one line and centred in the band.
Auto Trait Implementations§
impl<'a> Freeze for FieldFace<'a>
impl<'a> RefUnwindSafe for FieldFace<'a>
impl<'a> Send for FieldFace<'a>
impl<'a> Sync for FieldFace<'a>
impl<'a> Unpin for FieldFace<'a>
impl<'a> UnsafeUnpin for FieldFace<'a>
impl<'a> UnwindSafe for FieldFace<'a>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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