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: StyleStyle for the MAIN axis line or circular arc.
border_color, border_width, and alpha control the v1 stroke.
major_tick_color: ColorColor used for INDICATOR major ticks.
minor_tick_color: ColorColor used for ITEMS minor ticks.
label_color: ColorColor used for generated numeric labels.
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn new(bounds: Rect) -> Self
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.
Sourcepub fn with_range(bounds: Rect, min: i32, max: i32) -> Self
pub fn with_range(bounds: Rect, min: i32, max: i32) -> Self
Create a scale with bounds and an inclusive integer range.
Sourcepub fn set_font(&mut self, font: &'static dyn FontMetrics)
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.
Sourcepub fn set_range(&mut self, min: i32, max: i32)
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.
Sourcepub fn set_tick_count(&mut self, tick_count: u16)
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.
Sourcepub fn tick_count(&self) -> u16
pub fn tick_count(&self) -> u16
Return the total number of ticks.
Sourcepub fn set_total_tick_count(&mut self, tick_count: u16)
pub fn set_total_tick_count(&mut self, tick_count: u16)
Compatibility alias for LVGL’s total-tick naming.
Sourcepub fn total_tick_count(&self) -> u16
pub fn total_tick_count(&self) -> u16
Compatibility alias for LVGL’s total-tick naming.
Sourcepub fn set_major_tick_every(&mut self, every: u16)
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.
Sourcepub fn major_tick_every(&self) -> u16
pub fn major_tick_every(&self) -> u16
Return the major tick interval.
Sourcepub fn set_label_visible(&mut self, visible: bool)
pub fn set_label_visible(&mut self, visible: bool)
Show or hide generated numeric labels on major ticks.
Sourcepub fn label_visible(&self) -> bool
pub fn label_visible(&self) -> bool
Return whether generated numeric labels are visible.
Sourcepub fn set_label_show(&mut self, show: bool)
pub fn set_label_show(&mut self, show: bool)
Compatibility alias for LVGL’s label-show naming.
Sourcepub fn label_show(&self) -> bool
pub fn label_show(&self) -> bool
Compatibility alias for LVGL’s label-show naming.
Sourcepub fn set_angle_range(&mut self, degrees: i32)
pub fn set_angle_range(&mut self, degrees: i32)
Set the angular span used by round modes, clamped to 0..=360.
Sourcepub fn angle_range(&self) -> i32
pub fn angle_range(&self) -> i32
Return the angular span used by round modes.
Sourcepub fn set_rotation(&mut self, degrees: i32)
pub fn set_rotation(&mut self, degrees: i32)
Set the starting rotation used by round modes.
Trait Implementations§
Source§impl Widget for Scale
impl Widget for Scale
Source§fn widget_font_mut(&mut self) -> Option<&mut WidgetFont>
fn widget_font_mut(&mut self) -> Option<&mut WidgetFont>
Source§fn handle_event(&mut self, _event: &Event) -> bool
fn handle_event(&mut self, _event: &Event) -> bool
true if it was consumed. Read more