now it supports slides the texts if the label area is smaller than the text width length.
deprecated - elm_label_slide_set()/get()
added - elm_label_slide_mode_set()/get()
SVN revision: 82169
2012-01-03 Prince Dubey Kumar <prince.dubey@samsung.com>
* Fix gengrid region_show/bring_in and add test
+
+2012-01-04 ChunEon Park <hermet@hermet.pe.kr>
+
+ * Deprecate elm_label_slide_set()/get() and added elm_label_slide_mode_set()/get() instead.
* Add elm_dbus_menu to support D-Bus external menus.
* Add configuration: ELM_EXTERNAL_MENU, to switch between internal and extenal menus
* Add elm_systray.[ch]: Add support to D-Bus systray icons.
+ * Add elm_label_slide_mode_set(), elm_label_slide_mode_get()
Improvements:
* All internal widget hooks (and related macros) were removed, due
to deprecation. Thus, people using that (unstable) API will have
to adapt themselves.
+ * Deprecate elm_label_slide_set(), elm_label_slide_get().
Changes since Elementary 1.0.0:
-------------------------
* @deprecated Use elm_notify_align_get instead.
*/
EINA_DEPRECATED EAPI Elm_Notify_Orient elm_notify_orient_get(const Evas_Object *obj);
+
+/**
+ * @brief Set slide effect of label widget.
+ *
+ * @param obj The label object
+ * @param slide If true, slide effect will be shown
+ *
+ * If set to true, the text of the label will slide/scroll through the length of
+ * label.
+ *
+ * @warning This only works with the themes "slide_short", "slide_long" and
+ * "slide_bounce".
+ * @warning This doesn't work if the line wrap(elm_label_line_wrap_set()) or
+ * ellipsis(elm_label_ellipsis_set()) is set.
+ *
+ * @deprecated see elm_label_slide_mode_set() instead.
+ *
+ * @ingroup Label
+ */
+EINA_DEPRECATED EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide);
+
+/**
+ * @brief Get whether slide effect is shown or not.
+ *
+ * @param obj The label object
+ * @return If true, slide effect is shown.
+ *
+ * @see elm_label_slide_set()
+ *
+ * @deprecated see elm_label_slide_mode_get() instead.
+ *
+ * @ingroup Label
+ */
+EINA_DEPRECATED EAPI Eina_Bool elm_label_slide_get(const Evas_Object *obj);
static void
_label_slide_change(Evas_Object *obj)
{
+ Evas_Object *tb;
char *plaintxt;
int plainlen = 0;
// doesn't support multiline slide effect
if (sd->linewrap)
{
- sd->slide = EINA_FALSE;
+ sd->slide_mode = ELM_LABEL_SLIDE_MODE_NONE;
WRN("Doesn't support slide effect for multiline! : label=%p", obj);
return;
}
// too short to slide label
if (plainlen < 1)
{
- sd->slide = EINA_FALSE;
+ sd->slide_mode = ELM_LABEL_SLIDE_MODE_NONE;
return;
}
- if (sd->slide)
+ if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE)
{
+ //slide only if the slide area is smaller than text width size.
+ if (sd->slide_mode == ELM_LABEL_SLIDE_MODE_AUTO)
+ {
+ tb = (Evas_Object *) edje_object_part_object_get(wd->resize_obj,
+ "elm.text");
+ if (tb)
+ {
+ Evas_Coord w, tb_w;
+
+ evas_object_textblock_size_formatted_get(tb, &tb_w, NULL);
+ evas_object_geometry_get(wd->resize_obj,
+ NULL, NULL, &w, NULL);
+ if ((tb_w > 0) && (tb_w < w))
+ {
+ sd->slide_mode = ELM_LABEL_SLIDE_MODE_NONE;
+ return;
+ }
+ }
+ }
Edje_Message_Float_Set *msg =
alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double)));
}
EAPI void
-elm_label_slide_set(Evas_Object *obj,
- Eina_Bool slide)
+elm_label_slide_mode_set(Evas_Object *obj, Elm_Label_Slide_Mode mode)
{
ELM_LABEL_CHECK(obj);
- eo_do(obj, elm_obj_label_slide_set(slide));
+ eo_do(obj, elm_obj_label_slide_mode_set(mode));
+
}
static void
-_slide_set(Eo *obj, void *_pd, va_list *list)
+_slide_mode_set(Eo *obj, void *_pd, va_list *list)
{
- Eina_Bool slide = va_arg(*list, int);
+ Elm_Label_Slide_Mode mode = va_arg(*list, Elm_Label_Slide_Mode);
Elm_Label_Smart_Data *sd = _pd;
-
- if (sd->slide == slide) return;
- sd->slide = slide;
-
+ if (sd->slide_mode == mode) return;
+ sd->slide_mode = mode;
_label_slide_change(obj);
elm_layout_sizing_eval(obj);
}
-EAPI Eina_Bool
-elm_label_slide_get(const Evas_Object *obj)
+EAPI Elm_Label_Slide_Mode
+elm_label_slide_mode_get(const Evas_Object *obj)
{
- ELM_LABEL_CHECK(obj) EINA_FALSE;
- Eina_Bool ret = EINA_FALSE;
- eo_do((Eo *) obj, elm_obj_label_slide_get(&ret));
+ ELM_LABEL_CHECK(obj) ELM_LABEL_SLIDE_MODE_NONE;
+ Elm_Label_Slide_Mode ret = ELM_LABEL_SLIDE_MODE_NONE;
+ eo_do((Eo *) obj, elm_obj_label_slide_mode_get(&ret));
return ret;
}
static void
-_slide_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+_slide_mode_get(Eo *obj __UNUSED__, void *_pd, va_list *list)
{
- Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ Elm_Label_Slide_Mode *ret = va_arg(*list, Elm_Label_Slide_Mode *);
Elm_Label_Smart_Data *sd = _pd;
- *ret = sd->slide;
+ *ret = sd->slide_mode;
+}
+
+EINA_DEPRECATED EAPI void
+elm_label_slide_set(Evas_Object *obj,
+ Eina_Bool slide)
+{
+ if (slide)
+ elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
+ else
+ elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_NONE);
+}
+
+EINA_DEPRECATED EAPI Eina_Bool
+elm_label_slide_get(const Evas_Object *obj)
+{
+ ELM_LABEL_CHECK(obj) EINA_FALSE;
+ Eina_Bool ret = EINA_FALSE;
+ if (elm_label_slide_mode_get(obj) == ELM_LABEL_SLIDE_MODE_ALWAYS)
+ ret = EINA_TRUE;
+ return ret;
}
EAPI void
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_GET), _wrap_width_get),
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_SET), _ellipsis_set),
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET), _ellipsis_get),
- EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SET), _slide_set),
- EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GET), _slide_get),
+ EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET), _slide_mode_set),
+ EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET), _slide_mode_get),
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET), _slide_duration_set),
EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), _slide_duration_get),
EO_OP_FUNC_SENTINEL
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_GET, "Get wrap width of the label."),
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_SET, "Set the ellipsis behavior of the label."),
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET, "Get the ellipsis behavior of the label."),
- EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_SET, "Set slide effect of label widget."),
- EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_GET, "Get whether slide effect is shown or not."),
+ EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET, "Set slide effect mode of label widget."),
+ EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET, "Get current slide effect mode."),
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set the slide duration (speed) of the label."),
EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get the slide duration(speed) of the label."),
EO_OP_DESCRIPTION_SENTINEL
ELM_OBJ_LABEL_SUB_ID_WRAP_WIDTH_GET,
ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_SET,
ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET,
- ELM_OBJ_LABEL_SUB_ID_SLIDE_SET,
- ELM_OBJ_LABEL_SUB_ID_SLIDE_GET,
+ ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET,
+ ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET,
ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET,
ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET,
ELM_OBJ_LABEL_SUB_ID_LAST
#define elm_obj_label_ellipsis_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET), EO_TYPECHECK(Eina_Bool *, ret)
/**
- * @def elm_obj_label_slide_set
+ * @def elm_obj_label_slide_mode_set
* @since 1.8
*
- * @brief Set slide effect of label widget.
+ * @brief Set slide effect mode of label widget.
*
- * @param[in] slide
+ * @param[in] mode
*
- * @see elm_label_slide_set
+ * @see elm_label_slide_mode_set
*/
-#define elm_obj_label_slide_set(slide) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SET), EO_TYPECHECK(Eina_Bool, slide)
+#define elm_obj_label_slide_mode_set(mode) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET), EO_TYPECHECK(Elm_Label_Slide_Mode, mode)
/**
- * @def elm_obj_label_slide_get
+ * @def elm_obj_label_slide_mode_get
* @since 1.8
*
- * @brief Get whether slide effect is shown or not.
+ * @brief Get current slide effect mode.
*
* @param[out] ret
*
- * @see elm_label_slide_get
+ * @see elm_label_slide_mode_get
*/
-#define elm_obj_label_slide_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GET), EO_TYPECHECK(Eina_Bool *, ret)
+#define elm_obj_label_slide_mode_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET), EO_TYPECHECK(Elm_Label_Slide_Mode *, ret)
/**
* @def elm_obj_label_slide_duration_set
* @see elm_label_slide_duration_get
*/
#define elm_obj_label_slide_duration_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), EO_TYPECHECK(double *, ret)
+
+typedef enum
+{
+ ELM_LABEL_SLIDE_MODE_NONE = 0, /**< no slide effect */
+ ELM_LABEL_SLIDE_MODE_AUTO, /**< slide only if the label area is bigger than the text width length */
+ ELM_LABEL_SLIDE_MODE_ALWAYS /**< slide always */
+} Elm_Label_Slide_Mode;
+
/**
* @brief Add a new label to the parent
*
EAPI Eina_Bool elm_label_ellipsis_get(const Evas_Object *obj);
/**
- * @brief Set slide effect of label widget.
+ * @brief Set the slide duration (speed) of the label
*
* @param obj The label object
- * @param slide If true, slide effect will be shown
- *
- * If set to true, the text of the label will slide/scroll through the length of
- * label.
- *
- * @warning This only works with the themes "slide_short", "slide_long" and
- * "slide_bounce".
- * @warning This doesn't work if the line wrap(elm_label_line_wrap_set()) or
- * ellipsis(elm_label_ellipsis_set()) is set.
+ * @param duration The duration in seconds in moving text from slide begin position
+ * to slide end position
*
* @ingroup Label
*/
-EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide);
+EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration);
/**
- * @brief Get whether slide effect is shown or not.
+ * @brief Get the slide duration(speed) of the label
*
* @param obj The label object
- * @return If true, slide effect is shown.
+ * @return The duration time in moving text from slide begin position to slide end position
*
- * @see elm_label_slide_set()
+ * @see elm_label_slide_duration_set()
*
* @ingroup Label
*/
-EAPI Eina_Bool elm_label_slide_get(const Evas_Object *obj);
+EAPI double elm_label_slide_duration_get(const Evas_Object *obj);
/**
- * @brief Set the slide duration (speed) of the label
+ * @brief Slide only if the
*
* @param obj The label object
* @param duration The duration in seconds in moving text from slide begin position
*
* @ingroup Label
*/
-EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration);
+EAPI void elm_label_slide_area_limit_set(Evas_Object *obj, Eina_Bool limit);
/**
- * @brief Get the slide duration(speed) of the label
+ * @brief Set the slide mode of the label widget.
*
* @param obj The label object
- * @return The duration time in moving text from slide begin position to slide end position
+ * @param mode The slide mode
+ *
+ * elm_label_slide_mode_set() changes label slide mode.
+ * By default, slide mode is none. Possible values for @p mode are:
+ * @li ELM_LABEL_SLIDE_MODE_NONE - no slide effect
+ * @li ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than
+ * the text width length
+ * @li ELM_LABEL_SLIDE_MODE_ALWAYS -slide always
+ *
+ * @warning ELM_LABEL_SLIDE_MODE_AUTO, ELM_LABEL_SLIDE_MODE_ALWAYS only work
+ * with the themes "slide_short", "slide_long" and "slide_bounce".
+ * @warning ELM_LABEL_SLIDE_MODE_AUTO, ELM_LABEL_SLIDE_MODE_ALWAYS don't work
+ * if the line wrap(elm_label_line_wrap_set()) or
+ * ellipsis(elm_label_ellipsis_set()) is set.
*
- * @see elm_label_slide_duration_set()
+ * @see elm_label_slide_mode_get().
*
* @ingroup Label
*/
-EAPI double elm_label_slide_duration_get(const Evas_Object *obj);
+EAPI void elm_label_slide_mode_set(Evas_Object *obj, Elm_Label_Slide_Mode mode);
+
+/**
+ * @brief Get the slide mode of the label widget.
+ *
+ * @param obj The label object
+ * @return The slide mode
+ *
+ * @see elm_label_slide_set()
+ *
+ * @ingroup Label
+ */
+EAPI Elm_Label_Slide_Mode elm_label_slide_mode_get(const Evas_Object *obj);
/**
* @}
Evas_Coord lastw;
Evas_Coord wrap_w;
Elm_Wrap_Type linewrap;
+ Elm_Label_Slide_Mode slide_mode;
Eina_Bool ellipsis : 1;
- Eina_Bool slide : 1;
Eina_Bool slide_ellipsis : 1;
};