Class Toggle
- All Implemented Interfaces:
Proxy
A toggle within ToggleGroup.
AdwToggle can optionally have a name, set with Toggle:name.
If the name is set, ToggleGroup:active-name can be used to access
toggles instead of index.
- Since:
- 1.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classToggle.Builder<B extends Toggle.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionToggle()Create a new Toggle.Toggle(MemorySegment address) Create a Toggle instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ToggleasParent()Return this instance as if it were its parent type.static Toggle.Builder<? extends Toggle.Builder> builder()AToggle.Builderobject constructs aTogglewith the specified properties.@Nullable WidgetgetChild()Gets the child widget ofself.Gets the description ofself.booleanGets whether this Toggle is enabled.@Nullable StringGets the icon name ofself.intgetIndex()Gets the index of this Toggle within its toggle group.@Nullable StringgetLabel()Gets the label ofself.static MemoryLayoutThe memory layout of the native struct.getName()Gets the name ofself.Gets the tooltip ofself.static @Nullable TypegetType()Get the GType of the Toggle class.booleanGets whether this Toggle uses underlines.voidSets the child of this Toggle tochild.voidsetDescription(String description) Sets the description of this Toggle todescription.voidsetEnabled(boolean enabled) Sets whether this Toggle is enabled.voidsetIconName(@Nullable String iconName) Sets the icon name of this Toggle toiconName.voidSets the label of this Toggle tolabel.voidSets the name of this Toggle toname.voidsetTooltip(String tooltip) Sets the tooltip of this Toggle totooltip.voidsetUseUnderline(boolean useUnderline) Sets whether an embedded underline in the label indicates a mnemonic.Methods inherited from class 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 TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Toggle
Create a Toggle instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Toggle
public Toggle()Create a new Toggle.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
getChild
Gets the child widget ofself.- Returns:
- the toggle child
- Since:
- 1.7
-
getDescription
Gets the description ofself.- Returns:
- the toggle description
- Since:
- 1.9
-
getEnabled
public boolean getEnabled()Gets whether this Toggle is enabled.- Returns:
- whether the toggle is enabled
- Since:
- 1.7
-
getIconName
Gets the icon name ofself.- Returns:
- the toggle icon name
- Since:
- 1.7
-
getIndex
public int getIndex()Gets the index of this Toggle within its toggle group.- Returns:
- the index, or
Gtk.INVALID_LIST_POSITIONif it's not in a group - Since:
- 1.7
-
getLabel
-
getName
-
getTooltip
-
getUseUnderline
public boolean getUseUnderline()Gets whether this Toggle uses underlines.- Returns:
- whether the toggle uses underlines
- Since:
- 1.7
-
setChild
Sets the child of this Toggle to
child.When the child is set, icon and label are not displayed.
It's recommended to still set the label, as it can still be used by the screen reader.
- Parameters:
child- a child widget- Since:
- 1.7
-
setDescription
Sets the description of this Toggle to
description.The description will be read out when using screen reader. If not set,
Toggle:tooltipwill be used instead.See
Gtk.AccessibleProperty.description.- Parameters:
description- the description- Since:
- 1.9
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this Toggle is enabled.- Parameters:
enabled- whether the toggle should be enbled- Since:
- 1.7
-
setIconName
Sets the icon name of this Toggle to
iconName.The icon will be displayed alone or next to the label, unless
Toggle:childis set.- Parameters:
iconName- the icon name- Since:
- 1.7
-
setLabel
Sets the label of this Toggle to
label.The label will be displayed alone or next to the icon, unless
Toggle:childis set, but will still be read out by the screen reader.- Parameters:
label- a label- Since:
- 1.7
-
setName
Sets the name of this Toggle to
name.Allows accessing this Toggle by its name instead of index.
See
ToggleGroup:active-name.- Parameters:
name- a name- Since:
- 1.7
-
setTooltip
Sets the tooltip of this Toggle to
tooltip.tooltipcan be marked up with the Pango text markup language.Tooltip text will also be used as accessible description. Use
Toggle:descriptionto set it separately.- Parameters:
tooltip- the tooltip- Since:
- 1.7
-
setUseUnderline
public void setUseUnderline(boolean useUnderline) Sets whether an embedded underline in the label indicates a mnemonic.
See
Toggle:label.- Parameters:
useUnderline- whether an underline in the label indicates a mnemonic- Since:
- 1.7
-
builder
AToggle.Builderobject constructs aTogglewith the specified properties. Use the variousset...()methods to set properties, and finish construction withToggle.Builder.build().- Returns:
- the builder object
-