Struct i_slint_core::items::ItemVTable
source · #[repr(C)]pub struct ItemVTable {
pub init: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, window_adapter: &WindowAdapterRc),
pub geometry: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>) -> LogicalRect,
pub cached_rendering_data_offset: usize,
pub layout_info: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, orientation: Orientation, window_adapter: &WindowAdapterRc) -> LayoutInfo,
pub input_event_filter_before_children: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventFilterResult,
pub input_event: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventResult,
pub focus_event: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: &FocusEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> FocusEventResult,
pub key_event: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult,
pub render: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, backend: &mut &'_ mut dyn ItemRenderer, self_rc: &ItemRc) -> RenderingResult,
}Expand description
Items are the nodes in the render tree.
Fields§
§init: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, window_adapter: &WindowAdapterRc)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.
geometry: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>) -> LogicalRectReturns the geometry of this item (relative to its parent item)
cached_rendering_data_offset: usizeoffset in bytes from the *const ItemImpl. isize::MAX means None
layout_info: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, orientation: Orientation, window_adapter: &WindowAdapterRc) -> LayoutInfoWe would need max/min/preferred size, and all layout info
input_event_filter_before_children: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventFilterResultEvent 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 extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: MouseEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> InputEventResultHandle input event for mouse and touch event
focus_event: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: &FocusEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> FocusEventResult§key_event: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, _: &KeyEvent, window_adapter: &WindowAdapterRc, self_rc: &ItemRc) -> KeyEventResult§render: unsafe extern "C" fn(_: Pin<VRef<'_, ItemVTable>>, backend: &mut &'_ mut dyn ItemRenderer, self_rc: &ItemRc) -> RenderingResultImplementations§
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.