pub struct FloatingPanel { /* private fields */ }Expand description
A round button in the corner of the window that opens a panel over the app. The app stays usable behind it, and Escape or the sphere closes it. Dragging it or pressing an arrow key sends it to another corner, and it stays there while the app runs.
It moves while the pointer or the focus is on it. The rest of the time it holds still and asks for no frames, like the rest of the UI.
Whatever must outlive closing it, such as a Chat’s messages, belongs outside.
use ravenrs_reactive::State;
use ravenrs_widgets::{FloatingPanel, Text};
let open = State::new(false);
let panel = FloatingPanel::new(open.binding(), "Assistant", || {
Box::new(Text::new("Hello"))
});Implementations§
Source§impl FloatingPanel
impl FloatingPanel
Sourcepub fn new(
open: Binding<bool>,
title: impl Into<String>,
content: impl Fn() -> Box<dyn View> + 'static,
) -> FloatingPanel
pub fn new( open: Binding<bool>, title: impl Into<String>, content: impl Fn() -> Box<dyn View> + 'static, ) -> FloatingPanel
A closed panel called title, the name screen readers give its sphere.
Sourcepub fn size(self, width: f32, height: f32) -> FloatingPanel
pub fn size(self, width: f32, height: f32) -> FloatingPanel
Its size in logical pixels (400 by 520 by default). A smaller window gets less height.
Sourcepub fn bottom_inset(self, inset: f32) -> FloatingPanel
pub fn bottom_inset(self, inset: f32) -> FloatingPanel
Keeps it this far, in logical pixels, from the bottom of the window, to clear
something fixed there, such as a StatusBar.
Sourcepub fn movable(self, place: Binding<Option<Point>>) -> FloatingPanel
pub fn movable(self, place: Binding<Option<Point>>) -> FloatingPanel
Lets it go anywhere in the window, dragged by its header or moved with the arrow
keys on it, without the sphere: open is what opens it. place holds its top-left
corner, so the app can remember it, and is written when a drag ends; None puts it
in the corner at the bottom right. It stays inside a window that gets smaller.
Sourcepub fn minimized(self, minimized: Binding<bool>) -> FloatingPanel
pub fn minimized(self, minimized: Binding<bool>) -> FloatingPanel
Adds a button that reduces it to its header and brings it back, kept in minimized.
Trait Implementations§
Source§impl Debug for FloatingPanel
impl Debug for FloatingPanel
Auto Trait Implementations§
impl !RefUnwindSafe for FloatingPanel
impl !Send for FloatingPanel
impl !Sync for FloatingPanel
impl !UnwindSafe for FloatingPanel
impl Freeze for FloatingPanel
impl Unpin for FloatingPanel
impl UnsafeUnpin for FloatingPanel
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.