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