egui/crates
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
..
ecolor Increase MSRV to 1.67 (#3234) 2023-08-11 13:54:02 +02:00
eframe Fix iOS support in `eframe` (#3241) 2023-08-22 14:35:18 +02:00
egui Added Context::is_context_menu_open() (#3267) 2023-08-22 15:35:15 +02:00
egui-wgpu Improved wgpu callbacks (#3253) 2023-08-15 17:17:39 +02:00
egui-winit Change force to be Option<f32> instead of f32 (#3240) 2023-08-12 13:50:40 +02:00
egui_demo_app Improved wgpu callbacks (#3253) 2023-08-15 17:17:39 +02:00
egui_demo_lib Added Context::is_context_menu_open() (#3267) 2023-08-22 15:35:15 +02:00
egui_extras Add `TableBuilder::drag_to_scroll` (#3100) 2023-08-14 18:21:42 +02:00
egui_glium Support images with rounded corners (#3257) 2023-08-15 09:29:30 +02:00
egui_glow Fix wrong detection of OS (#3238) 2023-08-12 13:50:31 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Support images with rounded corners (#3257) 2023-08-15 09:29:30 +02:00
epaint Improved wgpu callbacks (#3253) 2023-08-15 17:17:39 +02:00