pub struct ChatMedia { /* private fields */ }Expand description
What a ChatMessage carries in its bubble, above its text: a photo,
a document or a recording. The file stays with the app, which asks to open it from
Self::on_open.
use ravenrs_reactive::State;
use ravenrs_widgets::{Chat, ChatMedia, ChatMessage, Ui};
let messages = State::new(vec![
ChatMessage::person("The *signed* contract")
.formatted()
.media(ChatMedia::document("contract.pdf").size(240_000).on_open(|| {})),
]);
let mut ui = Ui::new(Chat::new(messages.binding()), ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl ChatMedia
impl ChatMedia
Sourcepub fn photo(image: Option<ImageData>) -> ChatMedia
pub fn photo(image: Option<ImageData>) -> ChatMedia
A photo. While it is None it holds a space of the same size, so that what is above
does not jump when it arrives.
Sourcepub fn audio(player: impl Fn() -> AudioPlayerButton + 'static) -> ChatMedia
pub fn audio(player: impl Fn() -> AudioPlayerButton + 'static) -> ChatMedia
A recording. The player is built each time the message is shown, so that the clip or the transcript that arrives later is there.
Sourcepub fn side(self, side: f32) -> ChatMedia
pub fn side(self, side: f32) -> ChatMedia
The side of a photo, which is shown square (240 logical pixels by default).
Sourcepub fn icon(self, icon: IconName) -> ChatMedia
pub fn icon(self, icon: IconName) -> ChatMedia
The icon of a document (IconName::FileText by default).
Sourcepub fn on_open(self, handler: impl Fn() + 'static) -> ChatMedia
pub fn on_open(self, handler: impl Fn() + 'static) -> ChatMedia
Makes a photo or a document open with a click, Enter or Space: for instance in an
ImageLightbox, or through the system.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ChatMedia
impl !Send for ChatMedia
impl !Sync for ChatMedia
impl !UnwindSafe for ChatMedia
impl Freeze for ChatMedia
impl Unpin for ChatMedia
impl UnsafeUnpin for ChatMedia
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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.