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/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15 "github.com/bnema/puregotk/v4/gsk"
16)
17
18type EmojiChooserClass struct {
19 _ structs.HostLayout
20}
21
22func (x *EmojiChooserClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// Used by text widgets to let users insert Emoji characters.
27//
28// <picture>
29//
30// <source srcset="emojichooser-dark.png" media="(prefers-color-scheme: dark)">
31// <img alt="An example GtkEmojiChooser" src="emojichooser.png">
32//
33// </picture>
34//
35// `GtkEmojiChooser` emits the [signal@Gtk.EmojiChooser::emoji-picked]
36// signal when an Emoji is selected.
37//
38// # Shortcuts and Gestures
39//
40// `GtkEmojiChooser` supports the following keyboard shortcuts:
41//
42// - <kbd>Ctrl</kbd>+<kbd>N</kbd> scrolls th the next section.
43// - <kbd>Ctrl</kbd>+<kbd>P</kbd> scrolls th the previous section.
44//
45// # Actions
46//
47// `GtkEmojiChooser` defines a set of built-in actions:
48//
49// - `scroll.section` scrolls to the next or previous section.
50//
51// # CSS nodes
52//
53// ```
54// popover
55// ├── box.emoji-searchbar
56// │ ╰── entry.search
57// ╰── box.emoji-toolbar
58//
59// ├── button.image-button.emoji-section
60// ├── ...
61// ╰── button.image-button.emoji-section
62//
63// ```
64//
65// Every `GtkEmojiChooser` consists of a main node called popover.
66// The contents of the popover are largely implementation defined
67// and supposed to inherit general styles.
68// The top searchbar used to search emoji and gets the .emoji-searchbar
69// style class itself.
70// The bottom toolbar used to switch between different emoji categories
71// consists of buttons with the .emoji-section style class and gets the
72// .emoji-toolbar style class itself.
73type EmojiChooser struct {
74 Popover
75}
76
77var xEmojiChooserGLibType func() types.GType
78
79func EmojiChooserGLibType() types.GType {
80 return xEmojiChooserGLibType()
81}
82
83func EmojiChooserNewFromInternalPtr(ptr uintptr) *EmojiChooser {
84 cls := &EmojiChooser{}
85 cls.Ptr = ptr
86 return cls
87}
88
89var xNewEmojiChooser func() uintptr
90
91// Creates a new `GtkEmojiChooser`.
92func NewEmojiChooser() *EmojiChooser {
93 var cls *EmojiChooser
94
95 cret := xNewEmojiChooser()
96
97 if cret == 0 {
98 return nil
99 }
100 gobject.IncreaseRef(cret)
101 cls = &EmojiChooser{}
102 cls.Ptr = cret
103 return cls
104}
105
106func (c *EmojiChooser) GoPointer() uintptr {
107 if c == nil {
108 return 0
109 }
110 return c.Ptr
111}
112
113func (c *EmojiChooser) SetGoPointer(ptr uintptr) {
114 c.Ptr = ptr
115}
116
117// Emitted when the user selects an Emoji.
118func (x *EmojiChooser) ConnectEmojiPicked(cb *func(EmojiChooser, string)) uint {
119 cbPtr := uintptr(unsafe.Pointer(cb))
120 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
121 handlerID := gobject.SignalConnect(x.GoPointer(), "emoji-picked", cbRefPtr)
122 glib.SaveHandlerMapping(handlerID, cbPtr)
123 return handlerID
124 }
125
126 fcb := func(clsPtr uintptr, TextVarp uintptr) {
127 fa := EmojiChooser{}
128 fa.Ptr = clsPtr
129 cbFn := *cb
130
131 cbFn(fa, core.GoString(TextVarp))
132
133 }
134 cbRefPtr := purego.NewCallback(fcb)
135 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
136 handlerID := gobject.SignalConnect(x.GoPointer(), "emoji-picked", cbRefPtr)
137 glib.SaveHandlerMapping(handlerID, cbPtr)
138 return handlerID
139}
140
141// Requests the user's screen reader to announce the given message.
142//
143// This kind of notification is useful for messages that
144// either have only a visual representation or that are not
145// exposed visually at all, e.g. a notification about a
146// successful operation.
147//
148// Also, by using this API, you can ensure that the message
149// does not interrupts the user's current screen reader output.
150func (x *EmojiChooser) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
151
152 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
153
154}
155
156// Retrieves the accessible parent for an accessible object.
157//
158// This function returns `NULL` for top level widgets.
159func (x *EmojiChooser) GetAccessibleParent() *AccessibleBase {
160 var cls *AccessibleBase
161
162 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
163
164 if cret == 0 {
165 return nil
166 }
167 cls = &AccessibleBase{}
168 cls.Ptr = cret
169 return cls
170}
171
172// Retrieves the accessible role of an accessible object.
173func (x *EmojiChooser) GetAccessibleRole() AccessibleRole {
174
175 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
176 return cret
177}
178
179// Retrieves the implementation for the given accessible object.
180func (x *EmojiChooser) GetAtContext() *ATContext {
181 var cls *ATContext
182
183 cret := XGtkAccessibleGetAtContext(x.GoPointer())
184
185 if cret == 0 {
186 return nil
187 }
188 cls = &ATContext{}
189 cls.Ptr = cret
190 return cls
191}
192
193// Queries the coordinates and dimensions of this accessible
194//
195// This functionality can be overridden by `GtkAccessible`
196// implementations, e.g. to get the bounds from an ignored
197// child widget.
198func (x *EmojiChooser) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
199
200 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
201 return cret
202}
203
204// Retrieves the first accessible child of an accessible object.
205func (x *EmojiChooser) GetFirstAccessibleChild() *AccessibleBase {
206 var cls *AccessibleBase
207
208 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
209
210 if cret == 0 {
211 return nil
212 }
213 cls = &AccessibleBase{}
214 cls.Ptr = cret
215 return cls
216}
217
218// Retrieves the next accessible sibling of an accessible object
219func (x *EmojiChooser) GetNextAccessibleSibling() *AccessibleBase {
220 var cls *AccessibleBase
221
222 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
223
224 if cret == 0 {
225 return nil
226 }
227 cls = &AccessibleBase{}
228 cls.Ptr = cret
229 return cls
230}
231
232// Queries a platform state, such as focus.
233//
234// This functionality can be overridden by `GtkAccessible`
235// implementations, e.g. to get platform state from an ignored
236// child widget, as is the case for `GtkText` wrappers.
237func (x *EmojiChooser) GetPlatformState(StateVar AccessiblePlatformState) bool {
238
239 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
240 return cret
241}
242
243// Resets the accessible property to its default value.
244func (x *EmojiChooser) ResetProperty(PropertyVar AccessibleProperty) {
245
246 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
247
248}
249
250// Resets the accessible relation to its default value.
251func (x *EmojiChooser) ResetRelation(RelationVar AccessibleRelation) {
252
253 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
254
255}
256
257// Resets the accessible state to its default value.
258func (x *EmojiChooser) ResetState(StateVar AccessibleState) {
259
260 XGtkAccessibleResetState(x.GoPointer(), StateVar)
261
262}
263
264// Sets the parent and sibling of an accessible object.
265//
266// This function is meant to be used by accessible implementations that are
267// not part of the widget hierarchy, and but act as a logical bridge between
268// widgets. For instance, if a widget creates an object that holds metadata
269// for each child, and you want that object to implement the `GtkAccessible`
270// interface, you will use this function to ensure that the parent of each
271// child widget is the metadata object, and the parent of each metadata
272// object is the container widget.
273func (x *EmojiChooser) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
274
275 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
276
277}
278
279// Updates the next accessible sibling.
280//
281// That might be useful when a new child of a custom accessible
282// is created, and it needs to be linked to a previous child.
283func (x *EmojiChooser) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
284
285 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
286
287}
288
289// Informs ATs that the platform state has changed.
290//
291// This function should be used by `GtkAccessible` implementations that
292// have a platform state but are not widgets. Widgets handle platform
293// states automatically.
294func (x *EmojiChooser) UpdatePlatformState(StateVar AccessiblePlatformState) {
295
296 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
297
298}
299
300// Updates a list of accessible properties.
301//
302// See the [enum@Gtk.AccessibleProperty] documentation for the
303// value types of accessible properties.
304//
305// This function should be called by `GtkWidget` types whenever
306// an accessible property change must be communicated to assistive
307// technologies.
308//
309// Example:
310// ```c
311// value = gtk_adjustment_get_value (adjustment);
312// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
313//
314// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
315// -1);
316//
317// ```
318func (x *EmojiChooser) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
319
320 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
321
322}
323
324// Updates an array of accessible properties.
325//
326// This function should be called by `GtkWidget` types whenever an accessible
327// property change must be communicated to assistive technologies.
328//
329// This function is meant to be used by language bindings.
330func (x *EmojiChooser) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
331
332 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
333
334}
335
336// Updates a list of accessible relations.
337//
338// This function should be called by `GtkWidget` types whenever an accessible
339// relation change must be communicated to assistive technologies.
340//
341// If the [enum@Gtk.AccessibleRelation] requires a list of references,
342// you should pass each reference individually, followed by `NULL`, e.g.
343//
344// ```c
345// gtk_accessible_update_relation (accessible,
346//
347// GTK_ACCESSIBLE_RELATION_CONTROLS,
348// ref1, NULL,
349// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
350// ref1, ref2, ref3, NULL,
351// -1);
352//
353// ```
354func (x *EmojiChooser) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
355
356 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
357
358}
359
360// Updates an array of accessible relations.
361//
362// This function should be called by `GtkWidget` types whenever an accessible
363// relation change must be communicated to assistive technologies.
364//
365// This function is meant to be used by language bindings.
366func (x *EmojiChooser) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
367
368 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
369
370}
371
372// Updates a list of accessible states.
373//
374// See the [enum@Gtk.AccessibleState] documentation for the
375// value types of accessible states.
376//
377// This function should be called by `GtkWidget` types whenever
378// an accessible state change must be communicated to assistive
379// technologies.
380//
381// Example:
382//
383// ```c
384// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
385// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
386//
387// GTK_ACCESSIBLE_STATE_CHECKED, value,
388// -1);
389//
390// ```
391func (x *EmojiChooser) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
392
393 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
394
395}
396
397// Updates an array of accessible states.
398//
399// This function should be called by `GtkWidget` types whenever an accessible
400// state change must be communicated to assistive technologies.
401//
402// This function is meant to be used by language bindings.
403func (x *EmojiChooser) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
404
405 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
406
407}
408
409// Gets the ID of the @buildable object.
410//
411// `GtkBuilder` sets the name based on the ID attribute
412// of the `<object>` tag used to construct the @buildable.
413func (x *EmojiChooser) GetBuildableId() string {
414
415 cret := XGtkBuildableGetBuildableId(x.GoPointer())
416 return cret
417}
418
419// Returns the renderer that is used for this `GtkNative`.
420func (x *EmojiChooser) GetRenderer() *gsk.Renderer {
421 var cls *gsk.Renderer
422
423 cret := XGtkNativeGetRenderer(x.GoPointer())
424
425 if cret == 0 {
426 return nil
427 }
428 gobject.IncreaseRef(cret)
429 cls = &gsk.Renderer{}
430 cls.Ptr = cret
431 return cls
432}
433
434// Returns the surface of this `GtkNative`.
435func (x *EmojiChooser) GetSurface() *gdk.Surface {
436 var cls *gdk.Surface
437
438 cret := XGtkNativeGetSurface(x.GoPointer())
439
440 if cret == 0 {
441 return nil
442 }
443 gobject.IncreaseRef(cret)
444 cls = &gdk.Surface{}
445 cls.Ptr = cret
446 return cls
447}
448
449// Retrieves the surface transform of @self.
450//
451// This is the translation from @self's surface coordinates into
452// @self's widget coordinates.
453func (x *EmojiChooser) GetSurfaceTransform(XVar *float64, YVar *float64) {
454
455 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
456
457}
458
459// Realizes a `GtkNative`.
460//
461// This should only be used by subclasses.
462func (x *EmojiChooser) Realize() {
463
464 XGtkNativeRealize(x.GoPointer())
465
466}
467
468// Unrealizes a `GtkNative`.
469//
470// This should only be used by subclasses.
471func (x *EmojiChooser) Unrealize() {
472
473 XGtkNativeUnrealize(x.GoPointer())
474
475}
476
477func init() {
478 core.SetPackageName("GTK", "gtk4")
479 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
480 var libs []uintptr
481 for _, libPath := range core.GetPaths("GTK") {
482 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
483 if err != nil {
484 panic(err)
485 }
486 libs = append(libs, lib)
487 }
488
489 core.PuregoSafeRegister(&xEmojiChooserGLibType, libs, "gtk_emoji_chooser_get_type")
490
491 core.PuregoSafeRegister(&xNewEmojiChooser, libs, "gtk_emoji_chooser_new")
492
493}