# API map of the "Choice and toggles" family: old path to new path and setter renames. # Filled in by the family track; the codemods and the app scan read it. family = "Choice and toggles" new_module = "craft_ui::choice" # One entry per public type: `old` is the path an app calls today, `new` the path after migration. # `status` is "pending", "same" (path unchanged), "moved", "replaced" (use `note`) or "removed". [[type]] name = "Checkbox" old = "craft_ui::controls::checkbox::Checkbox" new = "craft_ui::choice::Checkbox" status = "moved" note = "A `Component` over `Bind` shown with `Show::show`; `Checkbox::new(label, &mut state).show(ui)` becomes `Checkbox::new(Bind::bound(&mut on)).label(label).show(ui)`. The output is `EditResponse`. A mixed value is a `Mixed` binding (`Bind::bound_mixed`), and a click on a mixed box makes it checked. The visible text is the label step's: a `Field` or `PaintUi::labelled` shows it." [[type]] name = "CheckState" old = "craft_ui::controls::checkbox::CheckState" new = "" status = "replaced" note = "`CheckState::Checked` and `Unchecked` are `true` and `false`; `CheckState::Mixed` is a `Mixed` binding made with `Bind::bound_mixed`." [[type]] name = "CheckValue" old = "craft_ui::controls::checkbox::CheckValue" new = "" status = "removed" note = "`Checkbox` is over `Bind` only; a value of another type is mapped to a bool and back in a binding." [[type]] name = "CheckColors" old = "craft_ui::controls::check::CheckColors" new = "" status = "replaced" note = "The colour tables are the style parts of `CheckboxStyle`, `RadioStyle` and `SwitchStyle`, read from the theme tokens; an app does not pass colours." [[type]] name = "Switch" old = "craft_ui::controls::switch::Switch" new = "craft_ui::choice::Switch" status = "moved" note = "A `Component` over `Bind`: `Switch::new(label, &mut on).show(ui)` becomes `Switch::new(Bind::bound(&mut on)).label(label).show(ui)`. The output is `EditResponse`. A `Mixed` binding rests the thumb in the middle. The visible text is the label step's." [[type]] name = "RadioGroup" old = "craft_ui::controls::radio::RadioGroup" new = "craft_ui::choice::RadioGroup" status = "moved" note = "A group container: `RadioGroup::new(label, Bind::bound(&mut value)).show(ui, |ui, _| { Radio::new(v).label(..).show(ui); .. })`. The members are `Radio` leaves shown anywhere in the body, in any nesting. One Tab stop; arrows move focus, Space, Enter or a click picks. The legacy `item(value, label)` list is the `Radio` calls in the body; `item_enabled(false)` is `Radio::enabled(false)`." [[type]] name = "Radio" old = "craft_ui::controls::radio::Radio" new = "craft_ui::choice::Radio" status = "moved" note = "A member of a `RadioGroup`: `Radio::new(value).label(name).show(ui)`. It draws the button; its text is the label step's." [[type]] name = "RadioSet" old = "craft_ui::controls::radio::RadioSet" new = "" status = "replaced" note = "`RadioSet::begin`, `radio(..)` and `end` are a `RadioGroup` with its `Radio` members shown in the body closure." [[type]] name = "PreparedRadioSet" old = "craft_ui::controls::radio::PreparedRadioSet" new = "" status = "replaced" note = "Replaced by the `RadioGroup` body: the members register with the group as the body shows them." [[type]] name = "RadioOption" old = "craft_ui::controls::radio::RadioOption" new = "" status = "replaced" note = "`name` is the `Radio`'s `Props::label`. A description is the `SideLabel::detail` of the row's `cx.labelled` call, with `FieldLayout::After` to put the label after the button. An icon is `SideLabel::icon`. Inline content (a swatch, a count widget) is the row the app lays out around the `Radio` button in the group's body." [[type]] name = "Segmented" old = "craft_ui::controls::segmented::Segmented" new = "craft_ui::choice::Segmented" status = "moved" note = "A leaf over `Bind` and a slice of `Entry`: `Segmented::new(label, Bind::bound(&mut value), &entries).show(ui)`. `item(value, label)` is `Entry::new(value, label)`; `icon_item(value, icon, label)` is `Entry::new(value, label).icon(IconId)`; `item_enabled(false)` is `Entry::enabled(false)`. Each entry is a part wearing a toggle button's face; separators are not allowed." [[type]] name = "Rating" old = "craft_ui::controls::rating::Rating" new = "craft_ui::choice::Rating" status = "moved" note = "A leaf over `Bind`: `Rating::new(Bind::bound(&mut stars), 5).label(name).show(ui)`. The output is `EditResponse`. The number of stars is the second argument; the legacy fixed maximum `MAX_STARS` is gone." [[type]] name = "paint_rating" old = "craft_ui::controls::rating::paint_rating" new = "" status = "removed" note = "Stars drawn on thumbnails and captions (the browse family) are a `Rating` shown as a face of a part, or `Draw::icon` with the `star` and `star_filled` icons; no function replaces it." [[type]] name = "Swatch" old = "craft_ui::controls::swatch::Swatch" new = "craft_ui::choice::Swatch" status = "moved" note = "A leaf colour well: `Swatch::new(label, color)` (a `Srgba` or `Mixed`; the id salt is the call order or `Props::id_salt`) with output `SwatchOutput { response, clicked, activation: Option, pick_color: Option }`. A click is `clicked`, and `activation` carries the modifiers (Cmd/Ctrl-click, Alt-click). `Swatch::picker(key)` makes a click on the swatch file `ColorRequest::new(key, color).title(label)` as `pick_color` (`color` is `Option`: `None` for a `Mixed` swatch, which opens the host's picker with no colour), for `HostRequests::request_color`." [[type]] name = "SwatchStyle" old = "craft_ui::controls::swatch::SwatchStyle" new = "craft_ui::choice::SwatchStyle" status = "moved" note = "The sizes are `SwatchMetrics::of(tokens, size)` (`side`, `cell`, `radius`); a composition that lays out wells reads them. `SwatchStyle::inner_edge(Option) -> DataColor` is the contrast ring. The checker and edge colours are the swatch's own style; a composition paints its fills with `Draw::data_fill` and `kit::checker`." # One entry per renamed, removed or reshaped setter or constructor. [[setter]] type = "Checkbox" old = "new(label, &mut CheckState)" new = "new(Bind).label(label)" [[setter]] type = "Checkbox" old = "bool(label, &mut bool)" new = "new(Bind::bound(&mut on)).label(label)" [[setter]] type = "Checkbox" old = "size(ControlSize)" new = "size(ControlSize)" [[setter]] type = "Checkbox" old = "enabled(bool)" new = "enabled(bool)" [[setter]] type = "Checkbox" old = "id_salt(impl AsIdSalt)" new = "id_salt(impl AsIdSalt)" [[setter]] type = "Switch" old = "new(label, &mut bool)" new = "new(Bind).label(label)" [[setter]] type = "Switch" old = "size(ControlSize)" new = "size(ControlSize)" [[setter]] type = "RadioGroup" old = "new(id_salt, label, &mut T)" new = "new(label, Bind).id_salt(..)" [[setter]] type = "RadioGroup" old = "item(value, label)" new = "Radio::new(value).label(label).show(ui) in the body" [[setter]] type = "RadioGroup" old = "item_enabled(bool)" new = "Radio::enabled(bool)" [[setter]] type = "Segmented" old = "new(id_salt, label, &mut T)" new = "new(label, Bind, &[Entry]).id_salt(..)" [[setter]] type = "Segmented" old = "item(value, label)" new = "Entry::new(value, label)" [[setter]] type = "Segmented" old = "icon_item(value, Icon, label)" new = "Entry::new(value, label).icon(IconId)" [[setter]] type = "Segmented" old = "item_enabled(bool)" new = "Entry::enabled(bool)" [[setter]] type = "Rating" old = "new(id_salt, label, &mut u8)" new = "new(Bind, max: u8).label(label).id_salt(..)" [[setter]] type = "Rating" old = "labels(RatingLabels)" new = "" note = "The star names are the built-in `ChoiceWords` (`choice.rating.stars`), translated through the host's words." [[setter]] type = "Swatch" old = "radio(bool)" new = "member(value)" note = "The swatch is a member of the enclosing `RadioGroup` standing for `value`; the group owns the pick, the keys and the Tab stop." [[setter]] type = "Swatch" old = "position_in_set(usize)" new = "" note = "The group reports the place in the set." [[setter]] type = "Swatch" old = "tab_stop(bool)" new = "" note = "The group is one Tab stop; its roving moves the focus." [[setter]] type = "Swatch" old = "table_cell(f32)" new = "cell()" note = "A cell of a table of touching swatches: `SwatchMetrics::cell` square, square corners, a list box option." [[setter]] type = "Swatch" old = "dimensions(f32, f32)" new = "fill()" note = "A well the layout sizes is a `PaintUi::face` of a `Swatch` in the part's rect; a wide well at the control height is `fill()`." [[setter]] type = "Swatch" old = "mixed(bool)" new = "new(label, Mixed::Mixed)" note = "The colour is a `Mixed`." [[setter]] type = "Swatch" old = "size(ControlSize)" new = "size(ControlSize)" [[setter]] type = "Swatch" old = "id_in(&Ui, impl AsIdSalt)" new = "" note = "Ids come from the pipeline; `Fixture::node_of` and the AccessKit tree find a node." [[setter]] type = "Swatch" old = "shapes(&SwatchStyle, Rect, Option, bool, bool, f32)" new = "" note = "A composition faces a `Swatch` for the well; one that paints its own fill paints it with `Draw::data_fill` over `kit::checker`." [[setter]] type = "Swatch" old = "outline(&SwatchStyle, Rect, bool, bool, f32)" new = "" note = "The edge and selected ring are painted by the `Swatch` itself." [[setter]] type = "Swatch" old = "hex(Rgba)" new = "Srgba::to_hex" note = "The colour as `#rrggbb`, or `#rrggbbaa` when translucent." [[setter]] type = "Swatch" old = "checkerboard(Rect, CornerRadius, [Color32; 2], f32)" new = "kit::checker" note = "`primitives::kit::checker` and `Checker` are the one checkerboard." # fwk-swatches [[type]] name = "SwatchFace" old = "" new = "craft_ui::choice::SwatchFace" status = "replaced" note = "New: the swatch face outside a `Swatch`: `SwatchFace::new(color).selected(bool).paint(&ContentPainterCx, Rect)`, the painter `Swatch` itself paints with, for a `PresetBrowser::thumb` painter."