~eliasnaur/gio

ref: f24232dac52e gio/widget d---------
widget: add key.InputHint to widget.Editor

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
widget/material: draw Loader completely inside its bounds

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget: make Editor implement io.Seeker, io.Reader and io.WriterTo

The WriteTo, Seek, Read methods implement a more efficient access to
the Editor content than Text.

Signed-off-by: pierre <pierre.curto@gmail.com>
widget: clip by most complex shape last

In the new compute renderer, clipping to a complex shape is slower than
filling it. Swap the clip shapes for drawing text so that the text shape
itself is last, and therefore used for filling.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/pointer: support nested scrollables

Fixes #185.

Signed-off-by: pierre <pierre.curto@gmail.com>
widget: fixed missing sides in Border

Signed-off-by: pierre <pierre.curto@gmail.com>
op/clip: expose Circle.Path and RRect.Path.

These can be nicely used together with clip.Stroke.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
widget/material: use clip.Circle to draw circles

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
widget: add Fit and Position to Image for image placement

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
widget: add Fit for scaling widgets

Currently adds four different variants Unscaled, Contain, Cover, ScaleDown and Fill.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
widget/material: use simpler clip.Rect for Clickable clip region

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget: handle hovering of the empty Enum key

Before this change, a radio button with the empty key ("") would be
displayed as hovering if no other button were.

It's still not possible to have no radio buttons selected when one of
them is the empty key. If that's becomes necessary, Enum.Value can be
converted to a *string.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget/material: remove bogus minimum cosntraint from checkable

checkable.layout forces the label to take up at least constraints.min
space. However, for min == max, the total checkbox plus label would then
overflow. The minimum constraint doesn't seem necessary anymore, so drop
it.

Remove a superfluous layout.W layout as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
io/pointer: rename button names to reflect their meaning, not placement

For example, ButtonLeft may be the right-most button for a left-handed user.
Rename the button names to match their intended use.

This is an API change. Use the following commands to update your
projects:

    $ gofmt -r 'pointer.ButtonLeft -> pointer.ButtonPrimary' -w .
    $ gofmt -r 'pointer.ButtonRight -> pointer.ButtonSecondary' -w .
    $ gofmt -r 'pointer.ButtonMiddle -> pointer.ButtonTertiary' -w .

Signed-off-by: Elias Naur <mail@eliasnaur.com>
widget: fix image scaling

Commit 94d242d broke the widget.Image's Scale field so
that it no longer had any effect on the actual size of
the displayed image. This commit fixes that, as well as
adding tests to confirm that the widget.Image type
scales appropriately with DPI changes and its own Scale
field.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
a8a48bb8 — vsariola 7 months ago
widget: fix bug how f.pos is calculated in widget.Float

The order of subtraction when calculating f.pos from value was wrong,
so setting a minimum value for a Float never really worked, although
min = 0 worked as intended which is why this probably went unnoticed.

Signed-off-by: vsariola <5684185+vsariola@users.noreply.github.com>
widget/material: use more readable editor default selection color

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Programmatic Click function

Signed-off-by: Paulo Melo <paulo.durrer.melo@gmail.com>
widget: fix Editor panic

If you created an Editor and immediately SetCaret, it panicked because
e.lines was nil and it looked at e.lines[0].

- Add e.makeValid at the top of SetCaret.
- Add a test case for this situation.

Signed-off-by: Larry Clapp <larry@theclapp.org>
widget,widget/material: add selection to the editor

- Allow dragging to be on both horizontal and vertical axes at once.
- Split Editor.caret.pos into caret.start and caret.stop. caret.start is
  the old caret.pos, and is both the position of the caret, and also the
  start of selected text. caret.end is the end of the selected text.
  Start can be after end, e.g. after after Shift-DownArrow.
- Update caret.end after a mouse drag, and various shifted keys
  (Shift-UpArrow, Shift-DownArrow, etc).
- Change Shortcut-C to copy only the selected text, not the whole editor
  text.
- Add Shortcut-X to copy and delete selected text, and Shortcut-A to
  select all text.
- The various Insert/Delete/etc functions now overwrite or delete the
  selection, as appropriate.
- Change MoveCaret to accept a distance for selection end, as well.
  Change SetCaret to accept a selection end offset.
- Add SelectionLen to get the selection length, Selection to get
  selection offsets, SelectedText to get the selected text, and
  ClearSelection to clear the selection.
- Add a rudimentary selection unit test, and extend the deleteWord unit
  test with some text selection cases.
- Add SelectionColor to material.EditorStyle, which defaults to
  Theme.Palette.ContrastBg.

Signed-off-by: Larry Clapp <larry@theclapp.org>
Next