Open emilk opened 8 months ago
In WPF/Avalonia there is a type called Brush, which is used for the foreground, background, and stroke properties on the widgets. It can be a solid color, a gradient, a texture etc. In .NET this is done through polymorphism everywhere (every class in WPF has like 9 abstract parent classes), but maybe egui could do the same with an enum? We would still be packing 24 bytes per field instead of 4 (if every variant other than Color32 is boxed), but maybe it would be worth it for the flexibility.
The extra variants could also be behind a feature, so the size becomes 4 bytes when it is not active. But then it has to be marked #[non_exhaustive]
, otherwise enabling the feature would cause a SemVer breaking change, and that goes against the API guidelines since features have to be additive.
As a first step towards more powerful styling, I want to change how
Frame
works to be slightly more like the CSS box model.In particular, the frame border stroke width should be counted as part of the width of the frame. This should let us get rid of the ugly
clip_rect_margin
.The plan is to use the new
Frame
for essentially all widgets (except maybeLabel
). So aButton
would ask theStyle
for aFrame
, then use that for both its sizing and color calculations.Here is the proposed outline