mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-22 10:58:31 +00:00
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:
parent
4ccae8bc10
commit
435eeaf892
18
src/lib.rs
18
src/lib.rs
@ -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
|
/// # Utilities
|
||||||
impl<'ui> Ui<'ui> {
|
impl<'ui> Ui<'ui> {
|
||||||
/// Returns `true` if the last item is being hovered by the mouse.
|
/// Returns `true` if the last item is being hovered by the mouse.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user