[genlist] enable item align feature for wearable profile 60/77060/2
authorSangHyeon Lee <sh10233.lee@samsung.com>
Tue, 28 Jun 2016 10:48:56 +0000 (19:48 +0900)
committerSangHyeon Lee <sh10233.lee@samsung.com>
Wed, 29 Jun 2016 03:21:56 +0000 (12:21 +0900)
Change-Id: I578e26c6b3b2c463fb606164402e867e560f75e9
Signed-off-by: SangHyeon Lee <sh10233.lee@samsung.com>
12 files changed:
src/lib/elm_config.c
src/lib/elm_config.h
src/lib/elm_interface_scrollable.c
src/lib/elm_main.c
src/lib/elm_object.h
src/lib/elm_pan.eo
src/lib/elm_priv.h
src/lib/elm_widget.c
src/lib/elm_widget.h
src/mobile_lib/elm_genlist.c
src/mobile_lib/elm_genlist_pan.eo
src/mobile_lib/elm_widget_genlist.h

index 28f3d92..b24b041 100644 (file)
@@ -441,6 +441,10 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, popup_vertical_align, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, popup_scrollable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, spinner_min_max_filter_enable, T_UCHAR);
+   // TIZEN_ONLY(20150705): Genlist item align feature
+   ELM_CONFIG_VAL(D, T, scroll_item_align_enable, T_UCHAR);
+   ELM_CONFIG_VAL(D, T, scroll_item_valign, T_STRING);
+   //
 #undef T
 #undef D
 #undef T_INT
@@ -1477,6 +1481,10 @@ _config_load(void)
    _elm_config->popup_vertical_align = 0.5;
 
    _elm_config->popup_scrollable = EINA_FALSE;
+   // TIZEN_ONLY(20150705): Genlist item align feature
+   _elm_config->scroll_item_align_enable = EINA_FALSE;
+   _elm_config->scroll_item_valign = eina_stringshare_add("center");
+   //
 }
 
 static void
@@ -1737,6 +1745,20 @@ err:
    return EINA_FALSE;
 }
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+void
+_elm_config_scroll_item_valign_set(const char *scroll_item_valign)
+{
+   if (_elm_config->scroll_item_valign &&
+         strcmp(_elm_config->scroll_item_valign, scroll_item_valign))
+     {
+        eina_stringshare_del(_elm_config->scroll_item_valign);
+     }
+
+   _elm_config->scroll_item_valign = eina_stringshare_add(scroll_item_valign);
+}
+//
+
 static void
 _config_update(void)
 {
@@ -3022,6 +3044,33 @@ elm_config_slider_indicator_visible_mode_get(void)
     return _elm_config->slider_indicator_visible_mode;
 }
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+EAPI void
+elm_config_scroll_item_align_enabled_set(Eina_Bool enable)
+{
+   _elm_config->scroll_item_align_enable = !!enable;
+}
+
+EAPI Eina_Bool
+elm_config_scroll_item_align_enabled_get(void)
+{
+   return _elm_config->scroll_item_align_enable;
+}
+
+EAPI void
+elm_config_scroll_item_valign_set(const char *scroll_item_valign)
+{
+   EINA_SAFETY_ON_NULL_RETURN(scroll_item_valign);
+   _elm_config_scroll_item_valign_set(scroll_item_valign);
+}
+
+EAPI const char *
+elm_config_scroll_item_valign_get(void)
+{
+   return _elm_config->scroll_item_valign;
+}
+//
+
 EAPI void
 elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode)
 {
index 66600d5..87761f5 100644 (file)
@@ -654,6 +654,52 @@ EAPI double       elm_config_scroll_thumbscroll_acceleration_weight_get(void);
  */
 EAPI void         elm_config_scroll_thumbscroll_acceleration_weight_set(double weight);
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+/**
+ * @brief Sets the scroll item align enable.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] enable The scroll item align state
+ *
+ * @see elm_config_scroll_item_align_enabled_get()
+ */
+EAPI void elm_config_scroll_item_align_enabled_set(Eina_Bool enable);
+
+/**
+ * @brief Sets the scroll item align enable.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @return The scroll item align state.
+ *
+ * @see elm_config_scroll_item_align_enabled_set()
+ */
+EAPI Eina_Bool elm_config_scroll_item_align_enabled_get(void);
+
+/**
+ * @brief Sets the scroll item vertical align.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] scroll_item_valign The position name.
+ *
+ * @see elm_config_scroll_item_valign_get()
+ */
+EAPI void elm_config_scroll_item_valign_set(const char *scroll_item_valign);
+
+/**
+ * @brief Sets the scroll item vertical align.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @return The scroll item vertical align name.
+ *
+ * @see elm_config_scroll_item_valign_set()
+ */
+EAPI const char *elm_config_scroll_item_valign_get(void);
+//
+
 /**
  * Focus Autoscroll Mode
  *
index b291db6..80936f1 100644 (file)
@@ -180,6 +180,14 @@ _elm_pan_pos_min_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *_pd EINA_UNUSED, E
      *y = 0;
 }
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+EOLIAN static void
+_elm_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd EINA_UNUSED, Evas_Coord *x EINA_UNUSED, Evas_Coord *y EINA_UNUSED)
+{
+
+}
+//
+
 EOLIAN static void
 _elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, Evas_Coord *w, Evas_Coord *h)
 {
@@ -2125,10 +2133,23 @@ _elm_scroll_momentum_animator(void *data)
         dt = dt / at;
         if (dt > 1.0) dt = 1.0;
         p = 1.0 - ((1.0 - dt) * (1.0 - dt));
-        dx = (sid->down.dx * (_elm_config->thumbscroll_friction +
-                              sid->down.extra_time) * p);
-        dy = (sid->down.dy * (_elm_config->thumbscroll_friction +
-                              sid->down.extra_time) * p);
+
+        // TIZEN_ONLY(20150705): Genlist item align feature
+        if (_elm_config->scroll_item_align_enable)
+          {
+             dx = sid->down.dx * p;
+             dy = sid->down.dy * p;
+          }
+        else
+          {
+        //
+             dx = (sid->down.dx * (_elm_config->thumbscroll_friction +
+                                   sid->down.extra_time) * p);
+             dy = (sid->down.dy * (_elm_config->thumbscroll_friction +
+                                   sid->down.extra_time) * p);
+        // TIZEN_ONLY(20150705): Genlist item align feature
+          }
+        //
         sid->down.ax = dx;
         sid->down.ay = dy;
         x = sid->down.sx - dx;
@@ -2595,6 +2616,28 @@ _elm_scroll_mouse_up_event_cb(void *data,
                               {
                                 sid->down.dy += (double)sid->down.pdy * _elm_config->thumbscroll_acceleration_weight;
                               }
+
+                            // TIZEN_ONLY(20150705): Genlist item align feature
+                            if (_elm_config->scroll_item_align_enable)
+                              {
+                                 Evas_Coord pos_x, pos_y;
+
+                                 pos_x = sid->down.dx;
+                                 pos_y = sid->down.dy;
+
+                                 pos_x = _round(pos_x * (_elm_config->thumbscroll_friction +
+                                                         sid->down.extra_time), 0);
+                                 pos_y = _round(pos_y * (_elm_config->thumbscroll_friction +
+                                                         sid->down.extra_time), 0);
+
+                                 eo_do(sid->pan_obj, elm_obj_pan_pos_adjust(&pos_x, &pos_y));
+
+                                 // adjusted position using to _elm_scroll_momentum_animator()
+                                 sid->down.dx = pos_x;
+                                 sid->down.dy = pos_y;
+                              }
+                            //
+
                             sid->down.pdx = sid->down.dx;
                             sid->down.pdy = sid->down.dy;
                             ox = -sid->down.dx;
@@ -2623,7 +2666,41 @@ _elm_scroll_mouse_up_event_cb(void *data,
                                  sid->down.b0y = 0;
                               }
                          }
+// TIZEN_ONLY(20150705): Genlist item align feature
+                       else
+                         {
+                            if (_elm_config->scroll_item_align_enable)
+                              {
+                                 Evas_Coord pos_x = 0, pos_y = 0;
+                                 Evas_Coord adjust_x, adjust_y;
+
+                                 eo_do(sid->pan_obj, elm_obj_pan_pos_adjust(&pos_x, &pos_y));
+
+                                 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&adjust_x, &adjust_y));
+                                 pos_y = -pos_y;
+                                 adjust_y += pos_y;
+
+                                 _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, adjust_y);
+                              }
+                         }
+                    }
+                  else
+                    {
+                       if (_elm_config->scroll_item_align_enable)
+                         {
+                            Evas_Coord pos_x = 0, pos_y = 0;
+                            Evas_Coord adjust_x, adjust_y;
+
+                            eo_do(sid->pan_obj, elm_obj_pan_pos_adjust(&pos_x, &pos_y));
+
+                            eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&adjust_x, &adjust_y));
+                            pos_y = -pos_y;
+                            adjust_y += pos_y;
+
+                            _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, adjust_y);
+                         }
                     }
+//
                }
              else
                {
index 4d77437..e80a763 100644 (file)
@@ -1626,6 +1626,38 @@ elm_object_scroll_item_loop_enabled_get(const Evas_Object *obj)
    return elm_widget_item_loop_enabled_get(obj);
 }
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+EAPI void
+elm_object_scroll_item_align_enabled_set(Evas_Object *obj,
+                                         Eina_Bool scroll_item_align_enable)
+{
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+   elm_widget_scroll_item_align_enabled_set(obj, scroll_item_align_enable);
+}
+
+EAPI Eina_Bool
+elm_object_scroll_item_align_enabled_get(const Evas_Object *obj)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
+   return elm_widget_scroll_item_align_enabled_get(obj);
+}
+
+EAPI void
+elm_object_scroll_item_valign_set(Evas_Object *obj,
+                                  char *scroll_item_valign)
+{
+   EINA_SAFETY_ON_NULL_RETURN(obj);
+   elm_widget_scroll_item_valign_set(obj, scroll_item_valign);
+}
+
+EAPI const char*
+elm_object_scroll_item_valign_get(const Evas_Object *obj)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+   return  elm_widget_scroll_item_valign_get(obj);
+}
+//
+
 EAPI Eina_Bool
 elm_object_widget_check(const Evas_Object *obj)
 {
index de740ac..f4c61f5 100644 (file)
@@ -528,3 +528,87 @@ EAPI Eina_Bool   elm_object_orientation_mode_disabled_get(const Evas_Object *obj
  */
 EAPI void elm_object_accessibility_highlight_set(Evas_Object *obj, Eina_Bool val);
 //
+
+// TIZEN_ONLY(20150705): Genlist item align feature
+/**
+ * @brief Sets the scroll item align enable.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks If the object's scroll item align is enabled, the nearest
+ *          item to the end of the scroll will be located according to
+ *          its vertical align.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @param[in] enabled The scroll item align state
+ *
+ * @see elm_object_scroll_item_align_enabled_get()
+ */
+EAPI void elm_object_scroll_item_align_enabled_set(Evas_Object *obj, Eina_Bool scroll_item_align_enable);
+
+/**
+ * @brief Sets the scroll item align enable.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks If @c EINA_TRUE, the nearest item to the end of the scroll will be
+ *          aligned according to its vertical align. If @c EINA_FALSE, the scroll
+ *          item align is disabled.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @return The scroll item align state.
+ *
+ * @see elm_object_scroll_item_align_enabled_set()
+ */
+EAPI Eina_Bool elm_object_scroll_item_align_enabled_get(const Evas_Object *obj);
+
+/**
+ * @brief Sets the scroll item vertical align.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks This API sets the scroll item vertical align. The scroll item
+ *          vertical align is referred when the object's scroll item align
+ *          is enabled. When the widget is scrolled, the nearest item to the
+ *          end of the scroll will be located according to the given alignment.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @param[in] vertical align The position name.
+ *
+ * @see elm_object_scroll_item_valign_get()
+ */
+EAPI void elm_object_scroll_item_valign_set(Evas_Object *obj, char *scroll_item_valign);
+
+/**
+ * @brief Sets the scroll item vertical align.
+ * @remarks Tizen only feature.
+ *
+ *
+ * @remarks This API gets the scroll item vertical align. The scroll item
+ *          vertical align is referred when the object's scroll item align
+ *          is enabled. When the widget is scrolled, the nearest item to the
+ *          end of the scroll will be located according to the given alignment.
+ *
+ * @remarks Currently implemented only Genlist.
+ *
+ * @since_tizen 2.3.1
+ *
+ * @param[in] obj The object handle
+ * @return The scroll item vertical align name.
+ *
+ * @see elm_object_scroll_item_valign_set()
+ */
+EAPI const char* elm_object_scroll_item_valign_get(const Evas_Object *obj);
+//
index 84368d5..751f0d5 100644 (file)
@@ -47,6 +47,12 @@ class Elm_Pan (Evas.Smart_Clipped)
             y: Evas.Coord;
          }
       }
+      pos_adjust {
+         params {
+            @out x: Evas.Coord;
+            @out y: Evas.Coord;
+         }
+      }
    }
    implements {
       Eo.Base.constructor;
index 0703285..28fdbce 100644 (file)
@@ -305,6 +305,10 @@ struct _Elm_Config
    int           gl_depth;
    int           gl_stencil;
    int           gl_msaa;
+// TIZEN_ONLY(20150705): Genlist item align feature
+   Eina_Bool     scroll_item_align_enable;
+   const char   *scroll_item_valign;
+//
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;
index f8ce65f..689b0b3 100644 (file)
@@ -3404,6 +3404,41 @@ _elm_widget_scroll_freeze_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
    return sd->scroll_freeze;
 }
 
+// TIZEN_ONLY(20150705): Genlist item align feature
+EAPI void
+elm_widget_scroll_item_align_enabled_set(Evas_Object *obj,
+                                        Eina_Bool scroll_item_align_enable)
+{
+   API_ENTRY return;
+   if (sd->scroll_item_align_enable == scroll_item_align_enable) return;
+   sd->scroll_item_align_enable = scroll_item_align_enable;
+}
+
+EAPI Eina_Bool
+elm_widget_scroll_item_align_enabled_get(const Evas_Object *obj)
+{
+   API_ENTRY return EINA_FALSE;
+   return sd->scroll_item_align_enable;
+}
+
+EAPI void
+elm_widget_scroll_item_valign_set(Evas_Object *obj,
+                                  char *scroll_item_valign)
+{
+   API_ENTRY return;
+   if (sd->scroll_item_valign) eina_stringshare_del(sd->scroll_item_valign);
+   if (!scroll_item_valign) sd->scroll_item_valign = NULL;
+   else sd->scroll_item_valign = eina_stringshare_add(scroll_item_valign);
+}
+
+EAPI const char*
+elm_widget_scroll_item_valign_get(const Evas_Object *obj)
+{
+   API_ENTRY return NULL;
+   return sd->scroll_item_valign;
+}
+//
+
 EOLIAN static void
 _elm_widget_scale_set(Eo *obj, Elm_Widget_Smart_Data *sd, double scale)
 {
index 6141645..b19b8b3 100644 (file)
@@ -465,7 +465,10 @@ typedef struct _Elm_Widget_Smart_Data
    ///TIZEN_ONLY(20170717) : expose highlight information on atspi
    Eina_Bool                     can_highlight : 1; /**< true if widget have at-spi HIGHLIGHTABLE state */
    ///
-
+// TIZEN_ONLY(20150705): Genlist item align feature
+   Eina_Bool                     scroll_item_align_enable;
+   char                          *scroll_item_valign;
+//
 } Elm_Widget_Smart_Data;
 
 /**
@@ -767,6 +770,12 @@ EAPI int              elm_widget_scroll_hold_get(const Evas_Object *obj);
 EAPI void             elm_widget_scroll_freeze_push(Evas_Object *obj);
 EAPI void             elm_widget_scroll_freeze_pop(Evas_Object *obj);
 EAPI int              elm_widget_scroll_freeze_get(const Evas_Object *obj);
+// TIZEN_ONLY(20150705): Genlist item align feature
+EAPI void             elm_widget_scroll_item_align_enabled_set(Evas_Object *obj, Eina_Bool scroll_item_align_enable);
+EAPI Eina_Bool        elm_widget_scroll_item_align_enabled_get(const Evas_Object *obj);
+EAPI void             elm_widget_scroll_item_valign_set(Evas_Object *obj, char *scroll_item_valign);
+EAPI const char*      elm_widget_scroll_item_valign_get(const Evas_Object *obj);
+//
 EAPI void             elm_widget_scale_set(Evas_Object *obj, double scale);
 EAPI double           elm_widget_scale_get(const Evas_Object *obj);
 EAPI Eina_Bool        elm_widget_mirrored_get(const Evas_Object *obj);
index 97ec0c2..51ede2f 100644 (file)
@@ -148,6 +148,10 @@ static const char SIGNAL_DEFAULT[] = "elm,state,default";
 static const char SIGNAL_FOCUSED[] = "elm,action,focus_highlight,show";
 static const char SIGNAL_UNFOCUSED[] = "elm,action,focus_highlight,hide";
 static const char SIGNAL_BG_CHANGE[] = "bg_color_change";
+static const char SIGNAL_ITEM_HIGHLIGHTED[] = "elm,state,highlighted";
+static const char SIGNAL_ITEM_UNHIGHLIGHTED[] = "elm,state,unhighlighted";
+static const char SIGNAL_FOCUS_BG_SHOW[] = "elm,state,focus_bg,show";
+static const char SIGNAL_FOCUS_BG_HIDE[] = "elm,state,focus_bg,hide";
 
 typedef enum
 {
@@ -441,7 +445,7 @@ _elm_genlist_pan_elm_pan_pos_get(Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *psd,
 }
 
 // TIZEN_ONLY(20150705): genlist item align feature
-static Elm_Object_Item *
+static Elm_Gen_Item *
 _elm_genlist_pos_adjust_xy_item_get(const Evas_Object *obj,
                                     Evas_Coord x,
                                     Evas_Coord y)
@@ -470,13 +474,13 @@ _elm_genlist_pos_adjust_xy_item_get(const Evas_Object *obj,
              ith = GL_IT(it)->minh;
 
              if (ELM_RECTS_INTERSECT(itx, ity, itw, ith, x, y, 1, 1))
-               return (Elm_Object_Item *)it;
+               return it;
           }
      }
 
    return NULL;
 }
-#if 0
+
 EOLIAN static void
 _elm_genlist_pan_elm_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *psd, Evas_Coord *x EINA_UNUSED, Evas_Coord *y)
 {
@@ -500,8 +504,7 @@ _elm_genlist_pan_elm_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *p
         vh = (vh / 2) - yy;
      }
 
-   it = (Elm_Gen_Item*)_elm_genlist_pos_adjust_xy_item_get(
-                            sd->obj, vw, vh);
+   it = _elm_genlist_pos_adjust_xy_item_get(sd->obj, vw, vh);
 
    vh += psd->wsd->pan_y;
 
@@ -513,7 +516,6 @@ _elm_genlist_pan_elm_pan_pos_adjust(Eo *obj EINA_UNUSED, Elm_Genlist_Pan_Data *p
    *y += (vh - it_h);
 }
 //
-#endif
 
 EOLIAN static void
 _elm_genlist_pan_elm_pan_pos_max_get(Eo *obj, Elm_Genlist_Pan_Data *psd, Evas_Coord *x, Evas_Coord *y)
@@ -1284,6 +1286,51 @@ _elm_genlist_content_min_limit_cb(Evas_Object *obj,
 }
 
 static void
+_elm_genlist_scroll_item_align_highlight_cb(Evas_Object *obj,
+                                            void *data)
+{
+   ELM_GENLIST_DATA_GET(obj, sd);
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
+   Evas_Coord vw, vh;
+
+   if (!(wd->scroll_item_align_enable)) return;
+
+   eo_do(obj, elm_interface_scrollable_content_viewport_geometry_get
+                  (NULL, NULL, &vw, &vh));
+
+   if (!strcmp(wd->scroll_item_valign, "center"))
+     {
+        vw = (vw / 2);
+        vh = (vh / 2);
+     }
+
+   sd->aligned_item = _elm_genlist_pos_adjust_xy_item_get(obj, vw, vh);
+
+   if (sd->aligned_item && sd->aligned_item->realized)
+      edje_object_signal_emit(VIEW(sd->aligned_item),
+                              SIGNAL_ITEM_HIGHLIGHTED, "elm");
+}
+
+static void
+_elm_genlist_scroll_item_align_unhighlight_cb(Evas_Object *obj,
+                                              void *data)
+{
+   Evas_Object *wobj = data;
+   ELM_GENLIST_DATA_GET(wobj, sd);
+   ELM_WIDGET_DATA_GET_OR_RETURN(wobj, wd);
+
+   if (!(wd->scroll_item_align_enable)) return;
+
+   if (sd->aligned_item)
+     {
+        if (sd->aligned_item->realized)
+          edje_object_signal_emit(VIEW(sd->aligned_item),
+                                  SIGNAL_ITEM_UNHIGHLIGHTED, "elm");
+        sd->aligned_item = NULL;
+     }
+}
+
+static void
 _item_position(Elm_Gen_Item *it,
                Evas_Object *view,
                Evas_Coord it_x,
@@ -1464,6 +1511,7 @@ _item_realize(Elm_Gen_Item *it,
               Eina_Bool calc)
 {
    const char *treesize;
+   Evas_Coord vw, vh;
    Eina_Bool ret;
 
    if (it->realized) return;
@@ -1537,7 +1585,23 @@ _item_realize(Elm_Gen_Item *it,
      {
         _decorate_item_realize(it);
      }
+   if (!sd->aligned_item)
+     {
+                eo_do(sd->obj, elm_interface_scrollable_content_viewport_geometry_get
+                                (NULL, NULL, &vw, &vh));
+        vw = (vw / 2);
+        vh = (vh / 2);
+
+               if (ELM_RECTS_INTERSECT(it->x - sd->pan_x, it->y - sd->pan_y, GL_IT(it)->w,
+                               GL_IT(it)->minh, vw, vh, 1, 1))
+          {
+             sd->aligned_item = it;
+             edje_object_signal_emit(VIEW(sd->aligned_item),
+                                     SIGNAL_ITEM_HIGHLIGHTED, "elm");
+          }
+     }
 
+   it->realized = EINA_TRUE;
    if (!calc)
      {
         _elm_genlist_item_index_update(it);
@@ -3397,6 +3461,7 @@ _elm_genlist_elm_widget_focus_highlight_geometry_get(const Eo *obj EINA_UNUSED,
 EOLIAN static Eina_Bool
 _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd, Elm_Object_Item *item)
 {
+   ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
    Eina_Bool int_ret = EINA_FALSE;
 
    eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_on_focus(NULL));
@@ -3404,6 +3469,34 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd, Elm_Object_Item
 
    if ((sd->items) && (sd->selected) && (!sd->last_selected_item))
      sd->last_selected_item = eina_list_data_get(sd->selected);
+   if (wd->scroll_item_align_enable)
+     {
+        Evas_Coord vw, vh;
+
+        evas_object_smart_callback_add(obj, "scroll,drag,start", _elm_genlist_scroll_item_align_unhighlight_cb, obj);
+        evas_object_smart_callback_add(obj, "scroll,anim,start", _elm_genlist_scroll_item_align_unhighlight_cb, obj);
+        evas_object_smart_callback_add(obj, "scroll,anim,stop", _elm_genlist_scroll_item_align_highlight_cb, obj);
+
+               eo_do(sd->obj, elm_interface_scrollable_content_viewport_geometry_get
+                               (NULL, NULL, &vw, &vh));
+
+        if (vw != 0 || vh != 0)
+          {
+             if (!strcmp(wd->scroll_item_valign, "center"))
+               {
+                  vw = (vw / 2);
+                  vh = (vh / 2);
+               }
+
+                        sd->aligned_item = _elm_genlist_pos_adjust_xy_item_get(obj, vw, vh);
+             if (sd->aligned_item)
+               {
+                  if (sd->aligned_item->realized)
+                    edje_object_signal_emit(VIEW(sd->aligned_item),
+                           SIGNAL_ITEM_HIGHLIGHTED, "elm");
+               }
+          }
+     }
 
    if (sd->select_on_focus_enabled) return EINA_TRUE;
    if (elm_widget_focus_get(obj))
@@ -5424,12 +5517,11 @@ _elm_genlist_evas_object_smart_add(Eo *obj, Elm_Genlist_Data *priv)
        _gesture_n_flicks_cb, priv);
 
    elm_layout_sizing_eval(obj);
-#if 0
+
 // TIZEN_ONLY(20150705): Genlist item align feature
    wd->scroll_item_align_enable = _elm_config->scroll_item_align_enable;
    wd->scroll_item_valign = _elm_config->scroll_item_valign;
 //
-#endif
    eo_do(obj, elm_interface_scrollable_content_viewport_geometry_get
                (NULL, NULL, &priv->viewport_w, &priv->viewport_h));
 }
index c4c5533..39a3ff2 100644 (file)
@@ -12,7 +12,7 @@ class Elm.Genlist_Pan (Elm_Pan)
       Elm_Pan.pos;
       Elm_Pan.pos_min.get;
       Elm_Pan.pos_max.get;
-      /*Elm_Pan.pos_adjust;*/
+      Elm_Pan.pos_adjust;
    }
    events {
       language,changed;
index 451e98f..e795eb5 100644 (file)
@@ -208,6 +208,7 @@ struct _Elm_Genlist_Data
    Elm_Gen_Item                         *highlighted_item;
    Evas_Coord                            viewport_w, viewport_h;
    Elm_Gen_Item                         *atspi_item_to_highlight;
+   Elm_Gen_Item                         *aligned_item;
 };
 
 typedef struct _Item_Block Item_Block;