Files
openchamber-android-native/third_party/mygo/ui/rowclick.go
T
OpenChamber 6c0ee61750 feat: port the client to MyGo native UI (0.3.0)
Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
2026-11-18 13:22:59 +08:00

63 lines
2.1 KiB
Go

package ui
// RowDoubleClicked reports, while a row of a List or a Table builds, that
// the row was double-clicked since the last frame with the pointer over the
// element: a cell sees its row's double click this way and leaves the click
// to the row, which chooses, where DoubleClicked would take it.
//
// ui.Table(c, &app.list, cols, len(app.rows), func(row, col int) {
// cell := ui.Box(c).FillWidth().Children(func() { ui.Text(c, app.rows[row][col]) })
// if cell.RowDoubleClicked() {
// app.edit(row, col)
// }
// })
func (e *node) RowDoubleClicked() bool {
if !e.hasState() {
return false
}
row := e.c.row
return row != nil && row.double && e.Hovered()
}
// RowClicked reports, while a row of a List or a Table builds, that the
// row was clicked since the last frame with the pointer over the element:
// a row's content acts on a click this way and leaves the click to the
// row, which goes on choosing, where Clicked would take it, so that the
// row's ListState.Label names what takes the click, for typing its first
// letters, screen readers and Tester.Click alike. It reports each click of
// the primary button without modifiers, on the row chosen too, and not the
// keys that move the choice, nor a Shift- or Cmd-click extending it. A
// double click reports its first click here and its second with
// RowDoubleClicked, as on the systems' own lists. Assistive technology
// pressing the row, without the pointer, reports it to the first element
// asking. In a list that does not choose its rows, asking makes the row
// take the click.
//
// ui.List(c, &app.files, len(app.names), func(i int) {
// if ui.Text(c, app.names[i]).Padding(6, 12).FillWidth().RowClicked() {
// app.open(i)
// }
// })
func (e *node) RowClicked() bool {
if !e.hasState() {
return false
}
row := e.c.row
if row == nil || row.e == nil {
return false
}
row.e.flags |= flagClickable
if !row.single {
return false
}
if row.e.Hovered() {
return e.Hovered()
}
// Not by the pointer: no element is under it.
if row.singleTaken {
return false
}
row.singleTaken = true
return true
}