mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 22:43:18 +00:00
WIP
This commit is contained in:
parent
21f4da6bf2
commit
809776f6bc
1 changed files with 32 additions and 0 deletions
32
crates/gpui/examples/views_post.rs
Normal file
32
crates/gpui/examples/views_post.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use gpui::*;
|
||||
|
||||
struct Counter {
|
||||
count: usize,
|
||||
}
|
||||
|
||||
impl Counter {
|
||||
fn new(cx: &mut WindowContext) -> View<Self> {
|
||||
cx.new_view(|_cx| Self { count: 0 })
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for Counter {
|
||||
fn render(&mut self, _cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {
|
||||
div()
|
||||
.size_full()
|
||||
.flex()
|
||||
.justify_center()
|
||||
.items_center()
|
||||
.text_xl()
|
||||
.bg(rgb(0x2d004b))
|
||||
.text_color(rgb(0xffffff))
|
||||
.child(self.count.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new().run(|cx: &mut AppContext| {
|
||||
cx.open_window(WindowOptions::default(), Counter::new);
|
||||
cx.activate(true);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue