HildonColorSelector

HildonColorSelector — A widget for selecting a color

Synopsis




            HildonColorSelectorPriv;
GtkWidget*  hildon_color_selector_new       (GtkWindow *parent);
const GdkColor* hildon_color_selector_get_color
                                            (HildonColorSelector *selector);
void        hildon_color_selector_set_color (HildonColorSelector *selector,
                                             GdkColor *color);

Description

HildonColorSelector allows selection of a color from a standard 16-color palette or a palette of 8 user-customizable colors. The user-customizable colors can be modified through HildonColorPopup.

Here is an example for using a color selector.


GtkWidget *selector;
GdkColor *color;
gint result;

selector = hildon_color_selector_new( GTK_WINDOW(gtk_widget_get_toplevel( data ) ));

result = gtk_dialog_run( GTK_DIALOG ( selector ) );
switch (result)
  {
    case GTK_RESPONSE_OK:
      color = hildon_color_selector_get_color( HILDON_COLOR_SELECTOR( selector ) );
      break;
    default:
      break;
  }

gtk_widget_destroy( selector );

Details

HildonColorSelectorPriv

typedef struct _HildonColorSelectorPriv HildonColorSelectorPriv;

Internal struct for color selector.


hildon_color_selector_new ()

GtkWidget*  hildon_color_selector_new       (GtkWindow *parent);

Creates a new HildonColorSelector dialog with 3x8 layout of base colors and 'OK', 'More..' and 'Cancel' buttons.

parent : the parent window. The X window ID of the parent window has to be the same as the X window ID of the application
Returns : new HildonColorSelector

hildon_color_selector_get_color ()

const GdkColor* hildon_color_selector_get_color
                                            (HildonColorSelector *selector);

selector : a HildonColorSelector
Returns : the currently selected GdkColor. The returned pointer must not be freed.

hildon_color_selector_set_color ()

void        hildon_color_selector_set_color (HildonColorSelector *selector,
                                             GdkColor *color);

Selects the color specified. Does nothing if the color does not exist among the standard colors.

selector : HildonColorSelector
color : Gdkcolor to set

See Also

HildonColorButton, HildonColorPopup