pub struct FormState<W>{
pub layout: Rc<GenericLayout<W>>,
pub area: Rect,
pub widget_area: Rect,
pub prev_area: Rect,
pub next_area: Rect,
pub page: usize,
pub container: FocusFlag,
pub mouse: MouseFlagsN,
pub non_exhaustive: NonExhaustive,
}Expand description
Widget state.
Fields§
§layout: Rc<GenericLayout<W>>Page layout read+write might be overwritten from widget.
area: RectFull area for the widget. read only renewed for each render.
widget_area: RectArea for the content. read only renewed for each render.
prev_area: RectArea for prev-page indicator. read only renewed with each render.
next_area: RectArea for next-page indicator. read only renewed with each render.
page: usize§container: FocusFlagThis widget has no focus of its own, but this flag can be used to set a container state.
mouse: MouseFlagsNMouse
non_exhaustive: NonExhaustiveOnly construct with ..Default::default().
Implementations§
Source§impl<W> FormState<W>
impl<W> FormState<W>
pub fn new() -> Self
Sourcepub fn valid_layout(&self, size: Size) -> bool
pub fn valid_layout(&self, size: Size) -> bool
Layout needs to change?
Sourcepub fn set_layout(&mut self, layout: GenericLayout<W>)
pub fn set_layout(&mut self, layout: GenericLayout<W>)
Set the layout.
Sourcepub fn layout(&self) -> Rc<GenericLayout<W>>
pub fn layout(&self) -> Rc<GenericLayout<W>>
Layout.
Sourcepub fn show(&mut self, widget: W)
pub fn show(&mut self, widget: W)
Show the page for this widget. If there is no widget for the given identifier, this will set the page to 0.
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Number of form pages.
Source§impl FormState<usize>
impl FormState<usize>
Sourcepub fn focus_first(&self, focus: &Focus) -> bool
pub fn focus_first(&self, focus: &Focus) -> bool
Focus the first widget on the active page. This assumes the usize-key is a widget id.
Sourcepub fn show_focused(&mut self, focus: &Focus) -> bool
pub fn show_focused(&mut self, focus: &Focus) -> bool
Show the page with the focused widget. This assumes the usize-key is a widget id. Does nothing if none of the widgets has the focus.
Trait Implementations§
Source§impl<W> HandleEvent<Event, MouseOnly, FormOutcome> for FormState<W>
impl<W> HandleEvent<Event, MouseOnly, FormOutcome> for FormState<W>
Source§impl<W> HandleEvent<Event, Regular, FormOutcome> for FormState<W>
impl<W> HandleEvent<Event, Regular, FormOutcome> for FormState<W>
Source§impl<W> HasFocus for FormState<W>
impl<W> HasFocus for FormState<W>
Source§fn build(&self, _builder: &mut FocusBuilder)
fn build(&self, _builder: &mut FocusBuilder)
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Auto Trait Implementations§
impl<W> !Freeze for FormState<W>
impl<W> !RefUnwindSafe for FormState<W>
impl<W> !Send for FormState<W>
impl<W> !Sync for FormState<W>
impl<W> Unpin for FormState<W>
impl<W> !UnwindSafe for FormState<W>
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,
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