#[repr(C)]pub struct ItemVTable {
pub init: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, my_item: &ItemRc),
pub cached_rendering_data_offset: usize,
pub layout_info: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, orientation: Orientation, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> LayoutInfo,
pub input_event_filter_before_children: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventFilterResult,
pub input_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventResult,
pub focus_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &FocusEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> FocusEventResult,
pub capture_key_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult,
pub key_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult,
pub render: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, backend: &mut &'_ mut dyn ItemRenderer, self_rc: &ItemRc, size: LogicalSize) -> RenderingResult,
pub bounding_rect: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, window_adapter: &WindowAdapterRc, self_rc: &ItemRc, geometry: LogicalRect) -> LogicalRect,
pub clips_children: unsafe fn(Pin<VRef<'_, ItemVTable>>) -> bool,
}
Expand description
Items are the nodes in the render tree.
Fields§
§init: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, my_item: &ItemRc)
This function is called by the run-time after the memory for the item has been allocated and initialized. It will be called before any user specified bindings are set.
cached_rendering_data_offset: usize
offset in bytes from the *const ItemImpl. isize::MAX means None
layout_info: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, orientation: Orientation, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> LayoutInfo
We would need max/min/preferred size, and all layout info
input_event_filter_before_children: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventFilterResult
Event handler for mouse and touch event. This function is called before being called on children.
Then, depending on the return value, it is called for the children, and their children, then
Self::input_event
is called on the children, and finally Self::input_event
is called
on this item again.
input_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventResult
Handle input event for mouse and touch event
focus_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &FocusEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> FocusEventResult
§capture_key_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult
Called on the parents of the focused item, allowing for global shortcuts and similar overrides of the default actions.
key_event: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult
§render: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, backend: &mut &'_ mut dyn ItemRenderer, self_rc: &ItemRc, size: LogicalSize) -> RenderingResult
§bounding_rect: unsafe fn(_: Pin<VRef<'_, ItemVTable>>, window_adapter: &WindowAdapterRc, self_rc: &ItemRc, geometry: LogicalRect) -> LogicalRect
§clips_children: unsafe fn(Pin<VRef<'_, ItemVTable>>) -> bool
Implementations§
Source§impl ItemVTable
impl ItemVTable
Sourcepub fn new<T: Item + ItemConsts>() -> Self
pub fn new<T: Item + ItemConsts>() -> Self
Create a vtable suitable for a given type implementing the trait.