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
_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
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)
{
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)
{
*/
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
*
*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)
{
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;
{
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;
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
{
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)
{
*/
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);
+//
y: Evas.Coord;
}
}
+ pos_adjust {
+ params {
+ @out x: Evas.Coord;
+ @out y: Evas.Coord;
+ }
+ }
}
implements {
Eo.Base.constructor;
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;
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)
{
///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;
/**
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);
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
{
}
// 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)
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)
{
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;
*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)
}
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,
Eina_Bool calc)
{
const char *treesize;
+ Evas_Coord vw, vh;
Eina_Bool ret;
if (it->realized) return;
{
_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);
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));
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))
_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));
}
Elm_Pan.pos;
Elm_Pan.pos_min.get;
Elm_Pan.pos_max.get;
- /*Elm_Pan.pos_adjust;*/
+ Elm_Pan.pos_adjust;
}
events {
language,changed;
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;