pub struct ResizeHint {
pub can_resize: bool,
pub can_resize_horizontally: bool,
pub can_resize_vertically: bool,
pub preserve_aspect_ratio: bool,
pub aspect_ratio_width: u32,
pub aspect_ratio_height: u32,
pub size_constraints: SizeConstraints,
}Expand description
Describes whether and how a host may resize an Editor, returned from
Editor::resize_hint().
The default is non-resizable (can_resize: false), matching the previous
fixed-size behavior. To make an editor resizable, return a hint with
can_resize: true; the per-axis flags and aspect-ratio fields refine how.
Fields§
§can_resize: boolWhether the host may resize the editor at all. Drives CLAP’s
gui.can_resize and VST3’s canResize. When false, the other fields
are ignored.
can_resize_horizontally: boolWhether the width may change. Only meaningful when can_resize is true.
can_resize_vertically: boolWhether the height may change. Only meaningful when can_resize is true.
preserve_aspect_ratio: boolIf true, the host should keep the editor’s aspect ratio fixed at
aspect_ratio_width : aspect_ratio_height while resizing.
aspect_ratio_width: u32Aspect-ratio numerator (only used when preserve_aspect_ratio is true).
aspect_ratio_height: u32Aspect-ratio denominator (only used when preserve_aspect_ratio is true).
size_constraints: SizeConstraintsImplementations§
Source§impl ResizeHint
impl ResizeHint
Sourcepub const NON_RESIZABLE: Self
pub const NON_RESIZABLE: Self
A non-resizable editor. This is the default value.
Sourcepub const RESIZABLE: Self
pub const RESIZABLE: Self
A freely resizable editor: both axes, no aspect-ratio lock. Convenience for the common case.
pub const fn non_resizable() -> Self
pub const fn resizable() -> Self
pub const fn with_min_logical_size(self, min_size: LogicalSize<f32>) -> Self
pub const fn with_min_max_logical_size( self, min_size: Option<LogicalSize<f32>>, max_size: Option<LogicalSize<f32>>, ) -> Self
pub const fn with_min_physical_size(self, min_size: PhysicalSize<u32>) -> Self
pub const fn with_min_max_physical_size( self, min_size: Option<PhysicalSize<u32>>, max_size: Option<PhysicalSize<u32>>, ) -> Self
pub const fn with_size_constraints( self, size_constraints: SizeConstraints, ) -> Self
Sourcepub const fn with_aspect_ratio(
self,
aspect_ratio_width: u32,
aspect_ratio_height: u32,
) -> Self
pub const fn with_aspect_ratio( self, aspect_ratio_width: u32, aspect_ratio_height: u32, ) -> Self
aspect_ratio_width: aspect-ratio numeratoraspect_ratio_height: aspect-ratio denominator
Sourcepub fn is_size_valid(
&self,
new_size: PhysicalSize<u32>,
current_size: PhysicalSize<u32>,
scale_factor: f64,
) -> bool
pub fn is_size_valid( &self, new_size: PhysicalSize<u32>, current_size: PhysicalSize<u32>, scale_factor: f64, ) -> bool
Returns whether or not the given size in physical pixels is valid.
Sourcepub fn adjust_size(
&self,
new_size: PhysicalSize<u32>,
current_size: PhysicalSize<u32>,
scale_factor: f64,
) -> PhysicalSize<u32>
pub fn adjust_size( &self, new_size: PhysicalSize<u32>, current_size: PhysicalSize<u32>, scale_factor: f64, ) -> PhysicalSize<u32>
Adjust the new requested size to the closest size that is compatible with this plugin.
Trait Implementations§
Source§impl Clone for ResizeHint
impl Clone for ResizeHint
Source§fn clone(&self) -> ResizeHint
fn clone(&self) -> ResizeHint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more