1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gdk"
9 "github.com/bnema/puregotk/v4/glib"
10 "github.com/bnema/puregotk/v4/gobject"
11 "github.com/bnema/puregotk/v4/gobject/types"
12 "github.com/bnema/puregotk/v4/gsk"
13 "github.com/bnema/puregotk/v4/pango"
14)
15
16// The `GtkFontChooserDialog` widget is a dialog for selecting a font.
17//
18// <picture>
19//
20// <source srcset="fontchooser-dark.png" media="(prefers-color-scheme: dark)">
21// <img alt="An example GtkFontChooserDialog" src="fontchooser.png">
22//
23// </picture>
24//
25// `GtkFontChooserDialog` implements the [iface@Gtk.FontChooser] interface
26// and does not provide much API of its own.
27//
28// To create a `GtkFontChooserDialog`, use [ctor@Gtk.FontChooserDialog.new].
29//
30// # GtkFontChooserDialog as GtkBuildable
31//
32// The `GtkFontChooserDialog` implementation of the `GtkBuildable`
33// interface exposes the buttons with the names “select_button”
34// and “cancel_button”.
35//
36// ## CSS nodes
37//
38// `GtkFontChooserDialog` has a single CSS node with the name `window` and style
39// class `.fontchooser`.
40type FontChooserDialog struct {
41 Dialog
42}
43
44var xFontChooserDialogGLibType func() types.GType
45
46func FontChooserDialogGLibType() types.GType {
47 return xFontChooserDialogGLibType()
48}
49
50func FontChooserDialogNewFromInternalPtr(ptr uintptr) *FontChooserDialog {
51 cls := &FontChooserDialog{}
52 cls.Ptr = ptr
53 return cls
54}
55
56var xNewFontChooserDialog func(uintptr, uintptr) uintptr
57
58// Creates a new `GtkFontChooserDialog`.
59func NewFontChooserDialog(TitleVar *string, ParentVar *Window) *FontChooserDialog {
60 var cls *FontChooserDialog
61
62 TitleVarPtr := core.GStrdupNullable(TitleVar)
63 defer core.GFreeNullable(TitleVarPtr)
64
65 cret := xNewFontChooserDialog(TitleVarPtr, ParentVar.GoPointer())
66
67 if cret == 0 {
68 return nil
69 }
70 gobject.IncreaseRef(cret)
71 cls = &FontChooserDialog{}
72 cls.Ptr = cret
73 return cls
74}
75
76func (c *FontChooserDialog) GoPointer() uintptr {
77 if c == nil {
78 return 0
79 }
80 return c.Ptr
81}
82
83func (c *FontChooserDialog) SetGoPointer(ptr uintptr) {
84 c.Ptr = ptr
85}
86
87// Requests the user's screen reader to announce the given message.
88//
89// This kind of notification is useful for messages that
90// either have only a visual representation or that are not
91// exposed visually at all, e.g. a notification about a
92// successful operation.
93//
94// Also, by using this API, you can ensure that the message
95// does not interrupts the user's current screen reader output.
96func (x *FontChooserDialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
97
98 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
99
100}
101
102// Retrieves the accessible parent for an accessible object.
103//
104// This function returns `NULL` for top level widgets.
105func (x *FontChooserDialog) GetAccessibleParent() *AccessibleBase {
106 var cls *AccessibleBase
107
108 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
109
110 if cret == 0 {
111 return nil
112 }
113 cls = &AccessibleBase{}
114 cls.Ptr = cret
115 return cls
116}
117
118// Retrieves the accessible role of an accessible object.
119func (x *FontChooserDialog) GetAccessibleRole() AccessibleRole {
120
121 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
122 return cret
123}
124
125// Retrieves the implementation for the given accessible object.
126func (x *FontChooserDialog) GetAtContext() *ATContext {
127 var cls *ATContext
128
129 cret := XGtkAccessibleGetAtContext(x.GoPointer())
130
131 if cret == 0 {
132 return nil
133 }
134 cls = &ATContext{}
135 cls.Ptr = cret
136 return cls
137}
138
139// Queries the coordinates and dimensions of this accessible
140//
141// This functionality can be overridden by `GtkAccessible`
142// implementations, e.g. to get the bounds from an ignored
143// child widget.
144func (x *FontChooserDialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
145
146 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
147 return cret
148}
149
150// Retrieves the first accessible child of an accessible object.
151func (x *FontChooserDialog) GetFirstAccessibleChild() *AccessibleBase {
152 var cls *AccessibleBase
153
154 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
155
156 if cret == 0 {
157 return nil
158 }
159 cls = &AccessibleBase{}
160 cls.Ptr = cret
161 return cls
162}
163
164// Retrieves the next accessible sibling of an accessible object
165func (x *FontChooserDialog) GetNextAccessibleSibling() *AccessibleBase {
166 var cls *AccessibleBase
167
168 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
169
170 if cret == 0 {
171 return nil
172 }
173 cls = &AccessibleBase{}
174 cls.Ptr = cret
175 return cls
176}
177
178// Queries a platform state, such as focus.
179//
180// This functionality can be overridden by `GtkAccessible`
181// implementations, e.g. to get platform state from an ignored
182// child widget, as is the case for `GtkText` wrappers.
183func (x *FontChooserDialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
184
185 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
186 return cret
187}
188
189// Resets the accessible property to its default value.
190func (x *FontChooserDialog) ResetProperty(PropertyVar AccessibleProperty) {
191
192 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
193
194}
195
196// Resets the accessible relation to its default value.
197func (x *FontChooserDialog) ResetRelation(RelationVar AccessibleRelation) {
198
199 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
200
201}
202
203// Resets the accessible state to its default value.
204func (x *FontChooserDialog) ResetState(StateVar AccessibleState) {
205
206 XGtkAccessibleResetState(x.GoPointer(), StateVar)
207
208}
209
210// Sets the parent and sibling of an accessible object.
211//
212// This function is meant to be used by accessible implementations that are
213// not part of the widget hierarchy, and but act as a logical bridge between
214// widgets. For instance, if a widget creates an object that holds metadata
215// for each child, and you want that object to implement the `GtkAccessible`
216// interface, you will use this function to ensure that the parent of each
217// child widget is the metadata object, and the parent of each metadata
218// object is the container widget.
219func (x *FontChooserDialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
220
221 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
222
223}
224
225// Updates the next accessible sibling.
226//
227// That might be useful when a new child of a custom accessible
228// is created, and it needs to be linked to a previous child.
229func (x *FontChooserDialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
230
231 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
232
233}
234
235// Informs ATs that the platform state has changed.
236//
237// This function should be used by `GtkAccessible` implementations that
238// have a platform state but are not widgets. Widgets handle platform
239// states automatically.
240func (x *FontChooserDialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
241
242 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
243
244}
245
246// Updates a list of accessible properties.
247//
248// See the [enum@Gtk.AccessibleProperty] documentation for the
249// value types of accessible properties.
250//
251// This function should be called by `GtkWidget` types whenever
252// an accessible property change must be communicated to assistive
253// technologies.
254//
255// Example:
256// ```c
257// value = gtk_adjustment_get_value (adjustment);
258// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
259//
260// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
261// -1);
262//
263// ```
264func (x *FontChooserDialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
265
266 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
267
268}
269
270// Updates an array of accessible properties.
271//
272// This function should be called by `GtkWidget` types whenever an accessible
273// property change must be communicated to assistive technologies.
274//
275// This function is meant to be used by language bindings.
276func (x *FontChooserDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
277
278 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
279
280}
281
282// Updates a list of accessible relations.
283//
284// This function should be called by `GtkWidget` types whenever an accessible
285// relation change must be communicated to assistive technologies.
286//
287// If the [enum@Gtk.AccessibleRelation] requires a list of references,
288// you should pass each reference individually, followed by `NULL`, e.g.
289//
290// ```c
291// gtk_accessible_update_relation (accessible,
292//
293// GTK_ACCESSIBLE_RELATION_CONTROLS,
294// ref1, NULL,
295// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
296// ref1, ref2, ref3, NULL,
297// -1);
298//
299// ```
300func (x *FontChooserDialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
301
302 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
303
304}
305
306// Updates an array 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// This function is meant to be used by language bindings.
312func (x *FontChooserDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
313
314 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
315
316}
317
318// Updates a list of accessible states.
319//
320// See the [enum@Gtk.AccessibleState] documentation for the
321// value types of accessible states.
322//
323// This function should be called by `GtkWidget` types whenever
324// an accessible state change must be communicated to assistive
325// technologies.
326//
327// Example:
328//
329// ```c
330// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
331// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
332//
333// GTK_ACCESSIBLE_STATE_CHECKED, value,
334// -1);
335//
336// ```
337func (x *FontChooserDialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
338
339 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
340
341}
342
343// Updates an array of accessible states.
344//
345// This function should be called by `GtkWidget` types whenever an accessible
346// state change must be communicated to assistive technologies.
347//
348// This function is meant to be used by language bindings.
349func (x *FontChooserDialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
350
351 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
352
353}
354
355// Gets the ID of the @buildable object.
356//
357// `GtkBuilder` sets the name based on the ID attribute
358// of the `<object>` tag used to construct the @buildable.
359func (x *FontChooserDialog) GetBuildableId() string {
360
361 cret := XGtkBuildableGetBuildableId(x.GoPointer())
362 return cret
363}
364
365// Gets the currently-selected font name.
366//
367// Note that this can be a different string than what you set with
368// [method@Gtk.FontChooser.set_font], as the font chooser widget may
369// normalize font names and thus return a string with a different
370// structure. For example, “Helvetica Italic Bold 12” could be
371// normalized to “Helvetica Bold Italic 12”.
372//
373// Use [method@Pango.FontDescription.equal] if you want to compare two
374// font descriptions.
375func (x *FontChooserDialog) GetFont() string {
376
377 cret := XGtkFontChooserGetFont(x.GoPointer())
378 return cret
379}
380
381// Gets the currently-selected font.
382//
383// Note that this can be a different string than what you set with
384// [method@Gtk.FontChooser.set_font], as the font chooser widget may
385// normalize font names and thus return a string with a different
386// structure. For example, “Helvetica Italic Bold 12” could be
387// normalized to “Helvetica Bold Italic 12”.
388//
389// Use [method@Pango.FontDescription.equal] if you want to compare two
390// font descriptions.
391func (x *FontChooserDialog) GetFontDesc() *pango.FontDescription {
392
393 cret := XGtkFontChooserGetFontDesc(x.GoPointer())
394 return cret
395}
396
397// Gets the `PangoFontFace` representing the selected font group
398// details (i.e. family, slant, weight, width, etc).
399//
400// If the selected font is not installed, returns %NULL.
401func (x *FontChooserDialog) GetFontFace() *pango.FontFace {
402 var cls *pango.FontFace
403
404 cret := XGtkFontChooserGetFontFace(x.GoPointer())
405
406 if cret == 0 {
407 return nil
408 }
409 gobject.IncreaseRef(cret)
410 cls = &pango.FontFace{}
411 cls.Ptr = cret
412 return cls
413}
414
415// Gets the `PangoFontFamily` representing the selected font family.
416//
417// Font families are a collection of font faces.
418//
419// If the selected font is not installed, returns %NULL.
420func (x *FontChooserDialog) GetFontFamily() *pango.FontFamily {
421 var cls *pango.FontFamily
422
423 cret := XGtkFontChooserGetFontFamily(x.GoPointer())
424
425 if cret == 0 {
426 return nil
427 }
428 gobject.IncreaseRef(cret)
429 cls = &pango.FontFamily{}
430 cls.Ptr = cret
431 return cls
432}
433
434// Gets the currently-selected font features.
435//
436// The format of the returned string is compatible with the
437// [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc).
438// It can be passed to [func@Pango.AttrFontFeatures.new].
439func (x *FontChooserDialog) GetFontFeatures() string {
440
441 cret := XGtkFontChooserGetFontFeatures(x.GoPointer())
442 return cret
443}
444
445// Gets the custom font map of this font chooser widget,
446// or %NULL if it does not have one.
447func (x *FontChooserDialog) GetFontMap() *pango.FontMap {
448 var cls *pango.FontMap
449
450 cret := XGtkFontChooserGetFontMap(x.GoPointer())
451
452 if cret == 0 {
453 return nil
454 }
455 cls = &pango.FontMap{}
456 cls.Ptr = cret
457 return cls
458}
459
460// The selected font size.
461func (x *FontChooserDialog) GetFontSize() int {
462
463 cret := XGtkFontChooserGetFontSize(x.GoPointer())
464 return cret
465}
466
467// Gets the language that is used for font features.
468func (x *FontChooserDialog) GetLanguage() string {
469
470 cret := XGtkFontChooserGetLanguage(x.GoPointer())
471 return cret
472}
473
474// Returns the current level of granularity for selecting fonts.
475func (x *FontChooserDialog) GetLevel() FontChooserLevel {
476
477 cret := XGtkFontChooserGetLevel(x.GoPointer())
478 return cret
479}
480
481// Gets the text displayed in the preview area.
482func (x *FontChooserDialog) GetPreviewText() string {
483
484 cret := XGtkFontChooserGetPreviewText(x.GoPointer())
485 return cret
486}
487
488// Returns whether the preview entry is shown or not.
489func (x *FontChooserDialog) GetShowPreviewEntry() bool {
490
491 cret := XGtkFontChooserGetShowPreviewEntry(x.GoPointer())
492 return cret
493}
494
495// Adds a filter function that decides which fonts to display
496// in the font chooser.
497func (x *FontChooserDialog) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
498
499 XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallbackNullable(FilterVar), UserDataVar, glib.NewCallback(DestroyVar))
500
501}
502
503// Sets the currently-selected font.
504func (x *FontChooserDialog) SetFont(FontnameVar string) {
505
506 XGtkFontChooserSetFont(x.GoPointer(), FontnameVar)
507
508}
509
510// Sets the currently-selected font from @font_desc.
511func (x *FontChooserDialog) SetFontDesc(FontDescVar *pango.FontDescription) {
512
513 XGtkFontChooserSetFontDesc(x.GoPointer(), FontDescVar)
514
515}
516
517// Sets a custom font map to use for this font chooser widget.
518//
519// A custom font map can be used to present application-specific
520// fonts instead of or in addition to the normal system fonts.
521//
522// ```c
523// FcConfig *config;
524// PangoFontMap *fontmap;
525//
526// config = FcInitLoadConfigAndFonts ();
527// FcConfigAppFontAddFile (config, my_app_font_file);
528//
529// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
530// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
531//
532// gtk_font_chooser_set_font_map (font_chooser, fontmap);
533// ```
534//
535// Note that other GTK widgets will only be able to use the
536// application-specific font if it is present in the font map they use:
537//
538// ```c
539// context = gtk_widget_get_pango_context (label);
540// pango_context_set_font_map (context, fontmap);
541// ```
542func (x *FontChooserDialog) SetFontMap(FontmapVar *pango.FontMap) {
543
544 XGtkFontChooserSetFontMap(x.GoPointer(), FontmapVar.GoPointer())
545
546}
547
548// Sets the language to use for font features.
549func (x *FontChooserDialog) SetLanguage(LanguageVar string) {
550
551 XGtkFontChooserSetLanguage(x.GoPointer(), LanguageVar)
552
553}
554
555// Sets the desired level of granularity for selecting fonts.
556func (x *FontChooserDialog) SetLevel(LevelVar FontChooserLevel) {
557
558 XGtkFontChooserSetLevel(x.GoPointer(), LevelVar)
559
560}
561
562// Sets the text displayed in the preview area.
563//
564// The @text is used to show how the selected font looks.
565func (x *FontChooserDialog) SetPreviewText(TextVar string) {
566
567 XGtkFontChooserSetPreviewText(x.GoPointer(), TextVar)
568
569}
570
571// Shows or hides the editable preview entry.
572func (x *FontChooserDialog) SetShowPreviewEntry(ShowPreviewEntryVar bool) {
573
574 XGtkFontChooserSetShowPreviewEntry(x.GoPointer(), ShowPreviewEntryVar)
575
576}
577
578// Returns the renderer that is used for this `GtkNative`.
579func (x *FontChooserDialog) GetRenderer() *gsk.Renderer {
580 var cls *gsk.Renderer
581
582 cret := XGtkNativeGetRenderer(x.GoPointer())
583
584 if cret == 0 {
585 return nil
586 }
587 gobject.IncreaseRef(cret)
588 cls = &gsk.Renderer{}
589 cls.Ptr = cret
590 return cls
591}
592
593// Returns the surface of this `GtkNative`.
594func (x *FontChooserDialog) GetSurface() *gdk.Surface {
595 var cls *gdk.Surface
596
597 cret := XGtkNativeGetSurface(x.GoPointer())
598
599 if cret == 0 {
600 return nil
601 }
602 gobject.IncreaseRef(cret)
603 cls = &gdk.Surface{}
604 cls.Ptr = cret
605 return cls
606}
607
608// Retrieves the surface transform of @self.
609//
610// This is the translation from @self's surface coordinates into
611// @self's widget coordinates.
612func (x *FontChooserDialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
613
614 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
615
616}
617
618// Realizes a `GtkNative`.
619//
620// This should only be used by subclasses.
621func (x *FontChooserDialog) Realize() {
622
623 XGtkNativeRealize(x.GoPointer())
624
625}
626
627// Unrealizes a `GtkNative`.
628//
629// This should only be used by subclasses.
630func (x *FontChooserDialog) Unrealize() {
631
632 XGtkNativeUnrealize(x.GoPointer())
633
634}
635
636// Returns the display that this `GtkRoot` is on.
637func (x *FontChooserDialog) GetDisplay() *gdk.Display {
638 var cls *gdk.Display
639
640 cret := XGtkRootGetDisplay(x.GoPointer())
641
642 if cret == 0 {
643 return nil
644 }
645 gobject.IncreaseRef(cret)
646 cls = &gdk.Display{}
647 cls.Ptr = cret
648 return cls
649}
650
651// Retrieves the current focused widget within the root.
652//
653// Note that this is the widget that would have the focus
654// if the root is active; if the root is not focused then
655// `gtk_widget_has_focus (widget)` will be %FALSE for the
656// widget.
657func (x *FontChooserDialog) GetFocus() *Widget {
658 var cls *Widget
659
660 cret := XGtkRootGetFocus(x.GoPointer())
661
662 if cret == 0 {
663 return nil
664 }
665 gobject.IncreaseRef(cret)
666 cls = &Widget{}
667 cls.Ptr = cret
668 return cls
669}
670
671// If @focus is not the current focus widget, and is focusable, sets
672// it as the focus widget for the root.
673//
674// If @focus is %NULL, unsets the focus widget for the root.
675//
676// To set the focus to a particular widget in the root, it is usually
677// more convenient to use [method@Gtk.Widget.grab_focus] instead of
678// this function.
679func (x *FontChooserDialog) SetFocus(FocusVar *Widget) {
680
681 XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
682
683}
684
685func init() {
686 core.SetPackageName("GTK", "gtk4")
687 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
688 var libs []uintptr
689 for _, libPath := range core.GetPaths("GTK") {
690 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
691 if err != nil {
692 panic(err)
693 }
694 libs = append(libs, lib)
695 }
696
697 core.PuregoSafeRegister(&xFontChooserDialogGLibType, libs, "gtk_font_chooser_dialog_get_type")
698
699 core.PuregoSafeRegister(&xNewFontChooserDialog, libs, "gtk_font_chooser_dialog_new")
700
701}