pub struct ScaleWidget {
pub mode: ScaleMode,
pub value: f32,
pub min: f32,
pub max: f32,
pub major_ticks: u8,
pub minor_ticks: u8,
pub start_angle: i16,
pub end_angle: i16,
pub show_labels: bool,
pub show_needle: bool,
pub tick_color: Rgb565,
pub needle_color: Rgb565,
}Expand description
Graduated scale widget with customizable major/minor ticks, labels, and needle indicator.
Fields§
§mode: ScaleMode§value: f32§min: f32§max: f32§major_ticks: u8§minor_ticks: u8§start_angle: i16§end_angle: i16§show_labels: bool§show_needle: bool§tick_color: Rgb565§needle_color: Rgb565Implementations§
Source§impl ScaleWidget
impl ScaleWidget
pub fn new(min: f32, max: f32, value: f32) -> Self
pub fn linear_horizontal(min: f32, max: f32, value: f32) -> Self
pub fn linear_vertical(min: f32, max: f32, value: f32) -> Self
pub fn with_ticks(self, major: u8, minor: u8) -> Self
pub fn with_angles(self, start_deg: i16, end_deg: i16) -> Self
pub fn with_labels(self, show: bool) -> Self
pub fn with_needle(self, show: bool, color: Rgb565) -> Self
pub fn render<D, C>( &self, ctx: &mut RenderCtx<'_, D, C>, rect: Rect, style: WidgetStyle, state: VisualState, ) -> Result<(), D::Error>
Trait Implementations§
Source§impl Clone for ScaleWidget
impl Clone for ScaleWidget
Source§fn clone(&self) -> ScaleWidget
fn clone(&self) -> ScaleWidget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScaleWidget
Source§impl Debug for ScaleWidget
impl Debug for ScaleWidget
Source§impl PartialEq for ScaleWidget
impl PartialEq for ScaleWidget
impl StructuralPartialEq for ScaleWidget
Source§impl Widget for ScaleWidget
impl Widget for ScaleWidget
fn render_widget_bounds(&self, _bounds: Rect, _style: &Style)
fn get_property(&self, key: PropertyKey) -> Option<PropertyValue<'_>>
fn set_property<'a>( &mut self, key: PropertyKey, val: PropertyValue<'a>, ) -> Result<(), PropertyError>
fn handle_widget_event( &mut self, _event: &UiEvent, _ctx: &mut EventContext, ) -> EventPolicy
Auto Trait Implementations§
impl Freeze for ScaleWidget
impl RefUnwindSafe for ScaleWidget
impl Send for ScaleWidget
impl Sync for ScaleWidget
impl Unpin for ScaleWidget
impl UnsafeUnpin for ScaleWidget
impl UnwindSafe for ScaleWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.