egui/crates/egui_demo_lib
lucasmerlin 10791cc43d
Add `Modal` and `Memory::set_modal_layer` (#5358)
* Closes #686 
* Closes #839 
* #5370 should be merged before this
* [x] I have followed the instructions in the PR template

This adds modals to egui. 
This PR
- adds a new `Modal` struct
- adds `Memory::set_modal_layer` to limit focus to a layer and above
(used by the modal struct, but could also be used by custom modal
implementations)
- adds `Memory::allows_interaction` to check if a layer is behind a
modal layer, deprecating `Layer::allows_interaction`



Current problems:
- ~When a button is focused before the modal opens, it stays focused and
you also can't hit tab to focus the next widget. Seems like focus is
"stuck" on that widget until you hit escape. This might be related to
https://github.com/emilk/egui/issues/5359~ fixed!

Possible future improvements: 
- The titlebar from `window` should be made into a separate widget and
added to the modal
- The state whether the modal is open should be stored in egui
(optionally), similar to popup and menu. Ideally before this we would
refactor popup state to unify popup and menu

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-11-28 16:52:05 +01:00
..
benches Add `Context::request_discard` (#5059) 2024-09-13 14:20:51 +02:00
data Move all existing .png images to git LGS (#5320) 2024-10-29 10:04:07 +01:00
src Add `Modal` and `Memory::set_modal_layer` (#5358) 2024-11-28 16:52:05 +01:00
tests/snapshots Add `Modal` and `Memory::set_modal_layer` (#5358) 2024-11-28 16:52:05 +01:00
Cargo.toml Add egui testing library (#5166) 2024-10-22 12:39:00 +02:00
README.md Move all crates into a `crates` directory (#1940) 2022-08-20 10:41:49 +02:00

README.md

egui demo library

Latest version Documentation unsafe forbidden MIT Apache

This crate contains example code for egui.

The demo library is a separate crate for three reasons: