editor2 rendering (#3244)

- Make tab bar visible
- Fix tab text colors
- Ensure panes cover the available space
- Make the close button close
- Fix bug when unsubscribe called after remove
- WIP: start on editor element
- Add hover behaviour to tabs
- Add PointingHand on tabs
- gpui2: Add on_hover events
- Tooltip on tabs
- MOAR TOOLTIPS
- Use an `IconButton` for the tab close button
- Remove unneeded type qualification
- Tooltips in mouse event handler & fix executor timer
- Move more tooltip logic into gpui2 & fix tooltip moving on paint
- Update tooltip code a bit
- Allow multiple subscriptions from one entity handle

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2023-11-06 11:29:42 -07:00 committed by GitHub
commit eb325fb387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 577 additions and 164 deletions

View file

@ -23,6 +23,7 @@ mod tab;
mod toast;
mod toggle;
mod tool_divider;
mod tooltip;
pub use avatar::*;
pub use button::*;
@ -49,3 +50,4 @@ pub use tab::*;
pub use toast::*;
pub use toggle::*;
pub use tool_divider::*;
pub use tooltip::*;

View file

@ -186,7 +186,6 @@ impl IconElement {
}
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
let fill = self.color.color(cx);
let svg_size = match self.size {
IconSize::Small => rems(0.75),
IconSize::Medium => rems(0.9375),
@ -196,7 +195,7 @@ impl IconElement {
.size(svg_size)
.flex_none()
.path(self.icon.path())
.text_color(fill)
.text_color(self.color.color(cx))
}
}

View file

@ -0,0 +1,31 @@
use gpui2::{div, px, Div, ParentElement, Render, SharedString, Styled, ViewContext};
use theme2::ActiveTheme;
#[derive(Clone, Debug)]
pub struct TextTooltip {
title: SharedString,
}
impl TextTooltip {
pub fn new(str: SharedString) -> Self {
Self { title: str }
}
}
impl Render for TextTooltip {
type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let theme = cx.theme();
div()
.bg(theme.colors().background)
.rounded(px(8.))
.border()
.font("Zed Sans")
.border_color(theme.colors().border)
.text_color(theme.colors().text)
.pl_2()
.pr_2()
.child(self.title.clone())
}
}