Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/esmart

Dir     : e17/libs/esmart/src/lib/esmart_container


Modified Files:
        Esmart_Container.h esmart_container.c 
        esmart_container_private.h 


Log Message:


clean up esmart. dont advertise publicly structs that SHOULd be private. fix
sort to pass objects, not container structs. fix text entry to do focus the
RIGHT way :)

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_container/Esmart_Container.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Esmart_Container.h  9 May 2004 23:29:36 -0000       1.3
+++ Esmart_Container.h  10 Nov 2004 15:22:22 -0000      1.4
@@ -17,11 +17,6 @@
 extern "C" {
 #endif
 
-typedef struct _Container Container;
-typedef struct _Container_Element Container_Element;
-typedef struct _Scroll_Data Scroll_Data;
-typedef struct _Container_Layout_Plugin Container_Layout_Plugin;
-
 enum _Container_Direction
 {
   CONTAINER_DIRECTION_HORIZONTAL,  
@@ -50,84 +45,8 @@
 };
 typedef enum _Container_Fill_Policy Container_Fill_Policy;
 
-struct _Container
-{
-  Evas *evas;
-  Evas_Object *obj;     /* the evas smart object */
-  Evas_Object *clipper; /* element clip */
-  Evas_Object *grabber; /* event grabber (for the container as a whole) */
-
-  Container_Layout_Plugin *plugin;
-
-  Evas_List *elements;  /* things contained */
-
-  struct
-  {
-    double l, r, t, b;
-  } padding;
-
-  double x, y, w, h;    /* geometry */
-  
-  int clipper_orig_alpha;              /* original alpha value of clipper */
-
-  int spacing;          /* space between elements */
-
-  Container_Direction direction; /* CONTAINER_DIRECTION_HORIZONTAL, _VERTICAL 
*/
-  Container_Alignment align;  /* CONTAINER_ALIGN_LEFT, _CENTER, or _RIGHT */
-  Container_Fill_Policy fill;
-
-  int move_button;      /* which button to move elements with? (0 for none) */
-
-  int scroll_offset;
-  Ecore_Timer *scroll_timer;
-
-  void (*cb_order_change) (void *data);
-  void *data_order_change;
-};
-
-struct _Container_Element
-{
-  Container *container;
-  Evas_Object *obj;
-  Evas_Object *grabber;
-
-  double orig_w, orig_h;
-
-  struct
-  {
-    double x, y;
-  } down, delta, current;
-
-  int mouse_down;
-  int dragging;
-};
-
-struct _Scroll_Data
-{
-  Container *cont;
-  double start_time;
-  double velocity;
-  double length;
-};
-
 Evas_Object *esmart_container_new(Evas *evas);
 
-struct _Container_Layout_Plugin{
-  void *handle;
-
-  void (*shutdown)(void);
-  
-  void (*layout)(Container *cont);
-  
-  void (*scroll_start)(Container *cont, double velocity);
-  void (*scroll_stop)(Container *cont);
-  void (*scroll_to)(Container *cont, Container_Element *el);
-
-  void (*post_init)(Container *cont);
-  void (*changed)(Container *cont);
-};
-
-
 void esmart_container_direction_set(Evas_Object *container, 
Container_Direction direction);
 Container_Direction esmart_container_direction_get(Evas_Object *container);
 
@@ -169,7 +88,7 @@
 void esmart_container_element_remove(Evas_Object *container, Evas_Object 
*element);
 void esmart_container_element_destroy(Evas_Object *container, Evas_Object 
*element);
 void esmart_container_empty (Evas_Object *container);
-void esmart_container_sort(Evas_Object *container, int (*func)(void*,void*));
+void esmart_container_sort(Evas_Object *container, int (*func)(Evas_Object *, 
Evas_Object *));
 
 Evas_List *esmart_container_elements_get(Evas_Object *container);
 
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_container/esmart_container.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- esmart_container.c  30 Oct 2004 09:09:59 -0000      1.3
+++ esmart_container.c  10 Nov 2004 15:22:38 -0000      1.4
@@ -15,17 +15,35 @@
 
 /*** external API ***/
 
-void esmart_container_sort(Evas_Object *container, int (*func)(void*,void*))
+static int (*_sort_func)(void*,void*) = NULL;
+
+static int
+_sort_cb(void *d1, void *d2)
 {
-  Container *cont;
+   Evas_Object *o = NULL;
+   Evas_Object *oo = NULL;
+   
+   o = ((Container_Element *) d1)->obj;
+   oo = ((Container_Element *) d2)->obj;
+   if (_sort_func) return 0;
+   return _sort_func(d1, d2);
+}
+
+void esmart_container_sort(Evas_Object *container, int (*func)(Evas_Object *, 
Evas_Object *$))
+{
+   Container *cont;
   
-  cont = _container_fetch(container);
-  if (!cont) return;
+   cont = _container_fetch(container);
+   if (!cont) return;
     
-  cont->elements = evas_list_sort(cont->elements, 
evas_list_count(cont->elements),
-                               func);
-  _container_elements_fix(cont);
+   _sort_func = func;
+   cont->elements = evas_list_sort(cont->elements,
+                                  evas_list_count(cont->elements),
+                                  _sort_cb);
+   _sort_func = NULL;
+   _container_elements_fix(cont);
 }
+
 void esmart_container_direction_set(Evas_Object *container, 
Container_Direction direction)
 {
   Container *cont;
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_container/esmart_container_private.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- esmart_container_private.h  5 May 2004 05:57:00 -0000       1.1.1.1
+++ esmart_container_private.h  10 Nov 2004 15:22:38 -0000      1.2
@@ -3,6 +3,86 @@
 
 #include "Esmart_Container.h"
 
+typedef struct _Container Container;
+typedef struct _Container_Element Container_Element;
+typedef struct _Scroll_Data Scroll_Data;
+typedef struct _Container_Layout_Plugin Container_Layout_Plugin;
+   
+struct _Container
+{
+  Evas *evas;
+  Evas_Object *obj;     /* the evas smart object */
+  Evas_Object *clipper; /* element clip */
+  Evas_Object *grabber; /* event grabber (for the container as a whole) */
+
+  Container_Layout_Plugin *plugin;
+
+  Evas_List *elements;  /* things contained */
+
+  struct
+  {
+    double l, r, t, b;
+  } padding;
+
+  double x, y, w, h;    /* geometry */
+  
+  int clipper_orig_alpha;              /* original alpha value of clipper */
+
+  int spacing;          /* space between elements */
+
+  Container_Direction direction; /* CONTAINER_DIRECTION_HORIZONTAL, _VERTICAL 
*/
+  Container_Alignment align;  /* CONTAINER_ALIGN_LEFT, _CENTER, or _RIGHT */
+  Container_Fill_Policy fill;
+
+  int move_button;      /* which button to move elements with? (0 for none) */
+
+  int scroll_offset;
+  Ecore_Timer *scroll_timer;
+
+  void (*cb_order_change) (void *data);
+  void *data_order_change;
+};
+
+struct _Container_Element
+{
+  Container *container;
+  Evas_Object *obj;
+  Evas_Object *grabber;
+
+  double orig_w, orig_h;
+
+  struct
+  {
+    double x, y;
+  } down, delta, current;
+
+  int mouse_down;
+  int dragging;
+};
+
+struct _Scroll_Data
+{
+  Container *cont;
+  double start_time;
+  double velocity;
+  double length;
+};
+
+struct _Container_Layout_Plugin{
+  void *handle;
+
+  void (*shutdown)(void);
+  
+  void (*layout)(Container *cont);
+  
+  void (*scroll_start)(Container *cont, double velocity);
+  void (*scroll_stop)(Container *cont);
+  void (*scroll_to)(Container *cont, Container_Element *el);
+
+  void (*post_init)(Container *cont);
+  void (*changed)(Container *cont);
+};
+
 Container *_container_fetch(Evas_Object *obj);
 Container_Element *_container_element_new(Container *cont, Evas_Object *obj);
 void _container_elements_fix(Container *cont);




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to