GimpColorButton

Name

GimpColorButton -- Widget for selecting a color.

Synopsis



struct      GimpColorButton;
#define     GIMP_COLOR_BUTTON               (obj)
GtkWidget*  gimp_color_button_new           (const gchar *title,
                                             gint width,
                                             gint height,
                                             guchar *color,
                                             gint bpp);
GtkWidget*  gimp_color_button_double_new    (const gchar *title,
                                             gint width,
                                             gint height,
                                             gdouble *color,
                                             gint bpp);
void        gimp_color_button_update        (GimpColorButton *gcb);

Object Hierarchy


  GtkObject
   +----GtkWidget
         +----GtkContainer
               +----GtkBin
                     +----GtkButton
                           +----GimpColorButton

Signal Prototypes


"color-changed"
            void        user_function      (GimpColorButton *gimpcolorbutton,
                                            gpointer user_data);

Description

This widget provides a simple button with a preview showing the color.

On click a GtkColorSelectionDialog is opened. Additionally the button supports Drag and Drop and has a right-click menu that allows to choose the color from the current FG or BG color. If the user changes the color, the "color_changed" signal is emitted.

Note that the color is changed in place.

Details

struct GimpColorButton

struct GimpColorButton;


GIMP_COLOR_BUTTON()

#define GIMP_COLOR_BUTTON(obj)            (GTK_CHECK_CAST ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButton))

Checks if the passed pointer is a pointer to a GimpColorButton and performs the cast if valid.

obj :The pointer to cast.


gimp_color_button_new ()

GtkWidget*  gimp_color_button_new           (const gchar *title,
                                             gint width,
                                             gint height,
                                             guchar *color,
                                             gint bpp);

Creates a new GimpColorButton widget.

This returns a button with a preview showing the color. When the button is clicked a GtkColorSelectionDialog is opened. If the user changes the color the new color is written into the array that was used to pass the initial color and the "color_changed" signal is emitted.

title : String that will be used as title for the color_selector.
width : Width of the colorpreview in pixels.
height : Height of the colorpreview in pixels.
color : An array of guchar holding the color (RGB or RGBA)
bpp : May be 3 for RGB or 4 for RGBA.
Returns : Pointer to the new GimpColorButton widget.


gimp_color_button_double_new ()

GtkWidget*  gimp_color_button_double_new    (const gchar *title,
                                             gint width,
                                             gint height,
                                             gdouble *color,
                                             gint bpp);

Creates a new GimpColorButton widget.

This returns a button with a preview showing the color. When the button is clicked a GtkColorSelectionDialog is opened. If the user changes the color the new color is written into the array that was used to pass the initial color and the "color_changed" signal is emitted.

title : String that wil be used as title for the color_selector.
width : Width of the colorpreview in pixels.
height : Height of the colorpreview in pixels.
color : An array of gdouble holding the color (RGB or RGBA)
bpp : May be 3 for RGB or 4 for RGBA.
Returns : Pointer to the new GimpColorButton widget.


gimp_color_button_update ()

void        gimp_color_button_update        (GimpColorButton *gcb);

Should be used after the color controlled by a GimpColorButton was changed. The color is then reread and the change is propagated to the preview and the GtkColorSelectionDialog if one is open.

gcb : Pointer to a GimpColorButton.

Signals

The "color-changed" signal

void        user_function                  (GimpColorButton *gimpcolorbutton,
                                            gpointer user_data);

gimpcolorbutton :the object which received the signal.
user_data :user data set when the signal handler was connected.

See Also

libgimp-gimpcolorspace