Let a Theme control the background color of an application
... and remove `Application::background_color`
This commit is contained in:
parent
2cfb307f8c
commit
03eda9b162
9 changed files with 33 additions and 79 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crate::conversion;
|
||||
use crate::{Application, Color, Debug, Mode, Point, Size, Viewport};
|
||||
use crate::{Application, Debug, Mode, Point, Size, Viewport};
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use winit::event::{Touch, WindowEvent};
|
||||
|
|
@ -10,7 +10,6 @@ use winit::window::Window;
|
|||
pub struct State<A: Application> {
|
||||
title: String,
|
||||
mode: Mode,
|
||||
background_color: Color,
|
||||
scale_factor: f64,
|
||||
viewport: Viewport,
|
||||
viewport_version: usize,
|
||||
|
|
@ -24,7 +23,6 @@ impl<A: Application> State<A> {
|
|||
pub fn new(application: &A, window: &Window) -> Self {
|
||||
let title = application.title();
|
||||
let mode = application.mode();
|
||||
let background_color = application.background_color();
|
||||
let scale_factor = application.scale_factor();
|
||||
|
||||
let viewport = {
|
||||
|
|
@ -39,7 +37,6 @@ impl<A: Application> State<A> {
|
|||
Self {
|
||||
title,
|
||||
mode,
|
||||
background_color,
|
||||
scale_factor,
|
||||
viewport,
|
||||
viewport_version: 0,
|
||||
|
|
@ -50,11 +47,6 @@ impl<A: Application> State<A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the current background [`Color`] of the [`State`].
|
||||
pub fn background_color(&self) -> Color {
|
||||
self.background_color
|
||||
}
|
||||
|
||||
/// Returns the current [`Viewport`] of the [`State`].
|
||||
pub fn viewport(&self) -> &Viewport {
|
||||
&self.viewport
|
||||
|
|
@ -187,9 +179,6 @@ impl<A: Application> State<A> {
|
|||
self.mode = new_mode;
|
||||
}
|
||||
|
||||
// Update background color
|
||||
self.background_color = application.background_color();
|
||||
|
||||
// Update scale factor
|
||||
let new_scale_factor = application.scale_factor();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue