lvgl-rs/lvgl-codegen/templates/style.rs.j2

34 lines
870 B
Plaintext
Raw Normal View History

2020-06-04 00:00:31 +00:00
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" %}
2020-06-04 19:29:21 +00:00
value: Opacity
2020-06-04 00:00:31 +00:00
{% endif %}
) {
2020-06-04 18:14:43 +00:00
let native_state: u32 = state.get_bits();
2020-06-04 00:00:31 +00:00
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" %}
2020-06-04 19:29:21 +00:00
value.into()
2020-06-04 00:00:31 +00:00
{% elif style_type == "_ptr" %}
value.into()
{% endif %}
);
}
}