Package org.gnome.adw
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 class
Toggle.Builder<B extends Toggle.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Field Summary
Fields inherited from class io.github.jwharm.javagi.base.ProxyInstance
address
-
Constructor Summary
ConstructorsConstructorDescriptionToggle()
Creates a new Toggle.Toggle
(MemorySegment address) Create a Toggle proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Toggle
asParent()
Returns this instance as if it were its parent type.static Toggle.Builder
<? extends Toggle.Builder> builder()
AToggle.Builder
object constructs aToggle
with the specified properties.getChild()
Gets the child widget of this Toggle.boolean
Gets whether this Toggle is enabled.Gets the icon name of this Toggle.int
getIndex()
Gets the index of this Toggle within its toggle group.getLabel()
Gets the label of this Toggle.getName()
Gets the name of this Toggle.Gets the tooltip of this Toggle.static Type
getType()
Get the GType of the Toggle classboolean
Gets whether this Toggle uses underlines.void
Sets the child of this Toggle tochild
.void
setEnabled
(boolean enabled) Sets whether this Toggle is enabled.void
setIconName
(@Nullable String iconName) Sets the icon name of this Toggle toiconName
.void
Sets the label of this Toggle tolabel
.void
Sets the name of this Toggle toname
.void
setTooltip
(String tooltip) Sets the tooltip of this Toggle totooltip
.void
setUseUnderline
(boolean useUnderline) Sets whether an embedded underline in the label indicates a mnemonic.Methods 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, getMemoryLayout, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Toggle
Create a Toggle proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Toggle
public Toggle()Creates a new Toggle.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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. -
getChild
-
getEnabled
public boolean getEnabled()Gets whether this Toggle is enabled.- Returns:
- whether the toggle is enabled
- Since:
- 1.7
-
getIconName
Gets the icon name of this Toggle.- 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_POSITION
if 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 tochild
.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
-
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 toiconName
.The icon will be displayed alone or next to the label, unless
Toggle:child
is set.- Parameters:
iconName
- the icon name- Since:
- 1.7
-
setLabel
Sets the label of this Toggle tolabel
.The label will be displayed alone or next to the icon, unless
Toggle:child
is 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 toname
.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 totooltip
.tooltip
can be marked up with the Pango text markup language.- 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.Builder
object constructs aToggle
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withToggle.Builder.build()
.
-