egui/examples
lucasmerlin a8e98d3f9b
Add `Popup` and `Tooltip`, unifying the previous behaviours (#5713)
This introduces new `Tooltip` and `Popup` structs that unify and extend
the old popups and tooltips.

`Popup` handles the positioning and optionally stores state on whether
the popup is open (for click based popups like `ComboBox`, menus,
context menus).
`Tooltip` is based on `Popup` and handles state of whether the tooltip
should be shown (which turns out to be quite complex to handles all the
edge cases).

Both `Popup` and `Tooltip` can easily be constructed from a `Response`
and then customized via builder methods.

This also introduces `PositionAlign`, for aligning something outside of
a `Rect` (in contrast to `Align2` for aligning inside a `Rect`). But I
don't like the name, any suggestions? Inspired by [mui's tooltip
positioning](https://mui.com/material-ui/react-tooltip/#positioned-tooltips).

* Part of #4607 
* [x] I have followed the instructions in the PR template

TODOs:
- [x] Automatic tooltip positioning based on available space
- [x] Review / fix / remove all code TODOs 
- [x] ~Update the helper fns on `Response` to be consistent in naming
and parameters (Some use tooltip, some hover_ui, some take &self, some
take self)~ actually, I think the naming and parameter make sense on
second thought
- [x] Make sure all old code is marked deprecated

For discussion during review:
- the following check in `show_tooltip_for` still necessary?:
```rust
     let is_touch_screen = ctx.input(|i| i.any_touches());
     let allow_placing_below = !is_touch_screen; // There is a finger below. TODO: Needed?
```
2025-02-18 15:53:07 +01:00
..
confirm_exit Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_3d_glow Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_font Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_font_style Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_keypad Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_style Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
custom_window_frame ⚠️ Rename `Rounding` to `CornerRadius` (#5673) 2025-02-04 12:53:18 +01:00
file_dialog Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
hello_android Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
hello_world Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
hello_world_par Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
hello_world_simple Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
images ⚠️ Rename `Rounding` to `CornerRadius` (#5673) 2025-02-04 12:53:18 +01:00
keyboard_events Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
multiple_viewports Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
popups Add `Popup` and `Tooltip`, unifying the previous behaviours (#5713) 2025-02-18 15:53:07 +01:00
puffin_profiler Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
screenshot Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
serial_windows Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
user_attention Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
README.md examples/README.md: explain that the examples are for master 2023-02-08 20:34:43 +01:00
run_all.sh Fix up some examples (#3614) 2023-11-23 12:58:44 +01:00

README.md

egui and eframe examples

All the examples in this folder uses eframe to set up a window for egui. Some examples are specific to eframe, but many are applicable to any egui integration.

There are a lot more examples at https://www.egui.rs, and it has links to the source code of each example.

Also check out the official docs at https://docs.rs/egui and https://docs.rs/eframe.

Note that all the examples on master are for the latest master version of egui.

If you want to look for examples for a specific version of egui, go to that tag, e.g. https://github.com/emilk/egui/tree/latest/examples.