Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/iconbar

Dir     : e17/apps/iconbar/src


Modified Files:
        container.c container.h iconbar.c 


Log Message:


add alignment and the beginnings of fill policy (still alot more work needed here)

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/container.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- container.c 27 Jul 2003 19:36:54 -0000      1.1
+++ container.c 11 Aug 2003 22:14:54 -0000      1.2
@@ -145,6 +145,32 @@
   return cont->fit_y;
 }
 
+void e_container_alignment_set(Evas_Object *container, 
+                               Container_Alignment align)
+{
+  Container *cont;
+  
+  cont = _container_fetch(container);
+  if (!cont) return;
+
+  if (cont->align == align) return;
+  
+  cont->align = align;
+
+  _container_elements_fix(cont);
+  
+}
+
+Container_Alignment e_container_alignment_get(Evas_Object *container)
+{
+  Container *cont;
+  
+  cont = _container_fetch(container);
+  if (!cont) return 0;
+
+  return cont->align;
+}
+
 void e_container_scroll_set(Evas_Object *container, int scroll)
 {
   Container *cont;
@@ -275,7 +301,7 @@
   Evas_List *l, *ll = NULL;
   
   cont = _container_fetch(container);
-  if (!cont) return;
+  if (!cont) return NULL;
 
   for (l = cont->elements; l; l = l->next)
   {
@@ -381,15 +407,15 @@
     /* vertical */
     if (cont->direction)
     {
-      if (cont->fit_x)
-      {
-      }
-      if (cont->fit_y)
-      {
-      }
-
       /* FIXME: do other alignments also */
-      ix = ax + (aw - ew) / 2;
+
+      if (cont->align == CONTAINER_ALIGN_LEFT)
+        ix = ax;
+      else if (cont->align == CONTAINER_ALIGN_CENTER)
+        ix = ax + (aw - ew) / 2;
+      else if (cont->align == CONTAINER_ALIGN_RIGHT)
+        ix = ax + aw - ew;
+
       evas_object_move(el->obj, ix, iy);
       evas_object_move(el->grabber, ix, iy);
       iy += eh + cont->spacing;
@@ -398,19 +424,22 @@
     /* horizontal */
     else
     {
-      if (cont->fit_x)
-      {
-      }
-      if (cont->fit_y)
-      {
-      }
 
-      /* FIXME: do other alignments also */
-      iy = ay + (ah - eh) / 2;
+      if (cont->align == CONTAINER_ALIGN_TOP)
+        iy = ay;
+      else if (cont->align == CONTAINER_ALIGN_CENTER)
+        ix = ay + (ah - eh) / 2;
+      else if (cont->align == CONTAINER_ALIGN_BOTTOM)
+        iy = ay + ah - eh;
+        
       evas_object_move(el->obj, ix, iy);
       evas_object_move(el->grabber, ix, iy);
       ix += ew + cont->spacing;
     }
+
+   
+    evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
+    evas_object_resize(el->grabber, ew, eh);
   }
 
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/container.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- container.h 27 Jul 2003 19:36:54 -0000      1.1
+++ container.h 11 Aug 2003 22:14:54 -0000      1.2
@@ -16,11 +16,31 @@
 ****/
 typedef struct _Container Container;
 typedef struct _Container_Element Container_Element;
+typedef enum _Container_Alignment Container_Alignment;
+typedef enum _Container_Fill_Policy Container_Fill_Policy;
 
-#define CONTAINER_ALIGN_LEFT   0;
-#define CONTAINER_ALIGN_RIGHT  1;
-#define CONTAINER_ALIGN_CENTER 2;
+enum _Container_Alignment
+{
+  CONTAINER_ALIGN_CENTER,
+  CONTAINER_ALIGN_LEFT,
+  CONTAINER_ALIGN_RIGHT,
+  CONTAINER_ALIGN_BOTTOM = CONTAINER_ALIGN_LEFT,
+  CONTAINER_ALIGN_TOP = CONTAINER_ALIGN_RIGHT
+};
 
+enum _Container_Fill_Policy
+{
+  CONTAINER_FILL_POLICY_NONE = 0,
+  CONTAINER_FILL_POLICY_KEEP_ASPECT = 0x01,
+  CONTAINER_FILL_POLICY_FILL_X = 0x02,
+  CONTAINER_FILL_POLICY_FILL_Y = 0x04,
+  CONTAINER_FILL_POLICY_FILL = 
+    CONTAINER_FILL_POLICY_FILL_X | CONTAINER_FILL_POLICY_FILL_Y,
+  CONTAINER_FILL_POLICY_FIT_X = 0x08,
+  CONTAINER_FILL_POLICY_FIT_Y = 0x16,
+  CONTAINER_FILL_POLICY_FIT = 
+    CONTAINER_FILL_POLICY_FIT_X | CONTAINER_FILL_POLICY_FIT_Y
+};
 
 struct _Container
 {
@@ -41,7 +61,7 @@
   int direction;        /* 0 = horizontal or 1 = vertical */
   int fit_x, fit_y;     /* shrink elements if area is smaller than them */
   int fill_x, fill_y;   /* make elements fill the container */
-  int align;            /* CONTAINER_ALIGN_LEFT, _CENTER, or _RIGHT */
+  Container_Alignment align;  /* CONTAINER_ALIGN_LEFT, _CENTER, or _RIGHT */
   int move_button;      /* which button to move elements with? (0 for none) */
 
   int scroll;
@@ -81,6 +101,10 @@
 int  e_container_fit_x_get(Evas_Object *container);
 void e_container_fit_y_set(Evas_Object *container, int fit_y);
 int  e_container_fit_y_get(Evas_Object *container);
+
+void e_container_alignment_set(Evas_Object *container,
+                               Container_Alignment align);
+Container_Alignment e_container_alignment_get(Evas_Object *container);
 
 void e_container_scroll_set(Evas_Object *container, int scroll);
 int  e_container_scroll_get(Evas_Object *container);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/iconbar/src/iconbar.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- iconbar.c   27 Jul 2003 19:36:54 -0000      1.1
+++ iconbar.c   11 Aug 2003 22:14:54 -0000      1.2
@@ -74,6 +74,7 @@
   evas_object_show(ib->cont);
   edje_object_part_swallow(ib->gui, "icons", ib->cont); //was clip
   e_container_spacing_set(ib->cont, 5);
+  e_container_alignment_set(ib->cont, CONTAINER_ALIGN_CENTER);
   e_container_callback_order_change_set(ib->cont, write_out_order, ib);
 
   edje_object_signal_callback_add(ib->gui, "mouse,*", "*", cb_iconbar, ib);




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to