Simplify theming for Application

This commit is contained in:
Héctor Ramón Jiménez 2024-03-06 21:27:03 +01:00
parent 34e7c6593a
commit 7c4bf70023
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
14 changed files with 382 additions and 392 deletions

View file

@ -2,8 +2,7 @@ use crate::core::mouse;
use crate::core::window::Id;
use crate::core::{Point, Size};
use crate::graphics::Compositor;
use crate::multi_window::{Application, State};
use crate::style::application::StyleSheet;
use crate::multi_window::{Application, State, Style};
use std::collections::BTreeMap;
use std::sync::Arc;
@ -12,8 +11,8 @@ use winit::monitor::MonitorHandle;
#[allow(missing_debug_implementations)]
pub struct WindowManager<A: Application, C: Compositor>
where
A::Theme: StyleSheet,
C: Compositor<Renderer = A::Renderer>,
Style<A::Theme>: Default,
{
aliases: BTreeMap<winit::window::WindowId, Id>,
entries: BTreeMap<Id, Window<A, C>>,
@ -23,7 +22,7 @@ impl<A, C> WindowManager<A, C>
where
A: Application,
C: Compositor<Renderer = A::Renderer>,
A::Theme: StyleSheet,
Style<A::Theme>: Default,
{
pub fn new() -> Self {
Self {
@ -109,7 +108,7 @@ impl<A, C> Default for WindowManager<A, C>
where
A: Application,
C: Compositor<Renderer = A::Renderer>,
A::Theme: StyleSheet,
Style<A::Theme>: Default,
{
fn default() -> Self {
Self::new()
@ -121,7 +120,7 @@ pub struct Window<A, C>
where
A: Application,
C: Compositor<Renderer = A::Renderer>,
A::Theme: StyleSheet,
Style<A::Theme>: Default,
{
pub raw: Arc<winit::window::Window>,
pub state: State<A>,
@ -136,7 +135,7 @@ impl<A, C> Window<A, C>
where
A: Application,
C: Compositor<Renderer = A::Renderer>,
A::Theme: StyleSheet,
Style<A::Theme>: Default,
{
pub fn position(&self) -> Option<Point> {
self.raw