diff --git a/imgui-examples/examples/test_window_impl.rs b/imgui-examples/examples/test_window_impl.rs index 51079d7..65d3000 100644 --- a/imgui-examples/examples/test_window_impl.rs +++ b/imgui-examples/examples/test_window_impl.rs @@ -50,6 +50,8 @@ struct State { color_edit: ColorEditState, custom_rendering: CustomRenderingState, dont_ask_me_next_time: bool, + stacked_modals_item: i32, + stacked_modals_color: [f32; 4], } impl Default for State { @@ -103,6 +105,8 @@ impl Default for State { color_edit: ColorEditState::default(), custom_rendering: Default::default(), dont_ask_me_next_time: false, + stacked_modals_item: 0, + stacked_modals_color: [0.4, 0.7, 0.0, 0.5], } } } @@ -669,6 +673,31 @@ CTRL+click on individual component to input value.\n", } }); }); + + if ui.button(im_str!("Stacked modals.."), (0.0, 0.0)) { + ui.open_popup(im_str!("Stacked 1")); + } + ui.popup_modal(im_str!("Stacked 1")).build(|| { + ui.text( + "Hello from Stacked The First\n\ + Using style.Colors[ImGuiCol_ModalWindowDarkening] for darkening." + ); + + let items = &[im_str!("aaaa"), im_str!("bbbb"), im_str!("cccc"), im_str!("dddd"), im_str!("eeee")]; + ui.combo(im_str!("Combo"), &mut state.stacked_modals_item, items, -1); + + ui.color_edit(im_str!("color"), &mut state.stacked_modals_color).build(); + + if ui.button(im_str!("Add another modal.."), (0.0, 0.0)) { + ui.open_popup(im_str!("Stacked 2")) ; + } + ui.popup_modal(im_str!("Stacked 2")).build(|| { + ui.text("Hello from Stacked The Second"); + if ui.button(im_str!("Close"), (0.0, 0.0)) { + ui.close_current_popup(); + } + }); + }); }); } })