pub struct ViziaState { /* private fields */ }
Expand description

State for an nih_plug_vizia editor. The scale factor can be manipulated at runtime using cx.set_user_scale_factor().

Implementations§

source§

impl ViziaState

source

pub fn new( size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static ) -> Arc<ViziaState>

Initialize the GUI’s state. This value can be passed to create_vizia_editor(). The callback always returns the window’s current size is in logical pixels, so before it is multiplied by the DPI scaling factor. This size can be computed based on the plugin’s current state.

source

pub fn new_with_default_scale_factor( size_fn: impl Fn() -> (u32, u32) + Send + Sync + 'static, default_scale_factor: f64 ) -> Arc<ViziaState>

The same as new(), but with a separate initial scale factor. This scale factor gets applied on top of any HiDPI scaling, and it can be modified at runtime by changing cx.set_user_scale_factor().

source

pub fn scaled_logical_size(&self) -> (u32, u32)

Returns a (width, height) pair for the current size of the GUI in logical pixels, after applying the user scale factor.

source

pub fn inner_logical_size(&self) -> (u32, u32)

Returns a (width, height) pair for the current size of the GUI in logical pixels before applying the user scale factor.

source

pub fn user_scale_factor(&self) -> f64

Get the non-DPI related uniform scaling factor the GUI’s size will be multiplied with. This can be changed by changing cx.user_scale_factor.

source

pub fn is_open(&self) -> bool

Whether the GUI is currently visible.

Trait Implementations§

source§

impl Debug for ViziaState

source§

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

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

impl<'de> Deserialize<'de> for ViziaState

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a> PersistentField<'a, ViziaState> for Arc<ViziaState>

source§

fn set(&self, new_value: ViziaState)

Update the stored T value using interior mutability.
source§

fn map<F, R>(&self, f: F) -> Rwhere F: Fn(&ViziaState) -> R,

Get a reference to the stored T value, and apply a function to it. This is used to serialize the T value.
source§

impl Serialize for ViziaState

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere 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> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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<T> Any for Twhere T: Any,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,