Struct kas_core::theme::FlatTheme

source ·
pub struct FlatTheme { /* private fields */ }
Expand description

A theme with flat (unshaded) rendering

This is a fully functional theme using only the basic drawing primitives available by default.

Implementations§

source§

impl FlatTheme

source

pub fn new() -> Self

Construct

source

pub fn with_font_size(self, pt_size: f32) -> Self

Set font size

Units: Points per Em (standard unit of font size)

source

pub fn with_colours(self, scheme: &str) -> Self

Set the colour scheme

If no scheme by this name is found the scheme is left unchanged.

Trait Implementations§

source§

impl Clone for FlatTheme

source§

fn clone(&self) -> FlatTheme

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FlatTheme

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for FlatTheme

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<DS: DrawSharedImpl> Theme<DS> for FlatTheme
where DS::Draw: DrawRoundedImpl,

§

type Config = Config

The associated config type
§

type Window = Window<<DS as DrawSharedImpl>::Draw>

The associated Window implementation.
§

type Draw<'a> = DrawHandle<'a, DS>

The associated [ThemeDraw] implementation.
source§

fn config(&self) -> Cow<'_, Self::Config>

Get current configuration
source§

fn apply_config(&mut self, config: &Self::Config) -> Action

Apply/set the passed config
source§

fn init(&mut self, shared: &mut SharedState<DS>)

Theme initialisation Read more
source§

fn new_window(&self, dpi_factor: f32) -> Self::Window

Construct per-window storage Read more
source§

fn update_window(&self, w: &mut Self::Window, dpi_factor: f32)

Update a window created by Theme::new_window Read more
source§

fn draw<'a>( &'a self, draw: DrawIface<'a, DS>, ev: &'a mut EventState, w: &'a mut Self::Window ) -> Self::Draw<'a>

Prepare to draw and construct a [ThemeDraw] object Read more
source§

fn draw_upcast<'a>( draw: DrawIface<'a, DS>, ev: &'a mut EventState, w: &'a mut Self::Window, cols: &'a ColorsLinear ) -> Self::Draw<'a>

Construct a draw object from parts Read more
source§

fn clear_color(&self) -> Rgba

The window/scene clear color Read more
source§

impl ThemeControl for FlatTheme

source§

fn set_font_size(&mut self, pt_size: f32) -> Action

Set font size Read more
source§

fn active_scheme(&self) -> &str

Get the name of the active color scheme
source§

fn list_schemes(&self) -> Vec<&str>

List available color schemes
source§

fn get_scheme(&self, name: &str) -> Option<&ColorsSrgb>

Get colors of a named scheme
source§

fn get_colors(&self) -> &ColorsLinear

Access the in-use color scheme
source§

fn set_colors(&mut self, name: String, cols: ColorsLinear) -> Action

Set colors directly Read more
source§

fn set_scheme(&mut self, name: &str) -> Action

Change the color scheme Read more
source§

fn set_theme(&mut self, _theme: &str) -> Action

Switch the theme Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<S, T> Cast<T> for S
where T: Conv<S>,

source§

fn cast(self) -> T

Cast from Self to T Read more
source§

fn try_cast(self) -> Result<T, Error>

Try converting from Self to T Read more
source§

impl<S, T> CastApprox<T> for S
where T: ConvApprox<S>,

source§

fn try_cast_approx(self) -> Result<T, Error>

Try approximate conversion from Self to T Read more
source§

fn cast_approx(self) -> T

Cast approximately from Self to T Read more
source§

impl<S, T> CastFloat<T> for S
where T: ConvFloat<S>,

source§

fn cast_trunc(self) -> T

Cast to integer, truncating Read more
source§

fn cast_nearest(self) -> T

Cast to the nearest integer Read more
source§

fn cast_floor(self) -> T

Cast the floor to an integer Read more
source§

fn cast_ceil(self) -> T

Cast the ceiling to an integer Read more
source§

fn try_cast_trunc(self) -> Result<T, Error>

Try converting to integer with truncation Read more
source§

fn try_cast_nearest(self) -> Result<T, Error>

Try converting to the nearest integer Read more
source§

fn try_cast_floor(self) -> Result<T, Error>

Try converting the floor to an integer Read more
source§

fn try_cast_ceil(self) -> Result<T, Error>

Try convert the ceiling to an integer Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<DS, T> ThemeDst<DS> for T
where DS: DrawSharedImpl, T: Theme<DS>,

source§

fn config(&self) -> MaybeBoxed<'_, dyn Any + 'static>

Get current configuration
source§

fn apply_config(&mut self, config: &(dyn Any + 'static)) -> Action

Apply/set the passed config
source§

fn init(&mut self, shared: &mut SharedState<DS>)

Theme initialisation Read more
source§

fn new_window(&self, dpi_factor: f32) -> Box<dyn Window>

Construct per-window storage Read more
source§

fn update_window(&self, window: &mut (dyn Window + 'static), dpi_factor: f32)

Update a window created by Theme::new_window Read more
source§

fn draw<'b>( &'b self, draw: DrawIface<'b, DS>, ev: &'b mut EventState, window: &'b mut (dyn Window + 'static) ) -> Box<dyn ThemeDraw + 'b>

source§

fn clear_color(&self) -> Rgba

Background colour Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more