pub struct NativeXComponent {
pub raw: XComponentRaw,
/* private fields */
}Fields§
§raw: XComponentRawImplementations§
Source§impl NativeXComponent
impl NativeXComponent
pub fn new(raw: XComponentRaw) -> Self
pub fn with_id(raw: XComponentRaw, id: String) -> Self
Sourcepub fn raw(&self) -> *mut OH_NativeXComponent
pub fn raw(&self) -> *mut OH_NativeXComponent
get raw point
pub fn native_window(&self) -> Option<RawWindow>
Sourcepub fn register_callback(&self) -> Result<()>
pub fn register_callback(&self) -> Result<()>
Register callbacks
For multi-mode, it will use hashmap to store all of your callbacks closure.
This may cause xcomponent being slower, if you want to avoid this.
You can disable feature with callbacks and use register_native_callback
pub fn on_surface_changed<T: Fn(XComponentRaw, WindowRaw) -> Result<()> + 'static>( &self, cb: T, )
pub fn on_surface_created<T: Fn(XComponentRaw, WindowRaw) -> Result<()> + 'static>( &self, cb: T, )
pub fn on_surface_destroyed<T: Fn(XComponentRaw, WindowRaw) -> Result<()> + 'static>( &self, cb: T, )
pub fn on_touch_event<T: Fn(XComponentRaw, WindowRaw, TouchEventData) -> Result<()> + 'static>( &self, cb: T, )
Sourcepub unsafe fn register_native_callback(
&self,
callbacks: Box<OH_NativeXComponent_Callback>,
) -> Result<()>
pub unsafe fn register_native_callback( &self, callbacks: Box<OH_NativeXComponent_Callback>, ) -> Result<()>
Use ffi to register callbacks directly.
Sourcepub fn size(&self, window: WindowRaw) -> Result<XComponentSize>
pub fn size(&self, window: WindowRaw) -> Result<XComponentSize>
Get current XComponent’s size info include width and height.
pub fn offset(&self, window: WindowRaw) -> Result<XComponentOffset>
pub fn set_frame_rate(&self, min: i32, max: i32, expected: i32) -> Result<()>
Sourcepub fn on_frame_callback<T: Fn(XComponentRaw, u64, u64) -> Result<()> + 'static>(
&self,
cb: T,
) -> Result<()>
pub fn on_frame_callback<T: Fn(XComponentRaw, u64, u64) -> Result<()> + 'static>( &self, cb: T, ) -> Result<()>
Register frame callback
pub fn on_key_event<T: Fn(XComponentRaw, WindowRaw, KeyEventData) -> Result<()> + 'static>( &self, cb: T, ) -> Result<()>
pub fn on_hover_event<T: Fn(XComponentRaw, bool) -> Result<()> + 'static>( &self, cb: T, ) -> Result<()>
pub fn on_mouse_event<T: Fn(XComponentRaw, WindowRaw, MouseEventData) -> Result<()> + 'static>( &self, cb: T, ) -> Result<()>
pub fn register_mouse_event_callback(&self) -> Result<()>
pub fn on_ui_input_event<T: Fn(XComponentRaw, ArkUIInputEvent) -> Result<()> + 'static>( &self, cb: T, ) -> Result<()>
Trait Implementations§
Source§impl Clone for NativeXComponent
impl Clone for NativeXComponent
Source§fn clone(&self) -> NativeXComponent
fn clone(&self) -> NativeXComponent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NativeXComponent
impl RefUnwindSafe for NativeXComponent
impl !Send for NativeXComponent
impl !Sync for NativeXComponent
impl Unpin for NativeXComponent
impl UnsafeUnpin for NativeXComponent
impl UnwindSafe for NativeXComponent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more