lvgl-rs/lvgl-codegen/templates/style.rs.j2
2020-06-04 20:47:40 +02:00

33 lines
858 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: u8
{% 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
{% elif style_type == "_ptr" %}
value.into()
{% endif %}
);
}
}