imgui: Add with_style_and_color_vars convenient function

Wraps with_style_vars and with_color_vars inside a single call.
This commit is contained in:
Malik Olivier Boussejra 2018-03-26 16:47:40 +09:00
parent 4ccae8bc10
commit 435eeaf892

View File

@ -1088,6 +1088,24 @@ impl<'ui> Ui<'ui> {
}
}
impl<'ui> Ui<'ui> {
/// Runs a function after temporarily pushing an array of values to the
/// style and color stack.
pub fn with_style_and_color_vars<F, C>(
&self,
style_vars: &[StyleVar],
color_vars: &[(ImGuiCol, C)],
f: F,
) where
F: FnOnce(),
C: Into<ImVec4> + Copy,
{
self.with_style_vars(style_vars, || {
self.with_color_vars(color_vars, f);
});
}
}
/// # Utilities
impl<'ui> Ui<'ui> {
/// Returns `true` if the last item is being hovered by the mouse.