pub struct TitleBar { /* private fields */ }Expand description
Cross-platform client-drawn title bar with a drag region, customizable title typography, optional leading/content/trailing slots, macOS traffic-light spacing, and platform-appropriate window controls.
Implementations§
Source§impl TitleBar
impl TitleBar
Sourcepub fn new(id: impl Into<ElementId>) -> TitleBar
pub fn new(id: impl Into<ElementId>) -> TitleBar
Creates a title bar with a stable identity in the window view.
Sourcepub fn title(self, title: impl Into<SharedString>) -> TitleBar
pub fn title(self, title: impl Into<SharedString>) -> TitleBar
Sets an explicit title string. When omitted, reads the live window title.
Sourcepub fn height(self, height: Pixels) -> TitleBar
pub fn height(self, height: Pixels) -> TitleBar
Sets the logical height of the title bar. Defaults to DEFAULT_TITLE_BAR_HEIGHT (48 px).
Sourcepub fn title_role(self, role: TypeRole) -> TitleBar
pub fn title_role(self, role: TypeRole) -> TitleBar
Selects the Material typography role for the title text. Defaults to TypeRole::TitleSmall.
Sourcepub fn title_font(self, font: Font) -> TitleBar
pub fn title_font(self, font: Font) -> TitleBar
Overrides the full GPUI Font used for the title text.
Sourcepub fn title_font_family(self, family: impl Into<SharedString>) -> TitleBar
pub fn title_font_family(self, family: impl Into<SharedString>) -> TitleBar
Overrides only the title font family while preserving weight and theme metrics.
Sourcepub fn title_font_size(self, size: Pixels) -> TitleBar
pub fn title_font_size(self, size: Pixels) -> TitleBar
Overrides the title font size in logical pixels.
Sourcepub fn leading(self, content: impl IntoElement) -> TitleBar
pub fn leading(self, content: impl IntoElement) -> TitleBar
Places leading client-area content after any macOS traffic-light inset and before the title/drag region.
Sourcepub fn content(self, content: impl IntoElement) -> TitleBar
pub fn content(self, content: impl IntoElement) -> TitleBar
Places client-area content between the drag region and trailing/caption controls.
Sourcepub fn trailing(self, content: impl IntoElement) -> TitleBar
pub fn trailing(self, content: impl IntoElement) -> TitleBar
Places trailing client-area content before the caption buttons.
Sourcepub fn traffic_light_padding(self, padding: Pixels) -> TitleBar
pub fn traffic_light_padding(self, padding: Pixels) -> TitleBar
Sets the logical leading inset reserved for macOS traffic light buttons
when not fullscreen. Defaults to DEFAULT_MACOS_TRAFFIC_LIGHT_PADDING (78 px).
Sourcepub fn colors(self, colors: TitleBarColors) -> TitleBar
pub fn colors(self, colors: TitleBarColors) -> TitleBar
Overrides the title bar surface, foreground, and optional bottom divider colors.
Sourcepub fn caption_colors(self, colors: CaptionButtonColors) -> TitleBar
pub fn caption_colors(self, colors: CaptionButtonColors) -> TitleBar
Overrides the caption button palette.
Sourcepub fn caption_labels(self, labels: CaptionButtonLabels) -> TitleBar
pub fn caption_labels(self, labels: CaptionButtonLabels) -> TitleBar
Overrides the localized accessible names for the caption buttons.
Overrides the logical width of each caption button.
Explicitly shows or hides caption buttons (still hidden in fullscreen).
Sourcepub fn on_close(
self,
handler: impl Fn(&mut Window, &mut App) + 'static,
) -> TitleBar
pub fn on_close( self, handler: impl Fn(&mut Window, &mut App) + 'static, ) -> TitleBar
Installs a custom close callback invoked when the Close button activates.
Sourcepub fn platform(self, platform: ChromePlatform) -> TitleBar
pub fn platform(self, platform: ChromePlatform) -> TitleBar
Overrides the target chrome platform rules. Defaults to ChromePlatform::current.
Trait Implementations§
Source§impl IntoElement for TitleBar
impl IntoElement for TitleBar
Source§type Element = ViewElement<TitleBar>
type Element = ViewElement<TitleBar>
Source§fn into_element(self) -> <TitleBar as IntoElement>::Element
fn into_element(self) -> <TitleBar as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for TitleBar
impl RenderOnce for TitleBar
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for TitleBar
impl !Send for TitleBar
impl !Sync for TitleBar
impl !UnwindSafe for TitleBar
impl Forget for TitleBar
impl Freeze for TitleBar
impl Move for TitleBar
impl Unpin for TitleBar
impl UnsafeUnpin for TitleBar
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.