Gnome::Gtk4::R-ColorChooser
Description
Gnome::Gtk4::R-ColorChooser is an interface that is implemented by widgets for choosing colors.
Depending on the situation, colors may be allowed to have alpha (translucency).
In GTK, the main widgets that implement this interface are Gnome::Gtk4::ColorChooserWidget, Gnome::Gtk4::ColorChooserDialog and Gnome::Gtk4::ColorButton.
Methods
add-palette
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Adds a palette to the color chooser.
If $orientation
is horizontal, the colors are grouped in rows, with $colors-per-line
colors in each row. If $horizontal
is False
, the colors are grouped in columns instead.
The default color palette of Gnome::Gtk4::ColorChooserWidget has 45 colors, organized in columns of 5 colors (this includes some grays).
The layout of the color chooser widget works best when the palettes have 9-10 columns.
Calling this function for the first time has the side effect of removing the default color palette from the color chooser.
If $colors
is undefined, removes all previously added palettes.
method add-palette ( GtkOrientation $orientation, Int() $colors-per-line, Int() $n-colors, N-Object $colors )
$orientation;
GTK_ORIENTATION_HORIZONTAL
if the palette should be displayed in rows,GTK_ORIENTATION_VERTICAL
for columns.$colors-per-line; the number of colors to show in each row/column.
$n-colors; the total number of elements in
$colors
.$colors; the colors of the palette
get-rgba
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Gets the currently-selected color.
method get-rgba ( N-Object $color )
$color; a Gnome::Gdk4::N-RGBA to fill in with the current color
get-use-alpha
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Returns whether the color chooser shows the alpha channel.
method get-use-alpha (--> Bool )
Return value; True
if the color chooser uses the alpha channel, False
if not.
set-rgba
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Sets the color.
method set-rgba ( N-Object $color )
$color; the new color
set-use-alpha
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Sets whether or not the color chooser should use the alpha channel.
method set-use-alpha ( Bool() $use-alpha )
$use-alpha;
True
if color chooser should use alpha channel,False
if not.
Signals
color-activated
Emitted when a color is activated from the color chooser.
This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.
method handler ( $color, Int :$_handle_id, N-GObject :$_native-object, Gnome::Gtk4::ColorChooser :$_widget, *C<user>-options )
$color; the color.
$_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::ColorChooser 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.