1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -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

@@ -1,4 +1,4 @@
use egui::{Id, Pos2, Rect, Response, Sense, Ui};
use egui::{Id, Pos2, Rect, Response, Sense, Ui, UiBuilder};
#[derive(Clone, Copy)]
pub(crate) enum CellSize {
@@ -197,11 +197,12 @@ impl<'l> StripLayout<'l> {
child_ui_id_source: egui::Id,
add_cell_contents: impl FnOnce(&mut Ui),
) -> Ui {
let mut child_ui = self.ui.child_ui_with_id_source(
max_rect,
self.cell_layout,
child_ui_id_source,
Some(egui::UiStackInfo::new(egui::UiKind::TableCell)),
let mut child_ui = self.ui.new_child(
UiBuilder::new()
.id_source(child_ui_id_source)
.ui_stack_info(egui::UiStackInfo::new(egui::UiKind::TableCell))
.max_rect(max_rect)
.layout(self.cell_layout),
);
if flags.clip {