Struct pixel_widgets::widget::layers::Layers[][src]

pub struct Layers<'a, T, Id> { /* fields omitted */ }
Expand description

Stack child widgets on top of each other, while only the topmost receives events.

Implementations

impl<'a, T: 'a, Id: 'a + Eq + Clone> Layers<'a, T, Id>[src]

pub fn new(state: &'a mut State<Id>) -> Self[src]

Construct new Layers

pub fn with_background(
    state: &'a mut State<Id>,
    background: impl IntoNode<'a, T>
) -> Self
[src]

Construct new Layers with a background layer

pub fn push(self, id: Id, layer: impl IntoNode<'a, T>) -> Self[src]

Adds a widget

pub fn extend<I: IntoIterator<Item = (Id, N)>, N: IntoNode<'a, T> + 'a>(
    self,
    iter: I
) -> Self
[src]

Adds child widgets using an iterator

Trait Implementations

impl<'a, T, Id> Drop for Layers<'a, T, Id>[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl<'a, T: 'a + Send, Id: 'a + Send + Eq + Clone> IntoNode<'a, T> for Layers<'a, T, Id>[src]

fn into_node(self) -> Node<'a, T>[src]

Perform the conversion.

fn class(self, class: &'a str) -> Node<'a, Message>[src]

Convenience function that converts to a node and then adds a style class to the Node.

fn on_event(
    self,
    event: NodeEvent,
    f: impl 'a + Send + Fn(&mut Context<Message>)
) -> Node<'a, Message>
[src]

Convenience function that converts to a node and then sets a handler for when a node event occurs.

impl<'a, T: 'a + Send, Id: 'a + Send> Widget<'a, T> for Layers<'a, T, Id>[src]

fn widget(&self) -> &'static str[src]

The name of this widget, used to identify widgets of this type in stylesheets.

fn len(&self) -> usize[src]

Should return the amount of children this widget has. Must be consistent with visit_children(). Read more

fn visit_children(&mut self, visitor: &mut dyn FnMut(&mut Node<'a, T>))[src]

Applies a visitor to all childs of the widget. If an widget fails to visit it’s children, the children won’t be able to resolve their stylesheet, resulting in a panic when calling size, hit, event or draw. Read more

fn focused(&self) -> bool[src]

Test the widget for focus exclusivity. If the widget or one of it’s descendants is in an exclusive focus state, this function should return true. In all other cases, it should return false. When a widget is in an exclusive focus state it is the only widget that is allowed to receive events in event. Widgets that intended to use this behaviour are modal dialogs, dropdown boxes, context menu’s, etc. Read more

fn size(&self, style: &Stylesheet) -> (Size, Size)[src]

Returns the (width, height) of this widget. The extents are defined as a Size, which will later be resolved to actual dimensions. Read more

fn event(
    &mut self,
    layout: Rectangle,
    clip: Rectangle,
    _: &Stylesheet,
    event: Event,
    context: &mut Context<T>
)
[src]

Handle an event. If an event changes the graphical appearance of an Widget, redraw should be called to let the Ui know that the ui should be redrawn. Read more

fn draw(
    &mut self,
    layout: Rectangle,
    clip: Rectangle,
    _: &Stylesheet
) -> Vec<Primitive<'a>>
[src]

Draw the widget. Returns a list of Primitives that should be drawn. Read more

fn state(&self) -> StateVec[src]

The state of this widget, used for computing the style. If None is returned, Node will automatically compute a state, such as “hover” and “pressed”. Read more

fn is_empty(&self) -> bool[src]

Returns whether this children has no children. Must be consistent with visit_children(). Read more

fn hit(
    &self,
    layout: Rectangle,
    clip: Rectangle,
    _style: &Stylesheet,
    x: f32,
    y: f32
) -> bool
[src]

Perform a hit detect on the widget. Most widgets are fine with the default implementation, but some widgets (like Window need to report a miss (false) even when the queried position is within their layout. Read more

fn node_event(
    &mut self,
    _layout: Rectangle,
    _style: &Stylesheet,
    _event: NodeEvent,
    _context: &mut Context<Message>
)
[src]

Handle a node event. If an event changes the graphical appearance of an Widget, redraw should be called to let the Ui know that the ui should be redrawn. Read more

Auto Trait Implementations

impl<'a, T, Id> !RefUnwindSafe for Layers<'a, T, Id>

impl<'a, T, Id> Send for Layers<'a, T, Id> where
    Id: Send

impl<'a, T, Id> !Sync for Layers<'a, T, Id>

impl<'a, T, Id> Unpin for Layers<'a, T, Id> where
    Id: Unpin

impl<'a, T, Id> !UnwindSafe for Layers<'a, T, Id>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast<T> for T

pub fn downcast(&self) -> &T

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> Upcast<T> for T

pub fn upcast(&self) -> Option<&T>