[−][src]Struct pixel_widgets::widget::Node
Generic ui widget.
Implementations
impl<'a, Message> Node<'a, Message>
[src]
pub fn new<T: 'a + Widget<'a, Message>>(widget: T) -> Self
[src]
Construct a new Node
from an Widget
.
pub fn class(self, class: &'a str) -> Self
[src]
Sets the style class
pub fn on_event(
self,
event: NodeEvent,
f: impl 'a + Send + Fn(&mut Context<Message>)
) -> Self
[src]
self,
event: NodeEvent,
f: impl 'a + Send + Fn(&mut Context<Message>)
) -> Self
Sets a handler for when a node event occurs
pub fn size(&self) -> (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.
pub fn hit(&self, layout: Rectangle, clip: Rectangle, 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.
Arguments:
layout
: the layout assigned to the widgetclip
: a clipping rect for mouse events. Mouse events outside of this rect should be considered invalid, such as withScroll
, where the widget would not be visible outside of the currently visible rect.x
: x mouse coordinate being queriedy
: y mouse coordinate being queried
pub 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.
pub fn event(
&mut self,
layout: Rectangle,
clip: Rectangle,
event: Event,
context: &mut Context<Message>
)
[src]
&mut self,
layout: Rectangle,
clip: Rectangle,
event: Event,
context: &mut Context<Message>
)
Handle an event.
Arguments:
layout
: the layout assigned to the widgetclip
: a clipping rect for mouse events. Mouse events outside of this rect should be considered invalid, such as withScroll
, where the widget would not be visible outside of the currently visible rect.event
: the event that needs to be handledcontext
: context for submitting messages and requesting redraws of the ui.
pub fn draw(&mut self, layout: Rectangle, clip: Rectangle) -> Vec<Primitive<'a>>
[src]
Draw the widget. Returns a list of Primitive
s that should be drawn.
Arguments:
layout
: the layout assigned to the widgetclip
: a clipping rect for use withPrimitive::PushClip
.
Trait Implementations
Auto Trait Implementations
impl<'a, Message> !RefUnwindSafe for Node<'a, Message>
[src]
impl<'a, Message> Send for Node<'a, Message>
[src]
impl<'a, Message> !Sync for Node<'a, Message>
[src]
impl<'a, Message> Unpin for Node<'a, Message>
[src]
impl<'a, Message> !UnwindSafe for Node<'a, Message>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,