GtkAda Reference Manual - Package Gtk.Extra.Color_Combo

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

# Package Gtk.Extra.Color`_`Combo

A Gtk_Color_Combo is a widget that ease the selection of colors by the user. It is a special form of a Gtk_Combo_Box, that displays a special popup window, with a list of colors.

Note that nothing appears in the button, this your responsibility to update it when the user selects a new color (see the "changed" signal).

The recommended solution is to put a Gtk_Pixmap as the child of the button of the combo box ("Add (Get_Button (Combo), Pixmap)"), and updated it in the handler for this signal.

- Gtk.Extra.Color_Combo Widget Hierarchy
- Gtk.Extra.Color_Combo Signals
- Gtk.Extra.Color_Combo 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_Combo_Box (see section Package Gtk.Extra.Combo_Box)
                   \___ Gtk_Color_Combo (see section Package Gtk.Extra.Color_Combo)

## Signals

- "changed" procedure Handler (Color_Combo : access Gtk_Color_Combo_Record'Class;
  Selection : Gint;
  Color_Name : String);
  Emitted when the color has selected a new color. Selection is the number of the selection (this is the total row * Ncols + col). Color_Name is the name of the selected color.

## Subprograms

    procedure Gtk_New
      (Widget             : out    Gtk_Color_Combo);
| Create a new default combo box. It shows a list of 40 default colors.
    procedure Gtk_New
      (Widget             : out    Gtk_Color_Combo;
       Nrows              :        Gint;
       Ncols              :        Gint;
       Values             :        Gdk.Color.Gdk_Color_Array);
| Create a new combo box with a specific list of colors. Note that Color_Names must contain at least Nrows * Ncols elements.
    function Get_Type              return Gtk.Gtk_Type;
| Return the internal value associated with a Gtk_Color_Combo.
    function Get_Color_At
      (Widget             : access Gtk_Color_Combo_Record;
       Row                :        Gint;
       Col                :        Gint)
       return Gdk.Color.Gdk_Color;
| Return the name of the color at specific coordinates.
    procedure Find_Color
      (Color_Combo        : access Gtk_Color_Combo_Record;
       Color              :        Gdk.Color.Gdk_Color;
       Row                : out    Gint;
       Col                : out    Gint);
| Return the coordinates in which a color appear in the popup window. (-1, -1) is returned if the color was not found in the combo box.
    function Get_Selection
      (Color_Combo        : access Gtk_Color_Combo_Record)
       return Gdk.Color.Gdk_Color;
| Return the current selection in the combo.
    function Set_Color
      (Color_Combo        : access Gtk_Color_Combo_Record;
       Name               :        String)
       return Boolean;
| Set the new current color. If the color is not found in the list of colors provided in the popup window, False is returned.
    function Set_Color
      (Color_Combo        : access Gtk_Color_Combo_Record;
       Color              :        Gdk.Color.Gdk_Color)
       return Boolean;
| Set the new current color. Color must have been allocated first. If the color is not found in the list of colors provided in the popup window, False is returned.
    function Get_Ncols
      (Color_Combo        : access Gtk_Color_Combo_Record)
       return Gint;
| Return the number of columns in the popup window
    function Get_Nrows
      (Color_Combo        : access Gtk_Color_Combo_Record)
       return Gint;
| Return the number of rows in the popup window
    procedure Changed
      (Color_Combo        : access Gtk_Color_Combo_Record;
       Row                :        Gint;
       Col                :        Gint);
| Emit the changed signal for the widget, as if the color at coordinates (Row, Col) had been selected. Note that this doesn't change the internal state of the widget (use Set_Color for that).

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