Class CssProvider.Builder<B extends CssProvider.Builder<B>>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
CssProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theCssProviderobject.Signals that a parsing error occurred.setPrefersColorScheme(InterfaceColorScheme prefersColorScheme) Define the color scheme used for rendering the user interface.setPrefersContrast(InterfaceContrast prefersContrast) Define the contrast mode to use for the user interface.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theCssProviderobject. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])to create a new GObject instance, which is then cast toCssProvider.- Overrides:
buildin classGObject.Builder<B extends CssProvider.Builder<B>>- Returns:
- a new instance of
CssProviderwith the properties that were set in the Builder object.
-
setPrefersColorScheme
Define the color scheme used for rendering the user interface.The UI can be set to either
Gtk.InterfaceColorScheme.LIGHT, orGtk.InterfaceColorScheme.DARKmode. Other values will be interpreted the same asGtk.InterfaceColorScheme.LIGHT.This setting is be available for media queries in CSS:
@media (prefers-color-scheme: dark) { // some dark mode styling }Changing this setting will cause a re-render of the style sheet.
- Parameters:
prefersColorScheme- the value for theprefers-color-schemeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 4.20
-
setPrefersContrast
Define the contrast mode to use for the user interface.When set to
Gtk.InterfaceContrast.MOREorGtk.InterfaceContrast.LESS, the UI is rendered in high or low contrast.When set to
Gtk.InterfaceContrast.NO_PREFERENCE(the default), the user interface will be rendered in default mode.This setting is be available for media queries in CSS:
@media (prefers-contrast: more) { // some style with high contrast }Changing this setting will cause a re-render of the style sheet.
- Parameters:
prefersContrast- the value for theprefers-contrastproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 4.20
-
onParsingError
Signals that a parsing error occurred.The expected error values are in the
Gtk.CssParserErrorandGtk.CssParserWarningenumerations.The
path,lineandpositiondescribe the actual location of the error as accurately as possible.Parsing errors are never fatal, so the parsing will resume after the error. Errors may however cause parts of the given data or even all of it to not be parsed at all. So it is a useful idea to check that the parsing succeeds by connecting to this signal.
Errors in the
Gtk.CssParserWarningenumeration should not be treated as fatal errors.Note that this signal may be emitted at any time as the css provider may opt to defer parsing parts or all of the input to a later time than when a loading function was called.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-