m3e/progress_indicator

progress_indicator provides Lustre support for the M3E Progress Indicator component

Types

Config holds the configuration for a ProgressIndicator

pub type Config {
  Config(
    buffer_value: Int,
    content: option.Option(String),
    diameter: Int,
    max: Int,
    mode: Mode,
    stroke_width: Int,
    value: Int,
    variant: Variant,
  )
}

Constructors

  • Config(
      buffer_value: Int,
      content: option.Option(String),
      diameter: Int,
      max: Int,
      mode: Mode,
      stroke_width: Int,
      value: Int,
      variant: Variant,
    )

Diameter is an alias to Int for clarity

pub type Diameter =
  Int

Maximum is an alias to Int for clarity

pub type Maximum =
  Int

Mode of an indicator

pub type Mode {
  Buffer
  Determinate
  Indeterminate
  Query
}

Constructors

  • Buffer
  • Determinate
  • Indeterminate
  • Query

ProgressIndicator holds all the values necessary to construct an M3E Progress Indicator

Fields:

  • buffer_value: A fractional value, between 0 and max, indicating buffer progress
  • content: Optional content displayed inside the circle when determinate
  • diameter: The diameter, in pixels, of the progress spinner
  • max: The maximum progress value
  • mode: The mode of the progress bar
  • stroke_width: The stroke width, in pixels, of the progress spinner
  • value: A fractional value, between 0 and max, indicating progress
pub opaque type ProgressIndicator

StrokeWidth is an alias to Int for clarity

pub type StrokeWidth =
  Int

Value is an alias to Int for clarity

pub type Value =
  Int

Variant of indicator

pub type Variant {
  Circular
  Linear
}

Constructors

  • Circular
  • Linear

Values

pub fn buffer_value(
  pi: ProgressIndicator,
  value: Int,
) -> ProgressIndicator

buffer_value sets the buffer_value field

pub fn circular() -> ProgressIndicator

circular builds a Circular ProgressIndicator

pub fn content(
  pi: ProgressIndicator,
  content: option.Option(String),
) -> ProgressIndicator

content sets the content field

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_diameter: Int
pub const default_max: Int
pub const default_mode: Mode
pub const default_stroke_width: Int
pub const default_variant: Variant
pub fn diameter(
  pi: ProgressIndicator,
  diameter: Int,
) -> ProgressIndicator

diameter sets the diameter field

pub fn from_config(c: Config) -> ProgressIndicator

from_config creates a ProgressIndicator from a Config record

pub fn indeterminate(
  pi: ProgressIndicator,
  mode: Mode,
) -> ProgressIndicator

indeterminate sets the mode field for Circular (semantic enum support)

pub fn linear() -> ProgressIndicator

linear builds a Linear ProgressIndicator

pub fn max(
  pi: ProgressIndicator,
  new_max: Int,
) -> ProgressIndicator

max sets the max field

pub fn mode(
  pi: ProgressIndicator,
  mode: Mode,
) -> ProgressIndicator

mode sets the mode field

pub fn render(
  pi: ProgressIndicator,
  attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)

render creates a Lustre Element from a ProgressIndicator

Parameters:

  • pi: a ProgressIndicator
  • attributes: a list of additional Attributes
pub fn render_config(
  config: Config,
  attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn stroke_width(
  pi: ProgressIndicator,
  stroke_width: Int,
) -> ProgressIndicator

stroke_width sets the stroke_width field

pub fn value(
  pi: ProgressIndicator,
  value: Int,
) -> ProgressIndicator

value sets the value field

Search Document