Class Dialog.Builder<B extends Dialog.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Direct Known Subclasses:
AboutDialog.Builder, AlertDialog.Builder, PreferencesDialog.Builder, ShortcutsDialog.Builder
Enclosing class:
Dialog

public static class Dialog.Builder<B extends Dialog.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
1.5
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Dialog build()
      Finish building the Dialog object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Dialog.
      Overrides:
      build in class Widget.Builder<B extends Dialog.Builder<B>>
      Returns:
      a new instance of Dialog with the properties that were set in the Builder object.
    • setCanClose

      public B setCanClose(boolean canClose)

      Whether the dialog can be closed.

      If set to FALSE, the close button, shortcuts and Dialog.close() will result in Dialog::close-attempt being emitted instead, and bottom sheet close swipe will be disabled. Dialog.forceClose() still works.

      Parameters:
      canClose - the value for the can-close property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setChild

      public B setChild(Widget child)
      The child widget of the AdwDialog.
      Parameters:
      child - the value for the child property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setContentHeight

      public B setContentHeight(int contentHeight)

      The height of the dialog's contents.

      Set it to -1 to reset it to the content's natural height.

      See also: Gtk.Window:default-height

      Parameters:
      contentHeight - the value for the content-height property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setContentWidth

      public B setContentWidth(int contentWidth)

      The width of the dialog's contents.

      Set it to -1 to reset it to the content's natural width.

      See also: Gtk.Window:default-width

      Parameters:
      contentWidth - the value for the content-width property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setDefaultWidget

      public B setDefaultWidget(Widget defaultWidget)

      The default widget.

      It's activated when the user presses Enter.

      Parameters:
      defaultWidget - the value for the default-widget property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setFocusWidget

      public B setFocusWidget(Widget focusWidget)
      The focus widget.
      Parameters:
      focusWidget - the value for the focus-widget property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setFollowsContentSize

      public B setFollowsContentSize(boolean followsContentSize)

      Whether to size content automatically.

      If set to TRUE, always use the content's natural size instead of Dialog:content-width and Dialog:content-height. If the content resizes, the dialog will immediately resize as well.

      See also: Gtk.Window:resizable

      Parameters:
      followsContentSize - the value for the follows-content-size property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setPresentationMode

      public B setPresentationMode(DialogPresentationMode presentationMode)

      The dialog's presentation mode.

      When set to Adw.DialogPresentationMode.auto, the dialog appears as a bottom sheet when the following condition is met: max-width: 450px or max-height: 360px, and as a floating window otherwise.

      Set it to Adw.DialogPresentationMode.floating or Adw.DialogPresentationMode.bottom-sheet to always present it a floating window or a bottom sheet respectively, regardless of available size.

      Presentation mode does nothing for dialogs presented as a window.

      Parameters:
      presentationMode - the value for the presentation-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • setTitle

      public B setTitle(String title)
      The title of the dialog.
      Parameters:
      title - the value for the title property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
    • onCloseAttempt

      public B onCloseAttempt(Dialog.CloseAttemptCallback handler)
      Emitted when the close button or shortcut is used, or Dialog.close() is called while Dialog:can-close is set to FALSE.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
      See Also:
    • onClosed

      public B onClosed(Dialog.ClosedCallback handler)
      Emitted when the dialog is successfully closed.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.5
      See Also: