Before this change, there was no guarantee that a PopOp matched
the intended PushOp. With a single stack operation, the client is
forced to match pop with the right push.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Move the Record and Stop methods from Ops to MacroOp itself.
Before this change, Ops.Stop stopped the recording of the most
recent macro, which could be a different macro than intended.
After this change, there is no such confusion.
As a bonus, the Ops API becomes less cluttered.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Rename Insets to the verb Inset for consistency with Align.
Uniform is a better description than Equal for the result of
UniformInset.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Exact was too special and can be expressed with RigidConstraints.
RigidConstraints is a better name ("rigid" was in the comment!)
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Replace the StageDead stage with DestroyEvent dedicated to ending
the event loop and, for premature window closes, the error.
Drop the error return from NewWindow; any errors in window creation
will appear as an immediate DestroyEvent with its Err field set.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Replace CreateWindow with NewWindow that immediately creates a Window
ready to use.
Drop the Windows channel of windows created by the system. For iOS
and Android where the system creates the windows, let them rendezvous
with the window created in the first NewWindow call.
Android is further changed so that destroying and re-creating the
Java Activity simply reconnects with the original Window.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
And add ProfileOp and ProfileEvent for registering and receiving
profile data.
Remove the Profiling field and Timings method from app.Window.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Redrawing should only be scheduled when some UI state has changed.
Window has no way to know whether a CommandEvent was ignored by
the client, so push the onus to the client to schedule a redraw.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Single stepping events only makes sense for widgets with complex
state, e.g. the text.Editor. For the input.Events source, returning
all events in a single Events call is sufficient and more natural
for clients.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change, the weight applied to the space left, not the
total space available after rigid children.
While here, ensure that weight sums > 1 are capped to the available
space.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The type and argument to Flex.Flexible does not carry its weight;
It is just as easy to expand the constraint directly.
While we're here, rename the flex argument to weight which is clearer.
With this change, a List l can be iterated with
for l.Init(...); l.More(); l.Next() {
l.Elem(..., l.Constraints(), l.Index())
}
instead of
l.Init(...)
for {
i, cs, ok := l.Next()
if !ok {
break
}
l.End(..., cs, i))
}
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Insets is like image.Rectangle, but with properly named fields
and ui.Value instead of raw ints to make use with the layout
package easier.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Let the caller decide whether the constraints should be stretched.
Also unexport Constraint (not Constraints) methods, they weren't
pulling their weight.
Finally, don't force cross axis constraint minimum to 0 in List.
Signed-off-by: Elias Naur <mail@eliasnaur.com>