GtkAda Reference Manual - Package Gtk.Color_Selection

[Contents] [Back] [Prev] [Up] [Next] [Forward]

# Package Gtk.Color`_`Selection

A Gtk_Color_Selection widget is a complex dialog that allows the user to select a color based either on its (Red, Green, Blue) or its (Hue, Saturation, Value). An additional field is provided to select the opacity of the color (this is usually called the alpha channel).

see section Package Gtk.Color`_`Selection`_`Dialog for a version of this widget that comes with its own dialog.

see section Package Gtk.Extra.Color`_`Combo for a different way to select colors.

- Gtk.Color_Selection Widget Hierarchy
- Gtk.Color_Selection Signals
- Gtk.Color_Selection Types
- Gtk.Color_Selection Subprograms

## Widget Hierarchy

    GObject                       (see section Package Glib.Object)
    Gtk_Object                    (see section Package Gtk.Object)
       \___ Gtk_Widget            (see section Package Gtk.Widget)
          \___ Gtk_Container      (see section Package Gtk.Container)
             \___ Gtk_Box         (see section Package Gtk.Box)
                \___ Gtk_Color_Selection (see section Package Gtk.Color_Selection)

## Signals

- "color_changed" procedure Handler
  (Selection : access Gtk_Color_Selection_Record'Class);
  Called every time a new color is selected in the dialog

## Types

    type Color_Array is array (Color_Index) of Gdouble;
| Array that indicates the currently selected color. All the values are between 0.0 and 1.0 (a percentage value). They should be converted to absolute values before using them to create a new color, with the following piece of code: Absolute := To_Absolute (Color_Array (Index))
    type Color_Index is
        (Red, Green, Blue, Opacity);
| Used as an index to the table used to set and get the currently selected color.

## Subprograms

    procedure Gtk_New
      (Widget             : out    Gtk_Color_Selection);
| Create a new color selection widget.
    function Get_Type              return Glib.GType;
| Return the internal value associated with a Gtk_Color_Selection.
    function Get_Has_Opacity_Control
      (Colorsel           : access Gtk_Color_Selection_Record)
       return Boolean;
| Return True if the Colorsel has an opacity control.
    procedure Set_Has_Opacity_Control
      (Colorsel           : access Gtk_Color_Selection_Record;
       Has_Opacity        :        Boolean);
| Set the Colorsel to use or not use opacity.
    function Get_Has_Palette
      (Colorsel           : access Gtk_Color_Selection_Record)
       return Boolean;
| Return True if the Colorsel has a palette.
    procedure Set_Has_Palette
      (Colorsel           : access Gtk_Color_Selection_Record;
       Has_Palette        :        Boolean);
| If Has_Palette is True, then set the Colorsel to show the palette. Hide the palette otherwise.
    procedure Set_Current_Color
      (Colorsel           : access Gtk_Color_Selection_Record;
       Color              :        Gdk.Color.Gdk_Color);
| Set the current color of the Colorsel. When called for the first time, the original color will the set to Color as well.
    procedure Set_Current_Alpha
      (Colorsel           : access Gtk_Color_Selection_Record;
       Alpha              :        Guint16);
| Set the current opacity to be Alpha. When called for the first time, the original opacity will be set too.
    procedure Get_Current_Color
      (Colorsel           : access Gtk_Color_Selection_Record;
       Color              : out    Gdk.Color.Gdk_Color);
| Set Color to the value of the current color in the Colorsel.
    function Get_Current_Alpha
      (Colorsel           : access Gtk_Color_Selection_Record)
       return Guint16;
| Return the current opacity.
    procedure Set_Previous_Color
      (Colorsel           : access Gtk_Color_Selection_Record;
       Color              :        Gdk.Color.Gdk_Color);
| Set the previous color. This procedure should not be called without analysis, as it might seem confusing to see that color change. Calling Set_Current_Color for the first time will also set this color.
    procedure Set_Previous_Alpha
      (Colorsel           : access Gtk_Color_Selection_Record;
       Alpha              :        Guint16);
| Set the previous opacity to Alpha. This procedure should not be called without analysis, as it might seem confusing to see that value change.
    procedure Get_Previous_Color
      (Colorsel           : access Gtk_Color_Selection_Record;
       Color              : out    Gdk.Color.Gdk_Color);
| Set Color to the original color value.
    function Get_Previous_Alpha
      (Colorsel           : access Gtk_Color_Selection_Record)
       return Guint16;
| Return the previous alpha value.
    function Is_Adjusting
      (Colorsel           : access Gtk_Color_Selection_Record)
       return Boolean;
| Get the current state of the Colorsel. Return TRue if the user is currently dragging a color around, False if the selection has stopped.
    function To_Absolute
      (Color              :        Gdouble)
       return Gushort;
| Convert from a percentage value as returned by Get_Color to an absolute value as can be used with Gdk_Color.
    function To_Percent
      (Color              :        Gushort)
       return Gdouble;
| Convert from an absolute value as used in Gdk_Color to a percentage value as used in Set_Color.

[Contents] [Back] [Prev] [Up] [Next] [Forward]