1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Create a UiBuilder for building Uis (#4969)

* Part of https://github.com/emilk/egui/issues/4634

The goals is to create fewer, more powerful entry points.


### Added
* `egui::UiBuilder`
* `Ui::allocate_new_ui`
* `Ui::new_child`

### Breaking changes
* `Ui::new` now takes a `UiBuilder`
* Deprecated
	* `ui.add_visible_ui`
	* `ui.allocate_ui_at_rect`
	* `ui.child_ui`
	* `ui.child_ui_with_id_source`
	* `ui.push_stack_info`
This commit is contained in:
Emil Ernerfeldt
2024-08-26 08:51:18 +02:00
committed by GitHub
parent 06f88e12b0
commit 5a196f6604
14 changed files with 392 additions and 172 deletions

View File

@@ -61,10 +61,15 @@ impl crate::Demo for WidgetGallery {
impl crate::View for WidgetGallery {
fn ui(&mut self, ui: &mut egui::Ui) {
ui.add_enabled_ui(self.enabled, |ui| {
if !self.visible {
ui.set_invisible();
}
let mut ui_builder = egui::UiBuilder::new();
if !self.enabled {
ui_builder = ui_builder.disabled();
}
if !self.visible {
ui_builder = ui_builder.invisible();
}
ui.scope_builder(ui_builder, |ui| {
ui.multiply_opacity(self.opacity);
egui::Grid::new("my_grid")