Update titlebar

This commit is contained in:
Nate Butler 2023-11-08 12:57:31 -05:00
parent 6e11044e9e
commit e4ca2cb20b

View file

@ -36,7 +36,7 @@ use futures::{
Future, FutureExt, StreamExt, Future, FutureExt, StreamExt,
}; };
use gpui::{ use gpui::{
div, point, size, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext, div, point, rems, size, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext,
AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, EventEmitter, FocusHandle, AsyncWindowContext, Bounds, Component, Div, Entity, EntityId, EventEmitter, FocusHandle,
GlobalPixels, Model, ModelContext, ParentElement, Point, Render, Size, StatefulInteractive, GlobalPixels, Model, ModelContext, ParentElement, Point, Render, Size, StatefulInteractive,
Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowBounds, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowBounds,
@ -69,6 +69,7 @@ use std::{
}; };
use theme2::ActiveTheme; use theme2::ActiveTheme;
pub use toolbar::{ToolbarItemLocation, ToolbarItemView}; pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
use ui::{h_stack, Label};
use util::ResultExt; use util::ResultExt;
use uuid::Uuid; use uuid::Uuid;
use workspace_settings::{AutosaveSetting, WorkspaceSettings}; use workspace_settings::{AutosaveSetting, WorkspaceSettings};
@ -2620,19 +2621,23 @@ impl Workspace {
// } // }
fn render_titlebar(&self, cx: &mut ViewContext<Self>) -> impl Component<Self> { fn render_titlebar(&self, cx: &mut ViewContext<Self>) -> impl Component<Self> {
div() h_stack()
.id("titlebar")
.justify_between()
.w_full()
.h(rems(1.75))
.bg(cx.theme().colors().title_bar_background) .bg(cx.theme().colors().title_bar_background)
.when( .when(
!matches!(cx.window_bounds(), WindowBounds::Fullscreen), !matches!(cx.window_bounds(), WindowBounds::Fullscreen),
|s| s.pl_20(), |s| s.pl_20(),
) )
.id("titlebar")
.on_click(|_, event, cx| { .on_click(|_, event, cx| {
if event.up.click_count == 2 { if event.up.click_count == 2 {
cx.zoom_window(); cx.zoom_window();
} }
}) })
.child("Collab title bar Item") // self.titlebar_item .child(h_stack().child(Label::new("Left side titlebar item"))) // self.titlebar_item
.child(h_stack().child(Label::new("Right side titlebar item")))
} }
fn active_item_path_changed(&mut self, cx: &mut ViewContext<Self>) { fn active_item_path_changed(&mut self, cx: &mut ViewContext<Self>) {