1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gdk"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14 "github.com/bnema/puregotk/v4/gsk"
15)
16
17type DragIconClass struct {
18 _ structs.HostLayout
19
20 ParentClass WidgetClass
21}
22
23func (x *DragIconClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// A `GtkRoot` implementation for drag icons.
28//
29// A drag icon moves with the pointer during a Drag-and-Drop operation
30// and is destroyed when the drag ends.
31//
32// To set up a drag icon and associate it with an ongoing drag operation,
33// use [ctor@Gtk.DragIcon.get_for_drag] to get the icon for a drag. You can
34// then use it like any other widget and use [method@Gtk.DragIcon.set_child]
35// to set whatever widget should be used for the drag icon.
36//
37// Keep in mind that drag icons do not allow user input.
38type DragIcon struct {
39 Widget
40}
41
42var xDragIconGLibType func() types.GType
43
44func DragIconGLibType() types.GType {
45 return xDragIconGLibType()
46}
47
48func DragIconNewFromInternalPtr(ptr uintptr) *DragIcon {
49 cls := &DragIcon{}
50 cls.Ptr = ptr
51 return cls
52}
53
54var xDragIconGetForDrag func(uintptr) uintptr
55
56// Gets the `GtkDragIcon` in use with @drag.
57//
58// If no drag icon exists yet, a new one will be created
59// and shown.
60func DragIconGetForDrag(DragVar *gdk.Drag) *DragIcon {
61 var cls *DragIcon
62
63 cret := xDragIconGetForDrag(DragVar.GoPointer())
64
65 if cret == 0 {
66 return nil
67 }
68 gobject.IncreaseRef(cret)
69 cls = &DragIcon{}
70 cls.Ptr = cret
71 return cls
72}
73
74var xDragIconGetChild func(uintptr) uintptr
75
76// Gets the widget currently used as drag icon.
77func (x *DragIcon) GetChild() *Widget {
78 var cls *Widget
79
80 cret := xDragIconGetChild(x.GoPointer())
81
82 if cret == 0 {
83 return nil
84 }
85 gobject.IncreaseRef(cret)
86 cls = &Widget{}
87 cls.Ptr = cret
88 return cls
89}
90
91var xDragIconSetChild func(uintptr, uintptr)
92
93// Sets the widget to display as the drag icon.
94func (x *DragIcon) SetChild(ChildVar *Widget) {
95
96 xDragIconSetChild(x.GoPointer(), ChildVar.GoPointer())
97
98}
99
100func (c *DragIcon) GoPointer() uintptr {
101 if c == nil {
102 return 0
103 }
104 return c.Ptr
105}
106
107func (c *DragIcon) SetGoPointer(ptr uintptr) {
108 c.Ptr = ptr
109}
110
111// Requests the user's screen reader to announce the given message.
112//
113// This kind of notification is useful for messages that
114// either have only a visual representation or that are not
115// exposed visually at all, e.g. a notification about a
116// successful operation.
117//
118// Also, by using this API, you can ensure that the message
119// does not interrupts the user's current screen reader output.
120func (x *DragIcon) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
121
122 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
123
124}
125
126// Retrieves the accessible parent for an accessible object.
127//
128// This function returns `NULL` for top level widgets.
129func (x *DragIcon) GetAccessibleParent() *AccessibleBase {
130 var cls *AccessibleBase
131
132 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
133
134 if cret == 0 {
135 return nil
136 }
137 cls = &AccessibleBase{}
138 cls.Ptr = cret
139 return cls
140}
141
142// Retrieves the accessible role of an accessible object.
143func (x *DragIcon) GetAccessibleRole() AccessibleRole {
144
145 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
146 return cret
147}
148
149// Retrieves the implementation for the given accessible object.
150func (x *DragIcon) GetAtContext() *ATContext {
151 var cls *ATContext
152
153 cret := XGtkAccessibleGetAtContext(x.GoPointer())
154
155 if cret == 0 {
156 return nil
157 }
158 cls = &ATContext{}
159 cls.Ptr = cret
160 return cls
161}
162
163// Queries the coordinates and dimensions of this accessible
164//
165// This functionality can be overridden by `GtkAccessible`
166// implementations, e.g. to get the bounds from an ignored
167// child widget.
168func (x *DragIcon) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
169
170 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
171 return cret
172}
173
174// Retrieves the first accessible child of an accessible object.
175func (x *DragIcon) GetFirstAccessibleChild() *AccessibleBase {
176 var cls *AccessibleBase
177
178 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
179
180 if cret == 0 {
181 return nil
182 }
183 cls = &AccessibleBase{}
184 cls.Ptr = cret
185 return cls
186}
187
188// Retrieves the next accessible sibling of an accessible object
189func (x *DragIcon) GetNextAccessibleSibling() *AccessibleBase {
190 var cls *AccessibleBase
191
192 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
193
194 if cret == 0 {
195 return nil
196 }
197 cls = &AccessibleBase{}
198 cls.Ptr = cret
199 return cls
200}
201
202// Queries a platform state, such as focus.
203//
204// This functionality can be overridden by `GtkAccessible`
205// implementations, e.g. to get platform state from an ignored
206// child widget, as is the case for `GtkText` wrappers.
207func (x *DragIcon) GetPlatformState(StateVar AccessiblePlatformState) bool {
208
209 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
210 return cret
211}
212
213// Resets the accessible property to its default value.
214func (x *DragIcon) ResetProperty(PropertyVar AccessibleProperty) {
215
216 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
217
218}
219
220// Resets the accessible relation to its default value.
221func (x *DragIcon) ResetRelation(RelationVar AccessibleRelation) {
222
223 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
224
225}
226
227// Resets the accessible state to its default value.
228func (x *DragIcon) ResetState(StateVar AccessibleState) {
229
230 XGtkAccessibleResetState(x.GoPointer(), StateVar)
231
232}
233
234// Sets the parent and sibling of an accessible object.
235//
236// This function is meant to be used by accessible implementations that are
237// not part of the widget hierarchy, and but act as a logical bridge between
238// widgets. For instance, if a widget creates an object that holds metadata
239// for each child, and you want that object to implement the `GtkAccessible`
240// interface, you will use this function to ensure that the parent of each
241// child widget is the metadata object, and the parent of each metadata
242// object is the container widget.
243func (x *DragIcon) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
244
245 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
246
247}
248
249// Updates the next accessible sibling.
250//
251// That might be useful when a new child of a custom accessible
252// is created, and it needs to be linked to a previous child.
253func (x *DragIcon) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
254
255 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
256
257}
258
259// Informs ATs that the platform state has changed.
260//
261// This function should be used by `GtkAccessible` implementations that
262// have a platform state but are not widgets. Widgets handle platform
263// states automatically.
264func (x *DragIcon) UpdatePlatformState(StateVar AccessiblePlatformState) {
265
266 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
267
268}
269
270// Updates a list of accessible properties.
271//
272// See the [enum@Gtk.AccessibleProperty] documentation for the
273// value types of accessible properties.
274//
275// This function should be called by `GtkWidget` types whenever
276// an accessible property change must be communicated to assistive
277// technologies.
278//
279// Example:
280// ```c
281// value = gtk_adjustment_get_value (adjustment);
282// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
283//
284// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
285// -1);
286//
287// ```
288func (x *DragIcon) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
289
290 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
291
292}
293
294// Updates an array of accessible properties.
295//
296// This function should be called by `GtkWidget` types whenever an accessible
297// property change must be communicated to assistive technologies.
298//
299// This function is meant to be used by language bindings.
300func (x *DragIcon) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
301
302 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
303
304}
305
306// Updates a list of accessible relations.
307//
308// This function should be called by `GtkWidget` types whenever an accessible
309// relation change must be communicated to assistive technologies.
310//
311// If the [enum@Gtk.AccessibleRelation] requires a list of references,
312// you should pass each reference individually, followed by `NULL`, e.g.
313//
314// ```c
315// gtk_accessible_update_relation (accessible,
316//
317// GTK_ACCESSIBLE_RELATION_CONTROLS,
318// ref1, NULL,
319// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
320// ref1, ref2, ref3, NULL,
321// -1);
322//
323// ```
324func (x *DragIcon) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
325
326 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
327
328}
329
330// Updates an array of accessible relations.
331//
332// This function should be called by `GtkWidget` types whenever an accessible
333// relation change must be communicated to assistive technologies.
334//
335// This function is meant to be used by language bindings.
336func (x *DragIcon) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
337
338 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
339
340}
341
342// Updates a list of accessible states.
343//
344// See the [enum@Gtk.AccessibleState] documentation for the
345// value types of accessible states.
346//
347// This function should be called by `GtkWidget` types whenever
348// an accessible state change must be communicated to assistive
349// technologies.
350//
351// Example:
352//
353// ```c
354// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
355// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
356//
357// GTK_ACCESSIBLE_STATE_CHECKED, value,
358// -1);
359//
360// ```
361func (x *DragIcon) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
362
363 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
364
365}
366
367// Updates an array of accessible states.
368//
369// This function should be called by `GtkWidget` types whenever an accessible
370// state change must be communicated to assistive technologies.
371//
372// This function is meant to be used by language bindings.
373func (x *DragIcon) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
374
375 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
376
377}
378
379// Gets the ID of the @buildable object.
380//
381// `GtkBuilder` sets the name based on the ID attribute
382// of the `<object>` tag used to construct the @buildable.
383func (x *DragIcon) GetBuildableId() string {
384
385 cret := XGtkBuildableGetBuildableId(x.GoPointer())
386 return cret
387}
388
389// Returns the renderer that is used for this `GtkNative`.
390func (x *DragIcon) GetRenderer() *gsk.Renderer {
391 var cls *gsk.Renderer
392
393 cret := XGtkNativeGetRenderer(x.GoPointer())
394
395 if cret == 0 {
396 return nil
397 }
398 gobject.IncreaseRef(cret)
399 cls = &gsk.Renderer{}
400 cls.Ptr = cret
401 return cls
402}
403
404// Returns the surface of this `GtkNative`.
405func (x *DragIcon) GetSurface() *gdk.Surface {
406 var cls *gdk.Surface
407
408 cret := XGtkNativeGetSurface(x.GoPointer())
409
410 if cret == 0 {
411 return nil
412 }
413 gobject.IncreaseRef(cret)
414 cls = &gdk.Surface{}
415 cls.Ptr = cret
416 return cls
417}
418
419// Retrieves the surface transform of @self.
420//
421// This is the translation from @self's surface coordinates into
422// @self's widget coordinates.
423func (x *DragIcon) GetSurfaceTransform(XVar *float64, YVar *float64) {
424
425 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
426
427}
428
429// Realizes a `GtkNative`.
430//
431// This should only be used by subclasses.
432func (x *DragIcon) Realize() {
433
434 XGtkNativeRealize(x.GoPointer())
435
436}
437
438// Unrealizes a `GtkNative`.
439//
440// This should only be used by subclasses.
441func (x *DragIcon) Unrealize() {
442
443 XGtkNativeUnrealize(x.GoPointer())
444
445}
446
447// Returns the display that this `GtkRoot` is on.
448func (x *DragIcon) GetDisplay() *gdk.Display {
449 var cls *gdk.Display
450
451 cret := XGtkRootGetDisplay(x.GoPointer())
452
453 if cret == 0 {
454 return nil
455 }
456 gobject.IncreaseRef(cret)
457 cls = &gdk.Display{}
458 cls.Ptr = cret
459 return cls
460}
461
462// Retrieves the current focused widget within the root.
463//
464// Note that this is the widget that would have the focus
465// if the root is active; if the root is not focused then
466// `gtk_widget_has_focus (widget)` will be %FALSE for the
467// widget.
468func (x *DragIcon) GetFocus() *Widget {
469 var cls *Widget
470
471 cret := XGtkRootGetFocus(x.GoPointer())
472
473 if cret == 0 {
474 return nil
475 }
476 gobject.IncreaseRef(cret)
477 cls = &Widget{}
478 cls.Ptr = cret
479 return cls
480}
481
482// If @focus is not the current focus widget, and is focusable, sets
483// it as the focus widget for the root.
484//
485// If @focus is %NULL, unsets the focus widget for the root.
486//
487// To set the focus to a particular widget in the root, it is usually
488// more convenient to use [method@Gtk.Widget.grab_focus] instead of
489// this function.
490func (x *DragIcon) SetFocus(FocusVar *Widget) {
491
492 XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
493
494}
495
496var xDragIconCreateWidgetForValue func(*gobject.Value) uintptr
497
498// Creates a widget that can be used as a drag icon for the given
499// @value.
500//
501// Supported types include strings, `GdkRGBA` and `GtkTextBuffer`.
502// If GTK does not know how to create a widget for a given value,
503// it will return %NULL.
504//
505// This method is used to set the default drag icon on drag-and-drop
506// operations started by `GtkDragSource`, so you don't need to set
507// a drag icon using this function there.
508func DragIconCreateWidgetForValue(ValueVar *gobject.Value) *Widget {
509 var cls *Widget
510
511 cret := xDragIconCreateWidgetForValue(ValueVar)
512
513 if cret == 0 {
514 return nil
515 }
516 cls = &Widget{}
517 cls.Ptr = cret
518 return cls
519}
520
521var xDragIconSetFromPaintable func(uintptr, uintptr, int, int)
522
523// Creates a `GtkDragIcon` that shows @paintable, and associates
524// it with the drag operation.
525//
526// The hotspot position on the paintable is aligned with the
527// hotspot of the cursor.
528func DragIconSetFromPaintable(DragVar *gdk.Drag, PaintableVar gdk.Paintable, HotXVar int, HotYVar int) {
529
530 xDragIconSetFromPaintable(DragVar.GoPointer(), PaintableVar.GoPointer(), HotXVar, HotYVar)
531
532}
533
534func init() {
535 core.SetPackageName("GTK", "gtk4")
536 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
537 var libs []uintptr
538 for _, libPath := range core.GetPaths("GTK") {
539 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
540 if err != nil {
541 panic(err)
542 }
543 libs = append(libs, lib)
544 }
545
546 core.PuregoSafeRegister(&xDragIconGLibType, libs, "gtk_drag_icon_get_type")
547
548 core.PuregoSafeRegister(&xDragIconGetForDrag, libs, "gtk_drag_icon_get_for_drag")
549
550 core.PuregoSafeRegister(&xDragIconGetChild, libs, "gtk_drag_icon_get_child")
551 core.PuregoSafeRegister(&xDragIconSetChild, libs, "gtk_drag_icon_set_child")
552
553 core.PuregoSafeRegister(&xDragIconCreateWidgetForValue, libs, "gtk_drag_icon_create_widget_for_value")
554 core.PuregoSafeRegister(&xDragIconSetFromPaintable, libs, "gtk_drag_icon_set_from_paintable")
555
556}