Convert Renderer::Theme to generic Widget type
This commit is contained in:
parent
545cc909c9
commit
7a50e9e8fb
88 changed files with 1219 additions and 1153 deletions
|
|
@ -1,5 +1,4 @@
|
|||
use crate::conversion;
|
||||
use crate::core;
|
||||
use crate::core::{mouse, window};
|
||||
use crate::core::{Color, Size};
|
||||
use crate::graphics::Viewport;
|
||||
|
|
@ -14,7 +13,7 @@ use winit::window::Window;
|
|||
/// The state of a multi-windowed [`Application`].
|
||||
pub struct State<A: Application>
|
||||
where
|
||||
<A::Renderer as core::Renderer>::Theme: application::StyleSheet,
|
||||
A::Theme: application::StyleSheet,
|
||||
{
|
||||
title: String,
|
||||
scale_factor: f64,
|
||||
|
|
@ -22,13 +21,13 @@ where
|
|||
viewport_version: u64,
|
||||
cursor_position: Option<winit::dpi::PhysicalPosition<f64>>,
|
||||
modifiers: winit::keyboard::ModifiersState,
|
||||
theme: <A::Renderer as core::Renderer>::Theme,
|
||||
theme: A::Theme,
|
||||
appearance: application::Appearance,
|
||||
}
|
||||
|
||||
impl<A: Application> Debug for State<A>
|
||||
where
|
||||
<A::Renderer as core::Renderer>::Theme: application::StyleSheet,
|
||||
A::Theme: application::StyleSheet,
|
||||
{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("multi_window::State")
|
||||
|
|
@ -44,7 +43,7 @@ where
|
|||
|
||||
impl<A: Application> State<A>
|
||||
where
|
||||
<A::Renderer as core::Renderer>::Theme: application::StyleSheet,
|
||||
A::Theme: application::StyleSheet,
|
||||
{
|
||||
/// Creates a new [`State`] for the provided [`Application`]'s `window`.
|
||||
pub fn new(
|
||||
|
|
@ -124,7 +123,7 @@ where
|
|||
}
|
||||
|
||||
/// Returns the current theme of the [`State`].
|
||||
pub fn theme(&self) -> &<A::Renderer as core::Renderer>::Theme {
|
||||
pub fn theme(&self) -> &A::Theme {
|
||||
&self.theme
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use winit::monitor::MonitorHandle;
|
|||
#[allow(missing_debug_implementations)]
|
||||
pub struct WindowManager<A: Application, C: Compositor>
|
||||
where
|
||||
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
|
||||
A::Theme: StyleSheet,
|
||||
C: Compositor<Renderer = A::Renderer>,
|
||||
{
|
||||
aliases: BTreeMap<winit::window::WindowId, Id>,
|
||||
|
|
@ -23,7 +23,7 @@ impl<A, C> WindowManager<A, C>
|
|||
where
|
||||
A: Application,
|
||||
C: Compositor<Renderer = A::Renderer>,
|
||||
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
|
||||
A::Theme: StyleSheet,
|
||||
{
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
|
@ -109,7 +109,7 @@ impl<A, C> Default for WindowManager<A, C>
|
|||
where
|
||||
A: Application,
|
||||
C: Compositor<Renderer = A::Renderer>,
|
||||
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
|
||||
A::Theme: StyleSheet,
|
||||
{
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
|
|
@ -121,7 +121,7 @@ pub struct Window<A, C>
|
|||
where
|
||||
A: Application,
|
||||
C: Compositor<Renderer = A::Renderer>,
|
||||
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
|
||||
A::Theme: StyleSheet,
|
||||
{
|
||||
pub raw: Arc<winit::window::Window>,
|
||||
pub state: State<A>,
|
||||
|
|
@ -136,7 +136,7 @@ impl<A, C> Window<A, C>
|
|||
where
|
||||
A: Application,
|
||||
C: Compositor<Renderer = A::Renderer>,
|
||||
<A::Renderer as crate::core::Renderer>::Theme: StyleSheet,
|
||||
A::Theme: StyleSheet,
|
||||
{
|
||||
pub fn position(&self) -> Option<Point> {
|
||||
self.raw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue