ref: 69dfd2e3a55419167975adc316f8126bc4737443 gio/widget/material d---------
op/paint: add support for efficient ImageOp subimages

The new field ImageOp.Rect is initialized to cover the entire source
image, but can be modified to draw only a section of it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
text: simplify text layout and shaping API

First, replace LayoutOptions with an explicit maximum width parameter.  The
single-field option struct doesn't carry its weight, and I don't think we'll
see more global layout options in the future. Rather, I expect options to cover
spans of text or be part of a Font.

Second, replace the unit.Converter with an scaled text size. It's simpler and
allow the Editor and similar widgets to easily detect whether their cached
layouts are stale. Package text no longer depends on package unit, which is
now dealt with at the widget-level only.

Finally, remove the Size field from Font. It was a design mistake: a Font is
assumed to cover all sizes, as evidenced by the FontRegistry disregarding
Size when looking up fonts.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
layout: replace Align with a Layout method on Direction

It's one less type (Align) and shorter:





It is also safer: since `layout.Align(...)` was a casting operation,
the Go compiler would not complain about an incompatible constant.

For example, the widget/material package contained a wrong cast:


which should have been


After this change, attempting `layout.Start.Layout(...)` result
in a compile error.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
text: make Shaper an interface

And rename out the caching implementation to FontRegistry.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
layout: simplify Stack API

Similar to what a previous commit did for Flex, this change simplifies
Stack to just one Layout call:

		layout.Stacked(func() {...}),
		layout.Expanded(func() {...}),

Signed-off-by: Elias Naur <mail@eliasnaur.com>
layout: simplify Flex API to a single Layout call

With the simplification of MacroOp, it is now possible to simplify
the Flex API to just a single Layout method, similar to List:

		layout.Rigid(func() { ... }),
		layout.Flexed(0.5, func() { ... }),

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op: remove operation list argument from MacroOp.Add

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>
io/pointer: unify area ops into a single AreaOp

Make Rect and Ellipse constructors of AreaOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/clip: replace Rect and RoundRect with Rect type

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

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget/material: rename material.go to theme.go

Signed-off-by: Elias Naur <mail@eliasnaur.com>
clip: change Rect argument to f32.Rectangle

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/clip: add RoundRect

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/clip: split clip operations into its own package

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget/material: use theme TextSize for Editors

Thanks to Werner Laurensse for noticing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
app/internal/windows: don't draw window background on Windows

Avoids flickering between GPU content and the CPU drawn background

gofmt -w -s . now we're here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget/material: clean up package docs, add license, rename file

Signed-off-by: Elias Naur <mail@eliasnaur.com>
089ae31f — Alexander Arin 11 months ago
widgets, widgets/material: add RadioButton & Enum

Signed-off-by: Alexander Arin <fralx@yandex.ru>
widget/material: document package

Signed-off-by: Elias Naur <mail@eliasnaur.com>
0f5b94a4 — Alexander Arin 11 months ago
widget,widget/material: add CheckBox
2a06f3d3 — Alexander Arin 11 months ago
widget/material: move Icon to its own file and add Color; add CornerRadius to Button
widget,widget/material: remove disabled drawing modes

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>