Class Application

All Implemented Interfaces:
ActionGroup, ActionMap, Proxy

@Generated("org.javagi.JavaGI") public class Application extends Application implements ActionGroup, ActionMap

A base class for Adwaita applications.

AdwApplication handles library initialization by calling Adw.init() in the default Gio.Application::startup signal handler, in turn chaining up as required by Application. Therefore, any subclass of AdwApplication should always chain up its startup handler before using any Adwaita or GTK API.

Automatic Resources

AdwApplication will automatically load certain resources located in the application's resource base path (see Application#setResourceBasePath, if they're present.

Shortcuts Dialog

If there's a resource located at shortcuts-dialog.ui which defines an ShortcutsDialog with the ID shortcuts_dialog, AdwApplication will set up an app.shortcuts action that creates and presents this dialog, as well as a Ctrl? accelerator for it.

Stylesheet

If there's a resource located at style.css, AdwApplication will load styles from it. This can be used to add custom styles to the application.

Additional styles (deprecated)

AdwApplication will also load the following stylesheets conditionally:

  • style-dark.css when StyleManager:dark is TRUE.

  • style-hc.css when the system high contrast preference is enabled.

  • style-hc-dark.css when the system high contrast preference is enabled and StyleManager:dark is TRUE.

:::warning These resources are deprecated since 1.9.

Use `style.css` with the following media queries instead:

- `prefers-color-scheme: dark` for styles used only for dark appearance.
- `prefers-contrast: more` for styles used only when the system high
  contrast preference is enabled.
  • Constructor Details

    • Application

      public Application(MemorySegment address)
      Create a Application instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Application

      public Application(@Nullable String applicationId, Set<ApplicationFlags> flags)

      Creates a new AdwApplication.

      If application_id is not NULL, then it must be valid. See Application#idIsValid.

      If no application ID is given then some features (most notably application uniqueness) will be disabled.

      Parameters:
      applicationId - The application ID
      flags - The application flags
    • Application

      public Application(@Nullable String applicationId, ApplicationFlags... flags)

      Creates a new AdwApplication.

      If application_id is not NULL, then it must be valid. See Application#idIsValid.

      If no application ID is given then some features (most notably application uniqueness) will be disabled.

      Parameters:
      applicationId - The application ID
      flags - The application flags
    • Application

      public Application()
      Create a new Application.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Application class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected Application asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Application
      Returns:
      the instance as if it were its parent type
    • getStyleManager

      public StyleManager getStyleManager()

      Gets the style manager for self.

      This is a convenience property allowing to access AdwStyleManager through property bindings or expressions.

      Returns:
      the style manager
    • builder

      public static Application.Builder<? extends Application.Builder> builder()
      A Application.Builder object constructs a Application with the specified properties. Use the various set...() methods to set properties, and finish construction with Application.Builder.build().
      Returns:
      the builder object