feat(app): set_context_title and set_header_title methods for ApplicationExt and Core

This commit is contained in:
Michael Aaron Murphy 2023-10-12 13:36:23 +02:00 committed by Michael Murphy
parent d620531e7e
commit a04c74f240
2 changed files with 20 additions and 0 deletions

View file

@ -109,6 +109,16 @@ impl Core {
self.is_condensed_update();
}
/// Set context drawer header title
pub fn set_context_title(&mut self, title: String) {
self.window.context_title = title;
}
/// Set header bar title
pub fn set_header_title(&mut self, title: String) {
self.window.header_title = title;
}
/// Whether to show or hide the main window's content.
pub(crate) fn show_content(&self) -> bool {
!self.is_condensed || !self.nav_bar.toggled_condensed

View file

@ -229,6 +229,16 @@ pub trait ApplicationExt: Application {
/// Get the title of the main window.
fn title(&self) -> &str;
/// Set the context drawer title.
fn set_context_title(&mut self, title: String) {
self.core_mut().set_context_title(title);
}
/// Set the header bar title.
fn set_header_title(&mut self, title: String) {
self.core_mut().set_header_title(title);
}
/// Set the title of the main window.
fn set_title(&mut self, title: String) -> iced::Command<Message<Self::Message>>;