About all my projects
Gnome::Gtk4::ColorButton

Gnome::Gtk4::ColorButton

Description

The Gnome::Gtk4::ColorButton allows to open a color chooser dialog to change the color.

No caption

It is suitable widget for selecting a color in a preference dialog.

CSS nodes

Gnome::Gtk4::ColorButton has a single CSS node with name colorbutton which contains a button node. To differentiate it from a plain Gnome::Gtk4::Button, it gets the .color style class.

Class initialization

Note: The native version of this class is deprecated in gtk4-lib() since version 4.10

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-colorbutton

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new color button.

This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color chooser dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

method new-colorbutton ( --> Gnome::Gtk4::ColorButton \)

new-with-rgba

Creates a new color button showing the given color.

method new-with-rgba ( N-Object $rgba --> Gnome::Gtk4::ColorButton \)
  • $rgba; A Gnome::Gdk4::N-RGBA to set the current color with

Methods

get-modal

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets whether the dialog is modal.

method get-modal (--> Bool )

Return value; True if the dialog is modal.

get-title

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the title of the color chooser dialog.

method get-title (--> Str )

Return value; An internal string, do not free the return value.

set-modal

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets whether the dialog should be modal.

method set-modal ( Bool() $modal )
  • $modal; True to make the dialog modal.

set-title

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the title for the color chooser dialog.

method set-title ( Str $title )
  • $title; String containing new window title.

Signals

activate

Emitted to when the color button is activated.

The `::activate` signal on Gnome::Gtk4::MenuButton is an action signal and emitting it causes the button to pop up its dialog.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::ColorButton :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::ColorButton object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

color-set

Emitted when the user selects a color.

When handling this signal, use .get-rgba() in class Gnome::Gtk4::R-ColorChooser to find out which color was just selected.

Note that this signal is only emitted when the user changes the color. If you need to react to programmatic color changes as well, use the notify::rgba signal.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::ColorButton :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::ColorButton object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.