mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-15 06:40:17 +00:00
e792c1a5c5
This PR changes GPUI to open windows with a default size and location, and to otherwise inherit from their spawning window. Note: The linux build now crashes on startup. Release Notes: - N/A --------- Co-authored-by: Nathan <nathan@zed.dev> Co-authored-by: Ezekiel Warren <zaucy@users.noreply.github.com>
39 lines
991 B
Rust
39 lines
991 B
Rust
use gpui::*;
|
|
|
|
struct HelloWorld {
|
|
text: SharedString,
|
|
}
|
|
|
|
impl Render for HelloWorld {
|
|
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
|
div()
|
|
.flex()
|
|
.bg(rgb(0x2e7d32))
|
|
.size(Length::Definite(Pixels(300.0).into()))
|
|
.justify_center()
|
|
.items_center()
|
|
.shadow_lg()
|
|
.border()
|
|
.border_color(rgb(0x0000ff))
|
|
.text_xl()
|
|
.text_color(rgb(0xffffff))
|
|
.child(format!("Hello, {}!", &self.text))
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
App::new().run(|cx: &mut AppContext| {
|
|
let bounds = Bounds::centered(size(px(600.0), px(600.0)), cx);
|
|
cx.open_window(
|
|
WindowOptions {
|
|
bounds: Some(bounds),
|
|
..Default::default()
|
|
},
|
|
|cx| {
|
|
cx.new_view(|_cx| HelloWorld {
|
|
text: "World".into(),
|
|
})
|
|
},
|
|
);
|
|
});
|
|
}
|