feat: theme integration
refactor: only apply updates if there is a change in the theme refactor: include theme in state cleanup: theme integration
This commit is contained in:
parent
c16b86d1bf
commit
abbe94e6e1
24 changed files with 409 additions and 139 deletions
|
|
@ -229,6 +229,7 @@ impl<P: Program + Send + 'static> IcedElement<P> {
|
|||
program: P,
|
||||
size: impl Into<Size<i32, Logical>>,
|
||||
handle: LoopHandle<'static, crate::state::State>,
|
||||
theme: cosmic::Theme,
|
||||
) -> IcedElement<P> {
|
||||
let size = size.into();
|
||||
let mut renderer =
|
||||
|
|
@ -257,7 +258,7 @@ impl<P: Program + Send + 'static> IcedElement<P> {
|
|||
pending_update: None,
|
||||
size,
|
||||
cursor_pos: None,
|
||||
theme: Theme::dark(), // TODO
|
||||
theme,
|
||||
renderer,
|
||||
state,
|
||||
debug,
|
||||
|
|
@ -308,6 +309,11 @@ impl<P: Program + Send + 'static> IcedElement<P> {
|
|||
self.0.lock().unwrap().update(true);
|
||||
}
|
||||
|
||||
pub fn set_theme(&self, theme: cosmic::Theme) {
|
||||
let mut guard = self.0.lock().unwrap();
|
||||
guard.theme = theme.clone();
|
||||
}
|
||||
|
||||
pub fn force_redraw(&self) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
for (_buffer, ref mut old_primitives) in internal.buffers.values_mut() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue