Next: , Previous: GtkRadioAction, Up: Top


77 GtkColorButton

A button to launch a color selection dialog

77.1 Overview

The <gtk-color-button> is a button which displays the currently selected color an allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.

77.2 Usage

— Class: <gtk-color-button>

Derives from <gtk-button>.

This class defines the following slots:

use-alpha
Whether or not to give the color an alpha value
title
The title of the color selection dialog
color
The selected color
alpha
The selected opacity value (0 fully transparent, 65535 fully opaque)
— Signal on <gtk-color-button>: color-set

The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk-color-button-get-color and gtk-color-button-get-alpha 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::color signal.

Since 2.4

— Function: gtk-color-button-new ⇒  (ret <gtk-widget>)

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-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

ret
a new color button.

Since 2.4

— Function: gtk-color-button-new-with-color (color <gdk-color>) ⇒  (ret <gtk-widget>)

Creates a new color button.

color
A <gdk-color> to set the current color with.
ret
a new color button.

Since 2.4

— Function: gtk-color-button-set-color (self <gtk-color-button>) (color <gdk-color>)
— Method: set-color

Sets the current color to be color.

color-button
a <gtk-color-button>.
color
A <gdk-color> to set the current color with.

Since 2.4

— Function: gtk-color-button-get-color (self <gtk-color-button>) (color <gdk-color>)
— Method: get-color

Sets color to be the current color in the <gtk-color-button> widget.

color-button
a <gtk-color-button>.
color
a <gdk-color> to fill in with the current color.

Since 2.4

— Function: gtk-color-button-set-alpha (self <gtk-color-button>) (alpha unsigned-int16)
— Method: set-alpha

Sets the current opacity to be alpha.

color-button
a <gtk-color-button>.
alpha
an integer between 0 and 65535.

Since 2.4

— Function: gtk-color-button-get-alpha (self <gtk-color-button>) ⇒  (ret unsigned-int16)
— Method: get-alpha

Returns the current alpha value.

color-button
a <gtk-color-button>.
ret
an integer between 0 and 65535.

Since 2.4

— Function: gtk-color-button-set-use-alpha (self <gtk-color-button>) (use_alpha bool)
— Method: set-use-alpha

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

color-button
a <gtk-color-button>.
use-alpha
#t’ if color button should use alpha channel, ‘#f’ if not.

Since 2.4

— Function: gtk-color-button-get-use-alpha (self <gtk-color-button>) ⇒  (ret bool)
— Method: get-use-alpha

Does the color selection dialog use the alpha channel?

color-button
a <gtk-color-button>.
ret
#t’ if the color sample uses alpha channel, ‘#f’ if not.

Since 2.4

— Function: gtk-color-button-set-title (self <gtk-color-button>) (title mchars)
— Method: set-title

Sets the title for the color selection dialog.

color-button
a <gtk-color-button>
title
String containing new window title.

Since 2.4

— Function: gtk-color-button-get-title (self <gtk-color-button>) ⇒  (ret mchars)
— Method: get-title

Gets the title of the color selection dialog.

color-button
a <gtk-color-button>
ret
An internal string, do not free the return value

Since 2.4