Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : proto

Dir     : e17/proto/esmart/src/container


Modified Files:
        container.c 


Log Message:
Added the 'smart' scrolling behaviour from e_container_scroll_start() to 
e_container_scroll()
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/esmart/src/container/container.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- container.c 17 Oct 2003 22:31:40 -0000      1.4
+++ container.c 18 Oct 2003 19:18:31 -0000      1.5
@@ -77,12 +77,31 @@
 void e_container_scroll(Evas_Object *container, int val)
 {
   Container *cont;
+  double size, length, pad, max_scroll;
   
-  if((cont = _container_fetch(container)))
-  {
-      cont->scroll_offset += val; 
-      _container_elements_fix(cont);
-  }
+  if(!(cont = _container_fetch(container)))
+    return;
+
+  length = e_container_elements_length_get(container);
+  size = cont->direction ? cont->h : cont->w;
+
+  /* don't scroll unless the elements exceed the size of the container */
+  if (length <= size)
+    return;
+
+  pad = cont->direction ? cont->padding.t + cont->padding.b :
+                              cont->padding.l + cont->padding.r;
+  max_scroll = size - length - pad;
+
+  cont->scroll_offset += val;
+  
+  /* don't scroll beyond the top/bottom */
+  if (cont->scroll_offset < max_scroll)
+    cont->scroll_offset = max_scroll;
+  else if (cont->scroll_offset > 0)
+    cont->scroll_offset = 0;
+  
+  _container_elements_fix(cont);
 }
 
 void e_container_scroll_offset_set(Evas_Object *container, int scroll_offset)




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to