@gtkx/react 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -27
- package/dist/errors.js +3 -0
- package/dist/factory.d.ts +3 -2
- package/dist/factory.js +1 -1
- package/dist/generated/internal.d.ts +28 -1
- package/dist/generated/internal.js +93 -18
- package/dist/generated/jsx.d.ts +1712 -1516
- package/dist/generated/jsx.js +475 -0
- package/dist/host-config.d.ts +3 -1
- package/dist/host-config.js +31 -11
- package/dist/jsx.d.ts +147 -97
- package/dist/jsx.js +89 -21
- package/dist/node.d.ts +3 -1
- package/dist/node.js +5 -3
- package/dist/nodes/abstract/positional-child.d.ts +9 -0
- package/dist/nodes/abstract/positional-child.js +29 -0
- package/dist/nodes/abstract/positional-parent.d.ts +18 -0
- package/dist/nodes/abstract/positional-parent.js +48 -0
- package/dist/nodes/abstract/virtual-container.d.ts +17 -0
- package/dist/nodes/abstract/virtual-container.js +59 -0
- package/dist/nodes/abstract/virtual-single-child.d.ts +18 -0
- package/dist/nodes/abstract/virtual-single-child.js +54 -0
- package/dist/nodes/action-row-child.d.ts +0 -13
- package/dist/nodes/action-row-child.js +14 -12
- package/dist/nodes/action-row.d.ts +6 -1
- package/dist/nodes/action-row.js +4 -37
- package/dist/nodes/adjustable.d.ts +23 -0
- package/dist/nodes/adjustable.js +62 -0
- package/dist/nodes/alert-dialog-response.d.ts +1 -0
- package/dist/nodes/alert-dialog-response.js +86 -0
- package/dist/nodes/animation/animation-controller.d.ts +17 -0
- package/dist/nodes/animation/animation-controller.js +107 -0
- package/dist/nodes/animation/animation-factory.d.ts +15 -0
- package/dist/nodes/animation/animation-factory.js +25 -0
- package/dist/nodes/animation/animation-node.d.ts +9 -0
- package/dist/nodes/animation/animation-node.js +126 -0
- package/dist/nodes/animation/animation-style-sheet.d.ts +16 -0
- package/dist/nodes/animation/animation-style-sheet.js +74 -0
- package/dist/nodes/animation/index.d.ts +4 -0
- package/dist/nodes/animation/index.js +1 -0
- package/dist/nodes/animation/property-mapper.d.ts +11 -0
- package/dist/nodes/animation/property-mapper.js +36 -0
- package/dist/nodes/animation/transform-state.d.ts +11 -0
- package/dist/nodes/animation/transform-state.js +57 -0
- package/dist/nodes/animation/widget-registry.d.ts +5 -0
- package/dist/nodes/animation/widget-registry.js +42 -0
- package/dist/nodes/application.js +17 -7
- package/dist/nodes/autowrapped.js +37 -43
- package/dist/nodes/calendar.js +16 -55
- package/dist/nodes/color-dialog-button.d.ts +1 -0
- package/dist/nodes/color-dialog-button.js +70 -0
- package/dist/nodes/column-view-column.d.ts +4 -3
- package/dist/nodes/column-view-column.js +5 -1
- package/dist/nodes/column-view.js +40 -43
- package/dist/nodes/dialog.d.ts +11 -0
- package/dist/nodes/dialog.js +20 -0
- package/dist/nodes/drawing-area.d.ts +1 -0
- package/dist/nodes/drawing-area.js +36 -0
- package/dist/nodes/event-controller.d.ts +1 -0
- package/dist/nodes/event-controller.js +96 -0
- package/dist/nodes/expander-row-child.d.ts +0 -14
- package/dist/nodes/expander-row-child.js +14 -12
- package/dist/nodes/expander-row.d.ts +6 -1
- package/dist/nodes/expander-row.js +11 -47
- package/dist/nodes/fixed-child.js +48 -36
- package/dist/nodes/font-dialog-button.d.ts +1 -0
- package/dist/nodes/font-dialog-button.js +90 -0
- package/dist/nodes/grid-child.js +39 -45
- package/dist/nodes/grid.d.ts +1 -0
- package/dist/nodes/grid.js +41 -0
- package/dist/nodes/index.d.ts +22 -6
- package/dist/nodes/index.js +22 -6
- package/dist/nodes/internal/base-item-renderer.d.ts +29 -0
- package/dist/nodes/internal/base-item-renderer.js +88 -0
- package/dist/nodes/internal/base-store.d.ts +9 -0
- package/dist/nodes/internal/base-store.js +20 -0
- package/dist/nodes/internal/child-attachment.d.ts +26 -0
- package/dist/nodes/internal/child-attachment.js +48 -0
- package/dist/nodes/internal/deferred-action.d.ts +8 -0
- package/dist/nodes/internal/deferred-action.js +19 -0
- package/dist/nodes/internal/list-item-renderer.d.ts +14 -14
- package/dist/nodes/internal/list-item-renderer.js +49 -70
- package/dist/nodes/internal/list-store.d.ts +7 -6
- package/dist/nodes/internal/list-store.js +20 -24
- package/dist/nodes/internal/predicates.d.ts +28 -1
- package/dist/nodes/internal/predicates.js +53 -38
- package/dist/nodes/internal/selection-model.d.ts +30 -0
- package/dist/nodes/internal/selection-model.js +91 -0
- package/dist/nodes/internal/signal-store.d.ts +5 -3
- package/dist/nodes/internal/signal-store.js +30 -21
- package/dist/nodes/internal/simple-list-store.js +6 -9
- package/dist/nodes/internal/text-buffer-controller.d.ts +43 -0
- package/dist/nodes/internal/text-buffer-controller.js +287 -0
- package/dist/nodes/internal/text-tag-styles.d.ts +43 -0
- package/dist/nodes/internal/text-tag-styles.js +52 -0
- package/dist/nodes/internal/tree-list-item-renderer.d.ts +16 -14
- package/dist/nodes/internal/tree-list-item-renderer.js +88 -91
- package/dist/nodes/internal/tree-store.d.ts +10 -9
- package/dist/nodes/internal/tree-store.js +31 -35
- package/dist/nodes/internal/utils.d.ts +7 -4
- package/dist/nodes/internal/utils.js +50 -5
- package/dist/nodes/level-bar.js +18 -66
- package/dist/nodes/list-item.d.ts +6 -3
- package/dist/nodes/list-item.js +7 -4
- package/dist/nodes/list-view.js +19 -11
- package/dist/nodes/menu.d.ts +3 -3
- package/dist/nodes/menu.js +3 -3
- package/dist/nodes/models/list.d.ts +11 -13
- package/dist/nodes/models/list.js +16 -73
- package/dist/nodes/models/menu.d.ts +8 -7
- package/dist/nodes/models/menu.js +43 -50
- package/dist/nodes/models/tree-list.d.ts +6 -12
- package/dist/nodes/models/tree-list.js +30 -93
- package/dist/nodes/navigation-page.d.ts +1 -0
- package/dist/nodes/navigation-page.js +7 -3
- package/dist/nodes/navigation-view.js +17 -28
- package/dist/nodes/notebook-page-tab.d.ts +4 -3
- package/dist/nodes/notebook-page-tab.js +5 -2
- package/dist/nodes/notebook-page.d.ts +7 -5
- package/dist/nodes/notebook-page.js +39 -16
- package/dist/nodes/notebook.js +2 -2
- package/dist/nodes/overlay-child.js +90 -30
- package/dist/nodes/pack-child.d.ts +0 -13
- package/dist/nodes/pack-child.js +14 -12
- package/dist/nodes/pack.d.ts +6 -1
- package/dist/nodes/pack.js +4 -37
- package/dist/nodes/popover-menu.js +2 -2
- package/dist/nodes/scale.js +15 -58
- package/dist/nodes/scrolled-window.js +7 -5
- package/dist/nodes/search-bar.d.ts +1 -0
- package/dist/nodes/search-bar.js +40 -0
- package/dist/nodes/shortcut-controller.d.ts +1 -0
- package/dist/nodes/shortcut-controller.js +90 -0
- package/dist/nodes/shortcut.d.ts +39 -0
- package/dist/nodes/shortcut.js +52 -0
- package/dist/nodes/simple-list-view.js +2 -3
- package/dist/nodes/slot.d.ts +6 -9
- package/dist/nodes/slot.js +27 -42
- package/dist/nodes/source-view.d.ts +1 -0
- package/dist/nodes/source-view.js +93 -0
- package/dist/nodes/stack-page.js +17 -13
- package/dist/nodes/stack.js +19 -5
- package/dist/nodes/text-anchor.d.ts +41 -0
- package/dist/nodes/text-anchor.js +59 -0
- package/dist/nodes/text-content.d.ts +10 -0
- package/dist/nodes/text-content.js +1 -0
- package/dist/nodes/text-paintable.d.ts +17 -0
- package/dist/nodes/text-paintable.js +34 -0
- package/dist/nodes/text-segment.d.ts +15 -0
- package/dist/nodes/text-segment.js +29 -0
- package/dist/nodes/text-tag.d.ts +136 -0
- package/dist/nodes/text-tag.js +202 -0
- package/dist/nodes/text-view.d.ts +31 -0
- package/dist/nodes/text-view.js +73 -0
- package/dist/nodes/toggle-group.js +24 -32
- package/dist/nodes/toggle.d.ts +1 -15
- package/dist/nodes/toggle.js +40 -32
- package/dist/nodes/toolbar-child.js +14 -16
- package/dist/nodes/tree-list-item.d.ts +7 -5
- package/dist/nodes/tree-list-item.js +24 -36
- package/dist/nodes/tree-list-view.js +9 -4
- package/dist/nodes/virtual.d.ts +1 -1
- package/dist/nodes/widget.d.ts +3 -13
- package/dist/nodes/widget.js +117 -231
- package/dist/nodes/window.d.ts +9 -3
- package/dist/nodes/window.js +35 -19
- package/dist/registry.d.ts +1 -1
- package/dist/render.js +8 -6
- package/dist/scheduler.d.ts +11 -1
- package/dist/scheduler.js +16 -4
- package/dist/types.d.ts +2 -110
- package/package.json +3 -3
- package/dist/nodes/calendar-mark.d.ts +0 -15
- package/dist/nodes/calendar-mark.js +0 -29
- package/dist/nodes/internal/constants.d.ts +0 -1
- package/dist/nodes/internal/constants.js +0 -21
- package/dist/nodes/level-bar-offset.d.ts +0 -13
- package/dist/nodes/level-bar-offset.js +0 -35
- package/dist/nodes/scale-mark.d.ts +0 -17
- package/dist/nodes/scale-mark.js +0 -38
- package/dist/nodes/virtual-child.d.ts +0 -18
- package/dist/nodes/virtual-child.js +0 -62
package/dist/generated/jsx.js
CHANGED
|
@@ -9118,3 +9118,478 @@ export const AdwWindowTitle = "AdwWindowTitle";
|
|
|
9118
9118
|
* `AdwWrapBox` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
|
|
9119
9119
|
*/
|
|
9120
9120
|
export const AdwWrapBox = "AdwWrapBox";
|
|
9121
|
+
/**
|
|
9122
|
+
* An event controller to initiate Drag-And-Drop operations.
|
|
9123
|
+
*
|
|
9124
|
+
* `GtkDragSource` can be set up with the necessary
|
|
9125
|
+
* ingredients for a DND operation ahead of time. This includes
|
|
9126
|
+
* the source for the data that is being transferred, in the form
|
|
9127
|
+
* of a {@link Gdk.ContentProvider}, the desired action, and the icon to
|
|
9128
|
+
* use during the drag operation. After setting it up, the drag
|
|
9129
|
+
* source must be added to a widget as an event controller, using
|
|
9130
|
+
* {@link Gtk.Widget.add_controller}.
|
|
9131
|
+
*
|
|
9132
|
+
* ```c
|
|
9133
|
+
* static void
|
|
9134
|
+
* my_widget_init (MyWidget *self)
|
|
9135
|
+
* {
|
|
9136
|
+
* GtkDragSource *drag_source = gtk_drag_source_new ();
|
|
9137
|
+
*
|
|
9138
|
+
* g_signal_connect (drag_source, "prepare", G_CALLBACK (on_drag_prepare), self);
|
|
9139
|
+
* g_signal_connect (drag_source, "drag-begin", G_CALLBACK (on_drag_begin), self);
|
|
9140
|
+
*
|
|
9141
|
+
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source));
|
|
9142
|
+
* }
|
|
9143
|
+
* ```
|
|
9144
|
+
*
|
|
9145
|
+
* Setting up the content provider and icon ahead of time only makes
|
|
9146
|
+
* sense when the data does not change. More commonly, you will want
|
|
9147
|
+
* to set them up just in time. To do so, `GtkDragSource` has
|
|
9148
|
+
* {@link Gtk.DragSource.:prepare} and {@link Gtk.DragSource.:drag-begin}
|
|
9149
|
+
* signals.
|
|
9150
|
+
*
|
|
9151
|
+
* The ::prepare signal is emitted before a drag is started, and
|
|
9152
|
+
* can be used to set the content provider and actions that the
|
|
9153
|
+
* drag should be started with.
|
|
9154
|
+
*
|
|
9155
|
+
* ```c
|
|
9156
|
+
* static GdkContentProvider *
|
|
9157
|
+
* on_drag_prepare (GtkDragSource *source,
|
|
9158
|
+
* double x,
|
|
9159
|
+
* double y,
|
|
9160
|
+
* MyWidget *self)
|
|
9161
|
+
* {
|
|
9162
|
+
* // This widget supports two types of content: GFile objects
|
|
9163
|
+
* // and GdkPixbuf objects; GTK will handle the serialization
|
|
9164
|
+
* // of these types automatically
|
|
9165
|
+
* GFile *file = my_widget_get_file (self);
|
|
9166
|
+
* GdkPixbuf *pixbuf = my_widget_get_pixbuf (self);
|
|
9167
|
+
*
|
|
9168
|
+
* return gdk_content_provider_new_union ((GdkContentProvider *[2]) {
|
|
9169
|
+
* gdk_content_provider_new_typed (G_TYPE_FILE, file),
|
|
9170
|
+
* gdk_content_provider_new_typed (GDK_TYPE_PIXBUF, pixbuf),
|
|
9171
|
+
* }, 2);
|
|
9172
|
+
* }
|
|
9173
|
+
* ```
|
|
9174
|
+
*
|
|
9175
|
+
* The ::drag-begin signal is emitted after the `GdkDrag` object has
|
|
9176
|
+
* been created, and can be used to set up the drag icon.
|
|
9177
|
+
*
|
|
9178
|
+
* ```c
|
|
9179
|
+
* static void
|
|
9180
|
+
* on_drag_begin (GtkDragSource *source,
|
|
9181
|
+
* GdkDrag *drag,
|
|
9182
|
+
* MyWidget *self)
|
|
9183
|
+
* {
|
|
9184
|
+
* // Set the widget as the drag icon
|
|
9185
|
+
* GdkPaintable *paintable = gtk_widget_paintable_new (GTK_WIDGET (self));
|
|
9186
|
+
* gtk_drag_source_set_icon (source, paintable, 0, 0);
|
|
9187
|
+
* g_object_unref (paintable);
|
|
9188
|
+
* }
|
|
9189
|
+
* ```
|
|
9190
|
+
*
|
|
9191
|
+
* During the DND operation, `GtkDragSource` emits signals that
|
|
9192
|
+
* can be used to obtain updates about the status of the operation,
|
|
9193
|
+
* but it is not normally necessary to connect to any signals,
|
|
9194
|
+
* except for one case: when the supported actions include
|
|
9195
|
+
* %GDK_ACTION_MOVE, you need to listen for the
|
|
9196
|
+
* {@link Gtk.DragSource.:drag-end} signal and delete the
|
|
9197
|
+
* data after it has been transferred.
|
|
9198
|
+
*/
|
|
9199
|
+
export const GtkDragSource = "GtkDragSource";
|
|
9200
|
+
/**
|
|
9201
|
+
* An event controller tracking the pointer during Drag-and-Drop operations.
|
|
9202
|
+
*
|
|
9203
|
+
* It is modeled after {@link Gtk.EventControllerMotion} so if you
|
|
9204
|
+
* have used that, this should feel really familiar.
|
|
9205
|
+
*
|
|
9206
|
+
* This controller is not able to accept drops, use {@link Gtk.DropTarget}
|
|
9207
|
+
* for that purpose.
|
|
9208
|
+
*/
|
|
9209
|
+
export const GtkDropControllerMotion = "GtkDropControllerMotion";
|
|
9210
|
+
/**
|
|
9211
|
+
* An event controller to receive Drag-and-Drop operations.
|
|
9212
|
+
*
|
|
9213
|
+
* The most basic way to use a `GtkDropTarget` to receive drops on a
|
|
9214
|
+
* widget is to create it via {@link Gtk.DropTarget.new}, passing in the
|
|
9215
|
+
* `GType` of the data you want to receive and connect to the
|
|
9216
|
+
* {@link Gtk.DropTarget.:drop} signal to receive the data:
|
|
9217
|
+
*
|
|
9218
|
+
* ```c
|
|
9219
|
+
* static gboolean
|
|
9220
|
+
* on_drop (GtkDropTarget *target,
|
|
9221
|
+
* const GValue *value,
|
|
9222
|
+
* double x,
|
|
9223
|
+
* double y,
|
|
9224
|
+
* gpointer data)
|
|
9225
|
+
* {
|
|
9226
|
+
* MyWidget *self = data;
|
|
9227
|
+
*
|
|
9228
|
+
* // Call the appropriate setter depending on the type of data
|
|
9229
|
+
* // that we received
|
|
9230
|
+
* if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
|
9231
|
+
* my_widget_set_file (self, g_value_get_object (value));
|
|
9232
|
+
* else if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
|
|
9233
|
+
* my_widget_set_pixbuf (self, g_value_get_object (value));
|
|
9234
|
+
* else
|
|
9235
|
+
* return FALSE;
|
|
9236
|
+
*
|
|
9237
|
+
* return TRUE;
|
|
9238
|
+
* }
|
|
9239
|
+
*
|
|
9240
|
+
* static void
|
|
9241
|
+
* my_widget_init (MyWidget *self)
|
|
9242
|
+
* {
|
|
9243
|
+
* GtkDropTarget *target =
|
|
9244
|
+
* gtk_drop_target_new (G_TYPE_INVALID, GDK_ACTION_COPY);
|
|
9245
|
+
*
|
|
9246
|
+
* // This widget accepts two types of drop types: GFile objects
|
|
9247
|
+
* // and GdkPixbuf objects
|
|
9248
|
+
* gtk_drop_target_set_gtypes (target, (GType [2]) {
|
|
9249
|
+
* G_TYPE_FILE,
|
|
9250
|
+
* GDK_TYPE_PIXBUF,
|
|
9251
|
+
* }, 2);
|
|
9252
|
+
*
|
|
9253
|
+
* g_signal_connect (target, "drop", G_CALLBACK (on_drop), self);
|
|
9254
|
+
* gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
|
|
9255
|
+
* }
|
|
9256
|
+
* ```
|
|
9257
|
+
*
|
|
9258
|
+
* `GtkDropTarget` supports more options, such as:
|
|
9259
|
+
*
|
|
9260
|
+
* * rejecting potential drops via the {@link Gtk.DropTarget.:accept} signal
|
|
9261
|
+
* and the {@link Gtk.DropTarget.reject} function to let other drop
|
|
9262
|
+
* targets handle the drop
|
|
9263
|
+
* * tracking an ongoing drag operation before the drop via the
|
|
9264
|
+
* {@link Gtk.DropTarget.:enter}, {@link Gtk.DropTarget.:motion} and
|
|
9265
|
+
* {@link Gtk.DropTarget.:leave} signals
|
|
9266
|
+
* * configuring how to receive data by setting the
|
|
9267
|
+
* {@link Gtk.DropTarget.preload} property and listening for its
|
|
9268
|
+
* availability via the {@link Gtk.DropTarget.value} property
|
|
9269
|
+
*
|
|
9270
|
+
* However, `GtkDropTarget` is ultimately modeled in a synchronous way
|
|
9271
|
+
* and only supports data transferred via `GType`. If you want full control
|
|
9272
|
+
* over an ongoing drop, the {@link Gtk.DropTargetAsync} object gives you
|
|
9273
|
+
* this ability.
|
|
9274
|
+
*
|
|
9275
|
+
* While a pointer is dragged over the drop target's widget and the drop
|
|
9276
|
+
* has not been rejected, that widget will receive the
|
|
9277
|
+
* %GTK_STATE_FLAG_DROP_ACTIVE state, which can be used to style the widget.
|
|
9278
|
+
*
|
|
9279
|
+
* If you are not interested in receiving the drop, but just want to update
|
|
9280
|
+
* UI state during a Drag-and-Drop operation (e.g. switching tabs), you can
|
|
9281
|
+
* use {@link Gtk.DropControllerMotion}.
|
|
9282
|
+
*/
|
|
9283
|
+
export const GtkDropTarget = "GtkDropTarget";
|
|
9284
|
+
/**
|
|
9285
|
+
* An event controller to receive Drag-and-Drop operations, asynchronously.
|
|
9286
|
+
*
|
|
9287
|
+
* It is the more complete but also more complex method of handling drop
|
|
9288
|
+
* operations compared to {@link Gtk.DropTarget}, and you should only use
|
|
9289
|
+
* it if `GtkDropTarget` doesn't provide all the features you need.
|
|
9290
|
+
*
|
|
9291
|
+
* To use a `GtkDropTargetAsync` to receive drops on a widget, you create
|
|
9292
|
+
* a `GtkDropTargetAsync` object, configure which data formats and actions
|
|
9293
|
+
* you support, connect to its signals, and then attach it to the widget
|
|
9294
|
+
* with {@link Gtk.Widget.add_controller}.
|
|
9295
|
+
*
|
|
9296
|
+
* During a drag operation, the first signal that a `GtkDropTargetAsync`
|
|
9297
|
+
* emits is {@link Gtk.DropTargetAsync.:accept}, which is meant to determine
|
|
9298
|
+
* whether the target is a possible drop site for the ongoing drop. The
|
|
9299
|
+
* default handler for the ::accept signal accepts the drop if it finds
|
|
9300
|
+
* a compatible data format and an action that is supported on both sides.
|
|
9301
|
+
*
|
|
9302
|
+
* If it is, and the widget becomes a target, you will receive a
|
|
9303
|
+
* {@link Gtk.DropTargetAsync.:drag-enter} signal, followed by
|
|
9304
|
+
* {@link Gtk.DropTargetAsync.:drag-motion} signals as the pointer moves,
|
|
9305
|
+
* optionally a {@link Gtk.DropTargetAsync.:drop} signal when a drop happens,
|
|
9306
|
+
* and finally a {@link Gtk.DropTargetAsync.:drag-leave} signal when the
|
|
9307
|
+
* pointer moves off the widget.
|
|
9308
|
+
*
|
|
9309
|
+
* The ::drag-enter and ::drag-motion handler return a `GdkDragAction`
|
|
9310
|
+
* to update the status of the ongoing operation. The ::drop handler
|
|
9311
|
+
* should decide if it ultimately accepts the drop and if it does, it
|
|
9312
|
+
* should initiate the data transfer and finish the operation by calling
|
|
9313
|
+
* {@link Gdk.Drop.finish}.
|
|
9314
|
+
*
|
|
9315
|
+
* Between the ::drag-enter and ::drag-leave signals the widget is a
|
|
9316
|
+
* current drop target, and will receive the %GTK_STATE_FLAG_DROP_ACTIVE
|
|
9317
|
+
* state, which can be used by themes to style the widget as a drop target.
|
|
9318
|
+
*/
|
|
9319
|
+
export const GtkDropTargetAsync = "GtkDropTargetAsync";
|
|
9320
|
+
/**
|
|
9321
|
+
* Tracks keyboard focus.
|
|
9322
|
+
*
|
|
9323
|
+
* The event controller offers {@link Gtk.EventControllerFocus.:enter}
|
|
9324
|
+
* and {@link Gtk.EventControllerFocus.:leave} signals, as well as
|
|
9325
|
+
* {@link Gtk.EventControllerFocus.is-focus} and
|
|
9326
|
+
* {@link Gtk.EventControllerFocus.contains-focus} properties
|
|
9327
|
+
* which are updated to reflect focus changes inside the widget hierarchy
|
|
9328
|
+
* that is rooted at the controllers widget.
|
|
9329
|
+
*/
|
|
9330
|
+
export const GtkEventControllerFocus = "GtkEventControllerFocus";
|
|
9331
|
+
/** Provides access to key events. */
|
|
9332
|
+
export const GtkEventControllerKey = "GtkEventControllerKey";
|
|
9333
|
+
/**
|
|
9334
|
+
* Provides raw access to the event stream.
|
|
9335
|
+
*
|
|
9336
|
+
* It should only be used as a last resort if none of the other event
|
|
9337
|
+
* controllers or gestures do the job.
|
|
9338
|
+
*/
|
|
9339
|
+
export const GtkEventControllerLegacy = "GtkEventControllerLegacy";
|
|
9340
|
+
/**
|
|
9341
|
+
* Tracks the pointer position.
|
|
9342
|
+
*
|
|
9343
|
+
* The event controller offers {@link Gtk.EventControllerMotion.:enter}
|
|
9344
|
+
* and {@link Gtk.EventControllerMotion.:leave} signals, as well as
|
|
9345
|
+
* {@link Gtk.EventControllerMotion.is-pointer} and
|
|
9346
|
+
* {@link Gtk.EventControllerMotion.contains-pointer} properties
|
|
9347
|
+
* which are updated to reflect changes in the pointer position as it
|
|
9348
|
+
* moves over the widget.
|
|
9349
|
+
*/
|
|
9350
|
+
export const GtkEventControllerMotion = "GtkEventControllerMotion";
|
|
9351
|
+
/**
|
|
9352
|
+
* Handles scroll events.
|
|
9353
|
+
*
|
|
9354
|
+
* It is capable of handling both discrete and continuous scroll
|
|
9355
|
+
* events from mice or touchpads, abstracting them both with the
|
|
9356
|
+
* {@link Gtk.EventControllerScroll.:scroll} signal. Deltas in
|
|
9357
|
+
* the discrete case are multiples of 1.
|
|
9358
|
+
*
|
|
9359
|
+
* In the case of continuous scroll events, `GtkEventControllerScroll`
|
|
9360
|
+
* encloses all {@link Gtk.EventControllerScroll.:scroll} emissions
|
|
9361
|
+
* between two {@link Gtk.EventControllerScroll.:scroll-begin} and
|
|
9362
|
+
* {@link Gtk.EventControllerScroll.:scroll-end} signals.
|
|
9363
|
+
*
|
|
9364
|
+
* The behavior of the event controller can be modified by the flags
|
|
9365
|
+
* given at creation time, or modified at a later point through
|
|
9366
|
+
* {@link Gtk.EventControllerScroll.set_flags} (e.g. because the scrolling
|
|
9367
|
+
* conditions of the widget changed).
|
|
9368
|
+
*
|
|
9369
|
+
* The controller can be set up to emit motion for either/both vertical
|
|
9370
|
+
* and horizontal scroll events through %GTK_EVENT_CONTROLLER_SCROLL_VERTICAL,
|
|
9371
|
+
* %GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL and %GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES.
|
|
9372
|
+
* If any axis is disabled, the respective {@link Gtk.EventControllerScroll.:scroll}
|
|
9373
|
+
* delta will be 0. Vertical scroll events will be translated to horizontal
|
|
9374
|
+
* motion for the devices incapable of horizontal scrolling.
|
|
9375
|
+
*
|
|
9376
|
+
* The event controller can also be forced to emit discrete events on all
|
|
9377
|
+
* devices through %GTK_EVENT_CONTROLLER_SCROLL_DISCRETE. This can be used
|
|
9378
|
+
* to implement discrete actions triggered through scroll events (e.g.
|
|
9379
|
+
* switching across combobox options).
|
|
9380
|
+
*
|
|
9381
|
+
* The %GTK_EVENT_CONTROLLER_SCROLL_KINETIC flag toggles the emission of the
|
|
9382
|
+
* {@link Gtk.EventControllerScroll.:decelerate} signal, emitted at the end
|
|
9383
|
+
* of scrolling with two X/Y velocity arguments that are consistent with the
|
|
9384
|
+
* motion that was received.
|
|
9385
|
+
*/
|
|
9386
|
+
export const GtkEventControllerScroll = "GtkEventControllerScroll";
|
|
9387
|
+
/**
|
|
9388
|
+
* Recognizes click gestures.
|
|
9389
|
+
*
|
|
9390
|
+
* It is able to recognize multiple clicks on a nearby zone, which
|
|
9391
|
+
* can be listened for through the {@link Gtk.GestureClick.:pressed}
|
|
9392
|
+
* signal. Whenever time or distance between clicks exceed the GTK
|
|
9393
|
+
* defaults, {@link Gtk.GestureClick.:stopped} is emitted, and the
|
|
9394
|
+
* click counter is reset.
|
|
9395
|
+
*/
|
|
9396
|
+
export const GtkGestureClick = "GtkGestureClick";
|
|
9397
|
+
/**
|
|
9398
|
+
* Recognizes drag gestures.
|
|
9399
|
+
*
|
|
9400
|
+
* The drag operation itself can be tracked throughout the
|
|
9401
|
+
* {@link Gtk.GestureDrag.:drag-begin},
|
|
9402
|
+
* {@link Gtk.GestureDrag.:drag-update} and
|
|
9403
|
+
* {@link Gtk.GestureDrag.:drag-end} signals, and the relevant
|
|
9404
|
+
* coordinates can be extracted through
|
|
9405
|
+
* {@link Gtk.GestureDrag.get_offset} and
|
|
9406
|
+
* {@link Gtk.GestureDrag.get_start_point}.
|
|
9407
|
+
*/
|
|
9408
|
+
export const GtkGestureDrag = "GtkGestureDrag";
|
|
9409
|
+
/**
|
|
9410
|
+
* Recognizes long press gestures.
|
|
9411
|
+
*
|
|
9412
|
+
* This gesture is also known as “Press and Hold”.
|
|
9413
|
+
*
|
|
9414
|
+
* When the timeout is exceeded, the gesture is triggering the
|
|
9415
|
+
* {@link Gtk.GestureLongPress.:pressed} signal.
|
|
9416
|
+
*
|
|
9417
|
+
* If the touchpoint is lifted before the timeout passes, or if
|
|
9418
|
+
* it drifts too far of the initial press point, the
|
|
9419
|
+
* {@link Gtk.GestureLongPress.:cancelled} signal will be emitted.
|
|
9420
|
+
*
|
|
9421
|
+
* How long the timeout is before the ::pressed signal gets emitted is
|
|
9422
|
+
* determined by the {@link Gtk.Settings.gtk-long-press-time} setting.
|
|
9423
|
+
* It can be modified by the {@link Gtk.GestureLongPress.delay-factor}
|
|
9424
|
+
* property.
|
|
9425
|
+
*/
|
|
9426
|
+
export const GtkGestureLongPress = "GtkGestureLongPress";
|
|
9427
|
+
/**
|
|
9428
|
+
* Recognizes pan gestures.
|
|
9429
|
+
*
|
|
9430
|
+
* These are drags that are locked to happen along one axis. The axis
|
|
9431
|
+
* that a `GtkGesturePan` handles is defined at construct time, and
|
|
9432
|
+
* can be changed through {@link Gtk.GesturePan.set_orientation}.
|
|
9433
|
+
*
|
|
9434
|
+
* When the gesture starts to be recognized, `GtkGesturePan` will
|
|
9435
|
+
* attempt to determine as early as possible whether the sequence
|
|
9436
|
+
* is moving in the expected direction, and denying the sequence if
|
|
9437
|
+
* this does not happen.
|
|
9438
|
+
*
|
|
9439
|
+
* Once a panning gesture along the expected axis is recognized,
|
|
9440
|
+
* the {@link Gtk.GesturePan.:pan} signal will be emitted as input
|
|
9441
|
+
* events are received, containing the offset in the given axis.
|
|
9442
|
+
*/
|
|
9443
|
+
export const GtkGesturePan = "GtkGesturePan";
|
|
9444
|
+
/**
|
|
9445
|
+
* Recognizes 2-finger rotation gestures.
|
|
9446
|
+
*
|
|
9447
|
+
* Whenever the angle between both handled sequences changes, the
|
|
9448
|
+
* {@link Gtk.GestureRotate.:angle-changed} signal is emitted.
|
|
9449
|
+
*/
|
|
9450
|
+
export const GtkGestureRotate = "GtkGestureRotate";
|
|
9451
|
+
/**
|
|
9452
|
+
* A `GtkGesture` subclass optimized for singe-touch and mouse gestures.
|
|
9453
|
+
*
|
|
9454
|
+
* Under interaction, these gestures stick to the first interacting sequence,
|
|
9455
|
+
* which is accessible through {@link Gtk.GestureSingle.get_current_sequence}
|
|
9456
|
+
* while the gesture is being interacted with.
|
|
9457
|
+
*
|
|
9458
|
+
* By default gestures react to both %GDK_BUTTON_PRIMARY and touch events.
|
|
9459
|
+
* {@link Gtk.GestureSingle.set_touch_only} can be used to change the
|
|
9460
|
+
* touch behavior. Callers may also specify a different mouse button number
|
|
9461
|
+
* to interact with through {@link Gtk.GestureSingle.set_button}, or react
|
|
9462
|
+
* to any mouse button by setting it to 0. While the gesture is active, the
|
|
9463
|
+
* button being currently pressed can be known through
|
|
9464
|
+
* {@link Gtk.GestureSingle.get_current_button}.
|
|
9465
|
+
*/
|
|
9466
|
+
export const GtkGestureSingle = "GtkGestureSingle";
|
|
9467
|
+
/**
|
|
9468
|
+
* Recognizes tablet stylus input.
|
|
9469
|
+
*
|
|
9470
|
+
* The provided signals just relay the basic information of the
|
|
9471
|
+
* stylus events.
|
|
9472
|
+
*/
|
|
9473
|
+
export const GtkGestureStylus = "GtkGestureStylus";
|
|
9474
|
+
/**
|
|
9475
|
+
* Recognizes swipe gestures.
|
|
9476
|
+
*
|
|
9477
|
+
* After a press/move/.../move/release sequence happens, the
|
|
9478
|
+
* {@link Gtk.GestureSwipe.:swipe} signal will be emitted,
|
|
9479
|
+
* providing the velocity and directionality of the sequence
|
|
9480
|
+
* at the time it was lifted.
|
|
9481
|
+
*
|
|
9482
|
+
* If the velocity is desired in intermediate points,
|
|
9483
|
+
* {@link Gtk.GestureSwipe.get_velocity} can be called in a
|
|
9484
|
+
* {@link Gtk.Gesture.:update} handler.
|
|
9485
|
+
*
|
|
9486
|
+
* All velocities are reported in pixels/sec units.
|
|
9487
|
+
*/
|
|
9488
|
+
export const GtkGestureSwipe = "GtkGestureSwipe";
|
|
9489
|
+
/**
|
|
9490
|
+
* Recognizes 2-finger pinch/zoom gestures.
|
|
9491
|
+
*
|
|
9492
|
+
* Whenever the distance between both tracked sequences changes, the
|
|
9493
|
+
* {@link Gtk.GestureZoom.:scale-changed} signal is emitted to report
|
|
9494
|
+
* the scale factor.
|
|
9495
|
+
*/
|
|
9496
|
+
export const GtkGestureZoom = "GtkGestureZoom";
|
|
9497
|
+
/**
|
|
9498
|
+
* Handles input from the pads found in drawing tablets.
|
|
9499
|
+
*
|
|
9500
|
+
* Pads are the collection of buttons and tactile sensors often found around
|
|
9501
|
+
* the stylus-sensitive area.
|
|
9502
|
+
*
|
|
9503
|
+
* These buttons and sensors have no implicit meaning, and by default they
|
|
9504
|
+
* perform no action. `GtkPadController` is provided to map those to
|
|
9505
|
+
* {@link Gio.Action} objects, thus letting the application give them a more
|
|
9506
|
+
* semantic meaning.
|
|
9507
|
+
*
|
|
9508
|
+
* Buttons and sensors are not constrained to triggering a single action,
|
|
9509
|
+
* some %GDK_SOURCE_TABLET_PAD devices feature multiple "modes". All these
|
|
9510
|
+
* input elements have one current mode, which may determine the final action
|
|
9511
|
+
* being triggered.
|
|
9512
|
+
*
|
|
9513
|
+
* Pad devices often divide buttons and sensors into groups. All elements
|
|
9514
|
+
* in a group share the same current mode, but different groups may have
|
|
9515
|
+
* different modes. See {@link Gdk.DevicePad.get_n_groups} and
|
|
9516
|
+
* {@link Gdk.DevicePad.get_group_n_modes}.
|
|
9517
|
+
*
|
|
9518
|
+
* Each of the actions that a given button/strip/ring performs for a given mode
|
|
9519
|
+
* is defined by a {@link Gtk.PadActionEntry}. It contains an action name that
|
|
9520
|
+
* will be looked up in the given {@link Gio.ActionGroup} and activated whenever
|
|
9521
|
+
* the specified input element and mode are triggered.
|
|
9522
|
+
*
|
|
9523
|
+
* A simple example of `GtkPadController` usage: Assigning button 1 in all
|
|
9524
|
+
* modes and pad devices to an "invert-selection" action:
|
|
9525
|
+
*
|
|
9526
|
+
* ```c
|
|
9527
|
+
* GtkPadActionEntry *pad_actions[] = {
|
|
9528
|
+
* { GTK_PAD_ACTION_BUTTON, 1, -1, "Invert selection", "pad-actions.invert-selection" },
|
|
9529
|
+
* …
|
|
9530
|
+
* };
|
|
9531
|
+
*
|
|
9532
|
+
* …
|
|
9533
|
+
* action_group = g_simple_action_group_new ();
|
|
9534
|
+
* action = g_simple_action_new ("pad-actions.invert-selection", NULL);
|
|
9535
|
+
* g_signal_connect (action, "activate", on_invert_selection_activated, NULL);
|
|
9536
|
+
* g_action_map_add_action (G_ACTION_MAP (action_group), action);
|
|
9537
|
+
* …
|
|
9538
|
+
* pad_controller = gtk_pad_controller_new (action_group, NULL);
|
|
9539
|
+
* ```
|
|
9540
|
+
*
|
|
9541
|
+
* The actions belonging to rings/strips/dials will be activated with a parameter
|
|
9542
|
+
* of type %G_VARIANT_TYPE_DOUBLE bearing the value of the given axis, it
|
|
9543
|
+
* is required that those are made stateful and accepting this `GVariantType`.
|
|
9544
|
+
* For rings the value is the angle of the ring position in degrees with 0
|
|
9545
|
+
* facing up. For strips the value is the absolute position on the strip, normalized
|
|
9546
|
+
* to the [0.0, 1.0] range.
|
|
9547
|
+
* For dials the value is the relative movement of the dial, normalized so that the
|
|
9548
|
+
* value 120 represents one logical scroll wheel detent in the positive direction.
|
|
9549
|
+
* Devices that support high-resolution scrolling may send events with fractions of
|
|
9550
|
+
* 120 to signify a smaller motion.
|
|
9551
|
+
*/
|
|
9552
|
+
export const GtkPadController = "GtkPadController";
|
|
9553
|
+
/**
|
|
9554
|
+
* Manages keyboard shortcuts and their activation.
|
|
9555
|
+
*
|
|
9556
|
+
* Most common shortcuts are using this controller implicitly, e.g. by
|
|
9557
|
+
* adding a mnemonic underline to a {@link Gtk.Label}, or by installing a key
|
|
9558
|
+
* binding using {@link Gtk.WidgetClass.add_binding}, or by adding accelerators
|
|
9559
|
+
* to global actions using {@link Gtk.Application.set_accels_for_action}.
|
|
9560
|
+
*
|
|
9561
|
+
* But it is possible to create your own shortcut controller, and add
|
|
9562
|
+
* shortcuts to it.
|
|
9563
|
+
*
|
|
9564
|
+
* `GtkShortcutController` implements {@link Gio.ListModel} for querying the
|
|
9565
|
+
* shortcuts that have been added to it.
|
|
9566
|
+
*
|
|
9567
|
+
* # GtkShortcutController as GtkBuildable
|
|
9568
|
+
*
|
|
9569
|
+
* `GtkShortcutController`s can be created in {@link Gtk.Builder} ui files, to set up
|
|
9570
|
+
* shortcuts in the same place as the widgets.
|
|
9571
|
+
*
|
|
9572
|
+
* An example of a UI definition fragment with `GtkShortcutController`:
|
|
9573
|
+
* ```xml
|
|
9574
|
+
* <object class='GtkButton'>
|
|
9575
|
+
* <child>
|
|
9576
|
+
* <object class='GtkShortcutController'>
|
|
9577
|
+
* <property name='scope'>managed</property>
|
|
9578
|
+
* <child>
|
|
9579
|
+
* <object class='GtkShortcut'>
|
|
9580
|
+
* <property name='trigger'><Control>k</property>
|
|
9581
|
+
* <property name='action'>activate</property>
|
|
9582
|
+
* </object>
|
|
9583
|
+
* </child>
|
|
9584
|
+
* </object>
|
|
9585
|
+
* </child>
|
|
9586
|
+
* </object>
|
|
9587
|
+
* ```
|
|
9588
|
+
*
|
|
9589
|
+
* This example creates a {@link Gtk.ActivateAction} for triggering the
|
|
9590
|
+
* `activate` signal of the {@link Gtk.Button}. See {@link Gtk.ShortcutAction.parse_string}
|
|
9591
|
+
* for the syntax for other kinds of {@link Gtk.ShortcutAction}. See
|
|
9592
|
+
* {@link Gtk.ShortcutTrigger.parse_string} to learn more about the syntax
|
|
9593
|
+
* for triggers.
|
|
9594
|
+
*/
|
|
9595
|
+
export const GtkShortcutController = "GtkShortcutController";
|
package/dist/host-config.d.ts
CHANGED
|
@@ -9,7 +9,9 @@ type TextInstance = Node;
|
|
|
9
9
|
type SuspenseInstance = never;
|
|
10
10
|
type HydratableInstance = never;
|
|
11
11
|
type PublicInstance = Gtk.Widget | Gtk.Application;
|
|
12
|
-
type HostContext =
|
|
12
|
+
type HostContext = {
|
|
13
|
+
insideTextBuffer?: boolean;
|
|
14
|
+
};
|
|
13
15
|
type ChildSet = never;
|
|
14
16
|
type TimeoutHandle = number;
|
|
15
17
|
type NoTimeout = -1;
|
package/dist/host-config.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getNativeId } from "@gtkx/ffi";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { createNode } from "./factory.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isBufferedType } from "./nodes/internal/predicates.js";
|
|
5
|
+
import { getSignalStore } from "./nodes/internal/signal-store.js";
|
|
5
6
|
import { flushAfterCommit } from "./scheduler.js";
|
|
6
7
|
if (!globalThis.__GTKX_CONTAINER_NODE_CACHE__) {
|
|
7
8
|
globalThis.__GTKX_CONTAINER_NODE_CACHE__ = new Map();
|
|
@@ -25,12 +26,26 @@ export function createHostConfig() {
|
|
|
25
26
|
isPrimaryRenderer: true,
|
|
26
27
|
noTimeout: -1,
|
|
27
28
|
getRootHostContext: () => ({}),
|
|
28
|
-
getChildHostContext: (parentHostContext) =>
|
|
29
|
+
getChildHostContext: (parentHostContext, type) => {
|
|
30
|
+
if (isBufferedType(type) || type === "TextTag") {
|
|
31
|
+
return { insideTextBuffer: true };
|
|
32
|
+
}
|
|
33
|
+
if (parentHostContext.insideTextBuffer) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return parentHostContext;
|
|
37
|
+
},
|
|
29
38
|
shouldSetTextContent: () => false,
|
|
30
39
|
createInstance: (type, props, rootContainer) => {
|
|
31
40
|
return createNode(type, props, undefined, rootContainer);
|
|
32
41
|
},
|
|
33
|
-
createTextInstance: (text, rootContainer) => {
|
|
42
|
+
createTextInstance: (text, rootContainer, hostContext) => {
|
|
43
|
+
if (hostContext.insideTextBuffer) {
|
|
44
|
+
const props = { text };
|
|
45
|
+
const node = createNode("TextSegment", props, undefined, rootContainer);
|
|
46
|
+
node.updateProps(null, props);
|
|
47
|
+
return node;
|
|
48
|
+
}
|
|
34
49
|
const props = { label: text };
|
|
35
50
|
const node = createNode("GtkLabel", props, undefined, rootContainer);
|
|
36
51
|
node.updateProps(null, props);
|
|
@@ -40,7 +55,9 @@ export function createHostConfig() {
|
|
|
40
55
|
parent.appendChild(child);
|
|
41
56
|
},
|
|
42
57
|
finalizeInitialChildren: (instance, _type, props) => {
|
|
58
|
+
instance.signalStore.blockAll();
|
|
43
59
|
instance.updateProps(null, props);
|
|
60
|
+
instance.signalStore.unblockAll();
|
|
44
61
|
return true;
|
|
45
62
|
},
|
|
46
63
|
commitUpdate: (instance, _type, oldProps, newProps) => {
|
|
@@ -70,18 +87,21 @@ export function createHostConfig() {
|
|
|
70
87
|
const parent = getOrCreateContainerNode(container);
|
|
71
88
|
parent.insertBefore(child, beforeChild);
|
|
72
89
|
},
|
|
73
|
-
prepareForCommit: () => {
|
|
74
|
-
|
|
90
|
+
prepareForCommit: (containerInfo) => {
|
|
91
|
+
getSignalStore(containerInfo).blockAll();
|
|
75
92
|
return null;
|
|
76
93
|
},
|
|
77
|
-
resetAfterCommit: () => {
|
|
78
|
-
batch(() => signalStore.blockAll());
|
|
79
|
-
endBatch();
|
|
94
|
+
resetAfterCommit: (containerInfo) => {
|
|
80
95
|
flushAfterCommit();
|
|
81
|
-
|
|
96
|
+
getSignalStore(containerInfo).unblockAll();
|
|
82
97
|
},
|
|
83
98
|
commitTextUpdate: (textInstance, oldText, newText) => {
|
|
84
|
-
textInstance.
|
|
99
|
+
if (textInstance.typeName === "TextSegment") {
|
|
100
|
+
textInstance.updateProps({ text: oldText }, { text: newText });
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
textInstance.updateProps({ label: oldText }, { label: newText });
|
|
104
|
+
}
|
|
85
105
|
},
|
|
86
106
|
clearContainer: () => { },
|
|
87
107
|
preparePortalMount: () => { },
|