[588:7] extends: object
Generated low-level callback wrapper for GIR callback clicked.
ButtonClickedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[30:7] extends: object
Calls a callback function when the button is clicked.
GtkButton widget can
hold any valid child widget. That is, it can hold almost any other standard
GtkWidget. The most commonly used child is the GtkLabel. # Shortcuts and
Gestures The following signals have default keybindings: -
[signal@Gtk.Button::activate] # CSS nodes GtkButton has a single CSS node
with name button. The node will get the style classes .image-button or
.text-button, if the content is just an image or label, respectively. It may
also receive the .flat style class. When activating a button via the
keyboard, the button will temporarily gain the .keyboard-activating style
class. Other style classes that are commonly used with GtkButton include
.suggested-action and .destructive-action. In special cases, buttons can be
made round by adding the .circular style class. Button-like widgets like
[class@Gtk.ToggleButton], [class@Gtk.MenuButton], [class@Gtk.VolumeButton],
[class@Gtk.LockButton], [class@Gtk.ColorButton] or [class@Gtk.FontButton] use
style classes such as .toggle, .popup, .scale, .lock, .color on the button
node to differentiate themselves from a plain GtkButton. # Accessibility
GtkButton uses the [enum@Gtk.AccessibleRole.button] role.
Button (label = null)
Creates a new
GtkButtonwidget. To add a child widget to the button, use [method@Gtk.Button.set_child].
label is The text you want the GtkLabel to hold.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asActionable ()
Wraps this handle as
Actionable.
A Actionable object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnActivate (callback Fn, UserData = null)
Emitted to animate press then release. This is an action signal. Applications should never connect to this signal, but use the [signal@Gtk.Button::clicked] signal. The default bindings for this signal are all forms of the ␣ and Enter keys.
Fn is the Aussom callback.Fn is called with (Button Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnClicked (callback Fn, UserData = null)
Emitted when the button has been activated (pressed and released).
Fn is the Aussom callback.Fn is called with (Button Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setCanshrink (bool Value)
Whether the size of the button can be made smaller than the natural size of its contents. For text buttons, setting this property will allow ellipsizing the label. If the contents of a button are an icon or a custom widget, setting this property has no effect.
Value is the new property value.None.setChild (object Value)
The child widget.
Value is the new property value.None.setHasframe (bool Value)
Whether the button has a frame.
Value is the new property value.None.setIconname (string Value)
The name of the icon used to automatically populate the button.
Value is the new property value.None.setLabel (string Value)
Text of the label inside the button, if the button contains a label widget.
Value is the new property value.None.setUseunderline (bool Value)
If set, an underline in the text indicates that the following character is to be used as mnemonic.
Value is the new property value.None.get_can_shrink ()
Retrieves whether the button can be smaller than the natural size of its contents.
get_child ()
Gets the child widget of @button.
get_has_frame ()
Returns whether the button has a frame.
get_icon_name ()
Returns the icon name of the button. If the icon name has not been set with [method@Gtk.Button.set_icon_name] the return value will be %NULL. This will be the case if you create an empty button with [ctor@Gtk.Button.new] to use as a container.
get_label ()
Fetches the text from the label of the button. If the label text has not been set with [method@Gtk.Button.set_label] the return value will be %NULL. This will be the case if you create an empty button with [ctor@Gtk.Button.new] to use as a container.
get_use_underline ()
gets whether underlines are interpreted as mnemonics. See [method@Gtk.Button.set_use_underline].
set_can_shrink (bool can_shrink)
Sets whether the button size can be smaller than the natural size of its contents. For text buttons, setting @can_shrink to true will ellipsize the label. For icons and custom children, this function has no effect.
can_shrink is whether the button can shrink.None.set_child (object child)
Sets the child widget of @button. Note that by using this API, you take full responsibility for setting up the proper accessibility label and description information for @button. Most likely, you'll either set the accessibility label or description for @button explicitly, or you'll set a labelled-by or described-by relations from @child to @button.
child is the child widget.None.set_has_frame (bool has_frame)
Sets the style of the button. Buttons can have a flat appearance or have a frame drawn around them.
has_frame is whether the button should have a visible frame.None.set_icon_name (string icon_name)
Adds a
GtkImagewith the given icon name as a child. If @button already contains a child widget, that child widget will be removed and replaced with the image.
icon_name is An icon name.None.set_label (string label)
Sets the text of the label of the button to @label. This will also clear any previously set labels.
label is a string.None.set_use_underline (bool use_underline)
Sets whether to use underlines as mnemonics. If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.
use_underline is %TRUE if underlines in the text indicate mnemonics.None.[478:14] static extends: object
Alternate constructors for Button. Usage:
ButtonCtors.<name>(...). The primary constructor lives
directly on Button.
newFromIconName (string icon_name)
Creates a new button containing an icon from the current icon theme. If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.
icon_name is an icon name.A new Button.newWithMnemonic (string label)
Creates a new
GtkButtoncontaining a label. If characters in @label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.
label is The text of the button, with an underscore in front of the mnemonic character.A new Button.[658:14] static extends: object
Generated metadata helpers for Button class surfaces.
properties ()
Returns property metadata for
Button.
A list.signals ()
Returns signal metadata for
Button.
A list.[518:7] extends: object
Generated low-level callback wrapper for GIR callback activate.
ButtonActivateCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.