gtk.color_chooser_mixin

Module for [ColorChooser] interface mixin

Templates 2

tmplColorChooserT()

[gtk.color_chooser.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 [gtk.color_chooser_widget.ColorChooserWidget], [gtk.color_chooser_dialog.ColorChooserDialog] and [gtk.color_button.ColorButton].

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

Functions

Get rgba property.

Returns

The currently selected color, as a [gdk.rgba.RGBA] struct.

The property can be set to change the current selection programmatically.

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

void rgba(gdk.rgba.RGBA propval)

Set rgba property.

Parameters

propvalThe currently selected color, as a [gdk.rgba.RGBA] struct. The property can be set to change the current selection programmatically.

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

bool useAlpha()

Get useAlpha property.

Returns

Whether colors may have alpha (translucency).

When ::use-alpha is false, the [gdk.rgba.RGBA] struct obtained via the [gtk.color_chooser.ColorChooser.rgba] property will be forced to have alpha == 1.

Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

void useAlpha(bool propval)

Set useAlpha property.

Parameters

propvalWhether colors may have alpha (translucency). When ::use-alpha is false, the [gdk.rgba.RGBA] struct obtained via the [gtk.color_chooser.ColorChooser.rgba] property will be forced to have alpha == 1. Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

void addPalette(gtk.types.Orientation orientation, int colorsPerLine, gdk.rgba.RGBA[] colors = null)

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 [gtk.color_chooser_widget.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 null, removes all previously added palettes.

Parameters

orientation[gtk.types.Orientation.Horizontal] if the palette should be displayed in rows, [gtk.types.Orientation.Vertical] for columns
colorsPerLinethe number of colors to show in each row/column
colorsthe colors of the palette

Deprecated

Use [gtk.color_dialog.ColorDialog] instead
void getRgba(out gdk.rgba.RGBA color)

Gets the currently-selected color.

Parameters

colora [gdk.rgba.RGBA] to fill in with the current color

Deprecated

Use [gtk.color_dialog.ColorDialog] instead
bool getUseAlpha()

Returns whether the color chooser shows the alpha channel.

Returns

true if the color chooser uses the alpha channel,

false if not

Deprecated

Use [gtk.color_dialog.ColorDialog] instead
void setRgba(gdk.rgba.RGBA color)

Sets the color.

Parameters

colorthe new color

Deprecated

Use [gtk.color_dialog.ColorDialog] instead
void setUseAlpha(bool useAlpha)

Sets whether or not the color chooser should use the alpha channel.

Parameters

useAlphatrue if color chooser should use alpha channel, false if not

Deprecated

Use [gtk.color_dialog.ColorDialog] instead
gulong connectColorActivated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gdk.rgba.RGBA))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.color_chooser.ColorChooser))) && Parameters!T.length < 3)

Connect to ColorActivated signal.

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.

Parameters

callbacksignal callback delegate or function to connect void callback(gdk.rgba.RGBA color, gtk.color_chooser.ColorChooser colorChooser) color the color (optional) colorChooser the instance the signal is connected to (optional)
afterYes.After to execute callback after default handler, No.After to execute before (default)

Returns

Signal ID

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

tmplColorChooserGidBuilderT()
Functions
T rgba(gdk.rgba.RGBA propval)

Set rgba property.

Parameters

propvalThe currently selected color, as a [gdk.rgba.RGBA] struct. The property can be set to change the current selection programmatically.

Returns

Builder instance for fluent chaining

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]

T useAlpha(bool propval)

Set useAlpha property.

Parameters

propvalWhether colors may have alpha (translucency). When ::use-alpha is false, the [gdk.rgba.RGBA] struct obtained via the [gtk.color_chooser.ColorChooser.rgba] property will be forced to have alpha == 1. Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Returns

Builder instance for fluent chaining

Deprecated

Use [gtk.color_dialog.ColorDialog] and [gtk.color_dialog_button.ColorDialogButton]

instead of widgets implementing [gtk.color_chooser.ColorChooser]