Interface BackendPeer

All Superinterfaces:
AutoCloseable, Backend
All Known Implementing Classes:
HeadlessBackend, LwjglBackend

public non-sealed interface BackendPeer extends Backend
What the toolkit asks of a backend below the application's view of it: the modal stack, and windows it can reach as peers. Every Backend is one, so the toolkit reaches this with of(Backend); a backend implements it.

Incubating, as the rest of this package: it may change in a minor release.

  • Method Details

    • of

      static BackendPeer of(Backend backend)
      Parameters:
      backend - any backend
      Returns:
      the same backend as a peer; every backend is one, since Backend permits no other implementation
    • createWindow

      WindowPeer createWindow(WindowConfig config)
      Creates (but does not necessarily show) a native window, as its peer. UI thread only.
      Specified by:
      createWindow in interface Backend
    • pushModal

      void pushModal(NativeWindow modal, @Nullable NativeWindow parent)
      Registers modal as an active modal window and pushes it on the modal stack. Only the topmost modal receives input; every window it locks ignores input until it closes.

      Modality scope: a non-null parent makes it window-modal, so it locks only parent (and parent's owned popups), leaving unrelated windows interactive. A null parent makes it toolkit-modal, so it locks every other window. Modals stack: with several open, only the top one is usable and the non-modal windows are released only after the whole modal stack closes. UI thread only.

    • popModal

      void popModal(NativeWindow modal)
      Removes modal from the modal stack, releasing what it locked. UI thread only.
    • pushSceneModal

      BackendPeer.SceneModalHandle pushSceneModal(NativeWindow owner, boolean toolkitScope)
      Registers an in-scene (overlay) modal hosted by owner. Unlike pushModal(limn.backend.NativeWindow, limn.backend.NativeWindow), there is no separate modal window: the overlay blocks owner's own content, so owner stays interactive, while this call blocks the same sibling windows a native modal would. toolkitScope true locks every other window; false locks only owner's owned popups. Release the returned handle when the overlay closes. UI thread only.
    • signalModalBlocked

      void signalModalBlocked()
      Gives the modal-blocked feedback (the alert sound plus a re-raise of the top modal) for an interaction the active modal ignores. The backend already does this for clicks on blocked native windows; call it for an in-scene modal's scrim so internal and native modals feel identical. UI thread only.
    • createTray

      default TrayPeer createTray(String id, TrayHost host)
      Makes the peer of a tray icon. Nothing is shown until its first TrayPeer.update(limn.backend.spi.TrayState). UI thread only.

      The default is the answer of a backend with no desktop under it: a peer that shows nothing and is never available.

      Parameters:
      id - the application's identifier for this icon: ASCII letters, digits, a dot, a hyphen and an underscore, already checked, and no other tray of this backend has it
      host - what the peer asks the menu of and tells of a click
      Returns:
      the peer
    • systemMenuBar

      default @Nullable SystemMenuBar systemMenuBar()
      The menu bar the system keeps outside the windows, where it keeps one and the application may have it.

      The default is the answer of every system but one: null, and a menu bar is drawn in its window.