pub struct Disclosure { /* private fields */ }Expand description
A header that shows or hides its content. Remembers whether it is open, or leaves
that to the app with expanded. The header can carry any view as
its title, a mark such as a Dot, and an on/off switch of its own.
use ravenrs_reactive::State;
use ravenrs_widgets::{Disclosure, Dot, Text, Tone, Ui};
let (open, enabled) = (State::new(true), State::new(false));
let panel = Disclosure::new("Effects", Text::new("Vignette and grain"))
.expanded(open.binding())
.mark(Dot::new().tone(Tone::Warning).label("Changed"))
.switch(enabled.binding());
let mut ui = Ui::new(panel, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl Disclosure
impl Disclosure
Sourcepub fn new(title: impl Into<String>, content: impl View + 'static) -> Self
pub fn new(title: impl Into<String>, content: impl View + 'static) -> Self
A collapsed disclosure with this title and content.
Sourcepub fn expanded(self, expanded: Binding<bool>) -> Self
pub fn expanded(self, expanded: Binding<bool>) -> Self
Keeps whether it is open in this binding, so the app decides and can remember it.
Self::open no longer matters.
Sourcepub fn title_view(self, view: impl View + 'static) -> Self
pub fn title_view(self, view: impl View + 'static) -> Self
Shows this view in the header instead of the title, which still names it for screen readers.
Sourcepub fn mark(self, mark: impl View + 'static) -> Self
pub fn mark(self, mark: impl View + 'static) -> Self
Shows this view at the end of the header, so what is inside can be told while it
is closed. A Dot with a label says it to screen readers as well.
Trait Implementations§
Source§impl Debug for Disclosure
impl Debug for Disclosure
Auto Trait Implementations§
impl !RefUnwindSafe for Disclosure
impl !Send for Disclosure
impl !Sync for Disclosure
impl !UnwindSafe for Disclosure
impl Freeze for Disclosure
impl Unpin for Disclosure
impl UnsafeUnpin for Disclosure
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
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.