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) -> Disclosure
pub fn new(title: impl Into<String>, content: impl View + 'static) -> Disclosure
A collapsed disclosure with this title and content.
Sourcepub fn open(self, open: bool) -> Disclosure
pub fn open(self, open: bool) -> Disclosure
Whether it starts open (closed by default).
Sourcepub fn expanded(self, expanded: Binding<bool>) -> Disclosure
pub fn expanded(self, expanded: Binding<bool>) -> Disclosure
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) -> Disclosure
pub fn title_view(self, view: impl View + 'static) -> Disclosure
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) -> Disclosure
pub fn mark(self, mark: impl View + 'static) -> Disclosure
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.
Sourcepub fn switch(self, value: Binding<bool>) -> Disclosure
pub fn switch(self, value: Binding<bool>) -> Disclosure
Puts an on/off switch at the end of the header, named after the title. Using it does not open or close the disclosure.
Sourcepub fn key(self, key: u64) -> Disclosure
pub fn key(self, key: u64) -> Disclosure
What tells this disclosure apart inside an Accordion, so it keeps its state
when the list changes (its position by default).
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
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>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.