Enlightenment CVS committal

Author  : lok
Project : e17
Module  : proto

Dir     : e17/proto/enhance/src/lib


Modified Files:
        enhance.c enhance_widget.c 


Log Message:
Spinner support added.

===================================================================
RCS file: /cvs/e/e17/proto/enhance/src/lib/enhance.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- enhance.c   7 Oct 2006 11:03:12 -0000       1.32
+++ enhance.c   8 Dec 2006 13:25:27 -0000       1.33
@@ -802,6 +802,13 @@
                             "step_increment", step_incr, 
                             "page_increment", page_incr, NULL);
      }
+
+   else if(!strcmp(name, "digits"))
+     {
+       PROPERTY_INT;
+
+       etk_object_properties_set(ETK_OBJECT(wid->wid), "digits", value, NULL);
+     }
 }
 
 void
===================================================================
RCS file: /cvs/e/e17/proto/enhance/src/lib/enhance_widget.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- enhance_widget.c    8 Sep 2006 23:22:26 -0000       1.24
+++ enhance_widget.c    8 Dec 2006 13:25:27 -0000       1.25
@@ -557,12 +557,12 @@
    char       *id;
    Ecore_List *props;
    EXML_Node  *prop;
-   int         value;
-   int         min       = 0;
-   int         max       = 0;
-   int         step_inc  = 1;
-   int         page_inc  = 1;
-   int         page_size = 1;
+   double      value;
+   double      min       = 0;
+   double      max       = 0;
+   double      step_inc  = 1;
+   double      page_inc  = 1;
+   double      page_size = 1;
    
    id = ecore_hash_get(node->attributes, "id");
    if(!id) return NULL;
@@ -586,7 +586,7 @@
                       char *adj;
                       
                       adj = strdup(prop->value);
-                      sscanf(adj, "%d %d %d %d %d %d", &value, &min, &max,
+                      sscanf(adj, "%lf %lf %lf %lf %lf %lf", &value, &min, 
&max,
                              &step_inc, &page_inc, &page_size);
                       E_FREE(adj);
                    }
@@ -611,12 +611,12 @@
    char       *id;
    Ecore_List *props;
    EXML_Node  *prop;
-   int         value;
-   int         min       = 0;
-   int         max       = 0;
-   int         step_inc  = 0;
-   int         page_inc  = 0;
-   int         page_size = 0;
+   double      value;
+   double      min       = 0;
+   double      max       = 0;
+   double      step_inc  = 0;
+   double      page_inc  = 0;
+   double      page_size = 0;
    
    id = ecore_hash_get(node->attributes, "id");
    if(!id) return NULL;
@@ -640,7 +640,7 @@
                       char *adj;
 
                       adj = strdup(prop->value);
-                      sscanf(adj, "%d %d %d %d %d %d", &value, &min, &max,
+                      sscanf(adj, "%lf %lf %lf %lf %lf %lf", &value, &min, 
&max,
                              &step_inc, &page_inc, &page_size);
                       E_FREE(adj);                    
                    }
@@ -651,10 +651,10 @@
    
    ecore_list_goto_first(props);
       
-   slider = _e_widget_new(en, node, etk_vslider_new((double)min, (double)max, 
-                                                   (double)value,
-                                                   (double) step_inc, 
-                                                   (double)page_inc), id);   
+   slider = _e_widget_new(en, node, etk_vslider_new(min, max, 
+                                                   value,
+                                                   step_inc, 
+                                                   page_inc), id);   
    return slider;
 }
 
@@ -742,6 +742,61 @@
    return tool_toggle_button;
 }
 
+static E_Widget *
+_e_widget_spinner_handle(Enhance *en, EXML_Node *node)
+{
+   E_Widget   *spinner;
+   char       *id;
+   Ecore_List *props;
+   EXML_Node  *prop;
+   double      value;
+   double      min       = 0;
+   double      max       = 0;
+   double      step_inc  = 1;
+   double      page_inc  = 1;
+   double      page_size = 1;
+   
+   id = ecore_hash_get(node->attributes, "id");
+   if(!id) return NULL;
+   
+   props = node->children;
+   ecore_list_goto_first(props);
+   prop = ecore_list_current(props);
+   while(prop != NULL)
+     {
+       if(!strcmp(prop->tag, "property"))
+         {
+            char *name;
+            
+            name = ecore_hash_get(prop->attributes, "name");
+            if(!name) { prop = ecore_list_next(props); continue; }
+            
+            if(!strcmp(name, "adjustment"))
+              {
+                 if(prop->value)
+                   {
+                      char *adj;
+                      
+                      adj = strdup(prop->value);
+                      sscanf(adj, "%lf %lf %lf %lf %lf %lf", &value, &min, 
&max,
+                             &step_inc, &page_inc, &page_size);
+                      E_FREE(adj);
+                   }
+              }
+         }
+       prop = ecore_list_next(props);
+     }
+
+   ecore_list_goto_first(props);
+   
+   spinner = _e_widget_new(en, node, etk_spinner_new(min, max, 
+                                                    value,
+                                                    step_inc,
+                                                    page_inc), id);   
+
+   return spinner;
+}
+
 E_Widget *
 _e_widget_handle(Enhance *en, EXML_Node *node)
 {
@@ -832,6 +887,8 @@
      return _e_widget_tool_button_handle(en, node);
    else if(!strcmp(class, "GtkToggleToolButton"))
      return _e_widget_tool_toggle_button_handle(en, node);
+   else if(!strcmp(class, "GtkSpinButton"))
+     return _e_widget_spinner_handle(en, node);
    return NULL;
 }
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to