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/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type VideoClass struct {
17 _ structs.HostLayout
18
19 ParentClass WidgetClass
20}
21
22func (x *VideoClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// Shows a `GtkMediaStream` with media controls.
27//
28// <picture>
29//
30// <source srcset="video-dark.png" media="(prefers-color-scheme: dark)">
31// <img alt="An example GtkVideo" src="video.png">
32//
33// </picture>
34//
35// The controls are available separately as [class@Gtk.MediaControls].
36// If you just want to display a video without controls, you can treat it
37// like any other paintable and for example put it into a [class@Gtk.Picture].
38//
39// `GtkVideo` aims to cover use cases such as previews, embedded animations,
40// etc. It supports autoplay, looping, and simple media controls. It does
41// not have support for video overlays, multichannel audio, device
42// selection, or input. If you are writing a full-fledged video player,
43// you may want to use the [iface@Gdk.Paintable] API and a media framework
44// such as Gstreamer directly.
45type Video struct {
46 Widget
47}
48
49var xVideoGLibType func() types.GType
50
51func VideoGLibType() types.GType {
52 return xVideoGLibType()
53}
54
55func VideoNewFromInternalPtr(ptr uintptr) *Video {
56 cls := &Video{}
57 cls.Ptr = ptr
58 return cls
59}
60
61var xNewVideo func() uintptr
62
63// Creates a new empty `GtkVideo`.
64func NewVideo() *Video {
65 var cls *Video
66
67 cret := xNewVideo()
68
69 if cret == 0 {
70 return nil
71 }
72 gobject.IncreaseRef(cret)
73 cls = &Video{}
74 cls.Ptr = cret
75 return cls
76}
77
78var xNewVideoForFile func(uintptr) uintptr
79
80// Creates a `GtkVideo` to play back the given @file.
81func NewVideoForFile(FileVar gio.File) *Video {
82 var cls *Video
83
84 cret := xNewVideoForFile(FileVar.GoPointer())
85
86 if cret == 0 {
87 return nil
88 }
89 gobject.IncreaseRef(cret)
90 cls = &Video{}
91 cls.Ptr = cret
92 return cls
93}
94
95var xNewVideoForFilename func(uintptr) uintptr
96
97// Creates a `GtkVideo` to play back the given @filename.
98//
99// This is a utility function that calls [ctor@Gtk.Video.new_for_file],
100// See that function for details.
101func NewVideoForFilename(FilenameVar *string) *Video {
102 var cls *Video
103
104 FilenameVarPtr := core.GStrdupNullable(FilenameVar)
105 defer core.GFreeNullable(FilenameVarPtr)
106
107 cret := xNewVideoForFilename(FilenameVarPtr)
108
109 if cret == 0 {
110 return nil
111 }
112 gobject.IncreaseRef(cret)
113 cls = &Video{}
114 cls.Ptr = cret
115 return cls
116}
117
118var xNewVideoForMediaStream func(uintptr) uintptr
119
120// Creates a `GtkVideo` to play back the given @stream.
121func NewVideoForMediaStream(StreamVar *MediaStream) *Video {
122 var cls *Video
123
124 cret := xNewVideoForMediaStream(StreamVar.GoPointer())
125
126 if cret == 0 {
127 return nil
128 }
129 gobject.IncreaseRef(cret)
130 cls = &Video{}
131 cls.Ptr = cret
132 return cls
133}
134
135var xNewVideoForResource func(uintptr) uintptr
136
137// Creates a `GtkVideo` to play back the resource at the
138// given @resource_path.
139//
140// This is a utility function that calls [ctor@Gtk.Video.new_for_file].
141func NewVideoForResource(ResourcePathVar *string) *Video {
142 var cls *Video
143
144 ResourcePathVarPtr := core.GStrdupNullable(ResourcePathVar)
145 defer core.GFreeNullable(ResourcePathVarPtr)
146
147 cret := xNewVideoForResource(ResourcePathVarPtr)
148
149 if cret == 0 {
150 return nil
151 }
152 gobject.IncreaseRef(cret)
153 cls = &Video{}
154 cls.Ptr = cret
155 return cls
156}
157
158var xVideoGetAutoplay func(uintptr) bool
159
160// Returns %TRUE if videos have been set to loop.
161func (x *Video) GetAutoplay() bool {
162
163 cret := xVideoGetAutoplay(x.GoPointer())
164 return cret
165}
166
167var xVideoGetFile func(uintptr) uintptr
168
169// Gets the file played by @self or %NULL if not playing back
170// a file.
171func (x *Video) GetFile() *gio.FileBase {
172 var cls *gio.FileBase
173
174 cret := xVideoGetFile(x.GoPointer())
175
176 if cret == 0 {
177 return nil
178 }
179 gobject.IncreaseRef(cret)
180 cls = &gio.FileBase{}
181 cls.Ptr = cret
182 return cls
183}
184
185var xVideoGetGraphicsOffload func(uintptr) GraphicsOffloadEnabled
186
187// Returns whether graphics offload is enabled.
188//
189// See [class@Gtk.GraphicsOffload] for more information on graphics offload.
190func (x *Video) GetGraphicsOffload() GraphicsOffloadEnabled {
191
192 cret := xVideoGetGraphicsOffload(x.GoPointer())
193 return cret
194}
195
196var xVideoGetLoop func(uintptr) bool
197
198// Returns %TRUE if videos have been set to loop.
199func (x *Video) GetLoop() bool {
200
201 cret := xVideoGetLoop(x.GoPointer())
202 return cret
203}
204
205var xVideoGetMediaStream func(uintptr) uintptr
206
207// Gets the media stream managed by @self or %NULL if none.
208func (x *Video) GetMediaStream() *MediaStream {
209 var cls *MediaStream
210
211 cret := xVideoGetMediaStream(x.GoPointer())
212
213 if cret == 0 {
214 return nil
215 }
216 gobject.IncreaseRef(cret)
217 cls = &MediaStream{}
218 cls.Ptr = cret
219 return cls
220}
221
222var xVideoSetAutoplay func(uintptr, bool)
223
224// Sets whether @self automatically starts playback when it
225// becomes visible or when a new file gets loaded.
226func (x *Video) SetAutoplay(AutoplayVar bool) {
227
228 xVideoSetAutoplay(x.GoPointer(), AutoplayVar)
229
230}
231
232var xVideoSetFile func(uintptr, uintptr)
233
234// Makes @self play the given @file.
235func (x *Video) SetFile(FileVar gio.File) {
236
237 xVideoSetFile(x.GoPointer(), FileVar.GoPointer())
238
239}
240
241var xVideoSetFilename func(uintptr, uintptr)
242
243// Makes @self play the given @filename.
244//
245// This is a utility function that calls gtk_video_set_file(),
246func (x *Video) SetFilename(FilenameVar *string) {
247
248 FilenameVarPtr := core.GStrdupNullable(FilenameVar)
249 defer core.GFreeNullable(FilenameVarPtr)
250
251 xVideoSetFilename(x.GoPointer(), FilenameVarPtr)
252
253}
254
255var xVideoSetGraphicsOffload func(uintptr, GraphicsOffloadEnabled)
256
257// Sets whether to enable graphics offload.
258//
259// See [class@Gtk.GraphicsOffload] for more information on graphics offload.
260func (x *Video) SetGraphicsOffload(EnabledVar GraphicsOffloadEnabled) {
261
262 xVideoSetGraphicsOffload(x.GoPointer(), EnabledVar)
263
264}
265
266var xVideoSetLoop func(uintptr, bool)
267
268// Sets whether new files loaded by @self should be set to loop.
269func (x *Video) SetLoop(LoopVar bool) {
270
271 xVideoSetLoop(x.GoPointer(), LoopVar)
272
273}
274
275var xVideoSetMediaStream func(uintptr, uintptr)
276
277// Sets the media stream to be played back.
278//
279// @self will take full control of managing the media stream. If you
280// want to manage a media stream yourself, consider using a
281// [class@Gtk.Picture] for display.
282//
283// If you want to display a file, consider using [method@Gtk.Video.set_file]
284// instead.
285func (x *Video) SetMediaStream(StreamVar *MediaStream) {
286
287 xVideoSetMediaStream(x.GoPointer(), StreamVar.GoPointer())
288
289}
290
291var xVideoSetResource func(uintptr, uintptr)
292
293// Makes @self play the resource at the given @resource_path.
294//
295// This is a utility function that calls [method@Gtk.Video.set_file].
296func (x *Video) SetResource(ResourcePathVar *string) {
297
298 ResourcePathVarPtr := core.GStrdupNullable(ResourcePathVar)
299 defer core.GFreeNullable(ResourcePathVarPtr)
300
301 xVideoSetResource(x.GoPointer(), ResourcePathVarPtr)
302
303}
304
305func (c *Video) GoPointer() uintptr {
306 if c == nil {
307 return 0
308 }
309 return c.Ptr
310}
311
312func (c *Video) SetGoPointer(ptr uintptr) {
313 c.Ptr = ptr
314}
315
316// SetPropertyAutoplay sets the "autoplay" property.
317// If the video should automatically begin playing.
318func (x *Video) SetPropertyAutoplay(value bool) {
319 var v gobject.Value
320 v.Init(gobject.TypeBooleanVal)
321 v.SetBoolean(value)
322 x.SetProperty("autoplay", &v)
323}
324
325// GetPropertyAutoplay gets the "autoplay" property.
326// If the video should automatically begin playing.
327func (x *Video) GetPropertyAutoplay() bool {
328 var v gobject.Value
329 x.GetProperty("autoplay", &v)
330 return v.GetBoolean()
331}
332
333// SetPropertyLoop sets the "loop" property.
334// If new media files should be set to loop.
335func (x *Video) SetPropertyLoop(value bool) {
336 var v gobject.Value
337 v.Init(gobject.TypeBooleanVal)
338 v.SetBoolean(value)
339 x.SetProperty("loop", &v)
340}
341
342// GetPropertyLoop gets the "loop" property.
343// If new media files should be set to loop.
344func (x *Video) GetPropertyLoop() bool {
345 var v gobject.Value
346 x.GetProperty("loop", &v)
347 return v.GetBoolean()
348}
349
350// Requests the user's screen reader to announce the given message.
351//
352// This kind of notification is useful for messages that
353// either have only a visual representation or that are not
354// exposed visually at all, e.g. a notification about a
355// successful operation.
356//
357// Also, by using this API, you can ensure that the message
358// does not interrupts the user's current screen reader output.
359func (x *Video) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
360
361 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
362
363}
364
365// Retrieves the accessible parent for an accessible object.
366//
367// This function returns `NULL` for top level widgets.
368func (x *Video) GetAccessibleParent() *AccessibleBase {
369 var cls *AccessibleBase
370
371 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
372
373 if cret == 0 {
374 return nil
375 }
376 cls = &AccessibleBase{}
377 cls.Ptr = cret
378 return cls
379}
380
381// Retrieves the accessible role of an accessible object.
382func (x *Video) GetAccessibleRole() AccessibleRole {
383
384 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
385 return cret
386}
387
388// Retrieves the implementation for the given accessible object.
389func (x *Video) GetAtContext() *ATContext {
390 var cls *ATContext
391
392 cret := XGtkAccessibleGetAtContext(x.GoPointer())
393
394 if cret == 0 {
395 return nil
396 }
397 cls = &ATContext{}
398 cls.Ptr = cret
399 return cls
400}
401
402// Queries the coordinates and dimensions of this accessible
403//
404// This functionality can be overridden by `GtkAccessible`
405// implementations, e.g. to get the bounds from an ignored
406// child widget.
407func (x *Video) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
408
409 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
410 return cret
411}
412
413// Retrieves the first accessible child of an accessible object.
414func (x *Video) GetFirstAccessibleChild() *AccessibleBase {
415 var cls *AccessibleBase
416
417 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
418
419 if cret == 0 {
420 return nil
421 }
422 cls = &AccessibleBase{}
423 cls.Ptr = cret
424 return cls
425}
426
427// Retrieves the next accessible sibling of an accessible object
428func (x *Video) GetNextAccessibleSibling() *AccessibleBase {
429 var cls *AccessibleBase
430
431 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
432
433 if cret == 0 {
434 return nil
435 }
436 cls = &AccessibleBase{}
437 cls.Ptr = cret
438 return cls
439}
440
441// Queries a platform state, such as focus.
442//
443// This functionality can be overridden by `GtkAccessible`
444// implementations, e.g. to get platform state from an ignored
445// child widget, as is the case for `GtkText` wrappers.
446func (x *Video) GetPlatformState(StateVar AccessiblePlatformState) bool {
447
448 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
449 return cret
450}
451
452// Resets the accessible property to its default value.
453func (x *Video) ResetProperty(PropertyVar AccessibleProperty) {
454
455 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
456
457}
458
459// Resets the accessible relation to its default value.
460func (x *Video) ResetRelation(RelationVar AccessibleRelation) {
461
462 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
463
464}
465
466// Resets the accessible state to its default value.
467func (x *Video) ResetState(StateVar AccessibleState) {
468
469 XGtkAccessibleResetState(x.GoPointer(), StateVar)
470
471}
472
473// Sets the parent and sibling of an accessible object.
474//
475// This function is meant to be used by accessible implementations that are
476// not part of the widget hierarchy, and but act as a logical bridge between
477// widgets. For instance, if a widget creates an object that holds metadata
478// for each child, and you want that object to implement the `GtkAccessible`
479// interface, you will use this function to ensure that the parent of each
480// child widget is the metadata object, and the parent of each metadata
481// object is the container widget.
482func (x *Video) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
483
484 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
485
486}
487
488// Updates the next accessible sibling.
489//
490// That might be useful when a new child of a custom accessible
491// is created, and it needs to be linked to a previous child.
492func (x *Video) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
493
494 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
495
496}
497
498// Informs ATs that the platform state has changed.
499//
500// This function should be used by `GtkAccessible` implementations that
501// have a platform state but are not widgets. Widgets handle platform
502// states automatically.
503func (x *Video) UpdatePlatformState(StateVar AccessiblePlatformState) {
504
505 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
506
507}
508
509// Updates a list of accessible properties.
510//
511// See the [enum@Gtk.AccessibleProperty] documentation for the
512// value types of accessible properties.
513//
514// This function should be called by `GtkWidget` types whenever
515// an accessible property change must be communicated to assistive
516// technologies.
517//
518// Example:
519// ```c
520// value = gtk_adjustment_get_value (adjustment);
521// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
522//
523// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
524// -1);
525//
526// ```
527func (x *Video) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
528
529 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
530
531}
532
533// Updates an array of accessible properties.
534//
535// This function should be called by `GtkWidget` types whenever an accessible
536// property change must be communicated to assistive technologies.
537//
538// This function is meant to be used by language bindings.
539func (x *Video) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
540
541 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
542
543}
544
545// Updates a list of accessible relations.
546//
547// This function should be called by `GtkWidget` types whenever an accessible
548// relation change must be communicated to assistive technologies.
549//
550// If the [enum@Gtk.AccessibleRelation] requires a list of references,
551// you should pass each reference individually, followed by `NULL`, e.g.
552//
553// ```c
554// gtk_accessible_update_relation (accessible,
555//
556// GTK_ACCESSIBLE_RELATION_CONTROLS,
557// ref1, NULL,
558// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
559// ref1, ref2, ref3, NULL,
560// -1);
561//
562// ```
563func (x *Video) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
564
565 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
566
567}
568
569// Updates an array of accessible relations.
570//
571// This function should be called by `GtkWidget` types whenever an accessible
572// relation change must be communicated to assistive technologies.
573//
574// This function is meant to be used by language bindings.
575func (x *Video) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
576
577 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
578
579}
580
581// Updates a list of accessible states.
582//
583// See the [enum@Gtk.AccessibleState] documentation for the
584// value types of accessible states.
585//
586// This function should be called by `GtkWidget` types whenever
587// an accessible state change must be communicated to assistive
588// technologies.
589//
590// Example:
591//
592// ```c
593// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
594// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
595//
596// GTK_ACCESSIBLE_STATE_CHECKED, value,
597// -1);
598//
599// ```
600func (x *Video) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
601
602 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
603
604}
605
606// Updates an array of accessible states.
607//
608// This function should be called by `GtkWidget` types whenever an accessible
609// state change must be communicated to assistive technologies.
610//
611// This function is meant to be used by language bindings.
612func (x *Video) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
613
614 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
615
616}
617
618// Gets the ID of the @buildable object.
619//
620// `GtkBuilder` sets the name based on the ID attribute
621// of the `<object>` tag used to construct the @buildable.
622func (x *Video) GetBuildableId() string {
623
624 cret := XGtkBuildableGetBuildableId(x.GoPointer())
625 return cret
626}
627
628func init() {
629 core.SetPackageName("GTK", "gtk4")
630 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
631 var libs []uintptr
632 for _, libPath := range core.GetPaths("GTK") {
633 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
634 if err != nil {
635 panic(err)
636 }
637 libs = append(libs, lib)
638 }
639
640 core.PuregoSafeRegister(&xVideoGLibType, libs, "gtk_video_get_type")
641
642 core.PuregoSafeRegister(&xNewVideo, libs, "gtk_video_new")
643 core.PuregoSafeRegister(&xNewVideoForFile, libs, "gtk_video_new_for_file")
644 core.PuregoSafeRegister(&xNewVideoForFilename, libs, "gtk_video_new_for_filename")
645 core.PuregoSafeRegister(&xNewVideoForMediaStream, libs, "gtk_video_new_for_media_stream")
646 core.PuregoSafeRegister(&xNewVideoForResource, libs, "gtk_video_new_for_resource")
647
648 core.PuregoSafeRegister(&xVideoGetAutoplay, libs, "gtk_video_get_autoplay")
649 core.PuregoSafeRegister(&xVideoGetFile, libs, "gtk_video_get_file")
650 core.PuregoSafeRegister(&xVideoGetGraphicsOffload, libs, "gtk_video_get_graphics_offload")
651 core.PuregoSafeRegister(&xVideoGetLoop, libs, "gtk_video_get_loop")
652 core.PuregoSafeRegister(&xVideoGetMediaStream, libs, "gtk_video_get_media_stream")
653 core.PuregoSafeRegister(&xVideoSetAutoplay, libs, "gtk_video_set_autoplay")
654 core.PuregoSafeRegister(&xVideoSetFile, libs, "gtk_video_set_file")
655 core.PuregoSafeRegister(&xVideoSetFilename, libs, "gtk_video_set_filename")
656 core.PuregoSafeRegister(&xVideoSetGraphicsOffload, libs, "gtk_video_set_graphics_offload")
657 core.PuregoSafeRegister(&xVideoSetLoop, libs, "gtk_video_set_loop")
658 core.PuregoSafeRegister(&xVideoSetMediaStream, libs, "gtk_video_set_media_stream")
659 core.PuregoSafeRegister(&xVideoSetResource, libs, "gtk_video_set_resource")
660
661}