Editor.Delete
Editor.Move
Editor.Insert
Move the Editor.command method up above all the functions it calls.
Signed-off-by: Larry Clapp <larry@theclapp.org>
Similar to what a previous commit did for Flex, this change simplifies
Stack to just one Layout call:
layout.Stack{}.Layout(gtx,
layout.Stacked(func() {...}),
layout.Expanded(func() {...}),
)
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With the simplification of MacroOp, it is now possible to simplify
the Flex API to just a single Layout method, similar to List:
layout.Flex{}.Layout(gtx,
layout.Rigid(func() { ... }),
layout.Flexed(0.5, func() { ... }),
)
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The ability to invoke other operation lists belongs in the new CallOp.
While we're here, make MacroOp.Add use a pointer receiver to match the
other methods.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
MacroOp is about to lose the ability to run a different operation list
than the one it was recorded on. Text shape caches rely on that property,
and must use the new CallOp operation added for purpose.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
While here, unexport the Queue and Config fields. The NewContext
cosntructor is shorter, and there is no reason to expose the fields
to accidental mutation.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Remembering the order of the corners in the RoundRect is difficult,
which suggest that RoundRect should be a struct with named fields.
Do that, and make Rect the special case where corner radii are all
zero.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
When you press enter to "submit" an editor widget, don't also append the
newline to the editor text. Enter should be "submit" or "add newline"
but not both.
Also add parens to the Enter check: x && y || z => x && (y || z).
Signed-off-by: Larry Clapp <larry@theclapp.org>
Determining the enabled state of a widget from whether its Clicked method has
been called only works for button-like widgets. For example, it's not clear a
Clicked method is appropriate for a CheckBox.
Remove the feature for now, and let's find a better design in the future.
As a nice side effect, we can now process events in Layout methods, so that
buttons react to user input even when Clicked is not called.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With public ImageOp fields there was no way to mark an image.Image as modified.
Replace them with NewImageOp that always make a copy, and use the opportunity
to ensure the copy is ready to upload to a GPU texture.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package ui is now only about units except for the Config.Now method.
Remove Now and rename Config to Converter. Add layout.Config to
replace the old ui.Config.
Signed-off-by: Elias Naur <mail@eliasnaur.com>