Skip to main content

PopupWindow

Struct PopupWindow 

Source
pub struct PopupWindow { /* private fields */ }
Expand description

A popup: a window next to the widget that opened it, sized to fit its one child. Open one with Cx::open_popup.

use crabshell_ui::{Button, PopupWindow, Text};

let button = Button::new(Text::new("open")).on_click(|cx| {
    cx.open_popup(|_cx| PopupWindow::new().child(Text::new("hello")))
});

Implementations§

Source§

impl PopupWindow

Source

pub fn new() -> PopupWindow

An empty popup.

Source

pub fn style(self, style: impl IntoProp<Style>) -> PopupWindow

Sets the popup’s style. Its color and font are inherited by every Text in it that doesn’t set its own.

Source

pub fn child(self, child: impl Widget) -> PopupWindow

Sets the popup’s one child. The popup is as large as the child wants to be, plus the style’s padding.

Source

pub fn edges(self, edges: impl IntoProp<Anchors>) -> PopupWindow

Sets the edge or corner of the widget the popup hangs from, such as Edge::Bottom | Edge::Left; opposite edges cancel. Read when it opens, as the compositor places a popup once.

Source

pub fn gravity(self, gravity: impl IntoProp<Anchors>) -> PopupWindow

Sets which way the popup extends from its edges, such as Edge::Bottom | Edge::Right. Read when it opens.

Source

pub fn adjustment(self, adjustment: impl IntoProp<Adjust>) -> PopupWindow

Sets how the popup may move or shrink to stay on its output. The default flips and slides it. Read when it opens.

Source

pub fn mask(self, mask: impl IntoProp<Option<Region>>) -> PopupWindow

Sets the part of the popup that takes pointer input, as PanelWindow::mask does, and None, the default, is the whole popup. A popup a click opened holds the pointer, so a click outside its mask reaches the shell’s own window below, but over another program it closes the popup, as any click outside does.

Source

pub fn compositor_opacity(self, opacity: impl IntoProp<f32>) -> PopupWindow

Sets the opacity the compositor shows the whole popup at, blur included, as PanelWindow::compositor_opacity does.

Source

pub fn visible_mask(self, region: impl IntoProp<Option<Region>>) -> PopupWindow

Tells the compositor which part of the popup holds anything to see, as PanelWindow::visible_mask does.

Trait Implementations§

Source§

impl Default for PopupWindow

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more