pub struct Panel {
pub fill: Option<Role>,
pub border: Option<Role>,
pub border_width: i32,
pub radius: Radius,
pub backdrop: bool,
}Expand description
A filled, optionally bordered rounded rectangle.
Panels are not interactive and are invisible to hit testing, so putting a
button on one does not mean the panel steals the click. Panel::backdrop
is the exception, for the sheet under an overlay’s contents.
Fields§
§fill: Option<Role>Background role, or None to leave what is underneath alone.
border: Option<Role>Border role, or None for no border.
border_width: i32Border thickness in pixels, drawn inside the bounds.
radius: RadiusCorner rounding token. The theme decides the pixels.
backdrop: boolWhether presses stop here instead of falling through.
See Panel::backdrop. Off for every ordinary panel.
Implementations§
Source§impl Panel
impl Panel
Sourcepub const fn bare() -> Self
pub const fn bare() -> Self
A panel that draws nothing: no fill, no border.
A container, for when the grouping is the point — a tabs node’s
pages, one per tab, shown and hidden as a unit. The tree already gives a
node a rectangle, a clip and children; this is the widget for a node
that wants those and no appearance of its own.
// Nothing to see, and that is the whole idea.
let page = Panel::bare();Sourcepub const fn backdrop(self) -> Self
pub const fn backdrop(self) -> Self
A panel that presses stop at, without disturbing the focus.
The sheet behind an overlay’s contents. An ordinary panel is invisible to hit testing, which is right for a card with a button on it and wrong for the sheet under an on-screen keyboard: a finger landing in the gap between two keys falls through to whatever is behind the overlay, and pressing that takes the focus away from the field being typed into — so a near-miss dismisses the keyboard.
This absorbs the press and leaves the focus exactly where it was, which
is the same bargain Button::no_focus
makes for the keys themselves.
Sourcepub const fn with_radius(self, radius: Radius) -> Self
pub const fn with_radius(self, radius: Radius) -> Self
Sets the corner rounding token.
Sourcepub const fn with_border(self, role: Role, width: i32) -> Self
pub const fn with_border(self, role: Role, width: i32) -> Self
Sets the border role and thickness.
Trait Implementations§
impl Copy for Panel
Source§impl Describe for Panel
impl Describe for Panel
Source§const DOC: &'static str = "A themed rectangle: the background other widgets sit on."
const DOC: &'static str = "A themed rectangle: the background other widgets sit on."
Source§const ICON: &'static Icon
const ICON: &'static Icon
Source§const PROPERTIES: &'static [Property]
const PROPERTIES: &'static [Property]
Source§impl<M: 'static> Widget<M> for Panel
impl<M: 'static> Widget<M> for Panel
Source§fn preserves_focus(&self) -> bool
fn preserves_focus(&self) -> bool
A backdrop is pressed past, not pressed: it must not move the focus and must not clear it.
Source§fn describe(&self) -> Option<&dyn DynDescribe>
fn describe(&self) -> Option<&dyn DynDescribe>
Source§fn describe_mut(&mut self) -> Option<&mut dyn DynDescribe>
fn describe_mut(&mut self) -> Option<&mut dyn DynDescribe>
describe.Source§fn accepts_pointer(&self) -> bool
fn accepts_pointer(&self) -> bool
true if the pointer can hit this widget. Read moreSource§fn paint(&self, ctx: &mut PaintCtx<'_>, canvas: &mut Pen<'_>)
fn paint(&self, ctx: &mut PaintCtx<'_>, canvas: &mut Pen<'_>)
canvas, which is already clipped to this widget’s bounds
intersected with the damage region being repainted. Read moreSource§fn on_event(&mut self, event: &Event<'_>, ctx: &mut EventCtx<'_, M>) -> Handled
fn on_event(&mut self, event: &Event<'_>, ctx: &mut EventCtx<'_, M>) -> Handled
Source§fn measure(&self, ctx: &mut MeasureCtx<'_>, offered: Offer) -> Measured
fn measure(&self, ctx: &mut MeasureCtx<'_>, offered: Offer) -> Measured
Source§fn animate(&mut self, now_ms: u64) -> Animation
fn animate(&mut self, now_ms: u64) -> Animation
EventCtx::request_animation — and stops being called
the moment it answers Wake::Never. Read moreAuto Trait Implementations§
impl Freeze for Panel
impl RefUnwindSafe for Panel
impl Send for Panel
impl Sync for Panel
impl Unpin for Panel
impl UnsafeUnpin for Panel
impl UnwindSafe for Panel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynDescribe for Twhere
T: Describe,
impl<T> DynDescribe for Twhere
T: Describe,
Source§fn kind(&self) -> &'static str
fn kind(&self) -> &'static str
Describe::KIND.Source§fn properties(&self) -> &'static [Property]
fn properties(&self) -> &'static [Property]
Describe::PROPERTIES.Source§fn get_property(&self, name: &str) -> Option<Value>
fn get_property(&self, name: &str) -> Option<Value>
Describe::get.Source§fn set_property(
&mut self,
name: &str,
value: Value,
) -> Result<(), PropertyError>
fn set_property( &mut self, name: &str, value: Value, ) -> Result<(), PropertyError>
Describe::set.