Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin


Modified Files:
        ewl_colordialog_test.c 


Log Message:
- rework the colour dialogs and spectrum
- the spectrum dosen't work 100% in all cases, sometimes does strange things
- haven't tested the alpha code yet, tho the base is in there

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/bin/ewl_colordialog_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_colordialog_test.c      21 Jun 2005 02:42:24 -0000      1.2
+++ ewl_colordialog_test.c      2 Nov 2005 17:51:44 -0000       1.3
@@ -3,6 +3,47 @@
 static Ewl_Widget *colordialog_button = NULL;
 
 static void
+__colordialog_cb_value_changed(Ewl_Widget *w, void *ev, void *data __UNUSED__)
+{
+       Ewl_Colordialog_Event *cd_ev;
+       unsigned int response;
+  
+       cd_ev = ev;
+       response = ewl_colordialog_event_response_get(cd_ev);
+       if (response == EWL_STOCK_OK)
+       {
+               Ewl_Widget *o;
+               unsigned int r, g, b, a;
+
+               o = ewl_widget_name_find("colour_preview");
+
+               ewl_colordialog_current_rgb_get(EWL_COLORDIALOG(w), &r, &g, &b);
+               a = ewl_colordialog_alpha_get(EWL_COLORDIALOG(w));
+
+               ewl_widget_color_set(o, r, g, b, a);
+       }
+       ewl_widget_destroy(w);
+}
+
+static void
+__colordialog_cb_launch(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, 
+                                       void *data __UNUSED__)
+{
+       Ewl_Widget *o;
+       int r, g, b, a;
+
+       o = ewl_widget_name_find("colour_preview");
+       ewl_widget_color_get(o, &r, &g, &b, &a);
+
+       o = ewl_colordialog_new();
+       ewl_colordialog_previous_rgb_set(EWL_COLORDIALOG(o), r, g, b);
+       ewl_colordialog_alpha_set(EWL_COLORDIALOG(o), a);
+       ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, 
+                               __colordialog_cb_value_changed, NULL);
+       ewl_widget_show(o);
+}
+
+static void 
 __destroy_colordialog_test_window(Ewl_Widget *w, void *ev_data __UNUSED__, 
                                                void *user_data __UNUSED__)
 {
@@ -16,7 +57,7 @@
                                                void *user_data __UNUSED__)
 {
        Ewl_Widget *colordialog_win;
-       Ewl_Widget *colordialog;
+       Ewl_Widget *box, *o;
 
        colordialog_button = w;
 
@@ -35,7 +76,22 @@
                                __close_main_window, NULL);
        ewl_widget_show(colordialog_win);
 
-       colordialog = ewl_colordialog_new(0, 0, 0);
-       ewl_container_child_append(EWL_CONTAINER(colordialog_win), colordialog);
-       ewl_widget_show(colordialog);
+       box = ewl_vbox_new();
+       ewl_container_child_append(EWL_CONTAINER(colordialog_win), box);
+       ewl_widget_show(box);
+
+       o = NEW(Ewl_Widget, 1);
+       ewl_widget_init(o);
+       ewl_container_child_append(EWL_CONTAINER(box), o);
+       ewl_object_minimum_size_set(EWL_OBJECT(o), 150, 20);
+       ewl_widget_name_set(o, "colour_preview");
+       ewl_widget_color_set(o, 255, 255, 255, 255);
+       ewl_widget_show(o);
+
+       o = ewl_button_new();
+       ewl_container_child_append(EWL_CONTAINER(box), o);
+       ewl_button_label_set(EWL_BUTTON(o), "Launch Colour Dialog");
+       ewl_callback_append(o, EWL_CALLBACK_CLICKED, __colordialog_cb_launch, 
NULL);
+       ewl_widget_show(o);
 }
+




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to