Enlightenment CVS committal

Author  : pfritz
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 esmart_container_smart.c 


Log Message:
make clipping optional, thanks to sevcsik

===================================================================
RCS file: /cvs/e/e17/libs/esmart/src/lib/esmart_container/Esmart_Container.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- Esmart_Container.h  12 Jul 2008 06:40:36 -0000      1.11
+++ Esmart_Container.h  18 Jul 2008 16:15:06 -0000      1.12
@@ -147,6 +147,18 @@
 
 EAPI int esmart_container_layout_plugin_set(Evas_Object *container, const char 
*name);
 
+/*! \brief Set that container should clip elements
+ * @param container Object
+ * @param val Boolean value: 1 to clip elements (default), 0 to not
+ */
+EAPI void esmart_container_clip_elements_set(Evas_Object *container, 
+                                             unsigned char val);
+
+/*! \brief Checks that container clips elements or not
+ * @param container Object
+ * @return Boolean value: 1 if clip elements, 0 if not
+ */
+EAPI unsigned char esmart_container_clip_elements_get(Evas_Object *container);
 
 #ifdef __cplusplus
 }
===================================================================
RCS file: /cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- esmart_container.c  16 Jul 2008 21:37:49 -0000      1.17
+++ esmart_container.c  18 Jul 2008 16:15:06 -0000      1.18
@@ -419,6 +419,47 @@
   return length;
 }
 
+EAPI void
+esmart_container_clip_elements_set(Evas_Object *container, unsigned char val)
+{
+   Container *cont;
+   Evas_List *l;
+
+   cont = _container_fetch(container);
+   if (val)
+      evas_object_show(cont->clipper);
+   else
+      evas_object_hide(cont->clipper);
+   cont->clip_elements = val;
+
+   if (val)
+   { /* Clip all elements */
+      for (l = cont->elements; l; l = l->next)
+      {
+         Container_Element *el = l->data;
+
+         evas_object_clip_set(el->obj, cont->clipper);
+      }
+   }
+   else
+   { /* Unclip all elements */
+      for (l = cont->elements; l; l = l->next)
+      {
+         Container_Element *el = l->data;
+
+         evas_object_clip_unset(el->obj);
+      }
+   }
+}
+
+EAPI unsigned char
+esmart_container_clip_elements_get(Evas_Object *container)
+{
+   Container *cont;
+
+   cont = _container_fetch(container);
+   return cont->clip_elements;
+}
 
 /**************** internal  functions *******************/
 
@@ -435,7 +476,7 @@
   el->obj = obj;
   evas_object_data_set(obj, "Container_Element", el); 
   evas_object_show(obj);
- 
+
   evas_object_geometry_get(obj, NULL, NULL, &w, &h);
   el->orig_w = w;
   el->orig_h = h;
@@ -444,9 +485,12 @@
   evas_object_repeat_events_set(el->grabber, 1);
   evas_object_color_set(el->grabber, 0, 0, 0, 0);
   evas_object_show(el->grabber);
-  
+
   el->container = cont;
-  evas_object_clip_set(el->obj, cont->clipper);
+
+  if (cont->clip_elements || !evas_object_visible_get(cont->obj))
+     evas_object_clip_set(el->obj, cont->clipper);
+
   evas_object_clip_set(el->grabber, cont->clipper);
 /*
   evas_object_layer_set(el->obj, evas_object_layer_get(cont->obj));
@@ -456,6 +500,7 @@
   evas_object_stack_above(el->obj, cont->obj);
 */
   evas_object_smart_member_add(el->obj, cont->obj);
+  
   evas_object_smart_member_add(el->grabber, cont->obj);
 
   evas_object_event_callback_add(el->grabber, EVAS_CALLBACK_MOUSE_DOWN, 
_cb_element_down, el);
===================================================================
RCS file: 
/cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container_private.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- esmart_container_private.h  12 Jul 2008 06:40:36 -0000      1.7
+++ esmart_container_private.h  18 Jul 2008 16:15:06 -0000      1.8
@@ -48,6 +48,9 @@
   void *data_order_change;
 
   unsigned char changed : 1;
+
+  unsigned char clip_elements : 1; /* decide wether to clip elements to 
container 
+                                      or not */
 };
 
 struct _Container_Element
===================================================================
RCS file: 
/cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container_smart.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- esmart_container_smart.c    16 Jul 2008 21:37:49 -0000      1.8
+++ esmart_container_smart.c    18 Jul 2008 16:15:06 -0000      1.9
@@ -177,22 +177,44 @@
 _container_show(Evas_Object *obj)
 {
   Container *data;
+  Evas_List *l;
   
   data = evas_object_smart_data_get(obj);
 
   evas_object_show(data->clipper);
   evas_object_show(data->grabber);
+  
+  /* This is needed because clipping is optional */
+  if (!data->clip_elements)
+  {
+    for (l = data->elements; l; l = l->next)
+    {
+      Container_Element *el = l->data;
+
+      evas_object_clip_unset(el->obj);
+    }
+  }
 }
 
 static void
 _container_hide(Evas_Object *obj)
 {
   Container *data;
+  Evas_List *l;
   
   data = evas_object_smart_data_get(obj);
 
   evas_object_hide(data->clipper);
   evas_object_hide(data->grabber);
+  
+  /* This is needed because clipping is optional, but we use it anyway when 
+   * hiding */
+  for (l = data->elements; l; l = l->next)
+  {
+    Container_Element *el = l->data;
+
+    evas_object_clip_set(el->obj, data->clipper);
+  }
 }
 
 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to