Gtk.Color_Button

Entities

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

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
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Activatable.Gtk_Activatable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Buildable.Gtk_Buildable
Parameters
Widget
Return Value

"+"

function "+"
  (Widget : access Gtk_Color_Button_Record'Class)
return Gtk.Color_Chooser.Gtk_Color_Chooser
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Actionable.Gtk_Actionable)
return Gtk_Color_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Activatable.Gtk_Activatable)
return Gtk_Color_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Color_Button
Parameters
Interf
Return Value

"-"

function "-"
  (Interf : Gtk.Color_Chooser.Gtk_Color_Chooser)
return Gtk_Color_Button
Parameters
Interf
Return Value

Add_Palette

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)
Parameters
Self
Orientation
Colors_Per_Line
N_Colors
Colors

Alpha_Property

Alpha_Property : constant Glib.Properties.Property_Uint;

The selected opacity value (0 fully transparent, 65535 fully opaque).

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Color_Button_Void

type Cb_Gtk_Color_Button_Void is not null access procedure
  (Self : access Gtk_Color_Button_Record'Class);
Parameters
Self

Color_Property

Color_Property : constant Gdk.Color.Property_Gdk_Color;

Type: Gdk.Color.Gdk_Color The selected color.

Do_Set_Related_Action

procedure Do_Set_Related_Action
   (Self   : not null access Gtk_Color_Button_Record;
    Action : not null access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

Get_Action_Name

function Get_Action_Name
   (Self : not null access Gtk_Color_Button_Record) return UTF8_String
Parameters
Self
Return Value

Get_Action_Target_Value

function Get_Action_Target_Value
   (Self : not null access Gtk_Color_Button_Record)
    return Glib.Variant.Gvariant
Parameters
Self
Return Value

Get_Alpha

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

Parameters
Button
Return Value

an integer between 0 and 65535

Get_Color

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

Parameters
Button
Color

a Gdk.Color.Gdk_Color to fill in with the current color

Get_Related_Action

function Get_Related_Action
   (Self : not null access Gtk_Color_Button_Record)
    return Gtk.Action.Gtk_Action
Parameters
Self
Return Value

Get_Rgba

procedure Get_Rgba
   (Self  : not null access Gtk_Color_Button_Record;
    Color : out Gdk.RGBA.Gdk_RGBA)
Parameters
Self
Color

Get_Title

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

Parameters
Button
Return Value

An internal string, do not free the return value

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Use_Action_Appearance

function Get_Use_Action_Appearance
   (Self : not null access Gtk_Color_Button_Record) return Boolean
Parameters
Self
Return Value

Get_Use_Alpha

function Get_Use_Alpha
   (Self : not null access Gtk_Color_Button_Record) return Boolean
Parameters
Self
Return Value

Gtk_Color_Button

type Gtk_Color_Button is access all Gtk_Color_Button_Record'Class;

Gtk_Color_Button_New

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

Return Value

Gtk_Color_Button_New_With_Color

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

Parameters
Color

A Gdk.Color.Gdk_Color to set the current color with

Return Value

Gtk_Color_Button_New_With_Rgba

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

Parameters
Rgba

A Gdk.RGBA.Gdk_RGBA to set the current color with

Return Value

Gtk_Color_Button_Record

type Gtk_Color_Button_Record is new Gtk_Button_Record with null record;

Gtk_New

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.

Parameters
Button

Gtk_New_With_Color

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.

Parameters
Button
Color

A Gdk.Color.Gdk_Color to set the current color with

Gtk_New_With_Rgba

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.

Parameters
Button
Rgba

A Gdk.RGBA.Gdk_RGBA to set the current color with

Implements_Gtk_Actionable

package Implements_Gtk_Actionable is new Glib.Types.Implements
  (Gtk.Actionable.Gtk_Actionable, Gtk_Color_Button_Record, Gtk_Color_Button);

Implements_Gtk_Activatable

package Implements_Gtk_Activatable is new Glib.Types.Implements
  (Gtk.Activatable.Gtk_Activatable, Gtk_Color_Button_Record, Gtk_Color_Button);

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Color_Button_Record, Gtk_Color_Button);

Implements_Gtk_Color_Chooser

package Implements_Gtk_Color_Chooser is new Glib.Types.Implements
  (Gtk.Color_Chooser.Gtk_Color_Chooser, Gtk_Color_Button_Record, Gtk_Color_Button);

Initialize

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.

Parameters
Button

Initialize_With_Color

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.

Parameters
Button
Color

A Gdk.Color.Gdk_Color to set the current color with

Initialize_With_Rgba

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.

Parameters
Button
Rgba

A Gdk.RGBA.Gdk_RGBA to set the current color with

On_Color_Set

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.

Parameters
Self
Call
Slot
After

On_Color_Set

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.

Parameters
Self
Call
After

Rgba_Property

Rgba_Property : constant Gdk.RGBA.Property_RGBA;

Type: Gdk.RGBA.Gdk_RGBA The RGBA color.

Set_Action_Name

procedure Set_Action_Name
   (Self        : not null access Gtk_Color_Button_Record;
    Action_Name : UTF8_String := "")
Parameters
Self
Action_Name

Set_Action_Target_Value

procedure Set_Action_Target_Value
   (Self         : not null access Gtk_Color_Button_Record;
    Target_Value : Glib.Variant.Gvariant)
Parameters
Self
Target_Value

Set_Alpha

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

Parameters
Button
Alpha

an integer between 0 and 65535

Set_Color

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

Parameters
Button
Color

A Gdk.Color.Gdk_Color to set the current color with

Set_Detailed_Action_Name

procedure Set_Detailed_Action_Name
   (Self                 : not null access Gtk_Color_Button_Record;
    Detailed_Action_Name : UTF8_String)
Parameters
Self
Detailed_Action_Name

Set_Related_Action

procedure Set_Related_Action
   (Self   : not null access Gtk_Color_Button_Record;
    Action : not null access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

Set_Rgba

procedure Set_Rgba
   (Self  : not null access Gtk_Color_Button_Record;
    Color : Gdk.RGBA.Gdk_RGBA)
Parameters
Self
Color

Set_Title

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

Parameters
Button
Title

String containing new window title

Set_Use_Action_Appearance

procedure Set_Use_Action_Appearance
   (Self           : not null access Gtk_Color_Button_Record;
    Use_Appearance : Boolean)
Parameters
Self
Use_Appearance

Set_Use_Alpha

procedure Set_Use_Alpha
   (Self      : not null access Gtk_Color_Button_Record;
    Use_Alpha : Boolean)
Parameters
Self
Use_Alpha

Show_Editor_Property

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

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.

Sync_Action_Properties

procedure Sync_Action_Properties
   (Self   : not null access Gtk_Color_Button_Record;
    Action : access Gtk.Action.Gtk_Action_Record'Class)
Parameters
Self
Action

Title_Property

Title_Property : constant Glib.Properties.Property_String;

The title of the color selection dialog

Use_Alpha_Property

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.