Custom window title #8

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

View file

@ -43,7 +43,7 @@ pub struct Modal {
impl Modal { impl Modal {
/// Margin from [`Modal`] window at top/left/right. /// Margin from [`Modal`] window at top/left/right.
const DEFAULT_MARGIN: f32 = 6.0; const DEFAULT_MARGIN: f32 = 8.0;
/// Maximum width of the content. /// Maximum width of the content.
const DEFAULT_WIDTH: f32 = Root::SIDE_PANEL_WIDTH - (2.0 * Self::DEFAULT_MARGIN); const DEFAULT_WIDTH: f32 = Root::SIDE_PANEL_WIDTH - (2.0 * Self::DEFAULT_MARGIN);
@ -223,7 +223,7 @@ impl Modal {
}; };
let x_align = View::get_left_inset() - View::get_right_inset(); let x_align = View::get_left_inset() - View::get_right_inset();
let y_align = View::get_top_inset() + Self::DEFAULT_MARGIN + if View::is_desktop() { let y_align = View::get_top_inset() + Self::DEFAULT_MARGIN + if View::is_desktop() {
Root::WINDOW_TITLE_HEIGHT + 8.0 Root::WINDOW_TITLE_HEIGHT + Root::WINDOW_FRAME_MARGIN
} else { } else {
0.0 0.0
}; };
@ -296,12 +296,12 @@ impl Modal {
// Draw title content. // Draw title content.
let title_resp = ui.allocate_ui_at_rect(rect, |ui| { let title_resp = ui.allocate_ui_at_rect(rect, |ui| {
ui.vertical_centered_justified(|ui| { ui.vertical_centered_justified(|ui| {
ui.add_space(9.0); ui.add_space(Self::DEFAULT_MARGIN);
ui.label(RichText::new(self.title.as_ref().unwrap()) ui.label(RichText::new(self.title.as_ref().unwrap())
.size(19.0) .size(19.0)
.color(Colors::title(true)) .color(Colors::title(true))
); );
ui.add_space(8.0); ui.add_space(Self::DEFAULT_MARGIN);
}); });
}).response; }).response;

View file

@ -45,6 +45,7 @@ impl Default for NetworkContent {
impl NetworkContent { impl NetworkContent {
pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) { pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
let show_connections = AppConfig::show_connections_network_panel(); let show_connections = AppConfig::show_connections_network_panel();
let dual_panel = Root::is_dual_panel_mode(ui);
// Show title panel. // Show title panel.
self.title_ui(ui, show_connections); self.title_ui(ui, show_connections);
@ -61,6 +62,20 @@ impl NetworkContent {
top: 6.0, top: 6.0,
bottom: View::get_bottom_inset() + 5.0, bottom: View::get_bottom_inset() + 5.0,
}, },
outer_margin: if View::is_desktop() {
Margin {
left: -0.5,
right: if dual_panel {
0.0
} else {
-0.5
},
top: 0.0,
bottom: -0.5,
}
} else {
Margin::ZERO
},
..Default::default() ..Default::default()
}) })
.show_inside(ui, |ui| { .show_inside(ui, |ui| {
@ -134,7 +149,7 @@ impl NetworkContent {
.show(ui, |ui| { .show(ui, |ui| {
ui.add_space(1.0); ui.add_space(1.0);
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
let max_width = if !Root::is_dual_panel_mode(ui) { let max_width = if !dual_panel {
Root::SIDE_PANEL_WIDTH * 1.3 Root::SIDE_PANEL_WIDTH * 1.3
} else { } else {
ui.available_width() ui.available_width()

View file

@ -182,6 +182,24 @@ impl WalletsContent {
top: 6.0, top: 6.0,
bottom: View::get_bottom_inset() + 5.0, bottom: View::get_bottom_inset() + 5.0,
}, },
outer_margin: if View::is_desktop() {
Margin {
left: if !dual_panel {
-0.5
} else {
0.0
},
right: if !self.wallet_panel_opened() {
-0.5
} else {
0.0
},
top: 0.0,
bottom: -0.5,
}
} else {
Margin::ZERO
},
..Default::default() ..Default::default()
}) })
.show_inside(ui, |ui| { .show_inside(ui, |ui| {

View file

@ -133,6 +133,20 @@ impl WalletContent {
top: 6.0, top: 6.0,
bottom: View::get_bottom_inset() + 5.0, bottom: View::get_bottom_inset() + 5.0,
}, },
outer_margin: if View::is_desktop() {
Margin {
left: if dual_panel {
0.0
} else {
-0.5
},
right: -0.5,
top: 0.0,
bottom: -0.5,
}
} else {
Margin::ZERO
},
..Default::default() ..Default::default()
}) })
.show_animated_inside(ui, !Self::block_navigation_on_sync(wallet), |ui| { .show_animated_inside(ui, !Self::block_navigation_on_sync(wallet), |ui| {