Skip to main content

Scale

Struct Scale 

Source
pub struct Scale {
    pub style: Style,
    pub major_tick_color: Color,
    pub minor_tick_color: Color,
    pub label_color: Color,
    /* private fields */
}
Expand description

Integer scale widget that draws major and minor ticks plus numeric labels.

Tick count is the total number of ticks including both endpoints. A tick count of zero draws only the base axis. major_tick_every == 0 disables major ticks and labels, matching the LPAR-11 LVGL parity note.

Fields§

§style: Style

Style for the MAIN axis line or circular arc.

border_color, border_width, and alpha control the v1 stroke.

§major_tick_color: Color

Color used for INDICATOR major ticks.

§minor_tick_color: Color

Color used for ITEMS minor ticks.

§label_color: Color

Color used for generated numeric labels.

Implementations§

Source§

impl Scale

Source

pub fn new(bounds: Rect) -> Self

Create a scale with default bounds and a 0..=100 integer range.

The initial mode is ScaleMode::HorizontalBottom, with six total ticks, every tick classified as major, and numeric labels visible.

Source

pub fn with_range(bounds: Rect, min: i32, max: i32) -> Self

Create a scale with bounds and an inclusive integer range.

Source

pub fn set_font(&mut self, font: &'static dyn FontMetrics)

Assign the font used to render this widget (FONT-00 §5); resolves to FONT_6X10 when unset.

Source

pub fn set_mode(&mut self, mode: ScaleMode)

Set the scale placement mode.

Source

pub fn mode(&self) -> ScaleMode

Return the current placement mode.

Source

pub fn set_range(&mut self, min: i32, max: i32)

Set the inclusive value range displayed by the scale.

Reversed ranges are preserved and render endpoint labels in the configured order.

Source

pub fn min_value(&self) -> i32

Configured minimum endpoint.

Source

pub fn max_value(&self) -> i32

Configured maximum endpoint.

Source

pub fn set_tick_count(&mut self, tick_count: u16)

Set the total number of ticks, including both range endpoints.

A value of zero is allowed and draws no ticks.

Source

pub fn tick_count(&self) -> u16

Return the total number of ticks.

Source

pub fn set_total_tick_count(&mut self, tick_count: u16)

Compatibility alias for LVGL’s total-tick naming.

Source

pub fn total_tick_count(&self) -> u16

Compatibility alias for LVGL’s total-tick naming.

Source

pub fn set_major_tick_every(&mut self, every: u16)

Set the major tick interval.

0 disables all major ticks and labels. Otherwise, tick index 0 and every index evenly divisible by the interval is major.

Source

pub fn major_tick_every(&self) -> u16

Return the major tick interval.

Source

pub fn set_label_visible(&mut self, visible: bool)

Show or hide generated numeric labels on major ticks.

Source

pub fn label_visible(&self) -> bool

Return whether generated numeric labels are visible.

Source

pub fn set_label_show(&mut self, show: bool)

Compatibility alias for LVGL’s label-show naming.

Source

pub fn label_show(&self) -> bool

Compatibility alias for LVGL’s label-show naming.

Source

pub fn set_angle_range(&mut self, degrees: i32)

Set the angular span used by round modes, clamped to 0..=360.

Source

pub fn angle_range(&self) -> i32

Return the angular span used by round modes.

Source

pub fn set_rotation(&mut self, degrees: i32)

Set the starting rotation used by round modes.

Source

pub fn rotation(&self) -> i32

Return the starting rotation used by round modes.

Trait Implementations§

Source§

impl Widget for Scale

Source§

fn bounds(&self) -> Rect

Return the area this widget occupies relative to its parent.
Source§

fn widget_font_mut(&mut self) -> Option<&mut WidgetFont>

Expose this widget’s font slot for cascade-driven font resolution (FONT-05 §5.B). Read more
Source§

fn draw(&self, renderer: &mut dyn Renderer)

Render the widget using the provided Renderer.
Source§

fn handle_event(&mut self, _event: &Event) -> bool

Handle an event and return true if it was consumed. Read more
Source§

fn set_bounds(&mut self, bounds: Rect)

Called by the LPAR-10 layout pass to notify this widget of its layout-computed bounds. Read more
Source§

fn clear_region(&mut self) -> Option<Rect>

Return a region (in draw/landscape coordinates) that should be restored from the pristine background copy, or None. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Scale

§

impl !Send for Scale

§

impl !Sync for Scale

§

impl !UnwindSafe for Scale

§

impl Freeze for Scale

§

impl Unpin for Scale

§

impl UnsafeUnpin for Scale

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

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

Source§

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>,

Source§

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.