Re: GtkColorSelection



Havoc Pennington <hp redhat com> writes:

>  - provide set_current_color() and set_current_alpha() to replace
>    set_color(), in order to get rid of the odd array of doubles 
>    API (that among other things doesn't work as an object property,
>    GUI builders can't understand it)
>
> void    gtk_color_selection_set_current_color  (GtkColorSelection *colorsel,
>                                                 GdkColor *color);
> void    gtk_color_selection_set_current_alpha  (GtkColorSelection *colorsel,
>                                                 guint16 alpha);
> void    gtk_color_selection_get_current_color  (GtkColorSelection *colorsel,
>                                                 GdkColor *color);
> guint16 gtk_color_selection_get_current_alpha  (GtkColorSelection *colorsel);

While not terrible, this makes the color selector harder to use if you
are not using GdkColor in your program.  You have to remember if a
GdkColor holds 8 or 16-bit values.  If you need a value in [0, 1] do
you divide by 255 or 256?  Or 65535 or 65536?

Also, a GUI builder does not need to set the color of a color selector.

GdkColor is also useless for color calibration.  Unless we declare it
to hold SRGB, which sort of makes sense.

>  - remove the is_adjusting() function, because I don't see what it's
>    for, though I'm willing to be convinced

See the Java APIs that use this convention.

You basically want to know if the widget is making rapid changes to
the color value, as when the user is dragging it with the mouse, so
that a potentially expensive signal handler may have a chance to skip
its work until later.  is_adjusting() lets you see whether this is a
possibly transient state or whether it is a final change.

> void gtk_color_selection_set_palette_color   (GtkColorSelection *colorsel,
>                                               gint index,
>                                               GdkColor *color);

You cannot set the alpha with this.

  Federico




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]