diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 6718c88bd0..e2a26c9e96 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -186,7 +186,6 @@ elm_private_eolian_files = \ # Legacy classes - not part of public EO API elm_legacy_eolian_files = \ lib/elementary/efl_ui_clock_legacy.eo \ - lib/elementary/elm_label.eo \ lib/elementary/elm_list.eo \ lib/elementary/elm_map.eo \ lib/elementary/elm_map_pan.eo \ @@ -363,6 +362,8 @@ lib/elementary/elm_index_item_eo.legacy.c \ lib/elementary/elm_interface_fileselector_eo.c \ lib/elementary/elm_inwin_eo.c \ lib/elementary/elm_inwin_eo.legacy.c \ +lib/elementary/elm_label_eo.c \ +lib/elementary/elm_label_eo.legacy.c \ $(NULL) elm_legacy_eo_headers = \ @@ -492,6 +493,8 @@ lib/elementary/elm_interface_fileselector_eo.h \ lib/elementary/elm_interface_fileselector_eo.legacy.h \ lib/elementary/elm_inwin_eo.h \ lib/elementary/elm_inwin_eo.legacy.h \ +lib/elementary/elm_label_eo.h \ +lib/elementary/elm_label_eo.legacy.h \ $(NULL) diff --git a/src/lib/elementary/elm_label.c b/src/lib/elementary/elm_label.c index 06f6ba3f35..9e31e5a5b1 100644 --- a/src/lib/elementary/elm_label.c +++ b/src/lib/elementary/elm_label.c @@ -632,4 +632,4 @@ ELM_PART_OVERRIDE_TEXT_SET(elm_label, ELM_LABEL, Elm_Label_Data) ELM_LAYOUT_SIZING_EVAL_OPS(elm_label), \ EFL_CANVAS_GROUP_ADD_OPS(elm_label) -#include "elm_label.eo.c" +#include "elm_label_eo.c" diff --git a/src/lib/elementary/elm_label.eo b/src/lib/elementary/elm_label.eo deleted file mode 100644 index ab96ef44e9..0000000000 --- a/src/lib/elementary/elm_label.eo +++ /dev/null @@ -1,133 +0,0 @@ -import elm_general; - -enum Elm.Label.Slide_Mode -{ - [[Slide mode of a label widget]] - none = 0, [[No slide effect.]] - auto, [[Slide only if the label area is bigger than the text width length.]] - always [[Slide always.]] -} - -class Elm.Label extends Efl.Ui.Layout_Base implements Efl.Ui.Legacy -{ - [[Elementary label class]] - legacy_prefix: elm_label; - eo_prefix: elm_obj_label; - event_prefix: elm_label; - methods { - @property wrap_width { - [[Control wrap width of the label - - This function sets the maximum width size hint of the label. - - Warning: This is only relevant if the label is inside a container.]] - set { - } - get { - } - values { - w: int; [[The wrap width in pixels at a minimum where words need to wrap]] - } - } - @property slide_speed { - [[Control the slide speed of the label - - Note: If you set the duration of the slide using @.slide_duration.set - you cannot get the correct speed using this function until the label - is actually rendered and resized. - - See @.slide_duration.set]] - set { - } - get { - } - values { - speed: double; [[The speed of the slide animation in px per seconds]] - } - } - @property slide_mode { - [[Control the slide mode of the label widget. - - By default, slide mode is none. Possible values for $mode are: - @Elm.Label.Slide_Mode.none - 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 - - 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. - - @since 1.8]] - set { - } - get { - } - values { - mode: Elm.Label.Slide_Mode; [[The slide mode]] - } - } - @property slide_duration { - [[Control the slide duration of the label - - Note: If you set the speed of the slide using @.slide_speed.set - you cannot get the correct duration using this function until the label - is actually rendered and resized.]] - set { - } - get { - } - values { - duration: double; [[The duration in seconds in moving text from slide begin position to slide end position]] - } - } - @property line_wrap { - [[Control the wrapping behavior of the label - - By default no wrapping is done. Possible values for $wrap are: - $ELM_WRAP_NONE - No wrapping - $ELM_WRAP_CHAR - wrap between characters - $ELM_WRAP_WORD - wrap between words - $ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap]] - set { - } - get { - } - values { - wrap: Elm.Wrap.Type; [[To wrap text or not]] - } - } - @property ellipsis { - [[Control the ellipsis behavior of the label - - If set to true and the text doesn't fit in the label an ellipsis("...") - will be shown at the end of the widget. - - Warning This doesn't work with slide(elm_label_slide_set()) or if the - chosen wrap method was $ELM_WRAP_WORD.]] - set { - } - get { - } - values { - ellipsis: bool; [[To ellipsis text or not]] - } - } - slide_go { - [[Start slide effect. - - See @.slide_mode.set.]] - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Ui.Widget.theme_apply; - Efl.Part.part_get; - } - events { - slide,end: void; [[Called when slide stopped]] - } -} diff --git a/src/lib/elementary/elm_label_eo.c b/src/lib/elementary/elm_label_eo.c new file mode 100644 index 0000000000..f16ea83ffd --- /dev/null +++ b/src/lib/elementary/elm_label_eo.c @@ -0,0 +1,219 @@ +EWAPI const Efl_Event_Description _ELM_LABEL_EVENT_SLIDE_END = + EFL_EVENT_DESCRIPTION("slide,end"); + +void _elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *pd, int w); + + +static Eina_Error +__eolian_elm_label_wrap_width_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; int cval; + if (!eina_value_int_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_label_wrap_width_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_wrap_width_set, EFL_FUNC_CALL(w), int w); + +int _elm_label_wrap_width_get(const Eo *obj, Elm_Label_Data *pd); + + +static Eina_Value +__eolian_elm_label_wrap_width_get_reflect(Eo *obj) +{ + int val = elm_obj_label_wrap_width_get(obj); + return eina_value_int_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_wrap_width_get, int, 0); + +void _elm_label_slide_speed_set(Eo *obj, Elm_Label_Data *pd, double speed); + + +static Eina_Error +__eolian_elm_label_slide_speed_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_label_slide_speed_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_slide_speed_set, EFL_FUNC_CALL(speed), double speed); + +double _elm_label_slide_speed_get(const Eo *obj, Elm_Label_Data *pd); + + +static Eina_Value +__eolian_elm_label_slide_speed_get_reflect(Eo *obj) +{ + double val = elm_obj_label_slide_speed_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_slide_speed_get, double, 0); + +void _elm_label_slide_mode_set(Eo *obj, Elm_Label_Data *pd, Elm_Label_Slide_Mode mode); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_slide_mode_set, EFL_FUNC_CALL(mode), Elm_Label_Slide_Mode mode); + +Elm_Label_Slide_Mode _elm_label_slide_mode_get(const Eo *obj, Elm_Label_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_slide_mode_get, Elm_Label_Slide_Mode, 0); + +void _elm_label_slide_duration_set(Eo *obj, Elm_Label_Data *pd, double duration); + + +static Eina_Error +__eolian_elm_label_slide_duration_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; double cval; + if (!eina_value_double_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_label_slide_duration_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_slide_duration_set, EFL_FUNC_CALL(duration), double duration); + +double _elm_label_slide_duration_get(const Eo *obj, Elm_Label_Data *pd); + + +static Eina_Value +__eolian_elm_label_slide_duration_get_reflect(Eo *obj) +{ + double val = elm_obj_label_slide_duration_get(obj); + return eina_value_double_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_slide_duration_get, double, 0); + +void _elm_label_line_wrap_set(Eo *obj, Elm_Label_Data *pd, Elm_Wrap_Type wrap); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_line_wrap_set, EFL_FUNC_CALL(wrap), Elm_Wrap_Type wrap); + +Elm_Wrap_Type _elm_label_line_wrap_get(const Eo *obj, Elm_Label_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_line_wrap_get, Elm_Wrap_Type, 0); + +void _elm_label_ellipsis_set(Eo *obj, Elm_Label_Data *pd, Eina_Bool ellipsis); + + +static Eina_Error +__eolian_elm_label_ellipsis_set_reflect(Eo *obj, Eina_Value val) +{ + Eina_Error r = 0; Eina_Bool cval; + if (!eina_value_bool_convert(&val, &cval)) + { + r = EINA_ERROR_VALUE_FAILED; + goto end; + } + elm_obj_label_ellipsis_set(obj, cval); + end: + eina_value_flush(&val); + return r; +} + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_label_ellipsis_set, EFL_FUNC_CALL(ellipsis), Eina_Bool ellipsis); + +Eina_Bool _elm_label_ellipsis_get(const Eo *obj, Elm_Label_Data *pd); + + +static Eina_Value +__eolian_elm_label_ellipsis_get_reflect(Eo *obj) +{ + Eina_Bool val = elm_obj_label_ellipsis_get(obj); + return eina_value_bool_init(val); +} + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_label_ellipsis_get, Eina_Bool, 0); + +void _elm_label_slide_go(Eo *obj, Elm_Label_Data *pd); + +EOAPI EFL_VOID_FUNC_BODY(elm_obj_label_slide_go); + +Efl_Object *_elm_label_efl_object_constructor(Eo *obj, Elm_Label_Data *pd); + + +Eina_Error _elm_label_efl_ui_widget_theme_apply(Eo *obj, Elm_Label_Data *pd); + + +Efl_Object *_elm_label_efl_part_part_get(const Eo *obj, Elm_Label_Data *pd, const char *name); + + +static Eina_Bool +_elm_label_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_LABEL_EXTRA_OPS +#define ELM_LABEL_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_label_wrap_width_set, _elm_label_wrap_width_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_wrap_width_get, _elm_label_wrap_width_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_speed_set, _elm_label_slide_speed_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_speed_get, _elm_label_slide_speed_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_mode_set, _elm_label_slide_mode_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_mode_get, _elm_label_slide_mode_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_duration_set, _elm_label_slide_duration_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_duration_get, _elm_label_slide_duration_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_line_wrap_set, _elm_label_line_wrap_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_line_wrap_get, _elm_label_line_wrap_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_ellipsis_set, _elm_label_ellipsis_set), + EFL_OBJECT_OP_FUNC(elm_obj_label_ellipsis_get, _elm_label_ellipsis_get), + EFL_OBJECT_OP_FUNC(elm_obj_label_slide_go, _elm_label_slide_go), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_label_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_label_efl_ui_widget_theme_apply), + EFL_OBJECT_OP_FUNC(efl_part_get, _elm_label_efl_part_part_get), + ELM_LABEL_EXTRA_OPS + ); + opsp = &ops; + + static const Efl_Object_Property_Reflection refl_table[] = { + {"wrap_width", __eolian_elm_label_wrap_width_set_reflect, __eolian_elm_label_wrap_width_get_reflect}, + {"slide_speed", __eolian_elm_label_slide_speed_set_reflect, __eolian_elm_label_slide_speed_get_reflect}, + {"slide_duration", __eolian_elm_label_slide_duration_set_reflect, __eolian_elm_label_slide_duration_get_reflect}, + {"ellipsis", __eolian_elm_label_ellipsis_set_reflect, __eolian_elm_label_ellipsis_get_reflect}, + }; + static const Efl_Object_Property_Reflection_Ops rops = { + refl_table, EINA_C_ARRAY_LENGTH(refl_table) + }; + ropsp = &rops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_label_class_desc = { + EO_VERSION, + "Elm.Label", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Label_Data), + _elm_label_class_initializer, + _elm_label_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_label_class_get, &_elm_label_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_label_eo.legacy.c" diff --git a/src/lib/elementary/elm_label_eo.h b/src/lib/elementary/elm_label_eo.h new file mode 100644 index 0000000000..56a0016f76 --- /dev/null +++ b/src/lib/elementary/elm_label_eo.h @@ -0,0 +1,258 @@ +#ifndef _ELM_LABEL_EO_H_ +#define _ELM_LABEL_EO_H_ + +#ifndef _ELM_LABEL_EO_CLASS_TYPE +#define _ELM_LABEL_EO_CLASS_TYPE + +typedef Eo Elm_Label; + +#endif + +#ifndef _ELM_LABEL_EO_TYPES +#define _ELM_LABEL_EO_TYPES + +/** Slide mode of a label widget + * + * @ingroup Elm_Label + */ +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; + + +#endif +/** Elementary label class + * + * @ingroup Elm_Label + */ +#define ELM_LABEL_CLASS elm_label_class_get() + +EWAPI const Efl_Class *elm_label_class_get(void); + +/** + * @brief Control wrap width of the label + * + * This function sets the maximum width size hint of the label. + * + * @warning This is only relevant if the label is inside a container. + * + * @param[in] obj The object. + * @param[in] w The wrap width in pixels at a minimum where words need to wrap + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_wrap_width_set(Eo *obj, int w); + +/** + * @brief Control wrap width of the label + * + * This function sets the maximum width size hint of the label. + * + * @warning This is only relevant if the label is inside a container. + * + * @param[in] obj The object. + * + * @return The wrap width in pixels at a minimum where words need to wrap + * + * @ingroup Elm_Label + */ +EOAPI int elm_obj_label_wrap_width_get(const Eo *obj); + +/** + * @brief Control the slide speed of the label + * + * @note If you set the duration of the slide using + * @ref elm_obj_label_slide_duration_set you cannot get the correct speed using + * this function until the label is actually rendered and resized. + * + * See @ref elm_obj_label_slide_duration_set + * + * @param[in] obj The object. + * @param[in] speed The speed of the slide animation in px per seconds + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_slide_speed_set(Eo *obj, double speed); + +/** + * @brief Control the slide speed of the label + * + * @note If you set the duration of the slide using + * @ref elm_obj_label_slide_duration_set you cannot get the correct speed using + * this function until the label is actually rendered and resized. + * + * See @ref elm_obj_label_slide_duration_set + * + * @param[in] obj The object. + * + * @return The speed of the slide animation in px per seconds + * + * @ingroup Elm_Label + */ +EOAPI double elm_obj_label_slide_speed_get(const Eo *obj); + +/** + * @brief Control the slide mode of the label widget. + * + * By default, slide mode is none. Possible values for @c mode are: + * @ref ELM_LABEL_SLIDE_MODE_NONE - no slide effect + * @ref ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than + * the text width length @ref ELM_LABEL_SLIDE_MODE_ALWAYS - slide always + * + * @warning @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref ELM_LABEL_SLIDE_MODE_ALWAYS + * only work with the themes "slide_short", "slide_long" and "slide_bounce". + * Warning: @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref 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. + * + * @param[in] obj The object. + * @param[in] mode The slide mode + * + * @since 1.8 + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_slide_mode_set(Eo *obj, Elm_Label_Slide_Mode mode); + +/** + * @brief Control the slide mode of the label widget. + * + * By default, slide mode is none. Possible values for @c mode are: + * @ref ELM_LABEL_SLIDE_MODE_NONE - no slide effect + * @ref ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than + * the text width length @ref ELM_LABEL_SLIDE_MODE_ALWAYS - slide always + * + * @warning @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref ELM_LABEL_SLIDE_MODE_ALWAYS + * only work with the themes "slide_short", "slide_long" and "slide_bounce". + * Warning: @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref 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. + * + * @param[in] obj The object. + * + * @return The slide mode + * + * @since 1.8 + * + * @ingroup Elm_Label + */ +EOAPI Elm_Label_Slide_Mode elm_obj_label_slide_mode_get(const Eo *obj); + +/** + * @brief Control the slide duration of the label + * + * @note If you set the speed of the slide using + * @ref elm_obj_label_slide_speed_set you cannot get the correct duration using + * this function until the label is actually rendered and resized. + * + * @param[in] obj The object. + * @param[in] duration The duration in seconds in moving text from slide begin + * position to slide end position + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_slide_duration_set(Eo *obj, double duration); + +/** + * @brief Control the slide duration of the label + * + * @note If you set the speed of the slide using + * @ref elm_obj_label_slide_speed_set you cannot get the correct duration using + * this function until the label is actually rendered and resized. + * + * @param[in] obj The object. + * + * @return The duration in seconds in moving text from slide begin position to + * slide end position + * + * @ingroup Elm_Label + */ +EOAPI double elm_obj_label_slide_duration_get(const Eo *obj); + +/** + * @brief Control the wrapping behavior of the label + * + * By default no wrapping is done. Possible values for @c wrap are: + * @c ELM_WRAP_NONE - No wrapping @c ELM_WRAP_CHAR - wrap between characters + * @c ELM_WRAP_WORD - wrap between words @c ELM_WRAP_MIXED - Word wrap, and if + * that fails, char wrap + * + * @param[in] obj The object. + * @param[in] wrap To wrap text or not + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_line_wrap_set(Eo *obj, Elm_Wrap_Type wrap); + +/** + * @brief Control the wrapping behavior of the label + * + * By default no wrapping is done. Possible values for @c wrap are: + * @c ELM_WRAP_NONE - No wrapping @c ELM_WRAP_CHAR - wrap between characters + * @c ELM_WRAP_WORD - wrap between words @c ELM_WRAP_MIXED - Word wrap, and if + * that fails, char wrap + * + * @param[in] obj The object. + * + * @return To wrap text or not + * + * @ingroup Elm_Label + */ +EOAPI Elm_Wrap_Type elm_obj_label_line_wrap_get(const Eo *obj); + +/** + * @brief Control the ellipsis behavior of the label + * + * If set to true and the text doesn't fit in the label an ellipsis("...") will + * be shown at the end of the widget. + * + * Warning This doesn't work with slide(elm_label_slide_set()) or if the chosen + * wrap method was @c ELM_WRAP_WORD. + * + * @param[in] obj The object. + * @param[in] ellipsis To ellipsis text or not + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_ellipsis_set(Eo *obj, Eina_Bool ellipsis); + +/** + * @brief Control the ellipsis behavior of the label + * + * If set to true and the text doesn't fit in the label an ellipsis("...") will + * be shown at the end of the widget. + * + * Warning This doesn't work with slide(elm_label_slide_set()) or if the chosen + * wrap method was @c ELM_WRAP_WORD. + * + * @param[in] obj The object. + * + * @return To ellipsis text or not + * + * @ingroup Elm_Label + */ +EOAPI Eina_Bool elm_obj_label_ellipsis_get(const Eo *obj); + +/** + * @brief Start slide effect. + * + * See @ref elm_obj_label_slide_mode_set. + * @param[in] obj The object. + * + * @ingroup Elm_Label + */ +EOAPI void elm_obj_label_slide_go(Eo *obj); + +EWAPI extern const Efl_Event_Description _ELM_LABEL_EVENT_SLIDE_END; + +/** Called when slide stopped + * + * @ingroup Elm_Label + */ +#define ELM_LABEL_EVENT_SLIDE_END (&(_ELM_LABEL_EVENT_SLIDE_END)) + +#endif diff --git a/src/lib/elementary/elm_label_eo.legacy.c b/src/lib/elementary/elm_label_eo.legacy.c new file mode 100644 index 0000000000..649b6d5a32 --- /dev/null +++ b/src/lib/elementary/elm_label_eo.legacy.c @@ -0,0 +1,78 @@ + +EAPI void +elm_label_wrap_width_set(Elm_Label *obj, int w) +{ + elm_obj_label_wrap_width_set(obj, w); +} + +EAPI int +elm_label_wrap_width_get(const Elm_Label *obj) +{ + return elm_obj_label_wrap_width_get(obj); +} + +EAPI void +elm_label_slide_speed_set(Elm_Label *obj, double speed) +{ + elm_obj_label_slide_speed_set(obj, speed); +} + +EAPI double +elm_label_slide_speed_get(const Elm_Label *obj) +{ + return elm_obj_label_slide_speed_get(obj); +} + +EAPI void +elm_label_slide_mode_set(Elm_Label *obj, Elm_Label_Slide_Mode mode) +{ + elm_obj_label_slide_mode_set(obj, mode); +} + +EAPI Elm_Label_Slide_Mode +elm_label_slide_mode_get(const Elm_Label *obj) +{ + return elm_obj_label_slide_mode_get(obj); +} + +EAPI void +elm_label_slide_duration_set(Elm_Label *obj, double duration) +{ + elm_obj_label_slide_duration_set(obj, duration); +} + +EAPI double +elm_label_slide_duration_get(const Elm_Label *obj) +{ + return elm_obj_label_slide_duration_get(obj); +} + +EAPI void +elm_label_line_wrap_set(Elm_Label *obj, Elm_Wrap_Type wrap) +{ + elm_obj_label_line_wrap_set(obj, wrap); +} + +EAPI Elm_Wrap_Type +elm_label_line_wrap_get(const Elm_Label *obj) +{ + return elm_obj_label_line_wrap_get(obj); +} + +EAPI void +elm_label_ellipsis_set(Elm_Label *obj, Eina_Bool ellipsis) +{ + elm_obj_label_ellipsis_set(obj, ellipsis); +} + +EAPI Eina_Bool +elm_label_ellipsis_get(const Elm_Label *obj) +{ + return elm_obj_label_ellipsis_get(obj); +} + +EAPI void +elm_label_slide_go(Elm_Label *obj) +{ + elm_obj_label_slide_go(obj); +} diff --git a/src/lib/elementary/elm_label_eo.legacy.h b/src/lib/elementary/elm_label_eo.legacy.h new file mode 100644 index 0000000000..126207a228 --- /dev/null +++ b/src/lib/elementary/elm_label_eo.legacy.h @@ -0,0 +1,243 @@ +#ifndef _ELM_LABEL_EO_LEGACY_H_ +#define _ELM_LABEL_EO_LEGACY_H_ + +#ifndef _ELM_LABEL_EO_CLASS_TYPE +#define _ELM_LABEL_EO_CLASS_TYPE + +typedef Eo Elm_Label; + +#endif + +#ifndef _ELM_LABEL_EO_TYPES +#define _ELM_LABEL_EO_TYPES + +/** Slide mode of a label widget + * + * @ingroup Elm_Label + */ +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; + + +#endif + +/** + * @brief Control wrap width of the label + * + * This function sets the maximum width size hint of the label. + * + * @warning This is only relevant if the label is inside a container. + * + * @param[in] obj The object. + * @param[in] w The wrap width in pixels at a minimum where words need to wrap + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_wrap_width_set(Elm_Label *obj, int w); + +/** + * @brief Control wrap width of the label + * + * This function sets the maximum width size hint of the label. + * + * @warning This is only relevant if the label is inside a container. + * + * @param[in] obj The object. + * + * @return The wrap width in pixels at a minimum where words need to wrap + * + * @ingroup Elm_Label_Group + */ +EAPI int elm_label_wrap_width_get(const Elm_Label *obj); + +/** + * @brief Control the slide speed of the label + * + * @note If you set the duration of the slide using + * @ref elm_label_slide_duration_set you cannot get the correct speed using + * this function until the label is actually rendered and resized. + * + * See @ref elm_label_slide_duration_set + * + * @param[in] obj The object. + * @param[in] speed The speed of the slide animation in px per seconds + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_slide_speed_set(Elm_Label *obj, double speed); + +/** + * @brief Control the slide speed of the label + * + * @note If you set the duration of the slide using + * @ref elm_label_slide_duration_set you cannot get the correct speed using + * this function until the label is actually rendered and resized. + * + * See @ref elm_label_slide_duration_set + * + * @param[in] obj The object. + * + * @return The speed of the slide animation in px per seconds + * + * @ingroup Elm_Label_Group + */ +EAPI double elm_label_slide_speed_get(const Elm_Label *obj); + +/** + * @brief Control the slide mode of the label widget. + * + * By default, slide mode is none. Possible values for @c mode are: + * @ref ELM_LABEL_SLIDE_MODE_NONE - no slide effect + * @ref ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than + * the text width length @ref ELM_LABEL_SLIDE_MODE_ALWAYS - slide always + * + * @warning @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref ELM_LABEL_SLIDE_MODE_ALWAYS + * only work with the themes "slide_short", "slide_long" and "slide_bounce". + * Warning: @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref 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. + * + * @param[in] obj The object. + * @param[in] mode The slide mode + * + * @since 1.8 + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_slide_mode_set(Elm_Label *obj, Elm_Label_Slide_Mode mode); + +/** + * @brief Control the slide mode of the label widget. + * + * By default, slide mode is none. Possible values for @c mode are: + * @ref ELM_LABEL_SLIDE_MODE_NONE - no slide effect + * @ref ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger than + * the text width length @ref ELM_LABEL_SLIDE_MODE_ALWAYS - slide always + * + * @warning @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref ELM_LABEL_SLIDE_MODE_ALWAYS + * only work with the themes "slide_short", "slide_long" and "slide_bounce". + * Warning: @ref ELM_LABEL_SLIDE_MODE_AUTO, @ref 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. + * + * @param[in] obj The object. + * + * @return The slide mode + * + * @since 1.8 + * + * @ingroup Elm_Label_Group + */ +EAPI Elm_Label_Slide_Mode elm_label_slide_mode_get(const Elm_Label *obj); + +/** + * @brief Control the slide duration of the label + * + * @note If you set the speed of the slide using @ref elm_label_slide_speed_set + * you cannot get the correct duration using this function until the label is + * actually rendered and resized. + * + * @param[in] obj The object. + * @param[in] duration The duration in seconds in moving text from slide begin + * position to slide end position + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_slide_duration_set(Elm_Label *obj, double duration); + +/** + * @brief Control the slide duration of the label + * + * @note If you set the speed of the slide using @ref elm_label_slide_speed_set + * you cannot get the correct duration using this function until the label is + * actually rendered and resized. + * + * @param[in] obj The object. + * + * @return The duration in seconds in moving text from slide begin position to + * slide end position + * + * @ingroup Elm_Label_Group + */ +EAPI double elm_label_slide_duration_get(const Elm_Label *obj); + +/** + * @brief Control the wrapping behavior of the label + * + * By default no wrapping is done. Possible values for @c wrap are: + * @c ELM_WRAP_NONE - No wrapping @c ELM_WRAP_CHAR - wrap between characters + * @c ELM_WRAP_WORD - wrap between words @c ELM_WRAP_MIXED - Word wrap, and if + * that fails, char wrap + * + * @param[in] obj The object. + * @param[in] wrap To wrap text or not + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_line_wrap_set(Elm_Label *obj, Elm_Wrap_Type wrap); + +/** + * @brief Control the wrapping behavior of the label + * + * By default no wrapping is done. Possible values for @c wrap are: + * @c ELM_WRAP_NONE - No wrapping @c ELM_WRAP_CHAR - wrap between characters + * @c ELM_WRAP_WORD - wrap between words @c ELM_WRAP_MIXED - Word wrap, and if + * that fails, char wrap + * + * @param[in] obj The object. + * + * @return To wrap text or not + * + * @ingroup Elm_Label_Group + */ +EAPI Elm_Wrap_Type elm_label_line_wrap_get(const Elm_Label *obj); + +/** + * @brief Control the ellipsis behavior of the label + * + * If set to true and the text doesn't fit in the label an ellipsis("...") will + * be shown at the end of the widget. + * + * Warning This doesn't work with slide(elm_label_slide_set()) or if the chosen + * wrap method was @c ELM_WRAP_WORD. + * + * @param[in] obj The object. + * @param[in] ellipsis To ellipsis text or not + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_ellipsis_set(Elm_Label *obj, Eina_Bool ellipsis); + +/** + * @brief Control the ellipsis behavior of the label + * + * If set to true and the text doesn't fit in the label an ellipsis("...") will + * be shown at the end of the widget. + * + * Warning This doesn't work with slide(elm_label_slide_set()) or if the chosen + * wrap method was @c ELM_WRAP_WORD. + * + * @param[in] obj The object. + * + * @return To ellipsis text or not + * + * @ingroup Elm_Label_Group + */ +EAPI Eina_Bool elm_label_ellipsis_get(const Elm_Label *obj); + +/** + * @brief Start slide effect. + * + * See @ref elm_label_slide_mode_set. + * @param[in] obj The object. + * + * @ingroup Elm_Label_Group + */ +EAPI void elm_label_slide_go(Elm_Label *obj); + +#endif diff --git a/src/lib/elementary/elm_label_legacy.h b/src/lib/elementary/elm_label_legacy.h index f072006e73..afd0927945 100644 --- a/src/lib/elementary/elm_label_legacy.h +++ b/src/lib/elementary/elm_label_legacy.h @@ -8,4 +8,4 @@ */ EAPI Evas_Object *elm_label_add(Evas_Object *parent); -#include "elm_label.eo.legacy.h" +#include "elm_label_eo.legacy.h" diff --git a/src/lib/elementary/elm_view_form.c b/src/lib/elementary/elm_view_form.c index b011cf1439..23f20e4b0f 100644 --- a/src/lib/elementary/elm_view_form.c +++ b/src/lib/elementary/elm_view_form.c @@ -11,7 +11,7 @@ #include "elm_priv.h" #include "elm_entry_eo.h" #include "elm_thumb.eo.h" -#include "elm_label.eo.h" +#include "elm_label_eo.h" #include diff --git a/src/lib/elementary/elm_widget_label.h b/src/lib/elementary/elm_widget_label.h index 899a79e815..949fcdfb00 100644 --- a/src/lib/elementary/elm_widget_label.h +++ b/src/lib/elementary/elm_widget_label.h @@ -5,7 +5,7 @@ #include -#include "elm_label.eo.h" +#include "elm_label_eo.h" /* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR * CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 8b2cde0f29..52da8ea4b5 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -1,6 +1,5 @@ pub_legacy_eo_files = [ 'efl_ui_clock_legacy.eo', - 'elm_label.eo', 'elm_list.eo', 'elm_map.eo', 'elm_map_pan.eo', @@ -765,6 +764,8 @@ elementary_pub_headers = [ 'elm_interface_fileselector_eo.legacy.h', 'elm_inwin_eo.h', 'elm_inwin_eo.legacy.h', + 'elm_label_eo.h', + 'elm_label_eo.legacy.h', ] elementary_header_src = [