Ok, I did as for the filedialog : there is two widgets :
 - the colorpicker is the part that allow to choose the color
 - the colordialog is a standalone dialog, with preview ok & cancel

I also changed the preview part with a colored rectangle. I used a new
home made widget, but I'm not sure it's the best way (and I'm sure it's
not a good one as I draw the rect pixel by pixel ! I will correct it I
promise)

For the new files, I just put the files, for the others I put a diff. I
also put a diff for the Makefile.am (lib_Makefile.am.diff) that changed
and the Ewl.h.in.

The callback part of the testapp also needed a change, so there's also
the diff for this Makefile.am (bin_Makefile.am.diff) and for
ewl_colorpicker_test.c

-- 
Colin Pitrat

http://www.framasoft.net/
D�couvrez la signification du mot libert�.


Andrew Elcock a ecrit :
> good luck - nice work, but you are right ;)
> 
> Colin Pitrat wrote:
> 
>>Andrew Elcock a ecrit :
>>
>>
>>>In, thanks - before I can mark this as fixed in TODO we realln need a
>>>dialog (style thing) using this that returns the colour that was
>>>selected - up for the challenge?
>>>
>>>perhaps OK Cancel Preview could be lined up, as there is quite a bit of
>>>whitespace on the right now...
>>>
>>>Thanks,
>>>
>>>Andrew
>>>
>>
>>
>>OK, I'm on it. The preview part could be better too (like a colored square).
>>
> 
> 
> 

--- e17_cvs/e17/libs/ewl/src/lib/Ewl.h.in	2005-03-28 09:04:27.000000000 +0200
+++ e17/libs/ewl/src/lib/Ewl.h.in	2005-06-11 01:26:37.449340184 +0200
@@ -308,6 +308,7 @@
 #include <ewl_text.h>
 
 #include <ewl_colorpicker.h>
+#include <ewl_colordialog.h>
 #include <ewl_password.h>
 #include <ewl_seeker.h>
 #include <ewl_scrollbar.h>
@@ -315,6 +316,7 @@
 #include <ewl_spinner.h>
 #include <ewl_image.h>
 #include <ewl_spectrum.h>
+#include <ewl_coloredrect.h>
 #include <ewl_menu_base.h>
 #include <ewl_imenu.h>
 #include <ewl_menu.h>

--- e17_cvs/e17/libs/ewl/src/bin/Makefile.am	2005-05-28 21:01:40.000000000 +0200
+++ e17/libs/ewl/src/bin/Makefile.am	2005-06-11 01:28:23.751179848 +0200
@@ -18,6 +18,7 @@
 					ewl_border_test.c \
 					ewl_box_test.c \
 					ewl_button_test.c \
+					ewl_colordialog_test.c \
 					ewl_colorpicker_test.c \
 					ewl_combo_test.c \
 					ewl_dialog_test.c \

#include <Ewl.h>
#include "ewl_debug.h"
#include "ewl_macros.h"

/**
 * @return Returns NULL on failure, otherwise a newly allocated color dialog.
 * @brief Allocate and initialize a new color dialog widget.
 */
Ewl_Widget *ewl_colordialog_new(int r, int g, int b)
{
	Ewl_ColorDialog *cd;

	DENTER_FUNCTION(DLEVEL_STABLE);

	cd = NEW(Ewl_ColorDialog, 1);
        if (!cd) {
                DRETURN_PTR(NULL, DLEVEL_STABLE);
        }

	if (!ewl_colordialog_init(cd, r, g, b)) {
                ewl_widget_destroy(EWL_WIDGET(cd));
		cd = NULL;
	}
	DRETURN_PTR(EWL_WIDGET(cd), DLEVEL_STABLE);
}

/**
 * @param cd: the color dialog to initialize
 * @return Returns TRUE on success, FALSE on failure.
 * @brief Initialize a color dialog to starting values.
 */
int ewl_colordialog_init(Ewl_ColorDialog *cd, int r, int g, int b)
{
        Ewl_Widget *picker;
        Ewl_Widget *vbox;
        Ewl_Widget *button;

	DENTER_FUNCTION(DLEVEL_STABLE);
	DCHECK_PARAM_PTR_RET("cd", cd, FALSE);

	if (!ewl_box_init(EWL_BOX(cd), EWL_ORIENTATION_HORIZONTAL))
		DRETURN_INT(FALSE, DLEVEL_STABLE);

	ewl_widget_appearance_set(EWL_WIDGET(cd), "colordialog");
	ewl_widget_inherit(EWL_WIDGET(cd), "colordialog");

	ewl_box_spacing_set(EWL_BOX(cd), 5);

	/*
	 * Setup the picker.
	 */
	picker = ewl_colorpicker_new();
	ewl_callback_append(picker, EWL_CALLBACK_VALUE_CHANGED,
			    ewl_colordialog_color_valuechanged_cb, cd);
	ewl_object_fill_policy_set(EWL_OBJECT(picker), EWL_FLAG_FILL_ALL);
	ewl_container_child_append(EWL_CONTAINER(cd), picker);
	ewl_widget_show(picker);

        /*
         * A preview to see the selected color, ok and cancel buttons
         */

        vbox = ewl_box_new(EWL_ORIENTATION_VERTICAL);
	ewl_box_spacing_set(EWL_BOX(vbox), 10);
        ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
        ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_CENTER);
        ewl_object_minimum_size_set(EWL_OBJECT(vbox), 20, 100);
	ewl_container_child_append(EWL_CONTAINER(cd), vbox);

        cd->preview = ewl_coloredrect_new(r, g, b, 255);
        ewl_object_fill_policy_set(EWL_OBJECT(cd->preview), EWL_FLAG_FILL_ALL);
        ewl_object_alignment_set(EWL_OBJECT(cd->preview), EWL_FLAG_ALIGN_CENTER);
	ewl_container_child_append(EWL_CONTAINER(vbox), cd->preview);
	ewl_widget_show(cd->preview);

        button = ewl_button_stock_with_id_new(EWL_STOCK_OK, EWL_RESPONSE_OK);
        ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
        ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_colordialog_button_cb, cd);
	ewl_container_child_append(EWL_CONTAINER(vbox), button);
	ewl_widget_show(button);

        button = ewl_button_stock_with_id_new(EWL_STOCK_CANCEL, EWL_RESPONSE_CANCEL);
        ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
        ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_colordialog_button_cb, cd);
	ewl_container_child_append(EWL_CONTAINER(vbox), button);
	ewl_widget_show(button);

	ewl_widget_show(vbox);

	DRETURN_INT(TRUE, DLEVEL_STABLE);
}

void ewl_colordialog_color_get(Ewl_ColorDialog *cd, int *r, int *g, int *b)
{
        *r = cd->selected.r;
        *g = cd->selected.g;
        *b = cd->selected.b;
}

void ewl_colordialog_color_valuechanged_cb(Ewl_Widget *w, void *ev_data, void *user_data)
{
        Ewl_ColorDialog *cd = EWL_COLORDIALOG(user_data);
        struct _ewl_colordialog_color *col = ev_data;
        cd->selected.r = col->r;
        cd->selected.g = col->g;
        cd->selected.b = col->b;
        ewl_coloredrect_color_set(EWL_COLOREDRECT(cd->preview), col->r, col->g, col->b, 255);
}

void ewl_colordialog_button_cb(Ewl_Widget *w, void *ev_data, void *user_data)
{
        Ewl_ColorDialog *cd = EWL_COLORDIALOG(user_data);
        ewl_callback_call_with_event_data(EWL_WIDGET(cd), EWL_CALLBACK_VALUE_CHANGED, &EWL_BUTTON_STOCK(w)->response_id);
}

#ifndef __EWL_COLORDIALOG_H
#define __EWL_COLORDIALOG_H

/**
 * @file ewl_colordialog.h
 * @defgroup Ewl_ColorDialog ColorDialog: A Simple Colour Dialog widget
 *
 * @{
 */

typedef struct Ewl_ColorDialog Ewl_ColorDialog;

/**
 * @def EWL_COLORDIALOG(cd)
 * Typecast a pointer to an Ewl_ColorDialog pointer.
 */
#define EWL_COLORDIALOG(cd) ((Ewl_ColorDialog *) cd)

struct Ewl_ColorDialog
{
	Ewl_Box box;
        Ewl_Widget *preview;
        struct _ewl_colordialog_color 
        {
                int r, g, b;
        } selected;
};

Ewl_Widget 	*ewl_colordialog_new(int r, int g, int b);
int 		ewl_colordialog_init(Ewl_ColorDialog *cd, int r, int g, int b);

/*
 * Internal callbacks, override at your own risk.
 */
void ewl_colordialog_color_valuechanged_cb(Ewl_Widget *w, void *ev_data, void *user_data);
void ewl_colordialog_button_cb(Ewl_Widget *w, void *ev_data, void *user_data);

/**
 * @}
 */

#endif

#include <Ewl.h>
#include "ewl_debug.h"
#include "ewl_macros.h"

/**
 * ewl_coloredrect_new - create a new color picker widget
 *
 * Returns a newly allocated color picker widget on success, NULL on failure.
 */
Ewl_Widget     *ewl_coloredrect_new(int r, int g, int b, int a)
{
	Ewl_ColoredRect *cr = NULL;

	DENTER_FUNCTION(DLEVEL_STABLE);
	cr = NEW(Ewl_ColoredRect, 1);
	if (!cr)
		DRETURN_PTR(NULL, DLEVEL_STABLE);

	ewl_coloredrect_init(cr, r, g, b, a);

	DRETURN_PTR(EWL_WIDGET(cr), DLEVEL_STABLE);
}

/**
 * @param cr: The coloredrect to init
 * @return Returns no value.
 * @brief Initializes the given coloredrect widget
 */
void ewl_coloredrect_init(Ewl_ColoredRect * cr, int r, int g, int b, int a)
{
	Ewl_Widget     *w;

	DENTER_FUNCTION(DLEVEL_STABLE);
	DCHECK_PARAM_PTR("cr", cr);

	w = EWL_WIDGET(cr);

        ewl_coloredrect_color_set(EWL_COLOREDRECT(w), r, g, b, a);

	ewl_image_init(EWL_IMAGE(w), NULL, NULL);
	ewl_widget_appearance_set(w, "coloredrect");
	ewl_widget_inherit(w, "coloredrect");

	ewl_callback_append(w, EWL_CALLBACK_CONFIGURE,
			    ewl_coloredrect_configure_cb, NULL);

	DRETURN(DLEVEL_STABLE);
}

/**
 * @param cr: The coloredrect to set the r, g, b values of
 * @param r: The red value to set
 * @param g: The green value to set
 * @param b: The blue value to set 
 * @return Returns no value.
 */ 
void
ewl_coloredrect_color_set(Ewl_ColoredRect * cr, int r, int g, int b, int a)
{
	DENTER_FUNCTION(DLEVEL_STABLE);
	DCHECK_PARAM_PTR("cr", cr);

	if (r >= 0 && r < 256)
		cr->r = r;
	if (g >= 0 && g < 256)
		cr->g = g;
	if (b >= 0 && b < 256)
		cr->b = b;

	cr->redraw = 1;
	ewl_widget_configure(EWL_WIDGET(cr));

	DRETURN(DLEVEL_STABLE);
}

/*
 * Callback for drawing the coloredrect to the image data.
 */
void
ewl_coloredrect_configure_cb(Ewl_Widget * w, void *ev_data __UNUSED__,
			  void *user_data __UNUSED__)
{
	Evas_Object    *o;
	int             pw, ph;
	int             i, j;
	int            *data = NULL;
	Ewl_ColoredRect   *cr;

	DENTER_FUNCTION(DLEVEL_STABLE);

	if (!REALIZED(w))
		DRETURN(DLEVEL_STABLE);

	cr = EWL_COLOREDRECT(w);
	if (!cr->redraw)
		DRETURN(DLEVEL_STABLE);

	o = EWL_IMAGE(cr)->image;
	if (!o)
		return;

	/* set/get the coloredrect size and image data */
	evas_object_image_size_set(o, CURRENT_W(cr), CURRENT_H(cr));
	evas_object_image_size_get(o, &pw, &ph);
	data = evas_object_image_data_get(o, 1);
	if (!data)
		return;

	/* draw the coloredrect */
	for (j = 0; j < ph; j++) {
		for (i = 0; i < pw; i++) {
			data[(j * pw) + i] =
			    (cr->a << 24) | (cr->r << 16) | (cr->g << 8) | cr->b;
		}
	}

	evas_object_image_data_set(o, data);
	evas_object_image_data_update_add(o, 0, 0, pw, ph);

	DLEAVE_FUNCTION(DLEVEL_STABLE);
}

#ifndef _EWL_COLOREDRECT_H
#define _EWL_COLOREDRECT_H

/**
 * @file ewl_coloredrect.h
 * @defgroup Ewl_ColoredRect ColoredRect The coloredrect widget
 *
 * @{
 */

/**
 * @themekey /coloredrect/file
 * @themekey /coloredrect/group
 */

typedef struct _ewl_coloredrect Ewl_ColoredRect;

#define EWL_COLOREDRECT(cr) ((Ewl_ColoredRect *)cr)

struct _ewl_coloredrect {
  Ewl_Image widget;
  int r, g, b, a; 
  int redraw;
};

Ewl_Widget     *ewl_coloredrect_new(int r, int g, int b, int a);
void            ewl_coloredrect_init(Ewl_ColoredRect * cp, int r, int g, int b, int a);

void            ewl_coloredrect_color_set(Ewl_ColoredRect *cr, int r, int g, int b, int a);

/*
 * Internally used callbacks, override at your own risk.
 */
void         ewl_coloredrect_configure_cb(Ewl_Widget * w, void *ev_data,
				       void *user_data);

/**
 * @}
 */
#endif

--- e17_cvs/e17/libs/ewl/src/lib/ewl_colorpicker.c	2005-03-28 09:04:27.000000000 +0200
+++ e17/libs/ewl/src/lib/ewl_colorpicker.c	2005-06-11 01:09:04.504412144 +0200
@@ -13,7 +13,8 @@
 	DENTER_FUNCTION(DLEVEL_STABLE);
 
 	cp = NEW(Ewl_ColorPicker, 1);
-	if (!ewl_colorpicker_init(cp)) {
+	if (!ewl_colorpicker_init(cp)) 
+        {
 		FREE(cp);
 		cp = NULL;
 	}
@@ -37,17 +38,7 @@
 	ewl_widget_appearance_set(EWL_WIDGET(cp), "colorpicker");
 	ewl_widget_inherit(EWL_WIDGET(cp), "colorpicker");
 
-	ewl_box_spacing_set(EWL_BOX(cp), 20);
-
-	/*
-	 * Setup the larger spectrum region for selecting shades of the base
-	 * color.
-	 */
-	cp->spectrum = ewl_spectrum_new();
-	ewl_spectrum_mode_set(EWL_SPECTRUM(cp->spectrum), EWL_PICK_MODE_RGB);
-	ewl_object_preferred_inner_size_set(EWL_OBJECT(cp->spectrum), 200, 200);
-	ewl_container_child_append(EWL_CONTAINER(cp), cp->spectrum);
-	ewl_widget_show(cp->spectrum);
+	ewl_box_spacing_set(EWL_BOX(cp), 5);
 
 	/*
 	 * Setup the range spectrum region for the base color.
@@ -62,27 +53,65 @@
 			    ewl_colorpicker_range_up_cb, cp);
 	ewl_callback_append(cp->range, EWL_CALLBACK_MOUSE_MOVE,
 			    ewl_colorpicker_range_move_cb, cp);
-	ewl_object_preferred_inner_size_set(EWL_OBJECT(cp->range), 20, 200);
-	ewl_object_fill_policy_set(EWL_OBJECT(cp->range), EWL_FLAG_FILL_VFILL);
+        ewl_object_minimum_size_set(EWL_OBJECT(cp->range), 50, 100);
+	ewl_object_fill_policy_set(EWL_OBJECT(cp->range), EWL_FLAG_FILL_ALL);
 	ewl_container_child_append(EWL_CONTAINER(cp), cp->range);
 	ewl_widget_show(cp->range);
 
+	/*
+	 * Setup the larger spectrum region for selecting shades of the base
+	 * color.
+	 */
+	cp->spectrum = ewl_spectrum_new();
+	ewl_callback_append(cp->spectrum, EWL_CALLBACK_MOUSE_DOWN,
+			    ewl_colorpicker_spectrum_down_cb, cp);
+	ewl_callback_append(cp->spectrum, EWL_CALLBACK_MOUSE_UP,
+			    ewl_colorpicker_spectrum_up_cb, cp);
+	ewl_callback_append(cp->spectrum, EWL_CALLBACK_MOUSE_MOVE,
+			    ewl_colorpicker_spectrum_move_cb, cp);
+	ewl_spectrum_mode_set(EWL_SPECTRUM(cp->spectrum), EWL_PICK_MODE_RGB);
+        ewl_object_minimum_size_set(EWL_OBJECT(cp->spectrum), 50, 100);
+	ewl_object_fill_policy_set(EWL_OBJECT(cp->spectrum), EWL_FLAG_FILL_ALL);
+	ewl_container_child_append(EWL_CONTAINER(cp), cp->spectrum);
+	ewl_widget_show(cp->spectrum);
+
 	DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
 
+void ewl_colorpicker_color_set(Ewl_ColorPicker *cp, int r, int g, int b)
+{
+        cp->selected.r = r;
+        cp->selected.g = g;
+        cp->selected.b = b;
+
+        ewl_callback_call_with_event_data(EWL_WIDGET(cp), EWL_CALLBACK_VALUE_CHANGED, &cp->selected);
+}
+
+#undef R
+#undef G
+#undef B
+#undef A
+#define R (cp->selected.r)
+#define G (cp->selected.g)
+#define B (cp->selected.b)
+#define A (cp->selected.a)
+
 void ewl_colorpicker_range_move_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
-	int r, g, b, a;
 	Ewl_ColorPicker *cp = user_data;
 	Ewl_Event_Mouse_Move *ev = ev_data;
 
 	DENTER_FUNCTION(DLEVEL_STABLE);
 
-	if (cp->drag) {
-		ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), ev->x, ev->y,
-					     &r, &g, &b, &a);
-		ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->spectrum), r, g, b);
-		ewl_callback_call(EWL_WIDGET(cp), EWL_CALLBACK_VALUE_CHANGED);
+	if (cp->drag && 
+                ev->x > w->object.current.x && ev->x < w->object.current.x + w->object.current.w && 
+                ev->y > w->object.current.y && ev->y < w->object.current.y + w->object.current.h) 
+        { 
+                int x = ev->x - w->object.current.x;
+                int y = ev->y - w->object.current.y;
+		ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), x, y, &R, &G, &B, &A);
+		ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->spectrum), R, G, B);
+                ewl_colorpicker_color_set(cp, R, G, B);
 	}
 
 	DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -90,23 +119,24 @@
 
 void ewl_colorpicker_range_down_cb(Ewl_Widget *w, void *ev_data, void *user_data)
 {
-	int r, g, b, a;
 	Ewl_ColorPicker *cp = user_data;
 	Ewl_Event_Mouse_Down *ev = ev_data;
 
 	DENTER_FUNCTION(DLEVEL_STABLE);
 
 	cp->drag = 1;
-	ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), ev->x, ev->y,
-				     &r, &g, &b, &a);
-	ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->spectrum), r, g, b);
-	ewl_callback_call(EWL_WIDGET(cp), EWL_CALLBACK_VALUE_CHANGED);
+
+        int x = ev->x - w->object.current.x;
+        int y = ev->y - w->object.current.y;
+	ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), x, y, &R, &G, &B, &A);
+	ewl_spectrum_rgb_set(EWL_SPECTRUM(cp->spectrum), R, G, B);
+        ewl_colorpicker_color_set(cp, R, G, B);
 
 	DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 void ewl_colorpicker_range_up_cb(Ewl_Widget *w __UNUSED__, 
-				void *ev_data __UNUSED__, void *user_data)
+                                        void *ev_data __UNUSED__, void *user_data)
 {
 	Ewl_ColorPicker *cp = user_data;
 
@@ -117,3 +147,51 @@
 	DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
+void ewl_colorpicker_spectrum_move_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+	Ewl_ColorPicker *cp = user_data;
+	Ewl_Event_Mouse_Move *ev = ev_data;
+
+	DENTER_FUNCTION(DLEVEL_STABLE);
+
+	if (cp->drag &&
+                ev->x > w->object.current.x && ev->x < w->object.current.x + w->object.current.w && 
+                ev->y > w->object.current.y && ev->y < w->object.current.y + w->object.current.h) 
+        {
+                int x = ev->x - w->object.current.x;
+                int y = ev->y - w->object.current.y;
+		ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), x, y, &R, &G, &B, &A);
+                ewl_colorpicker_color_set(cp, R, G, B);
+	}
+
+	DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_colorpicker_spectrum_down_cb(Ewl_Widget *w, void *ev_data, void *user_data)
+{
+	Ewl_ColorPicker *cp = user_data;
+	Ewl_Event_Mouse_Down *ev = ev_data;
+
+	DENTER_FUNCTION(DLEVEL_STABLE);
+
+	cp->drag = 1;
+        
+        int x = ev->x - w->object.current.x;
+        int y = ev->y - w->object.current.y;
+	ewl_spectrum_color_coord_map(EWL_SPECTRUM(w), x, y, &R, &G, &B, &A);
+        ewl_colorpicker_color_set(cp, R, G, B);
+
+	DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+void ewl_colorpicker_spectrum_up_cb(Ewl_Widget *w __UNUSED__, 
+                                        void *ev_data __UNUSED__, void *user_data)
+{
+	Ewl_ColorPicker *cp = user_data;
+
+	DENTER_FUNCTION(DLEVEL_STABLE);
+
+	cp->drag = 0;
+
+	DLEAVE_FUNCTION(DLEVEL_STABLE);
+}

--- e17_cvs/e17/libs/ewl/src/lib/ewl_colorpicker.h	2005-02-17 20:14:54.000000000 +0100
+++ e17/libs/ewl/src/lib/ewl_colorpicker.h	2005-06-10 23:14:32.057182928 +0200
@@ -10,16 +10,27 @@
 
 typedef struct Ewl_ColorPicker Ewl_ColorPicker;
 
+/**
+ * @def EWL_COLORPICKER(cp)
+ * Typecast a pointer to an Ewl_ColorPicker pointer.
+ */
+#define EWL_COLORPICKER(cp) ((Ewl_ColorPicker *) cp)
+
 struct Ewl_ColorPicker
 {
 	Ewl_Box box;
 	Ewl_Widget *spectrum;
 	Ewl_Widget *range;
 	int drag;
+        struct _ewl_colorpicker_color
+        {
+            int r, g, b, a;
+        } selected;
 };
 
 Ewl_Widget 	*ewl_colorpicker_new();
-int 		 ewl_colorpicker_init(Ewl_ColorPicker *cp);
+int 		ewl_colorpicker_init(Ewl_ColorPicker *cp);
+void            ewl_colorpicker_color_set(Ewl_ColorPicker *cp, int r, int g, int b);
 
 /*
  * Internal callbacks, override at your own risk.
@@ -27,6 +38,9 @@
 void ewl_colorpicker_range_down_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_colorpicker_range_up_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 void ewl_colorpicker_range_move_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_colorpicker_spectrum_down_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_colorpicker_spectrum_up_cb(Ewl_Widget *w, void *ev_data, void *user_data);
+void ewl_colorpicker_spectrum_move_cb(Ewl_Widget *w, void *ev_data, void *user_data);
 
 /**
  * @}

--- e17_cvs/e17/libs/ewl/src/bin/ewl_colorpicker_test.c	2005-05-28 22:32:49.000000000 +0200
+++ e17/libs/ewl/src/bin/ewl_colorpicker_test.c	2005-06-11 01:37:12.395813648 +0200
@@ -15,8 +15,8 @@
 __color_value_changed(Ewl_Widget *w __UNUSED__, void *ev_data, 
 						void *user_data __UNUSED__)
 {
-	char *text = ev_data;
-	printf("value changed to %s\n", text);
+	struct { int r, g, b; } *col = ev_data;
+	printf("value changed to (%i, %i, %i)\n", col->r, col->g, col->b);
 }
 
 void

--- e17_cvs/e17/libs/ewl/src/lib/Makefile.am	2005-03-11 16:20:53.000000000 +0100
+++ e17/libs/ewl/src/lib/Makefile.am	2005-06-10 23:54:07.323087624 +0200
@@ -19,6 +19,8 @@
 	ewl_cell.h \
 	ewl_check.h \
 	ewl_checkbutton.h \
+        ewl_colordialog.h \
+	ewl_coloredrect.h \
 	ewl_colorpicker.h \
 	ewl_combo.h \
 	ewl_config.h \
@@ -80,6 +82,8 @@
 	ewl_cell.c \
 	ewl_check.c \
 	ewl_checkbutton.c \
+        ewl_colordialog.c \
+	ewl_coloredrect.c \
 	ewl_colorpicker.c \
 	ewl_combo.c \
 	ewl_config.c \

Reply via email to