[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.

Widget Hierarchy

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

Types

type Color_Array is array (Color_Index'Range) 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 Gtk.Gtk_Type;

Return the internal value associated with a Gtk_Color_Selection.


procedure Set_Update_Policy    
  (Colorsel           : access Gtk_Color_Selection_Record;
   Policy             : in     Enums.Gtk_Update_Type);

Set the behavior of the scales used to select a value (red, green,...)
Set Policy to Update_Continuous if you want to update the color continuously as the slider is mode, Update_Discontinuous to update the color only when the mouse is released and Update_Delayed to update when the mouse is released or has been motionless for a while.


procedure Set_Opacity          
  (Colorsel           : access Gtk_Color_Selection_Record;
   Use_Opacity        : in     Boolean);

Indicate whether the dialog should provide a way to change the
opacity of the color. Since not every application can handle transparent colors, it is better to deactivate this feature if you don't intend to use it. Note also that if you deactivated that feature, Get_Color will not set a valid value for the Opacity index of its return type.


procedure Set_Color            
  (Colorsel           : access Gtk_Color_Selection_Record;
   Color              : in     Color_Array);

Modify the current color.
Note that Color is an array of percentages, between 0.0 and 1.0, not absolute values.


procedure Get_Color            
  (Colorsel           : access Gtk_Color_Selection_Record;
   Color              : out    Color_Array);

Get the current color.
Note that Color is an array of percentages, between 0.0 and 1.0, not absolute values.


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]