The Gtk.Color_Button.Gtk_Color_Button is a button which displays the currently selected color and allows to open a color selection dialog to change the color. It is suitable widget for selecting a color in a preference dialog.
# CSS nodes
GtkColorButton has a single CSS node with name button. To differentiate it from a plain Gtk.Button.Gtk_Button, it gets the .color style class.
<group>Buttons and Toggles</group>
function "+"
(Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Actionable.Gtk_Actionable
function "+"
(Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Activatable.Gtk_Activatable
function "+"
(Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Color_Chooser.Gtk_Color_Chooser
function "-"
(Interf : Gtk.Actionable.Gtk_Actionable)
return Gtk_Color_Button
function "-"
(Interf : Gtk.Activatable.Gtk_Activatable)
return Gtk_Color_Button
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Color_Button
function "-"
(Interf : Gtk.Color_Chooser.Gtk_Color_Chooser)
return Gtk_Color_Button
procedure Add_Palette
(Self : not null access Gtk_Color_Button_Record;
Orientation : Gtk.Enums.Gtk_Orientation;
Colors_Per_Line : Glib.Gint;
N_Colors : Glib.Gint;
Colors : array_of_Gdk_RGBA)
Alpha_Property : constant Glib.Properties.Property_Uint;
The selected opacity value (0 fully transparent, 65535 fully opaque).
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Color_Button_Void is not null access procedure
(Self : access Gtk_Color_Button_Record'Class);
Color_Property : constant Gdk.Color.Property_Gdk_Color;
Type: Gdk.Color.Gdk_Color The selected color.
procedure Do_Set_Related_Action
(Self : not null access Gtk_Color_Button_Record;
Action : not null access Gtk.Action.Gtk_Action_Record'Class)
function Get_Action_Name
(Self : not null access Gtk_Color_Button_Record) return UTF8_String
function Get_Action_Target_Value
(Self : not null access Gtk_Color_Button_Record)
return Glib.Variant.Gvariant
function Get_Alpha
(Button : not null access Gtk_Color_Button_Record) return Guint16
Returns the current alpha value. Since: gtk+ 2.4 Deprecated since 3.4, 1
an integer between 0 and 65535
procedure Get_Color
(Button : not null access Gtk_Color_Button_Record;
Color : out Gdk.Color.Gdk_Color)
Sets Color to be the current color in the Gtk.Color_Button.Gtk_Color_Button widget. Since: gtk+ 2.4 Deprecated since 3.4, 1
a Gdk.Color.Gdk_Color to fill in with the current color
function Get_Related_Action
(Self : not null access Gtk_Color_Button_Record)
return Gtk.Action.Gtk_Action
procedure Get_Rgba
(Self : not null access Gtk_Color_Button_Record;
Color : out Gdk.RGBA.Gdk_RGBA)
function Get_Title
(Button : not null access Gtk_Color_Button_Record) return UTF8_String
Gets the title of the color selection dialog. Since: gtk+ 2.4
An internal string, do not free the return value
function Get_Type return Glib.GType
function Get_Use_Action_Appearance
(Self : not null access Gtk_Color_Button_Record) return Boolean
function Get_Use_Alpha
(Self : not null access Gtk_Color_Button_Record) return Boolean
type Gtk_Color_Button is access all Gtk_Color_Button_Record'Class;
function Gtk_Color_Button_New return Gtk_Color_Button
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. Since: gtk+ 2.4
function Gtk_Color_Button_New_With_Color
(Color : Gdk.Color.Gdk_Color) return Gtk_Color_Button
Creates a new color button. Since: gtk+ 2.4
A Gdk.Color.Gdk_Color to set the current color with
function Gtk_Color_Button_New_With_Rgba
(Rgba : Gdk.RGBA.Gdk_RGBA) return Gtk_Color_Button
Creates a new color button. Since: gtk+ 3.0
A Gdk.RGBA.Gdk_RGBA to set the current color with
type Gtk_Color_Button_Record is new Gtk_Button_Record with null record;
procedure Gtk_New (Button : out Gtk_Color_Button)
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. Since: gtk+ 2.4 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Gtk_New_With_Color
(Button : out Gtk_Color_Button;
Color : Gdk.Color.Gdk_Color)
Creates a new color button. Since: gtk+ 2.4 Initialize_With_Color does nothing if the object was already created with another call to Initialize* or G_New.
A Gdk.Color.Gdk_Color to set the current color with
procedure Gtk_New_With_Rgba
(Button : out Gtk_Color_Button;
Rgba : Gdk.RGBA.Gdk_RGBA)
Creates a new color button. Since: gtk+ 3.0 Initialize_With_Rgba does nothing if the object was already created with another call to Initialize* or G_New.
A Gdk.RGBA.Gdk_RGBA to set the current color with
package Implements_Gtk_Actionable is new Glib.Types.Implements
(Gtk.Actionable.Gtk_Actionable, Gtk_Color_Button_Record, Gtk_Color_Button);
package Implements_Gtk_Activatable is new Glib.Types.Implements
(Gtk.Activatable.Gtk_Activatable, Gtk_Color_Button_Record, Gtk_Color_Button);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Color_Button_Record, Gtk_Color_Button);
package Implements_Gtk_Color_Chooser is new Glib.Types.Implements
(Gtk.Color_Chooser.Gtk_Color_Chooser, Gtk_Color_Button_Record, Gtk_Color_Button);
procedure Initialize
(Button : not null access Gtk_Color_Button_Record'Class)
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. Since: gtk+ 2.4 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Initialize_With_Color
(Button : not null access Gtk_Color_Button_Record'Class;
Color : Gdk.Color.Gdk_Color)
Creates a new color button. Since: gtk+ 2.4 Initialize_With_Color does nothing if the object was already created with another call to Initialize* or G_New.
A Gdk.Color.Gdk_Color to set the current color with
procedure Initialize_With_Rgba
(Button : not null access Gtk_Color_Button_Record'Class;
Rgba : Gdk.RGBA.Gdk_RGBA)
Creates a new color button. Since: gtk+ 3.0 Initialize_With_Rgba does nothing if the object was already created with another call to Initialize* or G_New.
A Gdk.RGBA.Gdk_RGBA to set the current color with
procedure On_Color_Set
(Self : not null access Gtk_Color_Button_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_rgba 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.
procedure On_Color_Set
(Self : not null access Gtk_Color_Button_Record;
Call : Cb_Gtk_Color_Button_Void;
After : Boolean := False)
The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_rgba 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.
Rgba_Property : constant Gdk.RGBA.Property_RGBA;
Type: Gdk.RGBA.Gdk_RGBA The RGBA color.
procedure Set_Action_Name
(Self : not null access Gtk_Color_Button_Record;
Action_Name : UTF8_String := "")
procedure Set_Action_Target_Value
(Self : not null access Gtk_Color_Button_Record;
Target_Value : Glib.Variant.Gvariant)
procedure Set_Alpha
(Button : not null access Gtk_Color_Button_Record;
Alpha : Guint16)
Sets the current opacity to be Alpha. Since: gtk+ 2.4 Deprecated since 3.4, 1
an integer between 0 and 65535
procedure Set_Color
(Button : not null access Gtk_Color_Button_Record;
Color : Gdk.Color.Gdk_Color)
Sets the current color to be Color. Since: gtk+ 2.4 Deprecated since None, 1
A Gdk.Color.Gdk_Color to set the current color with
procedure Set_Detailed_Action_Name
(Self : not null access Gtk_Color_Button_Record;
Detailed_Action_Name : UTF8_String)
procedure Set_Related_Action
(Self : not null access Gtk_Color_Button_Record;
Action : not null access Gtk.Action.Gtk_Action_Record'Class)
procedure Set_Rgba
(Self : not null access Gtk_Color_Button_Record;
Color : Gdk.RGBA.Gdk_RGBA)
procedure Set_Title
(Button : not null access Gtk_Color_Button_Record;
Title : UTF8_String)
Sets the title for the color selection dialog. Since: gtk+ 2.4
String containing new window title
procedure Set_Use_Action_Appearance
(Self : not null access Gtk_Color_Button_Record;
Use_Appearance : Boolean)
procedure Set_Use_Alpha
(Self : not null access Gtk_Color_Button_Record;
Use_Alpha : Boolean)
Show_Editor_Property : constant Glib.Properties.Property_Boolean;
Set this property to True to skip the palette in the dialog and go directly to the color editor.
This property should be used in cases where the palette in the editor would be redundant, such as when the color button is already part of a palette.
Signal_Color_Set : constant Glib.Signal_Name := "color-set";
The ::color-set signal is emitted when the user selects a color. When handling this signal, use gtk_color_button_get_rgba 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.
procedure Sync_Action_Properties
(Self : not null access Gtk_Color_Button_Record;
Action : access Gtk.Action.Gtk_Action_Record'Class)
Title_Property : constant Glib.Properties.Property_String;
The title of the color selection dialog
Use_Alpha_Property : constant Glib.Properties.Property_Boolean;
If this property is set to True, the color swatch on the button is rendered against a checkerboard background to show its opacity and the opacity slider is displayed in the color selection dialog.