Class Widget.Builder<B extends Widget.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
,Accessible.Builder<B>
- Direct Known Subclasses:
ActionBar.Builder
,AppChooserButton.Builder
,AppChooserWidget.Builder
,AspectFrame.Builder
,Avatar.Builder
,Banner.Builder
,Bin.Builder
,BottomSheet.Builder
,Box.Builder
,BreakpointBin.Builder
,Button.Builder
,ButtonContent.Builder
,Calendar.Builder
,Carousel.Builder
,CarouselIndicatorDots.Builder
,CarouselIndicatorLines.Builder
,CellView.Builder
,CenterBox.Builder
,CheckButton.Builder
,Clamp.Builder
,ClampScrollable.Builder
,ColorButton.Builder
,ColorChooserWidget.Builder
,ColorDialogButton.Builder
,ColumnView.Builder
,ComboBox.Builder
,CompletionCell.Builder
,Dialog.Builder
,DragIcon.Builder
,DrawingArea.Builder
,DropDown.Builder
,EditableLabel.Builder
,Entry.Builder
,Expander.Builder
,FileChooserWidget.Builder
,Fixed.Builder
,Flap.Builder
,FlowBox.Builder
,FlowBoxChild.Builder
,FontButton.Builder
,FontChooserWidget.Builder
,FontDialogButton.Builder
,Frame.Builder
,GLArea.Builder
,GraphicsOffload.Builder
,Grid.Builder
,Gutter.Builder
,GutterRenderer.Builder
,HeaderBar.Builder
,HeaderBar.Builder
,HoverDisplay.Builder
,IconView.Builder
,Image.Builder
,InfoBar.Builder
,Inscription.Builder
,Label.Builder
,LayoutSlot.Builder
,Leaflet.Builder
,LevelBar.Builder
,ListBase.Builder
,ListBox.Builder
,ListBoxRow.Builder
,MediaControls.Builder
,MenuButton.Builder
,MultiLayoutView.Builder
,NavigationPage.Builder
,NavigationSplitView.Builder
,NavigationView.Builder
,Notebook.Builder
,Overlay.Builder
,OverlaySplitView.Builder
,Paned.Builder
,PasswordEntry.Builder
,Picture.Builder
,Popover.Builder
,PopoverMenuBar.Builder
,PreferencesGroup.Builder
,PreferencesPage.Builder
,ProgressBar.Builder
,Range.Builder
,Revealer.Builder
,ScaleButton.Builder
,Scrollbar.Builder
,ScrolledWindow.Builder
,SearchBar.Builder
,SearchEntry.Builder
,Separator.Builder
,ShortcutLabel.Builder
,ShortcutsShortcut.Builder
,SpinButton.Builder
,Spinner.Builder
,Spinner.Builder
,SplitButton.Builder
,Squeezer.Builder
,Stack.Builder
,StackSidebar.Builder
,StackSwitcher.Builder
,Statusbar.Builder
,StatusPage.Builder
,StyleSchemeChooserWidget.Builder
,StyleSchemePreview.Builder
,Switch.Builder
,TabBar.Builder
,TabButton.Builder
,TabOverview.Builder
,TabView.Builder
,Text.Builder
,TextView.Builder
,ToastOverlay.Builder
,ToolbarView.Builder
,TreeExpander.Builder
,TreeView.Builder
,Video.Builder
,Viewport.Builder
,ViewStack.Builder
,ViewSwitcher.Builder
,ViewSwitcherBar.Builder
,ViewSwitcherTitle.Builder
,WebViewBase.Builder
,Window.Builder
,WindowControls.Builder
,WindowHandle.Builder
,WindowTitle.Builder
- Enclosing class:
Widget
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theWidget
object.onDestroy
(Widget.DestroyCallback handler) Signals that all holders of a reference to the widget should release the reference that they hold.Emitted when the text direction of a widget changes.onHide
(Widget.HideCallback handler) Emitted whenwidget
is hidden.Emitted if keyboard navigation fails.onMap
(Widget.MapCallback handler) Emitted whenwidget
is going to be mapped.Emitted when a widget is activated via a mnemonic.onMoveFocus
(Widget.MoveFocusCallback handler) Emitted when the focus is moved.Emitted when the widget’s tooltip is about to be shown.onRealize
(Widget.RealizeCallback handler) Emitted whenwidget
is associated with aGdkSurface
.onShow
(Widget.ShowCallback handler) Emitted whenwidget
is shown.Emitted when the widget state changes.onUnmap
(Widget.UnmapCallback handler) Emitted whenwidget
is going to be unmapped.onUnrealize
(Widget.UnrealizeCallback handler) Emitted when theGdkSurface
associated withwidget
is destroyed.setCanFocus
(boolean canFocus) Whether the widget or any of its descendents can accept the input focus.setCanTarget
(boolean canTarget) Whether the widget can receive pointer events.setCssClasses
(String[] cssClasses) A list of css classes applied to this widget.setCssName
(String cssName) The name of this widget in the CSS tree.The cursor used bywidget
.setFocusable
(boolean focusable) Whether this widget itself will accept the input focus.setFocusOnClick
(boolean focusOnClick) Whether the widget should grab focus when it is clicked with the mouse.How to distribute horizontal space if widget gets extra space.setHasTooltip
(boolean hasTooltip) Enables or disables the emission of the ::query-tooltip signal onwidget
.setHeightRequest
(int heightRequest) Override for height request of the widget.setHexpand
(boolean hexpand) Whether to expand horizontally.setHexpandSet
(boolean hexpandSet) Whether to use thehexpand
property.setLayoutManager
(LayoutManager layoutManager) TheGtkLayoutManager
instance to use to compute the preferred size of the widget, and allocate its children.setMarginBottom
(int marginBottom) Margin on bottom side of widget.setMarginEnd
(int marginEnd) Margin on end of widget, horizontally.setMarginStart
(int marginStart) Margin on start of widget, horizontally.setMarginTop
(int marginTop) Margin on top side of widget.The name of the widget.setOpacity
(double opacity) The requested opacity of the widget.setOverflow
(Overflow overflow) How content outside the widget's content area is treated.setReceivesDefault
(boolean receivesDefault) Whether the widget will receive the default action when it is focused.setSensitive
(boolean sensitive) Whether the widget responds to input.setTooltipMarkup
(String tooltipMarkup) Sets the text of tooltip to be the given string, which is marked up with Pango markup.setTooltipText
(String tooltipText) Sets the text of tooltip to be the given string.How to distribute vertical space if widget gets extra space.setVexpand
(boolean vexpand) Whether to expand vertically.setVexpandSet
(boolean vexpandSet) Whether to use thevexpand
property.setVisible
(boolean visible) Whether the widget is visible.setWidthRequest
(int widthRequest) Override for width request of the widget.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theWidget
object. 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 toWidget
.- Overrides:
build
in classInitiallyUnowned.Builder<B extends Widget.Builder<B>>
- Returns:
- a new instance of
Widget
with the properties that were set in the Builder object.
-
setCanFocus
Whether the widget or any of its descendents can accept the input focus.This property is meant to be set by widget implementations, typically in their instance init function.
- Parameters:
canFocus
- the value for thecan-focus
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCanTarget
Whether the widget can receive pointer events.- Parameters:
canTarget
- the value for thecan-target
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCssClasses
-
setCssName
The name of this widget in the CSS tree.This property is meant to be set by widget implementations, typically in their instance init function.
- Parameters:
cssName
- the value for thecss-name
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCursor
-
setFocusOnClick
Whether the widget should grab focus when it is clicked with the mouse.This property is only relevant for widgets that can take focus.
- Parameters:
focusOnClick
- the value for thefocus-on-click
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setFocusable
Whether this widget itself will accept the input focus.- Parameters:
focusable
- the value for thefocusable
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHalign
-
setHasTooltip
Enables or disables the emission of the ::query-tooltip signal onwidget
.A value of
true
indicates thatwidget
can have a tooltip, in this case the widget will be queried usingGtk.Widget::query-tooltip
to determine whether it will provide a tooltip or not.- Parameters:
hasTooltip
- the value for thehas-tooltip
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHeightRequest
Override for height request of the widget.If this is -1, the natural request will be used.
- Parameters:
heightRequest
- the value for theheight-request
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHexpand
Whether to expand horizontally.- Parameters:
hexpand
- the value for thehexpand
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setHexpandSet
Whether to use thehexpand
property.- Parameters:
hexpandSet
- the value for thehexpand-set
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setLayoutManager
TheGtkLayoutManager
instance to use to compute the preferred size of the widget, and allocate its children.This property is meant to be set by widget implementations, typically in their instance init function.
- Parameters:
layoutManager
- the value for thelayout-manager
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMarginBottom
Margin on bottom side of widget.This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from
Widget.setSizeRequest(int, int)
for example.- Parameters:
marginBottom
- the value for themargin-bottom
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMarginEnd
Margin on end of widget, horizontally.This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from
Widget.setSizeRequest(int, int)
for example.- Parameters:
marginEnd
- the value for themargin-end
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMarginStart
Margin on start of widget, horizontally.This property supports left-to-right and right-to-left text directions.
This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from
Widget.setSizeRequest(int, int)
for example.- Parameters:
marginStart
- the value for themargin-start
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setMarginTop
Margin on top side of widget.This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from
Widget.setSizeRequest(int, int)
for example.- Parameters:
marginTop
- the value for themargin-top
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setName
-
setOpacity
The requested opacity of the widget.- Parameters:
opacity
- the value for theopacity
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setOverflow
How content outside the widget's content area is treated.This property is meant to be set by widget implementations, typically in their instance init function.
- Parameters:
overflow
- the value for theoverflow
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setReceivesDefault
Whether the widget will receive the default action when it is focused.- Parameters:
receivesDefault
- the value for thereceives-default
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setSensitive
Whether the widget responds to input.- Parameters:
sensitive
- the value for thesensitive
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTooltipMarkup
Sets the text of tooltip to be the given string, which is marked up with Pango markup.Also see
Tooltip.setMarkup(java.lang.String)
.This is a convenience property which will take care of getting the tooltip shown if the given string is not
null
:Gtk.Widget:has-tooltip
will automatically be set totrue
and there will be taken care ofGtk.Widget::query-tooltip
in the default signal handler.Note that if both
Gtk.Widget:tooltip-text
andGtk.Widget:tooltip-markup
are set, the last one wins.- Parameters:
tooltipMarkup
- the value for thetooltip-markup
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTooltipText
Sets the text of tooltip to be the given string.Also see
Tooltip.setText(java.lang.String)
.This is a convenience property which will take care of getting the tooltip shown if the given string is not
null
:Gtk.Widget:has-tooltip
will automatically be set totrue
and there will be taken care ofGtk.Widget::query-tooltip
in the default signal handler.Note that if both
Gtk.Widget:tooltip-text
andGtk.Widget:tooltip-markup
are set, the last one wins.- Parameters:
tooltipText
- the value for thetooltip-text
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setValign
-
setVexpand
Whether to expand vertically.- Parameters:
vexpand
- the value for thevexpand
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setVexpandSet
Whether to use thevexpand
property.- Parameters:
vexpandSet
- the value for thevexpand-set
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setVisible
Whether the widget is visible.- Parameters:
visible
- the value for thevisible
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setWidthRequest
Override for width request of the widget.If this is -1, the natural request will be used.
- Parameters:
widthRequest
- the value for thewidth-request
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onDestroy
Signals that all holders of a reference to the widget should release the reference that they hold.May result in finalization of the widget if all references are released.
This signal is not suitable for saving widget state.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDirectionChanged
Emitted when the text direction of a widget changes.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onHide
Emitted whenwidget
is hidden.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onMap
Emitted whenwidget
is going to be mapped.A widget is mapped when the widget is visible (which is controlled with
Gtk.Widget:visible
) and all its parents up to the toplevel widget are also visible.The ::map signal can be used to determine whether a widget will be drawn, for instance it can resume an animation that was stopped during the emission of
Gtk.Widget::unmap
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onMnemonicActivate
Emitted when a widget is activated via a mnemonic.The default handler for this signal activates
widget
ifgroupCycling
isfalse
, or just makeswidget
grab focus ifgroupCycling
istrue
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onMoveFocus
Emitted when the focus is moved.The ::move-focus signal is a keybinding signal.
The default bindings for this signal are
Tab
to move forward, andShift
+Tab
to move backward.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onQueryTooltip
Emitted when the widget’s tooltip is about to be shown.This happens when the
Gtk.Widget:has-tooltip
property istrue
and the hover timeout has expired with the cursor hovering "above"widget
; or emitted whenwidget
got focus in keyboard mode.Using the given coordinates, the signal handler should determine whether a tooltip should be shown for
widget
. If this is the casetrue
should be returned,false
otherwise. Note that ifkeyboardMode
istrue
, the values ofx
andy
are undefined and should not be used.The signal handler is free to manipulate
tooltip
with the therefore destined function calls.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onRealize
Emitted whenwidget
is associated with aGdkSurface
.This means that
Widget.realize()
has been called or the widget has been mapped (that is, it is going to be drawn).- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onShow
Emitted whenwidget
is shown.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onStateFlagsChanged
Emitted when the widget state changes.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onUnmap
Emitted whenwidget
is going to be unmapped.A widget is unmapped when either it or any of its parents up to the toplevel widget have been set as hidden.
As ::unmap indicates that a widget will not be shown any longer, it can be used to, for example, stop an animation on the widget.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onUnrealize
Emitted when theGdkSurface
associated withwidget
is destroyed.This means that
Widget.unrealize()
has been called or the widget has been unmapped (that is, it is going to be hidden).- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-