Skip to main content

Panel

Struct Panel 

Source
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: i32

Border thickness in pixels, drawn inside the bounds.

§radius: Radius

Corner rounding token. The theme decides the pixels.

§backdrop: bool

Whether presses stop here instead of falling through.

See Panel::backdrop. Off for every ordinary panel.

Implementations§

Source§

impl Panel

Source

pub const fn filled(role: Role) -> Self

A panel filled with role and no border.

Source

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();
Source

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.

Source

pub const fn with_radius(self, radius: Radius) -> Self

Sets the corner rounding token.

Source

pub const fn with_border(self, role: Role, width: i32) -> Self

Sets the border role and thickness.

Trait Implementations§

Source§

impl Clone for Panel

Source§

fn clone(&self) -> Panel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Panel

Source§

impl Debug for Panel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Panel

Source§

fn default() -> Self

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

impl Describe for Panel

Source§

const KIND: &'static str = "panel"

The name a form file uses for this widget. Kebab-case.
Source§

const DOC: &'static str = "A themed rectangle: the background other widgets sit on."

One line saying what this widget is, for somebody choosing one. Read more
Source§

const GROUP: Group = Group::Container

Which shelf of the catalogue this belongs on.
Source§

const ICON: &'static Icon

The widget’s glyph: a small portrait of the thing, for a palette to draw beside — or instead of — its name. Read more
Source§

const PROPERTIES: &'static [Property]

Every property, in the order an inspector should show them.
Source§

fn get(&self, name: &str) -> Option<Value>

The current value. Read more
Source§

fn apply(&mut self, name: &str, value: Value) -> Result<(), Mismatch>

Applies a value, reporting only what went wrong. Read more
Source§

fn set(&mut self, name: &str, value: Value) -> Result<(), PropertyError>

Applies a value, reporting what went wrong and where.
Source§

impl<M: 'static> Widget<M> for Panel

Source§

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>

This widget’s property description, if it has one. Read more
Source§

fn describe_mut(&mut self) -> Option<&mut dyn DynDescribe>

The mutable half of describe.
Source§

fn accepts_pointer(&self) -> bool

Returns true if the pointer can hit this widget. Read more
Source§

fn paint(&self, ctx: &mut PaintCtx<'_>, canvas: &mut Pen<'_>)

Draws into canvas, which is already clipped to this widget’s bounds intersected with the damage region being repainted. Read more
Source§

fn on_event(&mut self, event: &Event<'_>, ctx: &mut EventCtx<'_, M>) -> Handled

Reacts to an event routed to this widget.
Source§

fn measure(&self, ctx: &mut MeasureCtx<'_>, offered: Offer) -> Measured

How big this widget would like to be, given what the caller can promise. Read more
Source§

fn focusable(&self) -> bool

Returns true if this widget can take keyboard focus.
Source§

fn animate(&mut self, now_ms: u64) -> Animation

Advances time-based state. Called only while this widget has asked to animate — see EventCtx::request_animation — and stops being called the moment it answers Wake::Never. Read more
Source§

fn snap(&mut self, now_ms: u64) -> Animation

Lands whatever is in flight at its end state, without animating it. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrows as dyn Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Mutably borrows as dyn Any.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynDescribe for T
where T: Describe,

Source§

fn kind(&self) -> &'static str

Source§

fn properties(&self) -> &'static [Property]

Source§

fn get_property(&self, name: &str) -> Option<Value>

Source§

fn set_property( &mut self, name: &str, value: Value, ) -> Result<(), PropertyError>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.