lvgl-rs/lvgl-codegen/templates/style.rs.j2
2020-06-04 21:29:21 +02:00

34 lines
870 B
Django/Jinja

pub fn set_{{func_name}}(&mut self, state: State,
{% if style_type == "_color" %}
value: Color
{% elif style_type == "_int" %}
value: i16
{% elif style_type == "_ptr" %}
value: Any
{% elif style_type == "_opa" %}
value: Opacity
{% endif %}
) {
let native_state: u32 = state.get_bits();
unsafe {
lvgl_sys::_lv_style_set{{style_type}}(
self.raw.as_mut(),
(lvgl_sys::LV_STYLE_{{prop_name}}
| (native_state << lvgl_sys::LV_STYLE_STATE_POS as u32)) as u16,
{% if style_type == "_color" %}
value.raw,
{% elif style_type == "_int" %}
value
{% elif style_type == "_opa" %}
value.into()
{% elif style_type == "_ptr" %}
value.into()
{% endif %}
);
}
}