Class Dialog
- All Implemented Interfaces:
Accessible,Buildable,ConstraintTarget,ShortcutManager,Proxy
- Direct Known Subclasses:
AboutDialog,AlertDialog,PreferencesDialog,ShortcutsDialog
AdwDialog is similar to a window, but is shown within another window. It
can be used with Window and ApplicationWindow, use
present(org.gnome.gtk.Widget) to show it.
AdwDialog is not resizable. Use the Dialog:content-width and
Dialog:content-height properties to set its size, or set
Dialog:follows-content-size to TRUE to make the dialog track the
content's size as it changes. AdwDialog can never be larger than its parent
window.
AdwDialog can be presented as a centered floating window or a bottom sheet.
By default it's automatic depending on the available size.
Dialog:presentation-mode can be used to change that.
AdwDialog can be closed via close().
When presented as a bottom sheet, AdwDialog can also be closed via swiping
it down.
The Dialog:can-close can be used to prevent closing. In that case,
Dialog::close-attempt gets emitted instead.
Use forceClose() to close the dialog even when can-close is set to
FALSE.
AdwDialog is transient and doesn't integrate with the window below it, for
example it's not possible to collapse it into a bottom bar. See
BottomSheet for persistent and more tightly integrated bottom sheets.
Header Bar Integration
When placed inside an AdwDialog, HeaderBar will display the dialog
title instead of window title. It will also adjust the decoration layout to
ensure it always has a close button and nothing else. Set
HeaderBar:show-start-title-buttons and
HeaderBar:show-end-title-buttons to FALSE to remove it if it's
unwanted.
Breakpoints
AdwDialog can be used with Breakpoint the same way as
BreakpointBin. Refer to that widget's documentation for details.
Like AdwBreakpointBin, if breakpoints are used, AdwDialog doesn't have a
minimum size, and Gtk.Widget:width-request and
Gtk.Widget:height-request properties must be set manually.
- Since:
- 1.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDialog.Builder<B extends Dialog.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theCloseAttemptCallbackcallback.static interfaceFunctional interface declaration of theClosedCallbackcallback.static classNested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.ShortcutManager
ShortcutManager.ShortcutManager$Impl, ShortcutManager.ShortcutManagerInterface -
Constructor Summary
ConstructorsConstructorDescriptionDialog()Creates a new Dialog.Dialog(MemorySegment address) Create a Dialog proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBreakpoint(Breakpoint breakpoint) Addsbreakpointtoself.protected DialogasParent()Returns this instance as if it were its parent type.static Dialog.Builder<? extends Dialog.Builder> builder()ADialog.Builderobject constructs aDialogwith the specified properties.booleanclose()Attempts to closeself.protected voidprotected voidclosed()voidEmits the "close-attempt" signal.voidEmits the "closed" signal.voidClosesself.booleanGets whether this Dialog can be closed.@Nullable WidgetgetChild()Gets the child widget ofself.intGets the height of the dialog's contents.intGets the width of the dialog's contents.@Nullable BreakpointGets the current breakpoint.@Nullable WidgetGets the default widget forself.@Nullable WidgetgetFocus()Gets the focus widget forself.booleanGets whether to size content of this Dialog automatically.static MemoryLayoutThe memory layout of the native struct.Gets presentation mode forself.getTitle()Gets the title ofself.static @Nullable TypegetType()Get the GType of the Dialog classEmitted when the close button or shortcut is used, orclose()is called whileDialog:can-closeis set toFALSE.onClosed(Dialog.ClosedCallback handler) Emitted when the dialog is successfully closed.voidPresents this Dialog withinparent'swindow.voidsetCanClose(boolean canClose) Sets whether this Dialog can be closed.voidSets the child widget ofself.voidsetContentHeight(int contentHeight) Sets the height of the dialog's contents.voidsetContentWidth(int contentWidth) Sets the width of the dialog's contents.voidsetDefaultWidget(@Nullable Widget defaultWidget) Sets the default widget forself.voidSets the focus widget forself.voidsetFollowsContentSize(boolean followsContentSize) Sets whether to size content of this Dialog automatically.voidsetPresentationMode(DialogPresentationMode presentationMode) Sets presentation mode forself.voidSets the title ofself.Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlagsMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
Dialog
Create a Dialog proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Dialog
public Dialog()Creates a new Dialog.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
addBreakpoint
Addsbreakpointtoself.- Parameters:
breakpoint- the breakpoint to add- Since:
- 1.5
-
close
public boolean close()Attempts to closeself.If the
Dialog:can-closeproperty is set toFALSE, theDialog::close-attemptsignal is emitted.See also:
forceClose().- Returns:
- whether this Dialog was successfully closed
- Since:
- 1.5
-
forceClose
public void forceClose()Closesself.Unlike
close(), it succeeds even ifDialog:can-closeis set toFALSE.- Since:
- 1.5
-
getCanClose
public boolean getCanClose()Gets whether this Dialog can be closed.- Returns:
- whether the dialog can be closed
- Since:
- 1.5
-
getChild
Gets the child widget ofself.- Returns:
- the child widget of this Dialog
- Since:
- 1.5
-
getContentHeight
public int getContentHeight()Gets the height of the dialog's contents.- Returns:
- the content height
- Since:
- 1.5
-
getContentWidth
public int getContentWidth()Gets the width of the dialog's contents.- Returns:
- the content width
- Since:
- 1.5
-
getCurrentBreakpoint
Gets the current breakpoint.- Returns:
- the current breakpoint
- Since:
- 1.5
-
getDefaultWidget
Gets the default widget forself.- Returns:
- the default widget
- Since:
- 1.5
-
getFocus
Gets the focus widget forself.- Returns:
- the focus widget
- Since:
- 1.5
-
getFollowsContentSize
public boolean getFollowsContentSize()Gets whether to size content of this Dialog automatically.- Returns:
- whether to size content automatically
- Since:
- 1.5
-
getPresentationMode
Gets presentation mode forself.- Returns:
- the presentation mode
- Since:
- 1.5
-
getTitle
-
present
Presents this Dialog withinparent'swindow.If this Dialog is already shown, raises it to the top instead.
If the window is an
WindoworApplicationWindow, the dialog will be shown within it. Otherwise, it will be a separate window.- Parameters:
parent- a widget within the toplevel- Since:
- 1.5
-
setCanClose
public void setCanClose(boolean canClose) Sets whether this Dialog can be closed.If set to
FALSE, the close button, shortcuts andclose()will result inDialog::close-attemptbeing emitted instead, and bottom sheet close swipe will be disabled.forceClose()still works.- Parameters:
canClose- whether to allow closing- Since:
- 1.5
-
setChild
Sets the child widget ofself.- Parameters:
child- the child widget- Since:
- 1.5
-
setContentHeight
public void setContentHeight(int contentHeight) Sets 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 content height- Since:
- 1.5
-
setContentWidth
public void setContentWidth(int contentWidth) Sets 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 content width- Since:
- 1.5
-
setDefaultWidget
Sets the default widget forself.It's activated when the user presses Enter.
- Parameters:
defaultWidget- the default widget- Since:
- 1.5
-
setFocus
Sets the focus widget forself.If
focusis not the current focus widget, and is focusable, sets it as the focus widget for the dialog.If focus is
NULL, unsets the focus widget for this dialog. To set the focus to a particular widget in the dialog, it is usually more convenient to useWidget.grabFocus()instead of this function.- Parameters:
focus- the focus widget- Since:
- 1.5
-
setFollowsContentSize
public void setFollowsContentSize(boolean followsContentSize) Sets whether to size content of this Dialog automatically.If set to
TRUE, always use the content's natural size instead ofDialog:content-widthandDialog:content-height. If the content resizes, the dialog will immediately resize as well.See also:
Gtk.Window:resizable- Parameters:
followsContentSize- whether to size content automatically- Since:
- 1.5
-
setPresentationMode
Sets presentation mode forself.When set to
ADW_DIALOG_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_DIALOG_FLOATINGorADW_DIALOG_BOTTOM_SHEETto 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 new presentation mode- Since:
- 1.5
-
setTitle
Sets the title ofself.- Parameters:
title- the new title- Since:
- 1.5
-
closeAttempt
protected void closeAttempt() -
closed
protected void closed() -
onCloseAttempt
public SignalConnection<Dialog.CloseAttemptCallback> onCloseAttempt(Dialog.CloseAttemptCallback handler) Emitted when the close button or shortcut is used, orclose()is called whileDialog:can-closeis set toFALSE.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.5
- See Also:
-
emitCloseAttempt
public void emitCloseAttempt()Emits the "close-attempt" signal. SeeonCloseAttempt(org.gnome.adw.Dialog.CloseAttemptCallback). -
onClosed
Emitted when the dialog is successfully closed.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 1.5
- See Also:
-
emitClosed
public void emitClosed()Emits the "closed" signal. SeeonClosed(org.gnome.adw.Dialog.ClosedCallback). -
builder
ADialog.Builderobject constructs aDialogwith the specified properties. Use the variousset...()methods to set properties, and finish construction withDialog.Builder.build().- Returns:
- the builder object
-