gtk.color_chooser_mixin

Module for [ColorChooser] interface mixin

Templates 2

tmplColorChooserT()

#GtkColorChooser 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 #GtkColorChooserWidget, #GtkColorChooserDialog and #GtkColorButton.

Functions

Get rgba property.

Returns

The ::rgba property contains the currently selected color,

as a #GdkRGBA struct. The property can be set to change the current selection programmatically.

void rgba(gdk.rgba.RGBA propval)

Set rgba property.

Parameters

propvalThe ::rgba property contains the currently selected color, as a #GdkRGBA struct. The property can be set to change the current selection programmatically.
bool useAlpha()

Get useAlpha property.

Returns

When ::use-alpha is true, colors may have alpha (translucency)

information. When it is false, the #GdkRGBA struct obtained via the #GtkColorChooser: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).

void useAlpha(bool propval)

Set useAlpha property.

Parameters

propvalWhen ::use-alpha is true, colors may have alpha (translucency) information. When it is false, the #GdkRGBA struct obtained via the #GtkColorChooser: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).
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 #GtkColorChooserWidget has 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.

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 and gray palettes 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, or null
void getRgba(out gdk.rgba.RGBA color)

Gets the currently-selected color.

Parameters

colora #GdkRGBA to fill in with the current color
bool getUseAlpha()

Returns whether the color chooser shows the alpha channel.

Returns

true if the color chooser uses the alpha channel,

false if not

void setRgba(gdk.rgba.RGBA color)

Sets the color.

Parameters

colorthe new color
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
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
tmplColorChooserGidBuilderT()
Functions
T rgba(gdk.rgba.RGBA propval)

Set rgba property.

Parameters

propvalThe ::rgba property contains the currently selected color, as a #GdkRGBA struct. The property can be set to change the current selection programmatically.

Returns

Builder instance for fluent chaining
T useAlpha(bool propval)

Set useAlpha property.

Parameters

propvalWhen ::use-alpha is true, colors may have alpha (translucency) information. When it is false, the #GdkRGBA struct obtained via the #GtkColorChooser: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