Appearance jammy (#78)
* chore(appearance): add interface i18n phrases * wip: appearance page skeleton * wip: more work on the skeletop * wip: appearance * wip: add icons and more widgets to appearance page * wip: set the theme on entering and leaving the appearance panel * cleanup & layout improvements * wip(appearance): accent buttons * fixes fix default schemas, install methods, and appearance page * use git deps * clippy and cleanup * update libcosmic & fix illustration names * feat: cosmic-comp theme variables * use git deps * fix: add dep to control * fix: install libwayland-dev * udpate libcosmic * wip: reset to default button * refactor: color button improvements * feat: import / export themes * refactor: defaults for most color pickers and toggle for window hint * refactor: use a context drawer for the container background color * cleanup(appearance): box ThemeBuilder in Message * cleanup(appearance): clippy * fix(appearance): window hint toggle handling * chore: more entries for the default schema * fix: typo
This commit is contained in:
parent
7c3f77c5d4
commit
0b74b0e586
109 changed files with 2443 additions and 327 deletions
|
|
@ -4,6 +4,7 @@
|
|||
use crate::section::{self, Section};
|
||||
use crate::{Content, Info, Page};
|
||||
use cosmic::iced_runtime::command::{Action, Command};
|
||||
use cosmic::Element;
|
||||
use regex::Regex;
|
||||
use slotmap::{SecondaryMap, SlotMap, SparseSecondaryMap};
|
||||
use std::{
|
||||
|
|
@ -135,6 +136,13 @@ impl<Message: 'static> Binder<Message> {
|
|||
page.downcast_ref::<P>()
|
||||
}
|
||||
|
||||
/// Obtain a reference to a page by its type ID.
|
||||
#[must_use]
|
||||
pub fn context_drawer(&self, id: crate::Entity) -> Option<Element<'_, Message>> {
|
||||
let page = self.page.get(id)?;
|
||||
page.context_drawer()
|
||||
}
|
||||
|
||||
/// Obtain a reference to a page by its type ID.
|
||||
#[must_use]
|
||||
pub fn page_mut<P: Page<Message>>(&mut self) -> Option<&mut P> {
|
||||
|
|
@ -142,6 +150,14 @@ impl<Message: 'static> Binder<Message> {
|
|||
page.downcast_mut::<P>()
|
||||
}
|
||||
|
||||
/// Returns a command when a page is left
|
||||
pub fn on_leave(&mut self, id: crate::Entity) -> Option<Command<Message>> {
|
||||
if let Some(page) = self.page.get_mut(id) {
|
||||
return Some(page.on_leave());
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Calls a page's load function to refresh its data.
|
||||
pub fn page_reload(&mut self, id: crate::Entity) -> Option<Command<Message>> {
|
||||
if let Some(page) = self.page.get(id) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ mod binder;
|
|||
pub use binder::{AutoBind, Binder};
|
||||
|
||||
mod insert;
|
||||
use cosmic::{Command, Element};
|
||||
use downcast_rs::{impl_downcast, Downcast};
|
||||
pub use insert::Insert;
|
||||
|
||||
|
|
@ -38,11 +39,21 @@ pub trait Page<Message: 'static>: Downcast {
|
|||
None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn context_drawer(&self) -> Option<Element<'_, Message>> {
|
||||
None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[allow(unused)]
|
||||
fn load(&self, page: crate::Entity) -> Option<crate::Task<Message>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// Emit a command when the page is left
|
||||
fn on_leave(&mut self) -> Command<Message> {
|
||||
Command::none()
|
||||
}
|
||||
}
|
||||
|
||||
impl_downcast!(Page<Message>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue