Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Modal and Memory::set_modal_layer #5358

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

lucasmerlin
Copy link
Collaborator

@lucasmerlin lucasmerlin commented Nov 8, 2024

#5370 should be merged before this

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:

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

@lucasmerlin lucasmerlin changed the title Add modal Add Modal and Memory::set_modal_layer Nov 8, 2024
@lucasmerlin lucasmerlin marked this pull request as draft November 8, 2024 10:30
Copy link

github-actions bot commented Nov 8, 2024

Preview available at https://egui-pr-preview.github.io/pr/5358-lucas/modal
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin marked this pull request as ready for review November 14, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal dialogs
1 participant