// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gio" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/pango" ) type FontDialogClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *FontDialogClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Asynchronous API to present a font chooser dialog. // // `GtkFontDialog` collects the arguments that are needed to present // the dialog to the user, such as a title for the dialog and whether // it should be modal. // // The dialog is shown with the [method@Gtk.FontDialog.choose_font] // function or its variants. // // See [class@Gtk.FontDialogButton] for a convenient control // that uses `GtkFontDialog` and presents the results. type FontDialog struct { gobject.Object } var xFontDialogGLibType func() types.GType func FontDialogGLibType() types.GType { return xFontDialogGLibType() } func FontDialogNewFromInternalPtr(ptr uintptr) *FontDialog { cls := &FontDialog{} cls.Ptr = ptr return cls } var xNewFontDialog func() uintptr // Creates a new `GtkFontDialog` object. func NewFontDialog() *FontDialog { var cls *FontDialog cret := xNewFontDialog() if cret == 0 { return nil } cls = &FontDialog{} cls.Ptr = cret return cls } var xFontDialogChooseFace func(uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) // Presents a font chooser dialog to the user. // // The font chooser dialog will be set up for selecting a font face. // // A font face represents a font family and style, but no specific font size. func (x *FontDialog) ChooseFace(ParentVar *Window, InitialValueVar *pango.FontFace, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { var CallbackVarRef uintptr if CallbackVar != nil { CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar)) if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok { CallbackVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) { cbFn := *CallbackVar cbFn(arg0, arg1, arg2) } CallbackVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar) } } xFontDialogChooseFace(x.GoPointer(), ParentVar.GoPointer(), InitialValueVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar) } var xFontDialogChooseFaceFinish func(uintptr, uintptr, **glib.Error) uintptr // Finishes the [method@Gtk.FontDialog.choose_face] call. // // Note that this function returns a [error@Gtk.DialogError.DISMISSED] // error if the user cancels the dialog. func (x *FontDialog) ChooseFaceFinish(ResultVar gio.AsyncResult) (*pango.FontFace, error) { var cls *pango.FontFace var cerr *glib.Error cret := xFontDialogChooseFaceFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr) if cret == 0 { return nil, cerr } cls = &pango.FontFace{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } var xFontDialogChooseFamily func(uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) // Presents a font chooser dialog to the user. // // The font chooser dialog will be set up for selecting a font family. func (x *FontDialog) ChooseFamily(ParentVar *Window, InitialValueVar *pango.FontFamily, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { var CallbackVarRef uintptr if CallbackVar != nil { CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar)) if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok { CallbackVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) { cbFn := *CallbackVar cbFn(arg0, arg1, arg2) } CallbackVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar) } } xFontDialogChooseFamily(x.GoPointer(), ParentVar.GoPointer(), InitialValueVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar) } var xFontDialogChooseFamilyFinish func(uintptr, uintptr, **glib.Error) uintptr // Finishes the [method@Gtk.FontDialog.choose_family] call. // // Note that this function returns a [error@Gtk.DialogError.DISMISSED] // error if the user cancels the dialog. func (x *FontDialog) ChooseFamilyFinish(ResultVar gio.AsyncResult) (*pango.FontFamily, error) { var cls *pango.FontFamily var cerr *glib.Error cret := xFontDialogChooseFamilyFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr) if cret == 0 { return nil, cerr } cls = &pango.FontFamily{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } var xFontDialogChooseFont func(uintptr, uintptr, *pango.FontDescription, uintptr, uintptr, uintptr) // Presents a font chooser dialog to the user. // // The font chooser dialog will be set up for selecting a font. // // If you want to let the user select font features as well, // use [method@Gtk.FontDialog.choose_font_and_features] instead. func (x *FontDialog) ChooseFont(ParentVar *Window, InitialValueVar *pango.FontDescription, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { var CallbackVarRef uintptr if CallbackVar != nil { CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar)) if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok { CallbackVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) { cbFn := *CallbackVar cbFn(arg0, arg1, arg2) } CallbackVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar) } } xFontDialogChooseFont(x.GoPointer(), ParentVar.GoPointer(), InitialValueVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar) } var xFontDialogChooseFontAndFeatures func(uintptr, uintptr, *pango.FontDescription, uintptr, uintptr, uintptr) // Presents a font chooser dialog to the user. // // The font chooser dialog will be set up for selecting a font // and specify features for the selected font. // // Font features affect how the font is rendered, for example // enabling glyph variants or ligatures. func (x *FontDialog) ChooseFontAndFeatures(ParentVar *Window, InitialValueVar *pango.FontDescription, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { var CallbackVarRef uintptr if CallbackVar != nil { CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar)) if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok { CallbackVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) { cbFn := *CallbackVar cbFn(arg0, arg1, arg2) } CallbackVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar) } } xFontDialogChooseFontAndFeatures(x.GoPointer(), ParentVar.GoPointer(), InitialValueVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar) } var xFontDialogChooseFontAndFeaturesFinish func(uintptr, uintptr, **pango.FontDescription, *string, **pango.Language, **glib.Error) bool // Finishes the [method@Gtk.FontDialog.choose_font_and_features] call. // // The selected font and features are returned in @font_desc and // @font_features. // // Note that this function returns a [error@Gtk.DialogError.DISMISSED] // error if the user cancels the dialog. func (x *FontDialog) ChooseFontAndFeaturesFinish(ResultVar gio.AsyncResult, FontDescVar **pango.FontDescription, FontFeaturesVar *string, LanguageVar **pango.Language) (bool, error) { var cerr *glib.Error cret := xFontDialogChooseFontAndFeaturesFinish(x.GoPointer(), ResultVar.GoPointer(), FontDescVar, FontFeaturesVar, LanguageVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xFontDialogChooseFontFinish func(uintptr, uintptr, **glib.Error) *pango.FontDescription // Finishes the [method@Gtk.FontDialog.choose_font] call. // // Note that this function returns a [error@Gtk.DialogError.DISMISSED] // error if the user cancels the dialog. func (x *FontDialog) ChooseFontFinish(ResultVar gio.AsyncResult) (*pango.FontDescription, error) { var cerr *glib.Error cret := xFontDialogChooseFontFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xFontDialogGetFilter func(uintptr) uintptr // Returns the filter that decides which fonts to display // in the font chooser dialog. func (x *FontDialog) GetFilter() *Filter { var cls *Filter cret := xFontDialogGetFilter(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Filter{} cls.Ptr = cret return cls } var xFontDialogGetFontMap func(uintptr) uintptr // Returns the fontmap from which fonts are selected, // or `NULL` for the default fontmap. func (x *FontDialog) GetFontMap() *pango.FontMap { var cls *pango.FontMap cret := xFontDialogGetFontMap(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &pango.FontMap{} cls.Ptr = cret return cls } var xFontDialogGetLanguage func(uintptr) *pango.Language // Returns the language for which font features are applied. func (x *FontDialog) GetLanguage() *pango.Language { cret := xFontDialogGetLanguage(x.GoPointer()) return cret } var xFontDialogGetModal func(uintptr) bool // Returns whether the font chooser dialog blocks interaction // with the parent window while it is presented. func (x *FontDialog) GetModal() bool { cret := xFontDialogGetModal(x.GoPointer()) return cret } var xFontDialogGetTitle func(uintptr) string // Returns the title that will be shown on the font chooser dialog. func (x *FontDialog) GetTitle() string { cret := xFontDialogGetTitle(x.GoPointer()) return cret } var xFontDialogSetFilter func(uintptr, uintptr) // Adds a filter that decides which fonts to display // in the font chooser dialog. // // The filter must be able to handle both `PangoFontFamily` // and `PangoFontFace` objects. func (x *FontDialog) SetFilter(FilterVar *Filter) { xFontDialogSetFilter(x.GoPointer(), FilterVar.GoPointer()) } var xFontDialogSetFontMap func(uintptr, uintptr) // Sets the fontmap from which fonts are selected. // // If @fontmap is `NULL`, the default fontmap is used. func (x *FontDialog) SetFontMap(FontmapVar *pango.FontMap) { xFontDialogSetFontMap(x.GoPointer(), FontmapVar.GoPointer()) } var xFontDialogSetLanguage func(uintptr, *pango.Language) // Sets the language for which font features are applied. func (x *FontDialog) SetLanguage(LanguageVar *pango.Language) { xFontDialogSetLanguage(x.GoPointer(), LanguageVar) } var xFontDialogSetModal func(uintptr, bool) // Sets whether the font chooser dialog blocks interaction // with the parent window while it is presented. func (x *FontDialog) SetModal(ModalVar bool) { xFontDialogSetModal(x.GoPointer(), ModalVar) } var xFontDialogSetTitle func(uintptr, string) // Sets the title that will be shown on the font chooser dialog. func (x *FontDialog) SetTitle(TitleVar string) { xFontDialogSetTitle(x.GoPointer(), TitleVar) } func (c *FontDialog) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *FontDialog) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyLanguage sets the "language" property. // The language for which the font features are selected. func (x *FontDialog) SetPropertyLanguage(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("language", &v) } // GetPropertyLanguage gets the "language" property. // The language for which the font features are selected. func (x *FontDialog) GetPropertyLanguage() uintptr { var v gobject.Value x.GetProperty("language", &v) return v.GetPointer() } // SetPropertyModal sets the "modal" property. // Whether the font chooser dialog is modal. func (x *FontDialog) SetPropertyModal(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("modal", &v) } // GetPropertyModal gets the "modal" property. // Whether the font chooser dialog is modal. func (x *FontDialog) GetPropertyModal() bool { var v gobject.Value x.GetProperty("modal", &v) return v.GetBoolean() } // SetPropertyTitle sets the "title" property. // A title that may be shown on the font chooser // dialog that is presented by [method@Gtk.FontDialog.choose_font]. func (x *FontDialog) SetPropertyTitle(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("title", &v) } // GetPropertyTitle gets the "title" property. // A title that may be shown on the font chooser // dialog that is presented by [method@Gtk.FontDialog.choose_font]. func (x *FontDialog) GetPropertyTitle() string { var v gobject.Value x.GetProperty("title", &v) return v.GetString() } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xFontDialogGLibType, libs, "gtk_font_dialog_get_type") core.PuregoSafeRegister(&xNewFontDialog, libs, "gtk_font_dialog_new") core.PuregoSafeRegister(&xFontDialogChooseFace, libs, "gtk_font_dialog_choose_face") core.PuregoSafeRegister(&xFontDialogChooseFaceFinish, libs, "gtk_font_dialog_choose_face_finish") core.PuregoSafeRegister(&xFontDialogChooseFamily, libs, "gtk_font_dialog_choose_family") core.PuregoSafeRegister(&xFontDialogChooseFamilyFinish, libs, "gtk_font_dialog_choose_family_finish") core.PuregoSafeRegister(&xFontDialogChooseFont, libs, "gtk_font_dialog_choose_font") core.PuregoSafeRegister(&xFontDialogChooseFontAndFeatures, libs, "gtk_font_dialog_choose_font_and_features") core.PuregoSafeRegister(&xFontDialogChooseFontAndFeaturesFinish, libs, "gtk_font_dialog_choose_font_and_features_finish") core.PuregoSafeRegister(&xFontDialogChooseFontFinish, libs, "gtk_font_dialog_choose_font_finish") core.PuregoSafeRegister(&xFontDialogGetFilter, libs, "gtk_font_dialog_get_filter") core.PuregoSafeRegister(&xFontDialogGetFontMap, libs, "gtk_font_dialog_get_font_map") core.PuregoSafeRegister(&xFontDialogGetLanguage, libs, "gtk_font_dialog_get_language") core.PuregoSafeRegister(&xFontDialogGetModal, libs, "gtk_font_dialog_get_modal") core.PuregoSafeRegister(&xFontDialogGetTitle, libs, "gtk_font_dialog_get_title") core.PuregoSafeRegister(&xFontDialogSetFilter, libs, "gtk_font_dialog_set_filter") core.PuregoSafeRegister(&xFontDialogSetFontMap, libs, "gtk_font_dialog_set_font_map") core.PuregoSafeRegister(&xFontDialogSetLanguage, libs, "gtk_font_dialog_set_language") core.PuregoSafeRegister(&xFontDialogSetModal, libs, "gtk_font_dialog_set_modal") core.PuregoSafeRegister(&xFontDialogSetTitle, libs, "gtk_font_dialog_set_title") }