1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13 "github.com/bnema/puregotk/v4/pango"
14)
15
16// The `GtkFontButton` allows to open a font chooser dialog to change
17// the font.
18//
19// <picture>
20//
21// <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)">
22// <img alt="An example GtkFontButton" src="font-button.png">
23//
24// </picture>
25//
26// It is suitable widget for selecting a font in a preference dialog.
27//
28// # CSS nodes
29//
30// ```
31// fontbutton
32// ╰── button.font
33//
34// ╰── [content]
35//
36// ```
37//
38// `GtkFontButton` has a single CSS node with name fontbutton which
39// contains a button node with the .font style class.
40type FontButton struct {
41 Widget
42}
43
44var xFontButtonGLibType func() types.GType
45
46func FontButtonGLibType() types.GType {
47 return xFontButtonGLibType()
48}
49
50func FontButtonNewFromInternalPtr(ptr uintptr) *FontButton {
51 cls := &FontButton{}
52 cls.Ptr = ptr
53 return cls
54}
55
56var xNewFontButton func() uintptr
57
58// Creates a new font picker widget.
59func NewFontButton() *FontButton {
60 var cls *FontButton
61
62 cret := xNewFontButton()
63
64 if cret == 0 {
65 return nil
66 }
67 gobject.IncreaseRef(cret)
68 cls = &FontButton{}
69 cls.Ptr = cret
70 return cls
71}
72
73var xNewFontButtonWithFont func(string) uintptr
74
75// Creates a new font picker widget showing the given font.
76func NewFontButtonWithFont(FontnameVar string) *FontButton {
77 var cls *FontButton
78
79 cret := xNewFontButtonWithFont(FontnameVar)
80
81 if cret == 0 {
82 return nil
83 }
84 gobject.IncreaseRef(cret)
85 cls = &FontButton{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xFontButtonGetModal func(uintptr) bool
91
92// Gets whether the dialog is modal.
93func (x *FontButton) GetModal() bool {
94
95 cret := xFontButtonGetModal(x.GoPointer())
96 return cret
97}
98
99var xFontButtonGetTitle func(uintptr) string
100
101// Retrieves the title of the font chooser dialog.
102func (x *FontButton) GetTitle() string {
103
104 cret := xFontButtonGetTitle(x.GoPointer())
105 return cret
106}
107
108var xFontButtonGetUseFont func(uintptr) bool
109
110// Returns whether the selected font is used in the label.
111func (x *FontButton) GetUseFont() bool {
112
113 cret := xFontButtonGetUseFont(x.GoPointer())
114 return cret
115}
116
117var xFontButtonGetUseSize func(uintptr) bool
118
119// Returns whether the selected size is used in the label.
120func (x *FontButton) GetUseSize() bool {
121
122 cret := xFontButtonGetUseSize(x.GoPointer())
123 return cret
124}
125
126var xFontButtonSetModal func(uintptr, bool)
127
128// Sets whether the dialog should be modal.
129func (x *FontButton) SetModal(ModalVar bool) {
130
131 xFontButtonSetModal(x.GoPointer(), ModalVar)
132
133}
134
135var xFontButtonSetTitle func(uintptr, string)
136
137// Sets the title for the font chooser dialog.
138func (x *FontButton) SetTitle(TitleVar string) {
139
140 xFontButtonSetTitle(x.GoPointer(), TitleVar)
141
142}
143
144var xFontButtonSetUseFont func(uintptr, bool)
145
146// If @use_font is %TRUE, the font name will be written
147// using the selected font.
148func (x *FontButton) SetUseFont(UseFontVar bool) {
149
150 xFontButtonSetUseFont(x.GoPointer(), UseFontVar)
151
152}
153
154var xFontButtonSetUseSize func(uintptr, bool)
155
156// If @use_size is %TRUE, the font name will be written using
157// the selected size.
158func (x *FontButton) SetUseSize(UseSizeVar bool) {
159
160 xFontButtonSetUseSize(x.GoPointer(), UseSizeVar)
161
162}
163
164func (c *FontButton) GoPointer() uintptr {
165 if c == nil {
166 return 0
167 }
168 return c.Ptr
169}
170
171func (c *FontButton) SetGoPointer(ptr uintptr) {
172 c.Ptr = ptr
173}
174
175// SetPropertyModal sets the "modal" property.
176// Whether the font chooser dialog should be modal.
177func (x *FontButton) SetPropertyModal(value bool) {
178 var v gobject.Value
179 v.Init(gobject.TypeBooleanVal)
180 v.SetBoolean(value)
181 x.SetProperty("modal", &v)
182}
183
184// GetPropertyModal gets the "modal" property.
185// Whether the font chooser dialog should be modal.
186func (x *FontButton) GetPropertyModal() bool {
187 var v gobject.Value
188 x.GetProperty("modal", &v)
189 return v.GetBoolean()
190}
191
192// SetPropertyTitle sets the "title" property.
193// The title of the font chooser dialog.
194func (x *FontButton) SetPropertyTitle(value string) {
195 var v gobject.Value
196 v.Init(gobject.TypeStringVal)
197 v.SetString(&value)
198 x.SetProperty("title", &v)
199}
200
201// GetPropertyTitle gets the "title" property.
202// The title of the font chooser dialog.
203func (x *FontButton) GetPropertyTitle() string {
204 var v gobject.Value
205 x.GetProperty("title", &v)
206 return v.GetString()
207}
208
209// SetPropertyUseFont sets the "use-font" property.
210// Whether the buttons label will be drawn in the selected font.
211func (x *FontButton) SetPropertyUseFont(value bool) {
212 var v gobject.Value
213 v.Init(gobject.TypeBooleanVal)
214 v.SetBoolean(value)
215 x.SetProperty("use-font", &v)
216}
217
218// GetPropertyUseFont gets the "use-font" property.
219// Whether the buttons label will be drawn in the selected font.
220func (x *FontButton) GetPropertyUseFont() bool {
221 var v gobject.Value
222 x.GetProperty("use-font", &v)
223 return v.GetBoolean()
224}
225
226// SetPropertyUseSize sets the "use-size" property.
227// Whether the buttons label will use the selected font size.
228func (x *FontButton) SetPropertyUseSize(value bool) {
229 var v gobject.Value
230 v.Init(gobject.TypeBooleanVal)
231 v.SetBoolean(value)
232 x.SetProperty("use-size", &v)
233}
234
235// GetPropertyUseSize gets the "use-size" property.
236// Whether the buttons label will use the selected font size.
237func (x *FontButton) GetPropertyUseSize() bool {
238 var v gobject.Value
239 x.GetProperty("use-size", &v)
240 return v.GetBoolean()
241}
242
243// Emitted to when the font button is activated.
244//
245// The `::activate` signal on `GtkFontButton` is an action signal and
246// emitting it causes the button to present its dialog.
247func (x *FontButton) ConnectActivate(cb *func(FontButton)) uint {
248 cbPtr := uintptr(unsafe.Pointer(cb))
249 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
250 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
251 glib.SaveHandlerMapping(handlerID, cbPtr)
252 return handlerID
253 }
254
255 fcb := func(clsPtr uintptr) {
256 fa := FontButton{}
257 fa.Ptr = clsPtr
258 cbFn := *cb
259
260 cbFn(fa)
261
262 }
263 cbRefPtr := purego.NewCallback(fcb)
264 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
265 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
266 glib.SaveHandlerMapping(handlerID, cbPtr)
267 return handlerID
268}
269
270// Emitted when the user selects a font.
271//
272// When handling this signal, use [method@Gtk.FontChooser.get_font]
273// to find out which font was just selected.
274//
275// Note that this signal is only emitted when the user changes the font.
276// If you need to react to programmatic font changes as well, use
277// the notify::font signal.
278func (x *FontButton) ConnectFontSet(cb *func(FontButton)) uint {
279 cbPtr := uintptr(unsafe.Pointer(cb))
280 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
281 handlerID := gobject.SignalConnect(x.GoPointer(), "font-set", cbRefPtr)
282 glib.SaveHandlerMapping(handlerID, cbPtr)
283 return handlerID
284 }
285
286 fcb := func(clsPtr uintptr) {
287 fa := FontButton{}
288 fa.Ptr = clsPtr
289 cbFn := *cb
290
291 cbFn(fa)
292
293 }
294 cbRefPtr := purego.NewCallback(fcb)
295 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
296 handlerID := gobject.SignalConnect(x.GoPointer(), "font-set", cbRefPtr)
297 glib.SaveHandlerMapping(handlerID, cbPtr)
298 return handlerID
299}
300
301// Requests the user's screen reader to announce the given message.
302//
303// This kind of notification is useful for messages that
304// either have only a visual representation or that are not
305// exposed visually at all, e.g. a notification about a
306// successful operation.
307//
308// Also, by using this API, you can ensure that the message
309// does not interrupts the user's current screen reader output.
310func (x *FontButton) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
311
312 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
313
314}
315
316// Retrieves the accessible parent for an accessible object.
317//
318// This function returns `NULL` for top level widgets.
319func (x *FontButton) GetAccessibleParent() *AccessibleBase {
320 var cls *AccessibleBase
321
322 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
323
324 if cret == 0 {
325 return nil
326 }
327 cls = &AccessibleBase{}
328 cls.Ptr = cret
329 return cls
330}
331
332// Retrieves the accessible role of an accessible object.
333func (x *FontButton) GetAccessibleRole() AccessibleRole {
334
335 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
336 return cret
337}
338
339// Retrieves the implementation for the given accessible object.
340func (x *FontButton) GetAtContext() *ATContext {
341 var cls *ATContext
342
343 cret := XGtkAccessibleGetAtContext(x.GoPointer())
344
345 if cret == 0 {
346 return nil
347 }
348 cls = &ATContext{}
349 cls.Ptr = cret
350 return cls
351}
352
353// Queries the coordinates and dimensions of this accessible
354//
355// This functionality can be overridden by `GtkAccessible`
356// implementations, e.g. to get the bounds from an ignored
357// child widget.
358func (x *FontButton) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
359
360 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
361 return cret
362}
363
364// Retrieves the first accessible child of an accessible object.
365func (x *FontButton) GetFirstAccessibleChild() *AccessibleBase {
366 var cls *AccessibleBase
367
368 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
369
370 if cret == 0 {
371 return nil
372 }
373 cls = &AccessibleBase{}
374 cls.Ptr = cret
375 return cls
376}
377
378// Retrieves the next accessible sibling of an accessible object
379func (x *FontButton) GetNextAccessibleSibling() *AccessibleBase {
380 var cls *AccessibleBase
381
382 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
383
384 if cret == 0 {
385 return nil
386 }
387 cls = &AccessibleBase{}
388 cls.Ptr = cret
389 return cls
390}
391
392// Queries a platform state, such as focus.
393//
394// This functionality can be overridden by `GtkAccessible`
395// implementations, e.g. to get platform state from an ignored
396// child widget, as is the case for `GtkText` wrappers.
397func (x *FontButton) GetPlatformState(StateVar AccessiblePlatformState) bool {
398
399 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
400 return cret
401}
402
403// Resets the accessible property to its default value.
404func (x *FontButton) ResetProperty(PropertyVar AccessibleProperty) {
405
406 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
407
408}
409
410// Resets the accessible relation to its default value.
411func (x *FontButton) ResetRelation(RelationVar AccessibleRelation) {
412
413 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
414
415}
416
417// Resets the accessible state to its default value.
418func (x *FontButton) ResetState(StateVar AccessibleState) {
419
420 XGtkAccessibleResetState(x.GoPointer(), StateVar)
421
422}
423
424// Sets the parent and sibling of an accessible object.
425//
426// This function is meant to be used by accessible implementations that are
427// not part of the widget hierarchy, and but act as a logical bridge between
428// widgets. For instance, if a widget creates an object that holds metadata
429// for each child, and you want that object to implement the `GtkAccessible`
430// interface, you will use this function to ensure that the parent of each
431// child widget is the metadata object, and the parent of each metadata
432// object is the container widget.
433func (x *FontButton) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
434
435 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
436
437}
438
439// Updates the next accessible sibling.
440//
441// That might be useful when a new child of a custom accessible
442// is created, and it needs to be linked to a previous child.
443func (x *FontButton) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
444
445 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
446
447}
448
449// Informs ATs that the platform state has changed.
450//
451// This function should be used by `GtkAccessible` implementations that
452// have a platform state but are not widgets. Widgets handle platform
453// states automatically.
454func (x *FontButton) UpdatePlatformState(StateVar AccessiblePlatformState) {
455
456 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
457
458}
459
460// Updates a list of accessible properties.
461//
462// See the [enum@Gtk.AccessibleProperty] documentation for the
463// value types of accessible properties.
464//
465// This function should be called by `GtkWidget` types whenever
466// an accessible property change must be communicated to assistive
467// technologies.
468//
469// Example:
470// ```c
471// value = gtk_adjustment_get_value (adjustment);
472// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
473//
474// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
475// -1);
476//
477// ```
478func (x *FontButton) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
479
480 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
481
482}
483
484// Updates an array of accessible properties.
485//
486// This function should be called by `GtkWidget` types whenever an accessible
487// property change must be communicated to assistive technologies.
488//
489// This function is meant to be used by language bindings.
490func (x *FontButton) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
491
492 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
493
494}
495
496// Updates a list of accessible relations.
497//
498// This function should be called by `GtkWidget` types whenever an accessible
499// relation change must be communicated to assistive technologies.
500//
501// If the [enum@Gtk.AccessibleRelation] requires a list of references,
502// you should pass each reference individually, followed by `NULL`, e.g.
503//
504// ```c
505// gtk_accessible_update_relation (accessible,
506//
507// GTK_ACCESSIBLE_RELATION_CONTROLS,
508// ref1, NULL,
509// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
510// ref1, ref2, ref3, NULL,
511// -1);
512//
513// ```
514func (x *FontButton) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
515
516 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
517
518}
519
520// Updates an array of accessible relations.
521//
522// This function should be called by `GtkWidget` types whenever an accessible
523// relation change must be communicated to assistive technologies.
524//
525// This function is meant to be used by language bindings.
526func (x *FontButton) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
527
528 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
529
530}
531
532// Updates a list of accessible states.
533//
534// See the [enum@Gtk.AccessibleState] documentation for the
535// value types of accessible states.
536//
537// This function should be called by `GtkWidget` types whenever
538// an accessible state change must be communicated to assistive
539// technologies.
540//
541// Example:
542//
543// ```c
544// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
545// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
546//
547// GTK_ACCESSIBLE_STATE_CHECKED, value,
548// -1);
549//
550// ```
551func (x *FontButton) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
552
553 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
554
555}
556
557// Updates an array of accessible states.
558//
559// This function should be called by `GtkWidget` types whenever an accessible
560// state change must be communicated to assistive technologies.
561//
562// This function is meant to be used by language bindings.
563func (x *FontButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
564
565 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
566
567}
568
569// Gets the ID of the @buildable object.
570//
571// `GtkBuilder` sets the name based on the ID attribute
572// of the `<object>` tag used to construct the @buildable.
573func (x *FontButton) GetBuildableId() string {
574
575 cret := XGtkBuildableGetBuildableId(x.GoPointer())
576 return cret
577}
578
579// Gets the currently-selected font name.
580//
581// Note that this can be a different string than what you set with
582// [method@Gtk.FontChooser.set_font], as the font chooser widget may
583// normalize font names and thus return a string with a different
584// structure. For example, “Helvetica Italic Bold 12” could be
585// normalized to “Helvetica Bold Italic 12”.
586//
587// Use [method@Pango.FontDescription.equal] if you want to compare two
588// font descriptions.
589func (x *FontButton) GetFont() string {
590
591 cret := XGtkFontChooserGetFont(x.GoPointer())
592 return cret
593}
594
595// Gets the currently-selected font.
596//
597// Note that this can be a different string than what you set with
598// [method@Gtk.FontChooser.set_font], as the font chooser widget may
599// normalize font names and thus return a string with a different
600// structure. For example, “Helvetica Italic Bold 12” could be
601// normalized to “Helvetica Bold Italic 12”.
602//
603// Use [method@Pango.FontDescription.equal] if you want to compare two
604// font descriptions.
605func (x *FontButton) GetFontDesc() *pango.FontDescription {
606
607 cret := XGtkFontChooserGetFontDesc(x.GoPointer())
608 return cret
609}
610
611// Gets the `PangoFontFace` representing the selected font group
612// details (i.e. family, slant, weight, width, etc).
613//
614// If the selected font is not installed, returns %NULL.
615func (x *FontButton) GetFontFace() *pango.FontFace {
616 var cls *pango.FontFace
617
618 cret := XGtkFontChooserGetFontFace(x.GoPointer())
619
620 if cret == 0 {
621 return nil
622 }
623 gobject.IncreaseRef(cret)
624 cls = &pango.FontFace{}
625 cls.Ptr = cret
626 return cls
627}
628
629// Gets the `PangoFontFamily` representing the selected font family.
630//
631// Font families are a collection of font faces.
632//
633// If the selected font is not installed, returns %NULL.
634func (x *FontButton) GetFontFamily() *pango.FontFamily {
635 var cls *pango.FontFamily
636
637 cret := XGtkFontChooserGetFontFamily(x.GoPointer())
638
639 if cret == 0 {
640 return nil
641 }
642 gobject.IncreaseRef(cret)
643 cls = &pango.FontFamily{}
644 cls.Ptr = cret
645 return cls
646}
647
648// Gets the currently-selected font features.
649//
650// The format of the returned string is compatible with the
651// [CSS font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc).
652// It can be passed to [func@Pango.AttrFontFeatures.new].
653func (x *FontButton) GetFontFeatures() string {
654
655 cret := XGtkFontChooserGetFontFeatures(x.GoPointer())
656 return cret
657}
658
659// Gets the custom font map of this font chooser widget,
660// or %NULL if it does not have one.
661func (x *FontButton) GetFontMap() *pango.FontMap {
662 var cls *pango.FontMap
663
664 cret := XGtkFontChooserGetFontMap(x.GoPointer())
665
666 if cret == 0 {
667 return nil
668 }
669 cls = &pango.FontMap{}
670 cls.Ptr = cret
671 return cls
672}
673
674// The selected font size.
675func (x *FontButton) GetFontSize() int {
676
677 cret := XGtkFontChooserGetFontSize(x.GoPointer())
678 return cret
679}
680
681// Gets the language that is used for font features.
682func (x *FontButton) GetLanguage() string {
683
684 cret := XGtkFontChooserGetLanguage(x.GoPointer())
685 return cret
686}
687
688// Returns the current level of granularity for selecting fonts.
689func (x *FontButton) GetLevel() FontChooserLevel {
690
691 cret := XGtkFontChooserGetLevel(x.GoPointer())
692 return cret
693}
694
695// Gets the text displayed in the preview area.
696func (x *FontButton) GetPreviewText() string {
697
698 cret := XGtkFontChooserGetPreviewText(x.GoPointer())
699 return cret
700}
701
702// Returns whether the preview entry is shown or not.
703func (x *FontButton) GetShowPreviewEntry() bool {
704
705 cret := XGtkFontChooserGetShowPreviewEntry(x.GoPointer())
706 return cret
707}
708
709// Adds a filter function that decides which fonts to display
710// in the font chooser.
711func (x *FontButton) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) {
712
713 XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallbackNullable(FilterVar), UserDataVar, glib.NewCallback(DestroyVar))
714
715}
716
717// Sets the currently-selected font.
718func (x *FontButton) SetFont(FontnameVar string) {
719
720 XGtkFontChooserSetFont(x.GoPointer(), FontnameVar)
721
722}
723
724// Sets the currently-selected font from @font_desc.
725func (x *FontButton) SetFontDesc(FontDescVar *pango.FontDescription) {
726
727 XGtkFontChooserSetFontDesc(x.GoPointer(), FontDescVar)
728
729}
730
731// Sets a custom font map to use for this font chooser widget.
732//
733// A custom font map can be used to present application-specific
734// fonts instead of or in addition to the normal system fonts.
735//
736// ```c
737// FcConfig *config;
738// PangoFontMap *fontmap;
739//
740// config = FcInitLoadConfigAndFonts ();
741// FcConfigAppFontAddFile (config, my_app_font_file);
742//
743// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
744// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
745//
746// gtk_font_chooser_set_font_map (font_chooser, fontmap);
747// ```
748//
749// Note that other GTK widgets will only be able to use the
750// application-specific font if it is present in the font map they use:
751//
752// ```c
753// context = gtk_widget_get_pango_context (label);
754// pango_context_set_font_map (context, fontmap);
755// ```
756func (x *FontButton) SetFontMap(FontmapVar *pango.FontMap) {
757
758 XGtkFontChooserSetFontMap(x.GoPointer(), FontmapVar.GoPointer())
759
760}
761
762// Sets the language to use for font features.
763func (x *FontButton) SetLanguage(LanguageVar string) {
764
765 XGtkFontChooserSetLanguage(x.GoPointer(), LanguageVar)
766
767}
768
769// Sets the desired level of granularity for selecting fonts.
770func (x *FontButton) SetLevel(LevelVar FontChooserLevel) {
771
772 XGtkFontChooserSetLevel(x.GoPointer(), LevelVar)
773
774}
775
776// Sets the text displayed in the preview area.
777//
778// The @text is used to show how the selected font looks.
779func (x *FontButton) SetPreviewText(TextVar string) {
780
781 XGtkFontChooserSetPreviewText(x.GoPointer(), TextVar)
782
783}
784
785// Shows or hides the editable preview entry.
786func (x *FontButton) SetShowPreviewEntry(ShowPreviewEntryVar bool) {
787
788 XGtkFontChooserSetShowPreviewEntry(x.GoPointer(), ShowPreviewEntryVar)
789
790}
791
792func init() {
793 core.SetPackageName("GTK", "gtk4")
794 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
795 var libs []uintptr
796 for _, libPath := range core.GetPaths("GTK") {
797 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
798 if err != nil {
799 panic(err)
800 }
801 libs = append(libs, lib)
802 }
803
804 core.PuregoSafeRegister(&xFontButtonGLibType, libs, "gtk_font_button_get_type")
805
806 core.PuregoSafeRegister(&xNewFontButton, libs, "gtk_font_button_new")
807 core.PuregoSafeRegister(&xNewFontButtonWithFont, libs, "gtk_font_button_new_with_font")
808
809 core.PuregoSafeRegister(&xFontButtonGetModal, libs, "gtk_font_button_get_modal")
810 core.PuregoSafeRegister(&xFontButtonGetTitle, libs, "gtk_font_button_get_title")
811 core.PuregoSafeRegister(&xFontButtonGetUseFont, libs, "gtk_font_button_get_use_font")
812 core.PuregoSafeRegister(&xFontButtonGetUseSize, libs, "gtk_font_button_get_use_size")
813 core.PuregoSafeRegister(&xFontButtonSetModal, libs, "gtk_font_button_set_modal")
814 core.PuregoSafeRegister(&xFontButtonSetTitle, libs, "gtk_font_button_set_title")
815 core.PuregoSafeRegister(&xFontButtonSetUseFont, libs, "gtk_font_button_set_use_font")
816 core.PuregoSafeRegister(&xFontButtonSetUseSize, libs, "gtk_font_button_set_use_size")
817
818}