use crate::{api, arc, ca, define_cls, define_obj_type, ns, objc, ui};
#[cfg(feature = "blocks")]
use crate::blocks;
define_obj_type!(
#[doc(alias = "UIUpdateLink")]
pub UpdateLink(ns::Id)
);
impl UpdateLink {
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
define_cls!(UI_UPDATE_LINK);
#[objc::msg_send(updateLinkForWindowScene:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_window_scene(window_scene: &ui::WindowScene) -> arc::R<Self>;
#[objc::msg_send(updateLinkForView:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_view(view: &ui::View) -> arc::R<Self>;
#[cfg(feature = "blocks")]
#[objc::msg_send(addActionToPhase:handler:)]
pub fn add_action_to_phase_block(
&mut self,
phase: &ui::UpdateActionPhase,
handler: &mut blocks::EscBlock<fn(update_link: &mut Self, update_info: &ui::UpdateInfo)>,
);
#[cfg(feature = "blocks")]
pub fn add_action_to_phase(
&mut self,
phase: &ui::UpdateActionPhase,
handler: impl FnMut(&mut Self, &ui::UpdateInfo) + 'static,
) {
let mut handler = blocks::EscBlock::new2(handler);
self.add_action_to_phase_block(phase, &mut handler);
}
#[objc::msg_send(addActionToPhase:target:selector:)]
pub fn add_action_to_phase_selector(
&mut self,
phase: &ui::UpdateActionPhase,
target: &ns::Id,
selector: &objc::Sel,
);
#[objc::msg_send(isEnabled)]
pub fn is_enabled(&self) -> bool;
#[objc::msg_send(setEnabled:)]
pub fn set_enabled(&mut self, val: bool);
#[objc::msg_send(requiresContinuousUpdates)]
pub fn requires_continuous_updates(&self) -> bool;
#[objc::msg_send(setRequiresContinuousUpdates:)]
pub fn set_requires_continuous_updates(&mut self, val: bool);
#[objc::msg_send(wantsLowLatencyEventDispatch)]
pub fn wants_low_latency_event_dispatch(&self) -> bool;
#[objc::msg_send(setWantsLowLatencyEventDispatch:)]
pub fn set_wants_low_latency_event_dispatch(&mut self, val: bool);
#[objc::msg_send(wantsImmediatePresentation)]
pub fn wants_immediate_presentation(&self) -> bool;
#[objc::msg_send(setWantsImmediatePresentation:)]
pub fn set_wants_immediate_presentation(&mut self, val: bool);
#[objc::msg_send(preferredFrameRateRange)]
pub fn preferred_frame_rate_range(&self) -> ca::FrameRateRange;
#[objc::msg_send(setPreferredFrameRateRange:)]
pub fn set_preferred_frame_rate_range(&mut self, val: ca::FrameRateRange);
#[objc::msg_send(currentUpdateInfo)]
pub fn current() -> Option<arc::R<Self>>;
}
impl UpdateLink {
#[cfg(feature = "blocks")]
#[objc::msg_send(addActionWithHandler:)]
pub fn add_action_block(
&mut self,
handler: &mut blocks::EscBlock<fn(update_link: &mut Self, update_info: &ui::UpdateInfo)>,
);
#[cfg(feature = "blocks")]
pub fn add_action(&mut self, handler: impl FnMut(&mut Self, &ui::UpdateInfo) + 'static) {
let mut handler = blocks::EscBlock::new2(handler);
self.add_action_block(&mut handler);
}
#[objc::msg_send(addActionWithTarget:selector:)]
pub fn add_action_selector(&mut self, target: &ns::Id, selector: &objc::Sel);
#[cfg(feature = "blocks")]
#[objc::msg_send(updateLinkForWindowScene:actionHandler:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_window_scene_handler_block(
window_scene: &ui::WindowScene,
handler: &mut blocks::EscBlock<fn(update_link: &mut Self, update_info: &ui::UpdateInfo)>,
) -> arc::R<Self>;
#[objc::msg_send(updateLinkForWindowScene:actionTarget:selector:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_window_scene_selector(
window_scene: &ui::WindowScene,
action_target: &ns::Id,
selector: &objc::Sel,
) -> arc::R<Self>;
#[cfg(feature = "blocks")]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_window_scene_handler(
window_scene: &ui::WindowScene,
handler: impl FnMut(&mut Self, &ui::UpdateInfo) + 'static,
) -> arc::R<Self> {
let mut handler = blocks::EscBlock::new2(handler);
Self::with_window_scene_handler_block(window_scene, &mut handler)
}
#[cfg(feature = "blocks")]
#[objc::msg_send(updateLinkForView:actionHandler:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_view_handler_block(
view: &ui::View,
handler: &mut blocks::EscBlock<fn(update_link: &mut Self, update_info: &ui::UpdateInfo)>,
) -> arc::R<Self>;
#[cfg(feature = "blocks")]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_view_handler(
view: &ui::View,
handler: impl FnMut(&mut Self, &ui::UpdateInfo) + 'static,
) -> arc::R<Self> {
let mut handler = blocks::EscBlock::new2(handler);
Self::with_view_handler_block(view, &mut handler)
}
#[objc::msg_send(updateLinkForView:actionTarget:selector:)]
#[api::available(ios = 18.0, tvos = 18.0, visionos = 2.0)]
pub fn with_view_selector(
view: &ui::View,
action_target: &ns::Id,
selector: &objc::Sel,
) -> arc::R<Self>;
}
#[link(name = "ui", kind = "static")]
unsafe extern "C" {
static UI_UPDATE_LINK: &'static objc::Class<UpdateLink>;
}