| 2450 |
2450 |
|
///
|
| 2451 |
2451 |
|
/// [`State::Disabled`] is what changes what a renderer may do: see
|
| 2452 |
2452 |
|
/// [`State::suppresses_interaction`], which is what says a disabled control
|
| 2453 |
|
- |
/// is drawn and not reachable. It has been the only member since 0.19.0,
|
| 2454 |
|
- |
/// and a control's focus is not sayable here at all — see the crate header,
|
| 2455 |
|
- |
/// "Reach, focus and the focus ring".
|
|
2453 |
+ |
/// is drawn and not reachable. It was the only member from 0.19.0 to
|
|
2454 |
+ |
/// 0.40.0, and a control's focus is not sayable here at all — see the crate
|
|
2455 |
+ |
/// header, "Reach, focus and the focus ring".
|
| 2456 |
2456 |
|
pub state: Option<State>,
|
|
2457 |
+ |
/// A sentence that is always true of this control, shown rather than hunted
|
|
2458 |
+ |
/// for.
|
|
2459 |
+ |
///
|
|
2460 |
+ |
/// Standing help, not a message and not a tooltip. Half the hosts that read
|
|
2461 |
+ |
/// this have no pointer: a hover is one spelling of it, and the shipped
|
|
2462 |
+ |
/// apps reached for that spelling only because egui and a browser both had
|
|
2463 |
+ |
/// one. What is being said is that the sentence is true, never that it is
|
|
2464 |
+ |
/// hidden until a pointer arrives.
|
|
2465 |
+ |
///
|
|
2466 |
+ |
/// # Why it is here rather than a layer up
|
|
2467 |
+ |
///
|
|
2468 |
+ |
/// It was in `quasi_router::Act` alone until 0.40.0, and each renderer drew
|
|
2469 |
+ |
/// it for itself: `makeover_tui` had no hint to read, so quasi-tui built
|
|
2470 |
+ |
/// the muted line, and quasi-immediate called `on_hover_text` outside
|
|
2471 |
+ |
/// [`crate::Act`] rather than inside it. `Field::hint` was here the whole
|
|
2472 |
+ |
/// time, so the same idea sat at two layers depending on which thing
|
|
2473 |
+ |
/// carried it, and a host that was not quasi could say it of a field and
|
|
2474 |
+ |
/// not of a control.
|
|
2475 |
+ |
///
|
|
2476 |
+ |
/// What kept it out was price rather than doubt: this crate declares
|
|
2477 |
+ |
/// `links`, so a member here moves 25 manifests across 12 repos. That is a
|
|
2478 |
+ |
/// release's forward-fix pass, which is a cost and was being read as a
|
|
2479 |
+ |
/// barrier.
|
|
2480 |
+ |
///
|
|
2481 |
+ |
/// # What a renderer owes it
|
|
2482 |
+ |
///
|
|
2483 |
+ |
/// Somewhere to put it, or nothing. Dropping it is legitimate; drawing it
|
|
2484 |
+ |
/// *instead of* the label is not, and neither is drawing it in a way that
|
|
2485 |
+ |
/// takes it out of the accessible tree, which is the failure `title` alone
|
|
2486 |
+ |
/// has on a browser. Nothing may live only in a hint.
|
|
2487 |
+ |
///
|
|
2488 |
+ |
/// `None` is a control whose label is the whole of it, which is nearly all
|
|
2489 |
+ |
/// of them.
|
|
2490 |
+ |
///
|
|
2491 |
+ |
/// Added 0.40.0.
|
|
2492 |
+ |
pub hint: Option<&'a str>,
|
| 2457 |
2493 |
|
}
|
| 2458 |
2494 |
|
|
| 2459 |
2495 |
|
impl<'a> Act<'a> {
|
| 2465 |
2501 |
|
key: None,
|
| 2466 |
2502 |
|
tone: Tone::Neutral,
|
| 2467 |
2503 |
|
state: None,
|
|
2504 |
+ |
hint: None,
|
| 2468 |
2505 |
|
}
|
| 2469 |
2506 |
|
}
|
| 2470 |
2507 |
|
|
|
2508 |
+ |
/// The sentence that is always true of it; see [`hint`](Self::hint).
|
|
2509 |
+ |
///
|
|
2510 |
+ |
/// A renderer with nowhere to put it drops it, so this must never be the
|
|
2511 |
+ |
/// only place a fact appears.
|
|
2512 |
+ |
#[must_use]
|
|
2513 |
+ |
pub const fn hinted(mut self, hint: &'a str) -> Self {
|
|
2514 |
+ |
self.hint = Some(hint);
|
|
2515 |
+ |
self
|
|
2516 |
+ |
}
|
|
2517 |
+ |
|
| 2471 |
2518 |
|
/// The key that reaches it.
|
| 2472 |
2519 |
|
#[must_use]
|
| 2473 |
2520 |
|
pub const fn key(mut self, key: &'a str) -> Self {
|