[examples] test_window_impl: Add buttons to close modal
@@ -49,6 +49,7 @@ struct State {
radio_button: i32,
color_edit: ColorEditState,
custom_rendering: CustomRenderingState,
+ dont_ask_me_next_time: bool,
}
impl Default for State {
@@ -101,6 +102,7 @@ impl Default for State {
radio_button: 0,
color_edit: ColorEditState::default(),
custom_rendering: Default::default(),
+ dont_ask_me_next_time: false,
}
}
}
@@ -655,7 +657,17 @@ CTRL+click on individual component to input value.\n",
ui.popup_modal(im_str!("Delete?")).always_auto_resize(true).build(|| {
ui.text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n");
ui.separator();
+ ui.with_style_var(StyleVar::FramePadding(ImVec2::new(0.0, 0.0)), || {
+ ui.checkbox(im_str!("Don't ask me next time"), &mut state.dont_ask_me_next_time);
+ if ui.button(im_str!("OK"), (120.0, 0.0)) {
+ ui.close_current_popup();
+ }
+ ui.same_line(0.0);
+ if ui.button(im_str!("Cancel"), (120.0, 0.0)) {
+ ui.close_current_popup();
+ }
+ });
});
});
}
