CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:54:10 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=38525b06f12fb1e9d025a4c967565e42630862d1ee0f14e3ae416beb090638dca%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22OpV6PWEL86c0hR1mOmkr8-FUKMHl8A_1%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d29fd77a6ec1bd-BLR
learn_gpui.rs - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::marker::PhantomData;
- use gpui::{
- App, Application, Context, Menu, MenuItem, Window,
- WindowOptions, actions, div, prelude::*, rgb, Global
- };
- pub struct Theme {
- primary: u32,
- secondary: u32,
- }
- impl From<(u32, u32)> for Theme {
- fn from(tup: (u32, u32)) -> Theme {
- Theme { primary: tup.0, secondary: tup.1 }
- }
- }
- pub const SPOTIFY_THEME: Theme = Theme {
- primary: 0x1cd061,
- secondary: 0x121212,
- };
- pub const FIREFOX_THEME: Theme = Theme {
- primary: 0xff5933,
- secondary: 0x421c5f,
- };
- pub const BLUEY_THEME: Theme = Theme {
- primary: 0xf2d787,
- secondary: 0x9acbec,
- };
- pub const SPICY_THEME: Theme = Theme {
- primary: 0x1b1b1b,
- secondary: 0xffa31a,
- };
- pub struct SetMenus;
- pub struct ActiveTheme {
- active_theme: Theme,
- }
- impl Global for ActiveTheme {}
- //what does this macro do exactly
- actions!(set_menus, [Quit]);
- actions!(set_menus, [SpotifyTheme]);
- actions!(set_menus, [FirefoxTheme]);
- actions!(set_menus, [BlueyTheme]);
- actions!(set_menus, [SpicyTheme]);
- impl Render for SetMenus {
- fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
- div()
- .flex()
- .bg(rgb(cx.global::<ActiveTheme>().active_theme.primary))
- .size_full()
- .justify_center()
- .items_center()
- .text_xl()
- .text_color(rgb(cx.global::<ActiveTheme>().active_theme.secondary))
- .child("Set Menus Example")
- }
- }
- fn main() {
- Application::new().run(|cx: &mut App| {
- cx.set_global::<ActiveTheme>(ActiveTheme { active_theme: SPOTIFY_THEME });
- //??? idk what this does exactly
- cx.activate(true);
- cx.on_action(|_: &Quit, cx: &mut App| cx.quit());
- cx.on_action(|_: &FirefoxTheme, cx: &mut App| {
- cx.set_global::<ActiveTheme>(ActiveTheme { active_theme: FIREFOX_THEME });
- cx.notify();
- });
- cx.on_action(|_: &BlueyTheme, cx: &mut App| {
- cx.set_global::<ActiveTheme>(ActiveTheme { active_theme: BLUEY_THEME });
- cx.notify();
- });
- cx.on_action(|_: &SpotifyTheme, cx: &mut App| {
- cx.set_global::<ActiveTheme>(ActiveTheme { active_theme: SPOTIFY_THEME });
- cx.notify();
- });
- cx.on_action(|_: &SpicyTheme, cx: &mut App| {
- cx.set_global::<ActiveTheme>(ActiveTheme { active_theme: SPICY_THEME });
- cx.notify();
- });
- cx.set_menus(vec![
- Menu {
- name: "main".into(),
- items: vec![
- MenuItem::action("Quit", Quit),
- ]},
- Menu {
- name: "themes!!!".into(),
- items: vec![
- MenuItem::action("Spotify theme", SpotifyTheme),
- MenuItem::action("Firefox theme", FirefoxTheme),
- MenuItem::action("Bluey theme", BlueyTheme),
- MenuItem::action("Spicy theme", SpicyTheme),
- ],
- },
- ]);
- let set_menus = cx.new(|_| {SetMenus});
- cx.open_window(WindowOptions::default(), |_, _cx| { set_menus }).unwrap();
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 3 sec ago | 0.25 KB
-
📌 ChangeNOW Exploit
JavaScript | 7 sec ago | 0.24 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 9 sec ago | 0.25 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 11 sec ago | 0.10 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ E
JavaScript | 12 sec ago | 0.25 KB
-
📌 Instant BTC Profit Method ✅ Working
JavaScript | 19 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ S
JavaScript | 19 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ 3
JavaScript | 21 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand