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() -> AnyView + 'static,
) -> Self
pub fn new( open: Binding<bool>, title: impl Into<String>, content: impl Fn() -> AnyView + 'static, ) -> Self
A closed panel called title, the name screen readers give its sphere.
Sourcepub fn size(self, width: f32, height: f32) -> Self
pub fn size(self, width: f32, height: f32) -> Self
Its size in logical pixels (400 by 520 by default). A smaller window gets less height.
Sourcepub fn bottom_inset(self, inset: f32) -> Self
pub fn bottom_inset(self, inset: f32) -> Self
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>>) -> Self
pub fn movable(self, place: Binding<Option<Point>>) -> Self
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.
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§
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<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>
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.