[genlist] add homogeneous config in item class 13/77513/3
authorSangHyeon Lee <sh10233.lee@samsung.com>
Thu, 30 Jun 2016 05:52:23 +0000 (14:52 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 30 Jun 2016 07:15:10 +0000 (00:15 -0700)
Change-Id: I6b2ced8c82329c48c0970473ec2593648fce2e9d
Signed-off-by: SangHyeon Lee <sh10233.lee@samsung.com>
src/lib/elm_gen.h
src/lib/elm_genlist.c
src/mobile_lib/elm_genlist.c

index 2ef3d86..f46c878 100644 (file)
@@ -56,6 +56,9 @@ struct _Elm_Gen_Item_Class
    int           version;  /**< Set by elementary if you alloc an item class using elm_genlist/gengrid_item_class_new(), or if you set your own class (must be const) then set it to ELM_GENLIST/GENGRID_ITEM_CLASS_VERSION */
    unsigned int  refcount; /**< Set it to 0 if you use your own const class, or its managed for you by class ref/unref calls */
    Eina_Bool     delete_me : 1; /**< Leave this alone - set it to 0 if you have a const class of your own */
+// TIZEN ONLY(20160630): Support homogeneous mode in item class.
+   Eina_Bool     homogeneous : 1;
+//
    const char   *item_style; /**< Name of the visual style to use for this item. If you don't know use "default" */
    const char   *decorate_item_style; /**< Style used if item is set to a decorate mode. @see elm_genlist_item_decorate_mode_set() or NULL if you don't care. currently it's used only in genlist. */
    const char   *decorate_all_item_style; /**< Style to use when in edit mode, or NULL if you don't care. currently it's used only in genlist. */
index 252686e..61bfb1a 100644 (file)
@@ -1864,7 +1864,8 @@ _item_realize(Elm_Gen_Item *it,
 
    size = eina_hash_find(sd->size_caches, &(it->itc));
    /* homogeneous genlist shortcut */
-   if ((calc) && (sd->homogeneous) && (!it->item->mincalcd) && size)
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+   if ((calc) && (sd->homogeneous || it->itc->homogeneous) && (!it->item->mincalcd) && size)
      {
         GL_IT(it)->w = GL_IT(it)->minw = size->minw;
         GL_IT(it)->h = GL_IT(it)->minh = size->minh;
@@ -1893,7 +1894,8 @@ _item_realize(Elm_Gen_Item *it,
 
         if (!it->item->mincalcd)
           {
-             if (sd->homogeneous && size)
+             // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+             if ((sd->homogeneous || it->itc->homogeneous) && size)
                {
                   GL_IT(it)->w = GL_IT(it)->minw = size->minw;
                   GL_IT(it)->h = GL_IT(it)->minh = size->minh;
@@ -1913,7 +1915,8 @@ _item_realize(Elm_Gen_Item *it,
                   it->item->h = it->item->minh = mh;
                   it->item->mincalcd = EINA_TRUE;
 
-                  if (sd->homogeneous)
+                  // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+                  if (sd->homogeneous || it->itc->homogeneous)
                     {
                        if (size)
                          eina_hash_del_by_key(sd->size_caches, &(it->itc));
@@ -4691,8 +4694,9 @@ _item_queue(Elm_Genlist_Data *sd,
         ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
         _queue_process(sd);
      }
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
    while ((sd->queue) && (sd->blocks) &&
-          (sd->homogeneous) && (sd->mode == ELM_LIST_COMPRESS))
+          ((sd->homogeneous) || it->itc->homogeneous) && (sd->mode == ELM_LIST_COMPRESS))
      {
         ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
         _queue_process(sd);
@@ -5139,10 +5143,12 @@ _item_block_recalc(Item_Block *itb,
           }
         if (!itb->realized)
           {
-             if (itb->sd->homogeneous &&
+             // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+             if ((itb->sd->homogeneous || it->itc->homogeneous) &&
                  ((!size) || it->itc != size->itc))
                size = eina_hash_find(itb->sd->size_caches, &(it->itc));
-             if (qadd || (itb->sd->homogeneous && !size))
+             // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+             if (qadd || ((itb->sd->homogeneous || it->itc->homogeneous) && !size))
                {
                   if (!it->item->mincalcd) changed = EINA_TRUE;
                   if (changed)
@@ -5162,7 +5168,8 @@ _item_block_recalc(Item_Block *itb,
                }
              else
                {
-                  if ((itb->sd->homogeneous) && size &&
+                  // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+                  if ((itb->sd->homogeneous || it->itc->homogeneous) && size &&
                       (itb->sd->mode == ELM_LIST_COMPRESS))
                     {
                        it->item->w = it->item->minw = size->minw;
@@ -6839,8 +6846,9 @@ _elm_genlist_item_coordinates_calc(Elm_Gen_Item *it,
    Evas_Coord gith = 0;
    ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
 
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
    if ((sd->queue) ||
-       (!((sd->homogeneous) &&
+       (!((sd->homogeneous || it->itc->homogeneous) &&
           (sd->mode == ELM_LIST_COMPRESS))))
      {
         if ((it->item->queued) || (!it->item->mincalcd) || (sd->queue))
@@ -8022,7 +8030,8 @@ _elm_genlist_item_select_mode_set(Eo *eo_it EINA_UNUSED, Elm_Gen_Item *it,
         sd->update_job = ecore_job_add(_update_job, sd->obj);
 
         // reset homogeneous item size
-        if (sd->homogeneous)
+        // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+        if (sd->homogeneous || it->itc->homogeneous)
           {
              Item_Size *size =
                 eina_hash_find(sd->size_caches, &(it->itc));
index 51ede2f..03fec54 100644 (file)
@@ -4427,7 +4427,8 @@ _item_min_calc(Elm_Gen_Item *it)
    if ((sd->mode != ELM_LIST_LIMIT) && vw && mw < vw)
      mw = vw;
 
-   if (sd->homogeneous)
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+   if (sd->homogeneous || it->itc->homogeneous)
      {
         Size_Cache *size, *tmp;
         tmp = eina_hash_find(sd->size_caches, it->itc->item_style);
@@ -4469,7 +4470,8 @@ _item_calc(Elm_Gen_Item *it)
    p_minw = GL_IT(it)->minw;
    p_minh = GL_IT(it)->minh;
 
-   if (sd->homogeneous)
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+   if (sd->homogeneous || it->itc->homogeneous)
      size = eina_hash_find(sd->size_caches, it->itc->item_style);
    if (size)
      {
@@ -7405,6 +7407,9 @@ elm_genlist_item_class_new(void)
    itc->version = CLASS_ALLOCATED;
    itc->refcount = 1;
    itc->delete_me = EINA_FALSE;
+   // TIZEN ONLY(20160630): Support homogeneous mode in item class.
+   itc->homogeneous = EINA_FALSE;
+   //
 
    return itc;
 }