Skip to main content

Module param

Module param 

Source
Expand description

A parameter widget: the editor a value descriptor calls for, in any of the three binding modes (ADR 0009). A float or an int is a Slider, or a NumberInput when its range is too wide to slide (crate::number::is_wide), a bool a check box, a choice a drop-down, three or four floats in [0, 1] a colour swatch, a text a field; every editor is named by the descriptor’s label.

use egui_pop_core::param::{self, Mode};
use egui_pop_model::values::{Descriptor, Value};

fn gain(ui: &mut egui::Ui, store: &egui_pop_core::binding::SharedStore, local: &mut Value) {
    let d = Descriptor::float("Gain", 0.0, 2.0, 1.0);
    param::param(ui, &d, Mode::Plain(local));
    param::param(ui, &d, Mode::Bound(store, "params/gain"));
    param::param(ui, &d, Mode::Watch(store, "params/gain"));
    // Bound, the descriptor the path was declared with.
    param::bound(ui, store, "params/gain");
}

Enums§

Mode
Where the value is.

Functions§

bound
The editor for a store’s path, bound to it (Mode::Bound), its descriptor read from the store: the one the path was declared with. A path nobody declared shows as a warning, named by the path.
current
The value a mode holds now (for display beside the editor).
is_colour
Whether a descriptor is a colour: three or four floats in [0, 1].
param
Draws the editor d calls for.
param_shown
As param, a choice’s values shown through shown (a translation: strings::setting_choice); the value kept is the raw one.