tabs: add overflow popover for tabs that do not fit

This commit is contained in:
2026-11-14 19:27:50 +07:00
parent 4b70df452a
commit 33f8856bc2
5 changed files with 414 additions and 22 deletions
+4 -4
View File
@@ -14,8 +14,8 @@ use crate::common::{OVERLAY_LAYER, v_flex};
/// Reports the next open state of a [`Popover`]: `true` to open, `false` to close.
type ChangeHandler = Rc<dyn Fn(bool, &mut Window, &mut App)>;
type TriggerFn = Box<dyn Fn(&mut Window, &mut App) -> AnyElement>;
type ContentFn = Box<dyn Fn(&mut Window, &mut App) -> AnyElement>;
type TriggerFn = Box<dyn FnOnce(&mut Window, &mut App) -> AnyElement>;
type ContentFn = Box<dyn FnOnce(&mut Window, &mut App) -> AnyElement>;
/// Bounds captured during the last paint, shared with the dismissal listener.
type BoundsCell = Rc<RefCell<Option<Bounds<Pixels>>>>;
@@ -65,7 +65,7 @@ impl Popover {
/// Sets the element the panel anchors below, rendered in place.
pub fn trigger<F>(mut self, trigger: F) -> Self
where
F: Fn(&mut Window, &mut App) -> AnyElement + 'static,
F: FnOnce(&mut Window, &mut App) -> AnyElement + 'static,
{
self.trigger = Some(Box::new(trigger));
self
@@ -74,7 +74,7 @@ impl Popover {
/// Sets the panel's contents.
pub fn content<F>(mut self, content: F) -> Self
where
F: Fn(&mut Window, &mut App) -> AnyElement + 'static,
F: FnOnce(&mut Window, &mut App) -> AnyElement + 'static,
{
self.content = Some(Box::new(content));
self