Download

Support

Ewl_Colorpicker: The colour picking widget


Detailed Description

Remarks:
Inherits from Ewl_Box.

Tutorial

The Ewl_Colorpicker widget provides a way to let the user select a color either by manually entering its values, or graphically via the built-in Ewl_Spectrum widget, which also provides a preview of the color. The color can be selected in RGB or HSV format (but can be retrieved only in RGB format for now).

Once you've setup the colour picker, you can read its current and previous value and set them. For example the following swaps the two.

 unsigned int r,g,b;
 ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(cp), &r, &g, &b);
 ewl_colorpicker_previous_rgb_set(EWL_COLORPICKER(cp), r, g, b);

You can also change the display mode of the spectrum programmatically


Data Structures

struct  Ewl_Colorpicker
 Inherits from Ewl_Box to produce a color picker widget. More...

Defines

#define EWL_COLORPICKER(cp)   ((Ewl_Colorpicker *) cp)
#define EWL_COLORPICKER_IS(w)   (ewl_widget_type_is(EWL_WIDGET(w), EWL_COLORPICKER_TYPE))
#define EWL_COLORPICKER_TYPE   "colorpicker"

Typedefs

typedef struct Ewl_Colorpicker Ewl_Colorpicker

Functions

unsigned int ewl_colorpicker_alpha_get (Ewl_Colorpicker *cp)
 Retrive the alpha value from the color picker.
void ewl_colorpicker_alpha_set (Ewl_Colorpicker *cp, unsigned int alpha)
 Set the alpha value into the color picker.
void ewl_colorpicker_cb_alpha_change (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_dnd_data (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_previous_clicked (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_radio_change (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_spinner_change (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_square_change (Ewl_Widget *w, void *ev, void *data)
void ewl_colorpicker_cb_vertical_change (Ewl_Widget *w, void *ev, void *data)
Ewl_Color_Mode ewl_colorpicker_color_mode_get (Ewl_Colorpicker *cp)
 Get the color mode of the color picker.
void ewl_colorpicker_color_mode_set (Ewl_Colorpicker *cp, Ewl_Color_Mode type)
 Set the color mode of the color picker.
void ewl_colorpicker_current_rgb_get (Ewl_Colorpicker *cp, unsigned int *r, unsigned int *g, unsigned int *b)
 Retrieve the current RGB values from the color picker.
void ewl_colorpicker_current_rgb_set (Ewl_Colorpicker *cp, unsigned int r, unsigned int g, unsigned int b)
 Set the current RGB values into the color picker.
unsigned int ewl_colorpicker_has_alpha_get (Ewl_Colorpicker *cp)
 Retrieves if the color picker displays alpha information.
void ewl_colorpicker_has_alpha_set (Ewl_Colorpicker *cp, unsigned int alpha)
 Set if the color picker displays alpha information.
int ewl_colorpicker_init (Ewl_Colorpicker *cp)
 Initializes the cp color picker widget.
Ewl_Widgetewl_colorpicker_new (void)
 Creates a new Ewl_Colorpicker widget.
void ewl_colorpicker_previous_rgba_get (Ewl_Colorpicker *cp, unsigned int *r, unsigned int *g, unsigned int *b, unsigned int *a)
 Retrieve the previous RGBA values from the color picker.
void ewl_colorpicker_previous_rgba_set (Ewl_Colorpicker *cp, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
 Set the previous RBGA values into the color picker.

Define Documentation

#define EWL_COLORPICKER_IS (  )     (ewl_widget_type_is(EWL_WIDGET(w), EWL_COLORPICKER_TYPE))

Returns TRUE if the widget is an Ewl_Colorpicker, FALSE otherwise


Typedef Documentation


Function Documentation

unsigned int ewl_colorpicker_alpha_get ( Ewl_Colorpicker cp  ) 

Retrive the alpha value from the color picker.

Parameters:
cp,: The colourpicker to get the alpha value from
Returns:
Returns the alpha value of the colorpicker (0-255)

References alpha, DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_COLORPICKER_TYPE, EWL_RANGE, ewl_range_value_get(), and spinners.

Referenced by ewl_colordialog_alpha_get(), and ewl_colorpicker_cb_dnd_data().

void ewl_colorpicker_alpha_set ( Ewl_Colorpicker cp,
unsigned int  alpha 
)

Set the alpha value into the color picker.

Parameters:
cp,: the colourpicker to set the alpha value too
alpha,: The alpha value to set.

References alpha, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, EWL_RANGE, ewl_range_value_set(), and spinners.

Referenced by ewl_colordialog_alpha_set(), and ewl_colorpicker_cb_dnd_data().

void ewl_colorpicker_cb_previous_clicked ( Ewl_Widget w,
void *  ev,
void *  data 
)

void ewl_colorpicker_cb_square_change ( Ewl_Widget w,
void *  ev,
void *  data 
)

Ewl_Color_Mode ewl_colorpicker_color_mode_get ( Ewl_Colorpicker cp  ) 

Get the color mode of the color picker.

Parameters:
cp,: The colorpicker to get the mode from
Returns:
Returns the Ewl_Color_Mode of the colorpicker

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_COLORPICKER_TYPE, and mode.

Referenced by ewl_colordialog_color_mode_get().

void ewl_colorpicker_color_mode_set ( Ewl_Colorpicker cp,
Ewl_Color_Mode  mode 
)

Set the color mode of the color picker.

Parameters:
cp,: The colorpicker to set the mode on
mode,: The mode to set on the colorpicker
Returns:
Returns no value.

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, EWL_SPECTRUM, ewl_spectrum_mode_set(), mode, picker, square, and vertical.

Referenced by ewl_colordialog_color_mode_set(), and ewl_colorpicker_init().

void ewl_colorpicker_current_rgb_get ( Ewl_Colorpicker cp,
unsigned int *  r,
unsigned int *  g,
unsigned int *  b 
)

Retrieve the current RGB values from the color picker.

Parameters:
cp,: The colorpicker to get the current rgb values from
r,: Where to store the red value
g,: Where to store the green value
b,: Where to store the blue value
Returns:
Returns no value

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, EWL_SPECTRUM, ewl_spectrum_rgb_get(), picker, and square.

Referenced by ewl_colordialog_current_rgb_get(), and ewl_colorpicker_cb_dnd_data().

void ewl_colorpicker_current_rgb_set ( Ewl_Colorpicker cp,
unsigned int  r,
unsigned int  g,
unsigned int  b 
)

Set the current RGB values into the color picker.

Parameters:
cp,: The colourpicker to set the current rgb value into
r,: The red value to set
g,: The green value to set
b,: The blue value to set
Returns:
Returns no value.

References alpha, current, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, EWL_RANGE, ewl_range_value_get(), EWL_SPECTRUM, ewl_spectrum_hsv_get(), ewl_spectrum_rgb_set(), ewl_widget_color_set(), picker, preview, spinners, square, and vertical.

Referenced by ewl_colordialog_current_rgb_set(), ewl_colorpicker_cb_dnd_data(), and ewl_colorpicker_cb_previous_clicked().

unsigned int ewl_colorpicker_has_alpha_get ( Ewl_Colorpicker cp  ) 

Retrieves if the color picker displays alpha information.

Parameters:
cp,: The colour picker to get the has_alpha flag from
Returns:
Returns the value of the has_alpha flag (TRUE or FALSE)

References DCHECK_PARAM_PTR_RET, DCHECK_TYPE_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_COLORPICKER_TYPE, and has_alpha.

Referenced by ewl_colordialog_has_alpha_get().

void ewl_colorpicker_has_alpha_set ( Ewl_Colorpicker cp,
unsigned int  alpha 
)

Set if the color picker displays alpha information.

Parameters:
cp,: The colour picker to set the has_alpha flag on.
alpha,: Value to set the has_alpha param too. (TRUE or FALSE)
Returns:
Returns no value.

References alpha_box, DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, DRETURN, EWL_COLORPICKER_TYPE, ewl_widget_hide(), ewl_widget_show(), and has_alpha.

Referenced by ewl_colordialog_has_alpha_set().

int ewl_colorpicker_init ( Ewl_Colorpicker cp  ) 

Initializes the cp color picker widget.

Parameters:
cp,: The Ewl_Colorpicker to initialize
Returns:
Returns TRUE on success or FALSE on failure

References alpha, alpha_box, current, DCHECK_PARAM_PTR_RET, DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_INT, EWL_BOX, ewl_box_init(), ewl_box_orientation_set(), EWL_BUTTON, ewl_button_label_set(), ewl_callback_append(), EWL_CALLBACK_CLICKED, EWL_CALLBACK_DND_DATA_RECEIVED, EWL_CALLBACK_VALUE_CHANGED, EWL_CHECKBUTTON, ewl_checkbutton_checked_set(), EWL_COLOR_MODE_HSV_HUE, EWL_COLOR_MODE_HSV_SATURATION, EWL_COLOR_MODE_HSV_VALUE, EWL_COLOR_MODE_RGB_BLUE, EWL_COLOR_MODE_RGB_GREEN, EWL_COLOR_MODE_RGB_RED, ewl_colorpicker_cb_alpha_change(), ewl_colorpicker_cb_dnd_data(), ewl_colorpicker_cb_previous_clicked(), ewl_colorpicker_cb_radio_change(), ewl_colorpicker_cb_spinner_change(), ewl_colorpicker_cb_square_change(), ewl_colorpicker_cb_vertical_change(), ewl_colorpicker_color_mode_set(), EWL_COLORPICKER_RADIOBUTTON, EWL_COLORPICKER_SPINNER, EWL_COLORPICKER_TYPE, EWL_CONTAINER, ewl_container_child_append(), ewl_dnd_accepted_types_set(), EWL_FLAG_FILL_FILL, EWL_FLAG_FILL_HFILL, EWL_FLAG_FILL_NONE, EWL_FLAG_FILL_SHRINK, EWL_FLAG_FILL_VSHRINK, EWL_GRID, ewl_grid_column_preferred_w_use(), ewl_grid_dimensions_set(), ewl_grid_new(), ewl_grid_vhomogeneous_set(), ewl_hbox_new(), EWL_LABEL, ewl_label_new(), ewl_label_text_set(), EWL_OBJECT, ewl_object_fill_policy_set(), EWL_OBJECT_MAX_SIZE, ewl_object_maximum_size_set(), ewl_object_minimum_h_set(), ewl_object_minimum_size_set(), ewl_object_padding_set(), EWL_ORIENTATION_HORIZONTAL, EWL_RADIOBUTTON, ewl_radiobutton_chain_set(), EWL_RANGE, ewl_range_maximum_value_set(), ewl_range_minimum_value_set(), ewl_range_step_set(), ewl_range_value_set(), EWL_SPECTRUM, ewl_spectrum_hsv_get(), ewl_spectrum_new(), ewl_spectrum_rgb_set(), ewl_spectrum_type_set(), EWL_SPECTRUM_TYPE_SQUARE, EWL_SPECTRUM_TYPE_VERTICAL, EWL_SPINNER, ewl_spinner_digits_set(), ewl_spinner_new(), ewl_vbox_new(), EWL_WIDGET, ewl_widget_appearance_set(), ewl_widget_color_set(), ewl_widget_inherit(), ewl_widget_init(), ewl_widget_internal_set(), ewl_widget_show(), hsv, NEW, picker, preview, previous, rgb, spinners, square, and vertical.

Referenced by ewl_colorpicker_new().

Ewl_Widget* ewl_colorpicker_new ( void   ) 

Creates a new Ewl_Colorpicker widget.

Returns:
Returns a new Ewl_Colorpicker widget or NULL on failure

References DENTER_FUNCTION, DLEVEL_STABLE, DRETURN_PTR, EWL_COLORPICKER, ewl_colorpicker_init(), ewl_widget_destroy(), and NEW.

Referenced by ewl_colordialog_init().

void ewl_colorpicker_previous_rgba_get ( Ewl_Colorpicker cp,
unsigned int *  r,
unsigned int *  g,
unsigned int *  b,
unsigned int *  a 
)

Retrieve the previous RGBA values from the color picker.

Parameters:
cp,: The colorpicker to get the previous rgb value from.
r,: Where to store the red value
g,: Where to store the green value
b,: Where to store the blue value
a,: Where to store the alpha value
Returns:
Returns no value.

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, and previous.

Referenced by ewl_colordialog_previous_rgba_get().

void ewl_colorpicker_previous_rgba_set ( Ewl_Colorpicker cp,
unsigned int  r,
unsigned int  g,
unsigned int  b,
unsigned int  a 
)

Set the previous RBGA values into the color picker.

Parameters:
cp,: The colorpicker to set the previous rgb value into
r,: The red value to set
g,: The green value to set
b,: The blue value to set
a,: The alpha value to set
Returns:
Returns no value.

References DCHECK_PARAM_PTR, DCHECK_TYPE, DENTER_FUNCTION, DLEAVE_FUNCTION, DLEVEL_STABLE, EWL_COLORPICKER_TYPE, ewl_widget_color_set(), preview, and previous.

Referenced by ewl_colordialog_previous_rgba_set().


Copyright © Enlightenment.org

Enlightened Widget Library Documentation Generated: Sat May 17 16:51:08 2008