// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT package adw import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type StyleManagerClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *StyleManagerClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Application color schemes for [property@StyleManager:color-scheme]. type ColorScheme int var xColorSchemeGLibType func() types.GType func ColorSchemeGLibType() types.GType { return xColorSchemeGLibType() } const ( // Inherit the parent color-scheme. When set on the // `AdwStyleManager` returned by [func@StyleManager.get_default], it's // equivalent to `ADW_COLOR_SCHEME_PREFER_LIGHT`. ColorSchemeDefaultValue ColorScheme = 0 // Always use light appearance. ColorSchemeForceLightValue ColorScheme = 1 // Use light appearance unless the system // prefers dark colors. ColorSchemePreferLightValue ColorScheme = 2 // Use dark appearance unless the system prefers // prefers light colors. ColorSchemePreferDarkValue ColorScheme = 3 // Always use dark appearance. ColorSchemeForceDarkValue ColorScheme = 4 ) // A class for managing application-wide styling. // // `AdwStyleManager` provides a way to query and influence the application // styles, such as whether to use dark style, the system accent color or high // contrast appearance. // // It allows to set the color scheme via the // [property@StyleManager:color-scheme] property, and to query the current // appearance, as well as whether a system-wide color scheme and accent color // preferences exists. type StyleManager struct { gobject.Object } var xStyleManagerGLibType func() types.GType func StyleManagerGLibType() types.GType { return xStyleManagerGLibType() } func StyleManagerNewFromInternalPtr(ptr uintptr) *StyleManager { cls := &StyleManager{} cls.Ptr = ptr return cls } var xStyleManagerGetAccentColor func(uintptr) AccentColor // Gets the current system accent color. // // See also [property@StyleManager:accent-color-rgba]. func (x *StyleManager) GetAccentColor() AccentColor { cret := xStyleManagerGetAccentColor(x.GoPointer()) return cret } var xStyleManagerGetAccentColorRgba func(uintptr) *gdk.RGBA // Gets the current system accent color as a `GdkRGBA`. // // Equivalent to calling [func@AccentColor.to_rgba] on the value of // [property@StyleManager:accent-color]. // // This is a background color. The matching foreground color is white. func (x *StyleManager) GetAccentColorRgba() *gdk.RGBA { cret := xStyleManagerGetAccentColorRgba(x.GoPointer()) return cret } var xStyleManagerGetColorScheme func(uintptr) ColorScheme // Gets the requested application color scheme. func (x *StyleManager) GetColorScheme() ColorScheme { cret := xStyleManagerGetColorScheme(x.GoPointer()) return cret } var xStyleManagerGetDark func(uintptr) bool // Gets whether the application is using dark appearance. // // This can be used to query the current appearance, as requested via // [property@StyleManager:color-scheme]. func (x *StyleManager) GetDark() bool { cret := xStyleManagerGetDark(x.GoPointer()) return cret } var xStyleManagerGetDisplay func(uintptr) uintptr // Gets the display the style manager is associated with. // // The display will be `NULL` for the style manager returned by // [func@StyleManager.get_default]. func (x *StyleManager) GetDisplay() *gdk.Display { var cls *gdk.Display cret := xStyleManagerGetDisplay(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gdk.Display{} cls.Ptr = cret return cls } var xStyleManagerGetDocumentFontName func(uintptr) string // Gets the system document font. // // The font is in the same format as [property@Gtk.Settings:gtk-font-name], // e.g. "Adwaita Sans 12". // // Use [func@Pango.FontDescription.from_string] to parse it. func (x *StyleManager) GetDocumentFontName() string { cret := xStyleManagerGetDocumentFontName(x.GoPointer()) return cret } var xStyleManagerGetHighContrast func(uintptr) bool // Gets whether the application is using high contrast appearance. // // This cannot be overridden by applications. func (x *StyleManager) GetHighContrast() bool { cret := xStyleManagerGetHighContrast(x.GoPointer()) return cret } var xStyleManagerGetMonospaceFontName func(uintptr) string // Gets the system monospace font. // // The font is in the same format as [property@Gtk.Settings:gtk-font-name], // e.g. "Adwaita Mono 11". // // Use [func@Pango.FontDescription.from_string] to parse it. func (x *StyleManager) GetMonospaceFontName() string { cret := xStyleManagerGetMonospaceFontName(x.GoPointer()) return cret } var xStyleManagerGetSystemSupportsAccentColors func(uintptr) bool // Gets whether the system supports accent colors. // // This can be used to check if the current environment provides an accent color // preference. For example, applications might want to show a preference for // choosing accent color if it's set to `FALSE`. // // See [property@StyleManager:accent-color]. func (x *StyleManager) GetSystemSupportsAccentColors() bool { cret := xStyleManagerGetSystemSupportsAccentColors(x.GoPointer()) return cret } var xStyleManagerGetSystemSupportsColorSchemes func(uintptr) bool // Gets whether the system supports color schemes. // // This can be used to check if the current environment provides a color scheme // preference. For example, applications might want to show a separate // appearance switcher if it's set to `FALSE`. func (x *StyleManager) GetSystemSupportsColorSchemes() bool { cret := xStyleManagerGetSystemSupportsColorSchemes(x.GoPointer()) return cret } var xStyleManagerSetColorScheme func(uintptr, ColorScheme) // Sets the requested application color scheme. // // The effective appearance will be decided based on the application color // scheme and the system preferred color scheme. The // [property@StyleManager:dark] property can be used to query the current // effective appearance. // // The `ADW_COLOR_SCHEME_PREFER_LIGHT` color scheme results in the application // using light appearance unless the system prefers dark colors. This is the // default value. // // The `ADW_COLOR_SCHEME_PREFER_DARK` color scheme results in the application // using dark appearance, but can still switch to the light appearance if the // system can prefers it, for example, when the high contrast preference is // enabled. // // The `ADW_COLOR_SCHEME_FORCE_LIGHT` and `ADW_COLOR_SCHEME_FORCE_DARK` values // ignore the system preference entirely. They are useful if the application // wants to match its UI to its content or to provide a separate color scheme // switcher. // // If a per-[class@Gdk.Display] style manager has its color scheme set to // `ADW_COLOR_SCHEME_DEFAULT`, it will inherit the color scheme from the // default style manager. // // For the default style manager, `ADW_COLOR_SCHEME_DEFAULT` is equivalent to // `ADW_COLOR_SCHEME_PREFER_LIGHT`. // // The [property@StyleManager:system-supports-color-schemes] property can be // used to check if the current environment provides a color scheme // preference. func (x *StyleManager) SetColorScheme(ColorSchemeVar ColorScheme) { xStyleManagerSetColorScheme(x.GoPointer(), ColorSchemeVar) } func (c *StyleManager) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *StyleManager) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // GetPropertyAccentColorRgba gets the "accent-color-rgba" property. // The current system accent color as a `GdkRGBA`. // // Equivalent to calling [func@AccentColor.to_rgba] on the value of // [property@StyleManager:accent-color]. // // This is a background color. The matching foreground color is white. func (x *StyleManager) GetPropertyAccentColorRgba() uintptr { var v gobject.Value x.GetProperty("accent-color-rgba", &v) return v.GetPointer() } // GetPropertyDark gets the "dark" property. // Whether the application is using dark appearance. // // This property can be used to query the current appearance, as requested via // [property@StyleManager:color-scheme]. func (x *StyleManager) GetPropertyDark() bool { var v gobject.Value x.GetProperty("dark", &v) return v.GetBoolean() } // GetPropertyDocumentFontName gets the "document-font-name" property. // The system document font. // // The font is in the same format as [property@Gtk.Settings:gtk-font-name], // e.g. "Adwaita Sans 12". // // Use [func@Pango.FontDescription.from_string] to parse it. func (x *StyleManager) GetPropertyDocumentFontName() string { var v gobject.Value x.GetProperty("document-font-name", &v) return v.GetString() } // GetPropertyHighContrast gets the "high-contrast" property. // Whether the application is using high contrast appearance. // // This cannot be overridden by applications. func (x *StyleManager) GetPropertyHighContrast() bool { var v gobject.Value x.GetProperty("high-contrast", &v) return v.GetBoolean() } // GetPropertyMonospaceFontName gets the "monospace-font-name" property. // The system monospace font. // // The font is in the same format as [property@Gtk.Settings:gtk-font-name], // e.g. "Adwaita Mono 11". // // Use [func@Pango.FontDescription.from_string] to parse it. func (x *StyleManager) GetPropertyMonospaceFontName() string { var v gobject.Value x.GetProperty("monospace-font-name", &v) return v.GetString() } // GetPropertySystemSupportsAccentColors gets the "system-supports-accent-colors" property. // Whether the system supports accent colors. // // This property can be used to check if the current environment provides an // accent color preference. For example, applications might want to show a // preference for choosing accent color if it's set to `FALSE`. // // See [property@StyleManager:accent-color]. func (x *StyleManager) GetPropertySystemSupportsAccentColors() bool { var v gobject.Value x.GetProperty("system-supports-accent-colors", &v) return v.GetBoolean() } // GetPropertySystemSupportsColorSchemes gets the "system-supports-color-schemes" property. // Whether the system supports color schemes. // // This property can be used to check if the current environment provides a // color scheme preference. For example, applications might want to show a // separate appearance switcher if it's set to `FALSE`. // // See [property@StyleManager:color-scheme]. func (x *StyleManager) GetPropertySystemSupportsColorSchemes() bool { var v gobject.Value x.GetProperty("system-supports-color-schemes", &v) return v.GetBoolean() } var xStyleManagerGetDefault func() uintptr // Gets the default `AdwStyleManager` instance. // // It manages all [class@Gdk.Display] instances unless the style manager for // that display has an override. // // See [func@StyleManager.get_for_display]. func StyleManagerGetDefault() *StyleManager { var cls *StyleManager cret := xStyleManagerGetDefault() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &StyleManager{} cls.Ptr = cret return cls } var xStyleManagerGetForDisplay func(uintptr) uintptr // Gets the `AdwStyleManager` instance managing @display. // // It can be used to override styles for that specific display instead of the // whole application. // // Most applications should use [func@StyleManager.get_default] instead. func StyleManagerGetForDisplay(DisplayVar *gdk.Display) *StyleManager { var cls *StyleManager cret := xStyleManagerGetForDisplay(DisplayVar.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &StyleManager{} cls.Ptr = cret return cls } func init() { core.SetPackageName("ADW", "libadwaita-1") core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("ADW") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xColorSchemeGLibType, libs, "adw_color_scheme_get_type") core.PuregoSafeRegister(&xStyleManagerGLibType, libs, "adw_style_manager_get_type") core.PuregoSafeRegister(&xStyleManagerGetAccentColor, libs, "adw_style_manager_get_accent_color") core.PuregoSafeRegister(&xStyleManagerGetAccentColorRgba, libs, "adw_style_manager_get_accent_color_rgba") core.PuregoSafeRegister(&xStyleManagerGetColorScheme, libs, "adw_style_manager_get_color_scheme") core.PuregoSafeRegister(&xStyleManagerGetDark, libs, "adw_style_manager_get_dark") core.PuregoSafeRegister(&xStyleManagerGetDisplay, libs, "adw_style_manager_get_display") core.PuregoSafeRegister(&xStyleManagerGetDocumentFontName, libs, "adw_style_manager_get_document_font_name") core.PuregoSafeRegister(&xStyleManagerGetHighContrast, libs, "adw_style_manager_get_high_contrast") core.PuregoSafeRegister(&xStyleManagerGetMonospaceFontName, libs, "adw_style_manager_get_monospace_font_name") core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsAccentColors, libs, "adw_style_manager_get_system_supports_accent_colors") core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsColorSchemes, libs, "adw_style_manager_get_system_supports_color_schemes") core.PuregoSafeRegister(&xStyleManagerSetColorScheme, libs, "adw_style_manager_set_color_scheme") core.PuregoSafeRegister(&xStyleManagerGetDefault, libs, "adw_style_manager_get_default") core.PuregoSafeRegister(&xStyleManagerGetForDisplay, libs, "adw_style_manager_get_for_display") }