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
impl PopupWindow
Sourcepub fn new() -> PopupWindow
pub fn new() -> PopupWindow
An empty popup.
Sourcepub fn style(self, style: impl IntoProp<Style>) -> PopupWindow
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.
Sourcepub fn child(self, child: impl Widget) -> PopupWindow
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.
Sourcepub fn edges(self, edges: impl IntoProp<Anchors>) -> PopupWindow
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.
Sourcepub fn gravity(self, gravity: impl IntoProp<Anchors>) -> PopupWindow
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.
Sourcepub fn adjustment(self, adjustment: impl IntoProp<Adjust>) -> PopupWindow
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.
Sourcepub fn mask(self, mask: impl IntoProp<Option<Region>>) -> PopupWindow
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.
Sourcepub fn compositor_opacity(self, opacity: impl IntoProp<f32>) -> PopupWindow
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.
Sourcepub fn visible_mask(self, region: impl IntoProp<Option<Region>>) -> PopupWindow
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.