Class Widget.Builder<B extends Widget.Builder<B>>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
Accessible.Builder<B>,BuilderInterface
- 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,InlineViewSwitcher.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,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,ToggleGroup.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,WrapBox.Builder
- Enclosing class:
Widget
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theWidgetobject.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 whenwidgetis hidden.Emitted if keyboard navigation fails.onMap(Widget.MapCallback handler) Emitted whenwidgetis 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 whenwidgetis associated with aGdkSurface.onShow(Widget.ShowCallback handler) Emitted whenwidgetis shown.Emitted when the widget state changes.onUnmap(Widget.UnmapCallback handler) Emitted whenwidgetis going to be unmapped.onUnrealize(Widget.UnrealizeCallback handler) Emitted when theGdkSurfaceassociated withwidgetis 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 theGtk.Widget::query-tooltipsignal onwidget.setHeightRequest(int heightRequest) Overrides for height request of the widget.setHexpand(boolean hexpand) Whether to expand horizontally.setHexpandSet(boolean hexpandSet) Whether to use thehexpandproperty.setLayoutManager(LayoutManager layoutManager) TheLayoutManagerinstance to use to compute the preferred size of the widget, and allocate its children.setLimitEvents(boolean limitEvents) Makes this widget act like a modal dialog, with respect to event delivery.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 thevexpandproperty.setVisible(boolean visible) Whether the widget is visible.setWidthRequest(int widthRequest) Overrides for width request of the widget.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRoleMethods inherited from interface org.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theWidgetobject. 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:
buildin classInitiallyUnowned.Builder<B extends Widget.Builder<B>>- Returns:
- a new instance of
Widgetwith 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-focusproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setCanTarget
Whether the widget can receive pointer events.- Parameters:
canTarget- the value for thecan-targetproperty- Returns:
- the
Builderinstance 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-nameproperty- Returns:
- the
Builderinstance 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-clickproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setFocusable
Whether this widget itself will accept the input focus.- Parameters:
focusable- the value for thefocusableproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setHalign
-
setHasTooltip
Enables or disables the emission of theGtk.Widget::query-tooltipsignal onwidget.A true value indicates that
widgetcan have a tooltip, in this case the widget will be queried usingGtk.Widget::query-tooltipto determine whether it will provide a tooltip or not.- Parameters:
hasTooltip- the value for thehas-tooltipproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setHeightRequest
Overrides for height request of the widget.If this is -1, the natural request will be used.
- Parameters:
heightRequest- the value for theheight-requestproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setHexpand
Whether to expand horizontally.- Parameters:
hexpand- the value for thehexpandproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setHexpandSet
Whether to use thehexpandproperty.- Parameters:
hexpandSet- the value for thehexpand-setproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setLayoutManager
TheLayoutManagerinstance 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-managerproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setLimitEvents
Makes this widget act like a modal dialog, with respect to event delivery.Global event controllers will not handle events with targets inside the widget, unless they are set up to ignore propagation limits. See
EventController.setPropagationLimit(org.gnome.gtk.PropagationLimit).- Parameters:
limitEvents- the value for thelimit-eventsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 4.18
-
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-bottomproperty- Returns:
- the
Builderinstance 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-endproperty- Returns:
- the
Builderinstance 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-startproperty- Returns:
- the
Builderinstance 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-topproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setName
-
setOpacity
The requested opacity of the widget.- Parameters:
opacity- the value for theopacityproperty- Returns:
- the
Builderinstance 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 theoverflowproperty- Returns:
- the
Builderinstance 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-defaultproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setSensitive
Whether the widget responds to input.- Parameters:
sensitive- the value for thesensitiveproperty- Returns:
- the
Builderinstance 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-tooltipwill automatically be set to true and there will be taken care ofGtk.Widget::query-tooltipin the default signal handler.Note that if both
Gtk.Widget:tooltip-textandGtk.Widget:tooltip-markupare set, the last one wins.- Parameters:
tooltipMarkup- the value for thetooltip-markupproperty- Returns:
- the
Builderinstance 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-tooltipwill automatically be set to true and there will be taken care ofGtk.Widget::query-tooltipin the default signal handler.Note that if both
Gtk.Widget:tooltip-textandGtk.Widget:tooltip-markupare set, the last one wins.- Parameters:
tooltipText- the value for thetooltip-textproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setValign
-
setVexpand
Whether to expand vertically.- Parameters:
vexpand- the value for thevexpandproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setVexpandSet
Whether to use thevexpandproperty.- Parameters:
vexpandSet- the value for thevexpand-setproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setVisible
Whether the widget is visible.- Parameters:
visible- the value for thevisibleproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setWidthRequest
Overrides for width request of the widget.If this is -1, the natural request will be used.
- Parameters:
widthRequest- the value for thewidth-requestproperty- Returns:
- the
Builderinstance 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
Builderinstance 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
Builderinstance is returned, to allow method chaining - See Also:
-
onHide
Emitted whenwidgetis hidden.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onMap
Emitted whenwidgetis 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
::mapsignal can be used to determine whether a widget will be drawn, for instance it can resume an animation that was stopped during the emission ofGtk.Widget::unmap.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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
widgetifgroupCyclingis false, or just makeswidgetgrab focus ifgroupCyclingis true.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onMoveFocus
Emitted when the focus is moved.The
::move-focussignal is a keybinding signal.The default bindings for this signal are
Tabto move forward, andShift+Tabto move backward.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance 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-tooltipproperty is true and the hover timeout has expired with the cursor hovering abovewidget;or emitted whenwidgetgot 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 case true should be returned, false otherwise. Note that ifkeyboardModeis true, the values ofxandyare undefined and should not be used.The signal handler is free to manipulate
tooltipwith the therefore destined function calls.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onRealize
Emitted whenwidgetis 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
Builderinstance is returned, to allow method chaining - See Also:
-
onShow
Emitted whenwidgetis shown.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onStateFlagsChanged
Emitted when the widget state changes.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onUnmap
Emitted whenwidgetis 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
::unmapindicates 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
Builderinstance is returned, to allow method chaining - See Also:
-
onUnrealize
Emitted when theGdkSurfaceassociated withwidgetis 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
Builderinstance is returned, to allow method chaining - See Also:
-