Commit Graph

255 Commits

Author SHA1 Message Date
Elias Naur ab13a2ee73 ui/text: add Editor.Focus method
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 18:23:50 +02:00
Elias Naur a0c04cb3b2 ui/app: (iOS) treat the \n character as a return key chord
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 17:54:50 +02:00
Elias Naur 47c6ea2dd2 ui/app: (iOS) redirect standard Go logger to NSLog
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 17:43:40 +02:00
Elias Naur 5f42e2e804 ui/app: (android) set close-on-exit flag on dup'ed log file descriptors
The file descriptors are probably overwritten on exec anyway, but at
least our intent is clear.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 16:47:38 +02:00
Elias Naur 1a417d353c ui/app: fix a few C signatures and a comment typo
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 16:33:11 +02:00
Elias Naur f110c26e3f ui/input: hide soft keyboard when focus is lost
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 15:52:09 +02:00
Elias Naur 31418eefbe ui/key: rename TextInputClosed to TextInputClose
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 15:52:09 +02:00
Elias Naur 5b7a7334c8 README.md: update for -buildmode=exe default
Also, move the exe section to the beginning of the mobile sections,
leaving -buildmode=archive second.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 11:43:32 +02:00
Elias Naur 2c5b7496d2 ui/text: apply correct material for cursor
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 00:48:00 +02:00
Elias Naur f56e082cc7 ui/app: introduce DataDir for application-specific data files
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 00:39:13 +02:00
Elias Naur 48786bbd05 README.md: move the build line first in webassembly instructions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-07 00:11:38 +02:00
Elias Naur 2d89a914e9 ui/app: tweak comment
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-06 16:09:01 +02:00
Elias Naur 8e46bea6dc cmd/gio: use package name for app name in -buildmode=exe
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-06 15:30:39 +02:00
Elias Naur 07d99ab182 cmd/gio: set default buildmode to "exe"
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-06 15:16:59 +02:00
Elias Naur 6440fc35b7 apps: update to renamed ColorOp.Color field
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-05 17:17:02 +02:00
Elias Naur 38ec6a8831 ui/draw: rename ColorOp.Col to Color 2019-07-05 17:14:57 +02:00
Elias Naur 0f576cf625 ui/text: use default colors to guard against empty materials
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-05 17:11:17 +02:00
Elias Naur e3629cc0fb apps: update to new material api
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-05 17:01:12 +02:00
Elias Naur 86bc3e612d ui/text: use BlockOp as materials
Before this change, clients were expected to set up the current
material (color or image) before laying out Labels and Editors.
This was done to avoid garbage from a hypothetical material
interface covering both colors and images.

However, some widgets need more than one material: the Editor had
HintImage for the hint text material.

This change implements generalized materials through blocks:
anywhere a material is expected, a ui.BlockOp is is assumed to
contain the operation(s) needed for setting the desired material.

This way we avoid allocations (interfaces) and keep the
abstraction over material types.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-05 16:52:13 +02:00
Elias Naur 30a558d10d ui/app: fix race condition between Window.Redraw and Draw
A Window.Redraw called after the client has completed building a
frame and before Window.Draw resets the redraw flag is effectively
ignored. Move the flag reset earlier to just before the client is
asked to build the frame, to ensure that no state updates are lost.

Tighten and simplify the locking while we're here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-04 16:31:48 +02:00
Elias Naur f1dffa155c ui/text: add ChangeEvent and rename Submit to SubmitEvent
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-04 15:06:50 +02:00
Elias Naur 252514af9d all: update dependencies
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-03 20:26:19 +02:00
Elias Naur 475bccb722 ui: add checks for unmatched Ops.Begin/End
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 20:12:06 +02:00
Elias Naur 322a95adee apps/hello: update to latest gio api
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 20:00:28 +02:00
Elias Naur e862761e17 ui/input: keep default focus on earliest focusable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 19:36:45 +02:00
Elias Naur 6fdab9dba6 apps/gophers: update to latest gio api
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 14:58:00 +02:00
Elias Naur 33fc35f58d ui/draw: switch to color.RGBA for colors
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 14:56:48 +02:00
Elias Naur 683df6345b ui/layout: fix Flex spacing
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-01 19:22:06 +02:00
Elias Naur 91de9acc4a cmd/assets: delete
It is unused.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-01 18:19:02 +02:00
Elias Naur 0316a27a45 apps/gophers: add editor hint
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-01 13:38:02 +02:00
Elias Naur d720fa6233 ui/text: add Hint and HintImage to Editor
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-01 13:36:54 +02:00
Elias Naur 0546683720 ui/text: add LayoutOptions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-30 23:58:05 +02:00
Elias Naur 28f53d8708 ui/text: add Label.MaxLines
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-30 23:51:11 +02:00
Elias Naur 3092a72089 apps/gophers: update to latest gioui.org/ui
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-27 12:47:33 +02:00
Elias Naur ef9384ceee ui/layout: allow one-line initialization of Flex and Stack
Returning itself from the Init methods allows the client to
initialize the layout instance on one line.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-27 12:44:15 +02:00
Elias Naur bf96bb8bdd cmd: update to latest gioui.org/ui version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-22 17:38:25 +02:00
Elias Naur 4f94f1078a ui/gesture: rename Scroller.Update to Scroller.Scroll
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-22 17:36:57 +02:00
Elias Naur bebfd822d8 ui/gesture: convert Click to single step events for symmetry
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-22 17:33:29 +02:00
Elias Naur b94119d093 cmd: update to latest API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:15:44 +02:00
Elias Naur 0b6dd4efd9 ui: change events to have "Event" suffixed, not prefixed
Match the Go error naming convention (FooError).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:14:16 +02:00
Elias Naur de5d5e19f5 cmd: update to latest API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:03:31 +02:00
Elias Naur 7aa7bb3be4 ui: rename ops to have Op suffixed, not prefixed
Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:01:45 +02:00
Elias Naur b981ccf9ed ui/input: support single stepping through events
Change input.Events interface to return one event at a time until
the queue is empty.

Change text.Editor and gestures to match.

Re-add Editor.Submit while we're here; we don't want to enable
submit mode always.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:30:20 +02:00
Elias Naur 893b7f3c9f cmd/gophers,cmd/hello: update to latest API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:18:44 +02:00
Elias Naur 898c3c5d7d ui/layout: unexport List.Update and move its parameters to state
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:17:29 +02:00
Elias Naur d4eb86a9b5 ui/text: replace Editor.Update with Next for stepping through events
Before this change, the Editor cleared its content after each
Submission event. If it didn't multiple submits for a frame would
not result in the cleared text for clients that wants to clear the
Editor between submits.

However, for clients that do not want to clear the content or that
wants to validate the text before accepting it were not supported.

Instead, switch to a event stepping model, where the client can
call Next to receive each EditorEvent (that is, Submit event) in
turn.

We can then delete the Submit flag on Editor and always report Submit
events.

We can also make Layout flush the pending events now that Editor
always has access to its Config and input queue.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 16:17:29 +02:00
Elias Naur 98d4d926f6 ui/text: move input.Events parameter from Update to Editor state
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:35:45 +02:00
Elias Naur dda9e3486d ui/text: move Config parameter from Editor.Update to Editor state
Assume the user will set a Config pointer once at init.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:27:57 +02:00
Elias Naur a695a115ce ui/measure: rename Faces.Cfg to Config
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:22:30 +02:00
Elias Naur 47c5859d87 ui/app: make Draw.Config a value, not a pointer
We are going to encourage a model where pointers to a central
(program global) Configs are passed to widgets at setup time, and
not pass Configs at every frame.

That way, the global Gonfig can change, but the pointers won't need
updating.

This change only switches the Draw event's Config pointer to a value
to avoid tempting programs to use the event Config instead of
updating their own central Configs.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 15:02:37 +02:00