Skip to main content

TabBarUI

Struct TabBarUI 

Source
pub struct TabBarUI {
    pub hovered_tab: Option<TabId>,
    pub close_hovered: Option<TabId>,
    pub show_new_tab_profile_menu: bool,
    /* private fields */
}
Expand description

Tab bar UI state

Fields§

§hovered_tab: Option<TabId>

Currently hovered tab ID

§close_hovered: Option<TabId>

Tab where close button is hovered

§show_new_tab_profile_menu: bool

Whether the new-tab profile popup is open

Implementations§

Source§

impl TabBarUI

Source

pub fn new() -> Self

Create a new tab bar UI

Source§

impl TabBarUI

Source

pub fn handle_mouse_wheel( &mut self, delta: &MouseScrollDelta, tab_min_width: f32, tab_count: usize, ) -> bool

Handle mouse wheel when hovering over the horizontal tab bar. Converts vertical scroll delta to horizontal tab scrolling. Returns true if the event was consumed.

Source§

impl TabBarUI

Source

pub fn should_show(&self, tab_count: usize, mode: TabBarMode) -> bool

Check if tab bar should be visible

Source

pub fn is_dragging(&self) -> bool

Check if a drag operation is in progress

Source

pub fn render( &mut self, ctx: &mut Ui, tabs: &TabManager, config: &Config, profiles: &ProfileManager, right_reserved_width: f32, ) -> TabBarAction

Render the tab bar and return any action triggered

Source

pub fn get_height(&self, tab_count: usize, config: &Config) -> f32

Get the tab bar height (0 if hidden or if position is Left)

Source

pub fn get_width(&self, tab_count: usize, config: &Config) -> f32

Get the tab bar width (non-zero only for Left position, 0 if hidden)

Source

pub fn is_context_menu_open(&self) -> bool

Check if the context menu is currently open

Source

pub fn is_app_menu_open(&self) -> bool

Check if the in-app menu’s drop-down is open.

True only on platforms that draw it (Linux/BSD, or a forced-on run — see crate::menu::AppMenuUi::enabled). While it is open, keyboard input should be routed to egui rather than the terminal.

Source

pub fn tab_at_logical_pos(&self, pos: Pos2) -> Option<TabId>

Return the tab ID at the given egui logical-pixel position, using the tab rects cached from the last render frame. Returns None if the position doesn’t fall inside any rendered tab.

Source

pub fn is_renaming(&self) -> bool

Check if the tab rename text field is active

Source

pub fn calculate_drop_target_horizontal( tab_rects: &[(TabId, Rect)], drag_source_index: Option<usize>, pointer_x: f32, ) -> Option<usize>

Calculate the drop target insert index for a horizontal drag given a pointer x position.

Returns None if the drop would be a no-op (same position as source), or Some(insert_index) for a valid insertion point.

This is a pure helper that can be tested without egui rendering.

Source

pub fn insertion_to_target_index( insert_index: usize, drag_source_index: Option<usize>, ) -> usize

Convert an insertion index to an effective target index, accounting for source removal.

When a tab is removed from source_index and re-inserted at insert_index, indices after the source shift down by one. This helper applies that adjustment.

Source

pub fn horizontal_tab_content_origin_x( tab_area_left: f32, scroll_offset: f32, ) -> f32

Calculate the x origin for horizontally scrolled tab content.

A larger scroll offset reveals tabs further to the right, so the content itself must move left inside the clipped tab area.

Source

pub fn test_set_drag_state(&mut self, tab_id: Option<TabId>, in_progress: bool)

Set drag state directly; used by integration tests to exercise state transitions without requiring a live egui render loop.

Source

pub fn test_set_drop_target(&mut self, index: Option<usize>)

Set the drop target index directly; used by integration tests.

Source

pub fn test_drop_target_index(&self) -> Option<usize>

Get the current drop target index; used by integration tests.

Source

pub fn test_dragging_tab(&self) -> Option<TabId>

Get the id of the tab currently being dragged; used by integration tests.

Source

pub fn test_open_context_menu(&mut self, tab_id: TabId)

Open the context menu for a specific tab; used by integration tests.

Source

pub fn test_close_context_menu(&mut self)

Close the context menu; used by integration tests.

Source

pub fn test_context_menu_tab(&self) -> Option<TabId>

Get the context menu tab id; used by integration tests.

Source

pub fn context_menu_tab_id(&self) -> Option<TabId>

Get the tab ID for which the context menu is currently open, if any.

Source

pub fn test_set_renaming(&mut self, value: bool)

Set rename mode active/inactive; used by integration tests.

Source

pub fn test_set_tab_rects(&mut self, rects: Vec<(TabId, Rect)>)

Set cached tab rects directly; used by integration tests to exercise tab_at_logical_pos without requiring a live egui render pass.

Source

pub fn test_set_horizontal_scroll_state( &mut self, needs_scroll: bool, scroll_offset: f32, )

Set horizontal scroll state directly for integration tests.

Source

pub fn test_scroll_offset(&self) -> f32

Get the current horizontal scroll offset for integration tests.

Source

pub fn set_move_tab_context( &mut self, gateway_active: bool, tab_count: usize, candidates: Vec<(WindowId, String)>, context_tab_has_multiple_panes: bool, )

Update the move-tab context shown in the right-click context menu. Must be called each frame before render() so the context menu has fresh state.

Trait Implementations§

Source§

impl Default for TabBarUI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl UIElement for TabBarUI

Source§

fn is_visible(&self, ctx: Self::Ctx<'_>) -> bool

Returns true when the tab bar is configured to show given the current tab count and config.tab_bar_mode.

Source§

fn height_logical(&self, ctx: Self::Ctx<'_>) -> f32

Effective height of the tab bar in logical pixels.

Non-zero only when the bar is visible and positioned horizontally (top or bottom). Returns 0.0 for a left-side tab bar.

Source§

fn width_logical(&self, ctx: Self::Ctx<'_>) -> f32

Effective width of the tab bar in logical pixels.

Non-zero only when the bar is visible and positioned on the left side. Returns 0.0 for top/bottom tab bars.

Source§

fn is_capturing_input(&self) -> bool

Returns true when the tab rename field or a context menu is open, indicating that keyboard input should not be forwarded to the terminal.

Source§

type Ctx<'a> = TabBarCtx<'a>

The per-call context type. Implementors define a concrete 'a-lifetime struct holding the references they need (e.g. &'a Config).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more