Commit Graph

5 Commits

Author SHA1 Message Date
Elias Naur a63e0cb44a all: [API] change op.Offset to take integer coordinates
op.Offset is a convenience function most often used by layouts. Layouts
usually operate in integer coordinates, and the float32 version of op.Offset
needlessly force conversions from int to float32. This change makes op.Offset
take integer coordinates, to better match its intended use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-05-31 10:24:09 +02:00
Pierre Curto 42ea56ac44 widget: adjust Draggable.Pos to be relative
When dragging objects around an area, it is easier to
reason with the relative movement of the dragged item.

References: https://todo.sr.ht/~eliasnaur/gio/363
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2022-02-19 12:03:10 +01:00
Pierre Curto 4c6d98879e widget: add Draggable.Pos
When the position of the cursor is required while dragging
a widget around, the pointer's cannot be tracked as the drag
grabs the event priority. Therefore, this patch exposes
the drag's current position.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2022-01-07 17:11:43 +01:00
Pierre Curto 038ec2cc3f widget: fix handling of disabled context in Draggable
While here, add an example on how to use the Draggable
widget.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-12-10 06:25:43 +01:00
Pierre Curto 03016f0c69 widget: add drag and drop support
This patch adds internal Drag and Drop support to app.Windows.

The new package io/transfer adds the ability to
define draggable and droppable targets, which
are leveraged by the new widget.Draggable type.

The API is generic and could handle future use
cases, such as external Drag and Drop.

Updates gio#153

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-12-07 12:45:53 +01:00