1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Table resize (#1438)

* Let 1D strips fill up parent width/height
* Add Strip + Table + DatePicker to egui_extras changelog
* Expose some dragging- and pointer related context/memory methods
* Make tables resizable
This commit is contained in:
Emil Ernerfeldt
2022-04-01 12:01:00 +02:00
committed by GitHub
parent a52bbade45
commit 21c32a18d8
12 changed files with 323 additions and 159 deletions

View File

@@ -56,7 +56,7 @@ impl<'a> DatePickerPopup<'a> {
ui.spacing_mut().item_spacing = Vec2::splat(spacing);
StripBuilder::new(ui)
.sizes(
Size::Absolute(height),
Size::exact(height),
match (self.combo_boxes, self.arrows) {
(true, true) => 2,
(true, false) | (false, true) => 1,
@@ -64,14 +64,14 @@ impl<'a> DatePickerPopup<'a> {
},
)
.sizes(
Size::Absolute((spacing + height) * (weeks.len() + 1) as f32),
Size::exact((spacing + height) * (weeks.len() + 1) as f32),
if self.calendar { 1 } else { 0 },
)
.size(Size::Absolute(height))
.size(Size::exact(height))
.vertical(|mut strip| {
if self.combo_boxes {
strip.strip_clip(|builder| {
builder.sizes(Size::Remainder, 3).horizontal(|mut strip| {
builder.sizes(Size::remainder(), 3).horizontal(|mut strip| {
strip.cell(|ui| {
ComboBox::from_id_source("date_picker_year")
.selected_text(popup_state.year.to_string())
@@ -138,7 +138,7 @@ impl<'a> DatePickerPopup<'a> {
if self.arrows {
strip.strip(|builder| {
builder.sizes(Size::Remainder, 6).horizontal(|mut strip| {
builder.sizes(Size::remainder(), 6).horizontal(|mut strip| {
strip.cell(|ui| {
ui.with_layout(Layout::top_down_justified(Align::Center), |ui| {
if ui
@@ -236,7 +236,7 @@ impl<'a> DatePickerPopup<'a> {
ui.spacing_mut().item_spacing = Vec2::new(1.0, 2.0);
TableBuilder::new(ui)
.scroll(false)
.columns(Size::Remainder, if self.calendar_week { 8 } else { 7 })
.columns(Size::remainder(), if self.calendar_week { 8 } else { 7 })
.header(height, |mut header| {
if self.calendar_week {
header.col(|ui| {
@@ -322,7 +322,7 @@ impl<'a> DatePickerPopup<'a> {
}
strip.strip(|builder| {
builder.sizes(Size::Remainder, 3).horizontal(|mut strip| {
builder.sizes(Size::remainder(), 3).horizontal(|mut strip| {
strip.empty();
strip.cell(|ui| {
ui.with_layout(Layout::top_down_justified(Align::Center), |ui| {