Enable more collab UI features (#3496)
* Current Call section of the collab panel * Improve the collab titlebar * Add basic UI for following Following only partially works, but the UI for following is now in place.
This commit is contained in:
commit
ae6ddceb67
22 changed files with 1473 additions and 1781 deletions
48
crates/gpui2/src/elements/canvas.rs
Normal file
48
crates/gpui2/src/elements/canvas.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
use crate::{Bounds, Element, IntoElement, Pixels, StyleRefinement, Styled, WindowContext};
|
||||
|
||||
pub fn canvas(callback: impl 'static + FnOnce(Bounds<Pixels>, &mut WindowContext)) -> Canvas {
|
||||
Canvas {
|
||||
paint_callback: Box::new(callback),
|
||||
style: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Canvas {
|
||||
paint_callback: Box<dyn FnOnce(Bounds<Pixels>, &mut WindowContext)>,
|
||||
style: StyleRefinement,
|
||||
}
|
||||
|
||||
impl IntoElement for Canvas {
|
||||
type Element = Self;
|
||||
|
||||
fn element_id(&self) -> Option<crate::ElementId> {
|
||||
None
|
||||
}
|
||||
|
||||
fn into_element(self) -> Self::Element {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Element for Canvas {
|
||||
type State = ();
|
||||
|
||||
fn layout(
|
||||
&mut self,
|
||||
_: Option<Self::State>,
|
||||
cx: &mut WindowContext,
|
||||
) -> (crate::LayoutId, Self::State) {
|
||||
let layout_id = cx.request_layout(&self.style.clone().into(), []);
|
||||
(layout_id, ())
|
||||
}
|
||||
|
||||
fn paint(self, bounds: Bounds<Pixels>, _: &mut (), cx: &mut WindowContext) {
|
||||
(self.paint_callback)(bounds, cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl Styled for Canvas {
|
||||
fn style(&mut self) -> &mut crate::StyleRefinement {
|
||||
&mut self.style
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
mod canvas;
|
||||
mod div;
|
||||
mod img;
|
||||
mod overlay;
|
||||
|
@ -5,6 +6,7 @@ mod svg;
|
|||
mod text;
|
||||
mod uniform_list;
|
||||
|
||||
pub use canvas::*;
|
||||
pub use div::*;
|
||||
pub use img::*;
|
||||
pub use overlay::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue