| 1231 |
1231 |
|
}
|
| 1232 |
1232 |
|
}
|
| 1233 |
1233 |
|
|
| 1234 |
|
- |
/// What a row is called: the first thing it says.
|
|
1234 |
+ |
/// Say that a table row can be opened, once, on its first column.
|
| 1235 |
1235 |
|
///
|
| 1236 |
|
- |
/// For [`egui::WidgetInfo`], which needs one string where a row is a run of
|
| 1237 |
|
- |
/// leaves. The first textual part is what `Row::new` takes and what a reader
|
| 1238 |
|
- |
/// would call the row, so there is nothing to invent here.
|
| 1239 |
|
- |
fn row_name(row: &quasi_router::Row) -> String {
|
| 1240 |
|
- |
row.parts
|
|
1236 |
+ |
/// The press is claimed per cell, and saying so per cell would put a button in
|
|
1237 |
+ |
/// the tree for every column of every row -- five buttons all called "kick.wav"
|
|
1238 |
+ |
/// on a five-column table, which is noise rather than access. The first column
|
|
1239 |
+ |
/// is where the row's name already is, so that is where it is announced;
|
|
1240 |
+ |
/// pressing any cell still opens it, exactly as before.
|
|
1241 |
+ |
///
|
|
1242 |
+ |
/// Second half of `461582b5`. The list half is [`row`], where a row has one
|
|
1243 |
+ |
/// rect and one place to say this.
|
|
1244 |
+ |
fn announce_row(ui: &Ui, response: &egui::Response, index: usize, row: &Cells) {
|
|
1245 |
+ |
if index != 0 || (row.activate.is_none() && row.menu.is_empty()) {
|
|
1246 |
+ |
return;
|
|
1247 |
+ |
}
|
|
1248 |
+ |
let named = cells_name(row);
|
|
1249 |
+ |
response.widget_info(|| {
|
|
1250 |
+ |
egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), &named)
|
|
1251 |
+ |
});
|
|
1252 |
+ |
}
|
|
1253 |
+ |
|
|
1254 |
+ |
/// What a table row is called: the first thing in its first cell.
|
|
1255 |
+ |
///
|
|
1256 |
+ |
/// [`row_name`]'s counterpart for [`quasi_router::Cells`], which holds cells
|
|
1257 |
+ |
/// rather than parts. Same rule and the same reason: it is where the row's name
|
|
1258 |
+ |
/// already is.
|
|
1259 |
+ |
fn cells_name(row: &quasi_router::Cells) -> String {
|
|
1260 |
+ |
row.values
|
| 1241 |
1261 |
|
.iter()
|
| 1242 |
|
- |
.find_map(|part| match &part.node {
|
|
1262 |
+ |
.find_map(|cell| {
|
|
1263 |
+ |
let said = row_leaf_text(&cell.parts);
|
|
1264 |
+ |
(!said.is_empty()).then_some(said)
|
|
1265 |
+ |
})
|
|
1266 |
+ |
.unwrap_or_default()
|
|
1267 |
+ |
}
|
|
1268 |
+ |
|
|
1269 |
+ |
/// The first thing a run of leaves says.
|
|
1270 |
+ |
fn row_leaf_text(parts: &[Node]) -> String {
|
|
1271 |
+ |
parts
|
|
1272 |
+ |
.iter()
|
|
1273 |
+ |
.find_map(|part| match part {
|
| 1243 |
1274 |
|
Node::Text { text, .. } | Node::Heading { text, .. } | Node::Link { text, .. } => {
|
| 1244 |
1275 |
|
Some(text.clone())
|
| 1245 |
1276 |
|
}
|
| 1248 |
1279 |
|
.unwrap_or_default()
|
| 1249 |
1280 |
|
}
|
| 1250 |
1281 |
|
|
|
1282 |
+ |
/// What a row is called: the first thing it says.
|
|
1283 |
+ |
///
|
|
1284 |
+ |
/// For [`egui::WidgetInfo`], which needs one string where a row is a run of
|
|
1285 |
+ |
/// leaves. The first textual part is what `Row::new` takes and what a reader
|
|
1286 |
+ |
/// would call the row, so there is nothing to invent here.
|
|
1287 |
+ |
fn row_name(row: &quasi_router::Row) -> String {
|
|
1288 |
+ |
let parts: Vec<Node> = row.parts.iter().map(|part| part.node.clone()).collect();
|
|
1289 |
+ |
row_leaf_text(&parts)
|
|
1290 |
+ |
}
|
|
1291 |
+ |
|
| 1251 |
1292 |
|
/// One part of a row's run.
|
| 1252 |
1293 |
|
///
|
| 1253 |
1294 |
|
/// A part is a role and a node, so the drawing is `draw` again: the role says
|
| 1624 |
1665 |
|
// its cells". That is the honest reading of what this renderer can
|
| 1625 |
1666 |
|
// see, and it is also what a user expects of a table row.
|
| 1626 |
1667 |
|
let response = cell_row_response(ui);
|
|
1668 |
+ |
announce_row(ui, &response, index, row);
|
| 1627 |
1669 |
|
if let Some((action, confirm)) = row_menu(pass.immediate, &response, &row.menu) {
|
| 1628 |
1670 |
|
menued = Some((action, confirm));
|
| 1629 |
1671 |
|
} else if let Some(action) = &row.activate
|