ohos-arkui-binding 0.2.0

OpenHarmony's arkui binding for rust
Documentation
//! Module component::built_in_component::radio wrappers and related types.

// BEGIN_GENERATED_COMPONENT_METHODS_Radio
impl super::Radio {
    pub fn set_radio_checked<T: Into<crate::ArkUINodeAttributeItem>>(
        &self,
        value: T,
    ) -> crate::ArkUIResult<()> {
        <Self as crate::ArkUICommonAttribute>::set_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioChecked,
            value.into(),
        )
    }

    pub fn get_radio_checked(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
        <Self as crate::ArkUICommonAttribute>::get_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioChecked,
        )
    }

    pub fn set_radio_style<T: Into<crate::ArkUINodeAttributeItem>>(
        &self,
        value: T,
    ) -> crate::ArkUIResult<()> {
        <Self as crate::ArkUICommonAttribute>::set_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioStyle,
            value.into(),
        )
    }

    pub fn get_radio_style(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
        <Self as crate::ArkUICommonAttribute>::get_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioStyle,
        )
    }

    pub fn set_radio_value<T: Into<crate::ArkUINodeAttributeItem>>(
        &self,
        value: T,
    ) -> crate::ArkUIResult<()> {
        <Self as crate::ArkUICommonAttribute>::set_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioValue,
            value.into(),
        )
    }

    pub fn get_radio_value(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
        <Self as crate::ArkUICommonAttribute>::get_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioValue,
        )
    }

    pub fn set_radio_group<T: Into<crate::ArkUINodeAttributeItem>>(
        &self,
        value: T,
    ) -> crate::ArkUIResult<()> {
        <Self as crate::ArkUICommonAttribute>::set_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioGroup,
            value.into(),
        )
    }

    pub fn get_radio_group(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
        <Self as crate::ArkUICommonAttribute>::get_attribute(
            self,
            crate::ArkUINodeAttributeType::RadioGroup,
        )
    }
}
// END_GENERATED_COMPONENT_METHODS_Radio

impl super::Radio {
    pub fn on_radio_change<T: Fn(bool) + 'static>(&mut self, cb: T) {
        crate::ArkUIEvent::on_event(
            self,
            crate::NodeEventType::RadioEventOnChange,
            move |event| {
                cb(event.i32_value(0).unwrap_or_default() != 0);
            },
        );
    }
}