Custom window title #8

Merged
ardocrat merged 29 commits from custom_window_title into master 2024-07-03 13:44:26 +03:00
7 changed files with 88 additions and 110 deletions
Showing only changes of commit f2a23ec0e0 - Show all commits

View file

@ -105,7 +105,7 @@ impl<Platform: PlatformCallbacks> App<Platform> {
sw: 0.0,
se: 0.0,
},
fill: Colors::TRANSPARENT,
fill: Colors::yellow(),
stroke: Stroke {
width: 1.0,
color: egui::Color32::from_gray(200)
@ -126,7 +126,7 @@ impl<Platform: PlatformCallbacks> App<Platform> {
let content_stroke = RectShape {
rect: content_stroke_rect,
rounding: Rounding::ZERO,
fill: Colors::TRANSPARENT,
fill: Colors::fill(),
stroke: Stroke {
width: 1.0,
color: Colors::stroke()

View file

@ -79,19 +79,11 @@ impl NetworkContent {
.resizable(false)
.exact_width(ui.available_width())
.frame(egui::Frame {
outer_margin: if !show_connections {
Margin {
outer_margin: Margin {
left: -0.5,
right: if !dual_panel {
-0.5
} else {
0.0
},
right: -0.5,
top: 0.0,
bottom: 0.0,
}
} else {
Margin::ZERO
},
..Default::default()
})
@ -116,21 +108,22 @@ impl NetworkContent {
// Show connections content.
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: View::item_stroke(),
outer_margin: if show_connections {
Margin {
left: -0.5,
right: if !dual_panel {
-0.5
} else {
0.0
},
right: -0.5,
top: 0.0,
bottom: -0.5,
}
} else {
Margin::ZERO
},
..Default::default()
})
.show_inside(ui, |ui| {
egui::CentralPanel::default()
.frame(egui::Frame {
stroke: View::item_stroke(),
inner_margin: Margin {
left: if show_connections {
View::get_left_inset() + 4.0
@ -149,7 +142,7 @@ impl NetworkContent {
4.0
},
},
fill: Colors::button(),
fill: Colors::fill(),
..Default::default()
})
.show_inside(ui, |ui| {
@ -171,6 +164,7 @@ impl NetworkContent {
});
});
});
});
// Redraw after delay.
if Node::is_running() {

View file

@ -111,23 +111,19 @@ impl Root {
let (is_panel_open, panel_width) = Self::network_panel_state_width(ui, dual_panel);
// Show network content.
if is_panel_open {
egui::SidePanel::left("network_panel")
.resizable(false)
.exact_width(panel_width)
.frame(egui::Frame {
fill: Colors::fill(),
..Default::default()
})
.show_inside(ui, |ui| {
.show_animated_inside(ui, is_panel_open, |ui| {
self.network.ui(ui, cb);
});
}
// Show wallets content.
egui::CentralPanel::default()
.frame(egui::Frame {
fill: Colors::fill(),
..Default::default()
})
.show_inside(ui, |ui| {

View file

@ -206,20 +206,6 @@ impl WalletsContent {
egui::Frame::default()
} else {
egui::Frame {
outer_margin: Margin {
left: if !root_dual_panel {
-0.5
} else {
0.0
},
right: if !wallet_panel_opened {
-0.5
} else {
0.0
},
top: 0.0,
bottom: 0.0,
},
stroke: View::item_stroke(),
fill: Colors::fill_deep(),
inner_margin: Margin {
@ -228,6 +214,16 @@ impl WalletsContent {
top: 3.0,
bottom: 4.0,
},
outer_margin: Margin {
left: 0.0,
right: if !wallet_panel_opened {
-0.5
} else {
0.0
},
top: 0.0,
bottom: 0.0,
},
..Default::default()
}
})

View file

@ -79,20 +79,6 @@ impl WalletCreation {
top: 4.0,
bottom: View::get_bottom_inset(),
},
outer_margin: if View::is_desktop() {
Margin {
left: if !Root::is_dual_panel_mode(ui) {
-0.5
} else {
0.0
},
right: -0.5,
top: 0.0,
bottom: -0.5,
}
} else {
Margin::ZERO
},
..Default::default()
})
.show_inside(ui, |ui| {

View file

@ -103,11 +103,7 @@ impl WalletContent {
bottom: 0.0,
},
outer_margin: Margin {
left: if !dual_panel {
-0.5
} else {
0.0
},
left: -0.5,
right: -0.5,
top: 0.0,
bottom: if dual_panel {
@ -156,11 +152,7 @@ impl WalletContent {
egui::CentralPanel::default()
.frame(egui::Frame {
outer_margin: Margin {
left: if !dual_panel {
-0.5
} else {
0.0
},
left: -0.5,
right: -0.5,
top: 0.0,
bottom: 0.0,

View file

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![windows_subsystem = "windows"]
use egui::os::OperatingSystem;
pub fn main() {
#[allow(dead_code)]
#[cfg(not(target_os = "android"))]
@ -74,17 +78,27 @@ fn real_main() {
viewport,
..Default::default()
};
options.renderer = eframe::Renderer::Wgpu;
// Use Glow renderer for Windows.
let is_windows = OperatingSystem::from_target_os() == OperatingSystem::Windows;
options.renderer = if is_windows {
eframe::Renderer::Glow
} else {
eframe::Renderer::Wgpu
};
match grim::start(options.clone(), grim::app_creator(App::new(platform.clone()))) {
Ok(_) => {}
Err(_) => {
// Start with Glow renderer on error.
Err(e) => {
if is_windows {
panic!("{}", e);
}
// Start with another renderer on error.
options.renderer = eframe::Renderer::Glow;
match grim::start(options, grim::app_creator(App::new(platform))) {
Ok(_) => {}
Err(_) => {
panic!("Impossible to render");
Err(e) => {
panic!("{}", e);
}
}
}