Add the toolbar API which expand the transverse length
authorJaehwan Kim <jae.hwan.kim.neo@gmail.com>
Thu, 27 Sep 2012 03:05:50 +0000 (03:05 +0000)
committerJaehwan Kim <jae.hwan.kim.neo@gmail.com>
Thu, 27 Sep 2012 03:05:50 +0000 (03:05 +0000)
SVN revision: 77107

ChangeLog
NEWS
src/bin/test_toolbar.c
src/lib/elm_toolbar.c
src/lib/elm_toolbar.h
src/lib/elm_widget_toolbar.h

index f7707a5..7307efc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
 2012-09-25  Cedric Bail
 
-       * Escape theme filename correctly.
+        * Escape theme filename correctly.
+
+2012-09-27  Jaehwan Kim
+
+        * Add the toolbar API which expand the transverse length
diff --git a/NEWS b/NEWS
index 874072a..0d20058 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Additions:
    * Add elementary_codegen
    * Add window floating mode api's
    * Add reorder mode set/get API in Toolbar.
+   * Add the toolbar API which expand the transverse length.
 
 Improvements:
 
index 0a7efe8..35a9312 100644 (file)
@@ -831,6 +831,7 @@ test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    tb = elm_toolbar_add(win);
    elm_toolbar_homogeneous_set(tb, EINA_FALSE);
    elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
+   elm_toolbar_transverse_expanded_set(tb, EINA_TRUE);
    elm_toolbar_standard_priority_set(tb, 0);
    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
index f52bf97..d3a6bcf 100644 (file)
@@ -236,12 +236,12 @@ _resize_job(void *data)
 
         if (sd->vertical)
           {
-             evas_object_resize(sd->bx, w, vh);
+             h = vh;
              _items_visibility_fix(sd, &ih, vh, &more);
           }
         else
           {
-             evas_object_resize(sd->bx, vw, h);
+             w = vw;
              _items_visibility_fix(sd, &iw, vw, &more);
           }
         evas_object_geometry_get
@@ -316,12 +316,12 @@ _resize_job(void *data)
 
         if (sd->vertical)
           {
-             evas_object_resize(sd->bx, w, vh);
+             h = vh;
              _items_visibility_fix(sd, &ih, vh, &more);
           }
         else
           {
-             evas_object_resize(sd->bx, vw, h);
+             w = vw;
              _items_visibility_fix(sd, &iw, vw, &more);
           }
         evas_object_box_remove_all(sd->bx, EINA_FALSE);
@@ -353,12 +353,10 @@ _resize_job(void *data)
      {
         Evas_Coord iw = 0, ih = 0;
 
-        if ((vw >= mw) && (vh >= mh))
-          evas_object_resize(sd->bx, vw, vh);
-        else if (vw < mw)
-          evas_object_resize(sd->bx, mw, vh);
-        else if (vh < mh)
-          evas_object_resize(sd->bx, vw, mh);
+        if (sd->vertical)
+                       h = (vh >= mh) ? vh : mh;
+               else
+                       w = (vw >= mw) ? vw : mw;
 
         if (sd->vertical)
           _items_visibility_fix(sd, &ih, vh, &more);
@@ -389,11 +387,11 @@ _resize_job(void *data)
      {
         if (sd->vertical)
           {
-             if ((vh >= mh) && (h != vh)) evas_object_resize(sd->bx, w, vh);
+             if ((vh >= mh) && (h != vh)) h = vh;
           }
         else
           {
-             if ((vw >= mw) && (w != vw)) evas_object_resize(sd->bx, vw, h);
+             if ((vw >= mw) && (w != vw)) w = vw;
           }
         EINA_INLIST_FOREACH(sd->items, it)
           {
@@ -405,6 +403,16 @@ _resize_job(void *data)
           }
      }
 
+   if (sd->transverse_expanded)
+     {
+        if (sd->vertical)
+          w = vw;
+        else
+          h = vh;
+     }
+
+   evas_object_resize(sd->bx, w, h);
+
 // Remove the first or last separator since it is not neccessary
    list = evas_object_box_children_get(sd->bx_more);
    EINA_INLIST_FOREACH(sd->items, it)
@@ -840,8 +848,14 @@ _sizing_eval(Evas_Object *obj)
      {
         minw = minw_bx + (w - vw);
         minh = minh_bx + (h - vh);
-        if (minw_bx < vw) minw_bx = vw;
-        if (minh_bx < vh) minh_bx = vh;
+               if (sd->vertical)
+               {
+                       if (minh_bx < vh) minh_bx = vh;
+               }
+               else
+               {
+                       if (minw_bx < vw) minw_bx = vw;
+               }
      }
    else
      {
@@ -857,8 +871,16 @@ _sizing_eval(Evas_Object *obj)
           }
      }
 
+   if (sd->transverse_expanded)
+     {
+        if (sd->vertical)
+          minw_bx = vw;
+        else
+          minh_bx = vh;
+     }
+
    evas_object_resize(sd->bx, minw_bx, minh_bx);
-   evas_object_resize(sd->more, w, h);
+   evas_object_resize(sd->more, minw_bx, minh_bx);
    evas_object_size_hint_min_set(obj, minw, minh);
    evas_object_size_hint_max_set(obj, -1, -1);
 
@@ -2648,6 +2670,27 @@ elm_toolbar_shrink_mode_get(const Evas_Object *obj)
 }
 
 EAPI void
+elm_toolbar_transverse_expanded_set(Evas_Object *obj, Eina_Bool transverse_expanded)
+{
+   ELM_TOOLBAR_CHECK(obj);
+   ELM_TOOLBAR_DATA_GET(obj, sd);
+
+   if (sd->transverse_expanded == transverse_expanded) return;
+   sd->transverse_expanded = transverse_expanded;
+
+   _sizing_eval(obj);
+}
+
+EAPI Eina_Bool
+elm_toolbar_transverse_expanded_get(const Evas_Object *obj)
+{
+   ELM_TOOLBAR_CHECK(obj) EINA_FALSE;
+   ELM_TOOLBAR_DATA_GET(obj, sd);
+
+   return sd->transverse_expanded;
+}
+
+EAPI void
 elm_toolbar_homogeneous_set(Evas_Object *obj,
                             Eina_Bool homogeneous)
 {
index 28dc475..775b857 100644 (file)
@@ -610,6 +610,33 @@ EAPI void                         elm_toolbar_shrink_mode_set(Evas_Object *obj,
 EAPI Elm_Toolbar_Shrink_Mode      elm_toolbar_shrink_mode_get(const Evas_Object *obj);
 
 /**
+ * Set the item's transverse expansion of a given toolbar widget @p obj.
+ *
+ * @param obj The toolbar object.
+ * @param transverse_expanded The transverse expansion of the item.
+ * (EINA_TRUE = on, EINA_FALSE = off, default = EINA_FALSE)
+ *
+ * This will expand the transverse length of the item according the transverse length of the toolbar.
+ * The default is what the transverse length of the item is set according its min value.
+ *
+ * @ingroup Toolbar
+ */
+EAPI void                         elm_toolbar_transverse_expanded_set(Evas_Object *obj, Eina_Bool transverse_expanded);
+
+/**
+ * Get the transverse expansion of toolbar @p obj.
+ *
+ * @param obj The toolbar object.
+ * @return The transverse expansion of the item.
+ * (EINA_TRUE = on, EINA_FALSE = off, default = EINA_FALSE)
+ *
+ * @see elm_toolbar_transverse_expand_set() for details.
+ *
+ * @ingroup Toolbar
+ */
+EAPI Eina_Bool                    elm_toolbar_transverse_expanded_get(const Evas_Object *obj);
+
+/**
  * Enable/disable homogeneous mode.
  *
  * @param obj The toolbar object
index 2c1483d..14d3c99 100644 (file)
@@ -151,6 +151,7 @@ struct _Elm_Toolbar_Smart_Data
    Eina_Bool                             homogeneous : 1;
    Eina_Bool                             on_deletion : 1;
    Eina_Bool                             reorder_mode : 1;
+   Eina_Bool                             transverse_expanded : 1;
 };
 
 struct _Elm_Toolbar_Item