1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00
Files
egui/examples
Lucas Meurer 64470b2d40 Add Frame::expand_in_place, Frame::invisible and TextVisuals constructors
The expansion/stroke correction on a widget's margins was written out by
hand. Move it into `Frame::expand_in_place`, which knows the frame's own
stroke width, so a caller states the intent instead of the arithmetic.
`Frame::invisible` goes with it: a frame that keeps its layout but drops
its paint.

Two fixes fall out of it in the button style:

* A small button zeroed its vertical padding after the correction, which
  left the frame a `stroke.width - expansion` tall. Zeroing before the
  correction makes it exactly zero in every state, which is what "must
  not add any height" means.
* The invisible frame of a button that hides its frame when inactive
  dropped the outer margin and the stroke width, so it was not, in fact,
  as big as the painted one. It now keeps the whole frame and only drops
  the paint.

Also give `TextVisuals` a `new` and a `from_widget_visuals`, replacing the
local `text_visuals` helper, and add `HasClasses::add_classes` and
`HasClasses::with_classes`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 13:56:49 +02:00
..
2025-05-08 09:15:42 +02:00
2023-11-23 12:58:44 +01:00

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 main are for the latest main 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.