egui/crates/egui_demo_lib/src
David M. Lary 32a63da580
Added Context::is_context_menu_open() (#3267)
I encountered a case where I needed to know if an egui context menu was
open, even if the mouse cursor was not in an egui area (full details in
discord).  I found that every resource I needed to detect that the menu
was open was either private, or pub(crate).  While it is possible to
wrap the `Response::context_menu()` in code to do state-tracking, it
becomes necessary to duplicate that code in every place you use a
context menu.

In this commit, I add `Context::is_context_menu_open()`.  Named similarly
to `Context::is_pointer_over_area()`, this method will return true if
any context menu is open.  This is possible because the context menu
uses a temp var with a fixed Id to store its state.  This method just
fetches the state, and interrogates it to see if there is a menu
present.

One helper method, `BarState::has_root()`, was added as all the fields
needed to perform the check were private to the `menu` module.

I've also updated the Context Menu demo to show the result of
`is_context_menu_open()` to verify the code functions as expected.
2023-08-22 15:35:15 +02:00
..
demo Added Context::is_context_menu_open() (#3267) 2023-08-22 15:35:15 +02:00
easy_mark Increase MSRV to 1.67 (#3234) 2023-08-11 13:54:02 +02:00
color_test.rs Fix typos (#2866) 2023-04-18 15:52:45 +02:00
lib.rs Check for typos on CI (#2918) 2023-04-18 16:10:20 +02:00
syntax_highlighting.rs Avoid deadlocks by using lambdas for context lock (#2625) 2023-01-25 10:24:23 +01:00