From 513817fefd93a7ec8a93d4bd8980764d9f4e2458 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Mar 2019 17:00:37 -0500 Subject: [PATCH] elm_segment_control*: remove all legacy usage from eo files this takes the current generated output from eolian for legacy code in efl and adds it to the tree, then removes legacy references from the corresponding eo files. in the case where the entire eo file was for a legacy object, that eo file has been removed from the tree ref T7724 Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8197 --- src/Makefile_Elementary.am | 10 +- src/lib/elementary/elm_segment_control.c | 8 +- src/lib/elementary/elm_segment_control.eo | 147 ---------------- src/lib/elementary/elm_segment_control_eo.c | 95 +++++++++++ src/lib/elementary/elm_segment_control_eo.h | 186 +++++++++++++++++++++ src/lib/elementary/elm_segment_control_eo.legacy.c | 48 ++++++ src/lib/elementary/elm_segment_control_eo.legacy.h | 170 +++++++++++++++++++ src/lib/elementary/elm_segment_control_item.eo | 47 ------ src/lib/elementary/elm_segment_control_item_eo.c | 84 ++++++++++ src/lib/elementary/elm_segment_control_item_eo.h | 72 ++++++++ .../elm_segment_control_item_eo.legacy.c | 18 ++ .../elm_segment_control_item_eo.legacy.h | 65 +++++++ src/lib/elementary/elm_segment_control_legacy.h | 4 +- src/lib/elementary/meson.build | 6 +- 14 files changed, 756 insertions(+), 204 deletions(-) delete mode 100644 src/lib/elementary/elm_segment_control.eo create mode 100644 src/lib/elementary/elm_segment_control_eo.c create mode 100644 src/lib/elementary/elm_segment_control_eo.h create mode 100644 src/lib/elementary/elm_segment_control_eo.legacy.c create mode 100644 src/lib/elementary/elm_segment_control_eo.legacy.h delete mode 100644 src/lib/elementary/elm_segment_control_item.eo create mode 100644 src/lib/elementary/elm_segment_control_item_eo.c create mode 100644 src/lib/elementary/elm_segment_control_item_eo.h create mode 100644 src/lib/elementary/elm_segment_control_item_eo.legacy.c create mode 100644 src/lib/elementary/elm_segment_control_item_eo.legacy.h diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index d335d00..8abc253 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -217,8 +217,6 @@ elm_legacy_eolian_files = \ lib/elementary/elm_actionslider_part.eo \ lib/elementary/elm_bubble_part.eo \ lib/elementary/elm_fileselector_part.eo \ - lib/elementary/elm_segment_control.eo \ - lib/elementary/elm_segment_control_item.eo \ lib/elementary/elm_separator.eo \ lib/elementary/elm_slideshow.eo \ lib/elementary/elm_slideshow_item.eo \ @@ -394,6 +392,10 @@ lib/elementary/elm_route_eo.c \ lib/elementary/elm_route_eo.legacy.c \ lib/elementary/elm_scroller_eo.c \ lib/elementary/elm_scroller_eo.legacy.c \ +lib/elementary/elm_segment_control_eo.c \ +lib/elementary/elm_segment_control_eo.legacy.c \ +lib/elementary/elm_segment_control_item_eo.c \ +lib/elementary/elm_segment_control_item_eo.legacy.c \ $(NULL) elm_legacy_eo_headers = \ @@ -569,6 +571,10 @@ lib/elementary/elm_route_eo.h \ lib/elementary/elm_route_eo.legacy.h \ lib/elementary/elm_scroller_eo.h \ lib/elementary/elm_scroller_eo.legacy.h \ +lib/elementary/elm_segment_control_eo.h \ +lib/elementary/elm_segment_control_eo.legacy.h \ +lib/elementary/elm_segment_control_item_eo.h \ +lib/elementary/elm_segment_control_item_eo.legacy.h \ $(NULL) diff --git a/src/lib/elementary/elm_segment_control.c b/src/lib/elementary/elm_segment_control.c index 01719c0..96d7558 100644 --- a/src/lib/elementary/elm_segment_control.c +++ b/src/lib/elementary/elm_segment_control.c @@ -10,8 +10,8 @@ #include #include "elm_priv.h" -#include "elm_segment_control.eo.h" -#include "elm_segment_control_item.eo.h" +#include "elm_segment_control_eo.h" +#include "elm_segment_control_item_eo.h" #include "elm_widget_segment_control.h" #define MY_CLASS ELM_SEGMENT_CONTROL_CLASS @@ -829,5 +829,5 @@ _elm_segment_control_item_efl_ui_focus_object_focus_parent_get(const Eo *obj EIN ELM_LAYOUT_SIZING_EVAL_OPS(elm_segment_control), \ EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_segment_control) -#include "elm_segment_control_item.eo.c" -#include "elm_segment_control.eo.c" +#include "elm_segment_control_item_eo.c" +#include "elm_segment_control_eo.c" diff --git a/src/lib/elementary/elm_segment_control.eo b/src/lib/elementary/elm_segment_control.eo deleted file mode 100644 index 74b65b4..0000000 --- a/src/lib/elementary/elm_segment_control.eo +++ /dev/null @@ -1,147 +0,0 @@ -class Elm.Segment_Control extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.Composition, Efl.Ui.Legacy -{ - [[Elementary segment control class]] - legacy_prefix: elm_segment_control; - eo_prefix: elm_obj_segment_control; - event_prefix: elm_segment_control; - methods { - @property item_count { - get { - [[Get the Segment items count from segment control. - - It will just return the number of items added to segment control $obj.]] - return: int; [[Segment items count.]] - } - } - @property item_selected { - get { - [[Get the selected item. - - The selected item can be unselected with function - elm_segment_control_item_selected_set(). - - The selected item always will be highlighted on segment control.]] - - return: Elm.Widget.Item; [[The selected item or $NULL if none of segment items is selected.]] - - } - } - item_label_get @const { - [[Get the label of item. - - The return value is a pointer to the label associated to the item when - it was created, with function elm_segment_control_item_add(), or later - with function elm_object_item_text_set. If no label - was passed as argument, it will return $NULL.]] - - return: string; [[The label of the item at $index.]] - params { - @in idx: int; [[The index of the segment item.]] - } - } - item_insert_at { - [[Insert a new item to the segment control object at specified position. - - Index values must be between $0, when item will be prepended to - segment control, and items count, that can be get with - elm_segment_control_item_count_get(), case when item will be appended - to segment control, just like elm_segment_control_item_add(). - - Items created with this function can be deleted with function - elm_object_item_del() or elm_segment_control_item_del_at(). - - Note: $label set to $NULL is different from empty string "". - If an item - only has icon, it will be displayed bigger and centered. If it has - icon and label, even that an empty string, icon will be smaller and - positioned at left.]] - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]] - @in label: string @optional; [[The label of the item.]] - @in idx: int; [[Item position. Value should be between 0 and items count.]] - } - } - item_get @const { - [[Get the item placed at specified index. - - Index is the position of an item in segment control widget. Its - range is from $0 to count - 1 . - Count is the number of items, that can be get with - elm_segment_control_item_count_get().]] - - return: Elm.Widget.Item; [[The segment control item or $NULL on failure.]] - params { - @in idx: int; [[The index of the segment item.]] - } - } - item_del_at { - [[Remove a segment control item at given index from its parent, deleting it. - - Items can be added with elm_segment_control_item_add() or elm_segment_control_item_insert_at().]] - - params { - @in idx: int; [[The position of the segment control item to be deleted.]] - } - } - item_add { - [[Append a new item to the segment control object. - - A new item will be created and appended to the segment control, i.e., will - be set as last item. - - If it should be inserted at another position, - elm_segment_control_item_insert_at() should be used instead. - - Items created with this function can be deleted with function - elm_object_item_del() or elm_object_item_del_at(). - - Note: $label set to $NULL is different from empty string "". - If an item - only has icon, it will be displayed bigger and centered. If it has - icon and label, even that an empty string, icon will be smaller and - positioned at left.]] - - /* FIXME-doc - Simple example: - @code - sc = elm_segment_control_add(win); - ic = elm_icon_add(win); - elm_image_file_set(ic, "path/to/image", NULL); - elm_icon_resizable_set(ic, true, true); - elm_segment_control_item_add(sc, ic, "label"); - evas_object_show(sc); - @endcode */ - - return: Elm.Widget.Item; [[The created item or $NULL upon failure.]] - params { - @in icon: Efl.Canvas.Object @optional; [[The icon object to use for the left side of the item. An icon can be any Evas object, but usually it is an icon created with elm_icon_add().]] - @in label: string @optional; [[The label of the item. Note that, NULL is different from empty string "".]] - } - } - item_icon_get @const { - [[Get the icon associated to the item. - - The return value is a pointer to the icon associated to the item when - it was created, with function elm_segment_control_item_add(), or later - with function elm_object_item_part_content_set(). If no icon - was passed as argument, it will return $NULL.]] - return: Efl.Canvas.Object; [[The left side icon associated to the item at $index.]] - params { - @in idx: int; [[The index of the segment item.]] - } - } - } - implements { - class.constructor; - Efl.Object.constructor; - Efl.Ui.Widget.theme_apply; - Efl.Ui.Widget.on_access_update; - Efl.Ui.Widget.disabled {set;} - Efl.Ui.L10n.translation_update; - } - events { - changed: Efl.Object; [[Called when segment control changed]] - } -} diff --git a/src/lib/elementary/elm_segment_control_eo.c b/src/lib/elementary/elm_segment_control_eo.c new file mode 100644 index 0000000..931b473 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_eo.c @@ -0,0 +1,95 @@ +EWAPI const Efl_Event_Description _ELM_SEGMENT_CONTROL_EVENT_CHANGED = + EFL_EVENT_DESCRIPTION("changed"); + +int _elm_segment_control_item_count_get(const Eo *obj, Elm_Segment_Control_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_segment_control_item_count_get, int, 0); + +Elm_Widget_Item *_elm_segment_control_item_selected_get(const Eo *obj, Elm_Segment_Control_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_segment_control_item_selected_get, Elm_Widget_Item *, NULL); + +const char *_elm_segment_control_item_label_get(const Eo *obj, Elm_Segment_Control_Data *pd, int idx); + +EOAPI EFL_FUNC_BODYV_CONST(elm_obj_segment_control_item_label_get, const char *, NULL, EFL_FUNC_CALL(idx), int idx); + +Elm_Widget_Item *_elm_segment_control_item_insert_at(Eo *obj, Elm_Segment_Control_Data *pd, Efl_Canvas_Object *icon, const char *label, int idx); + +EOAPI EFL_FUNC_BODYV(elm_obj_segment_control_item_insert_at, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(icon, label, idx), Efl_Canvas_Object *icon, const char *label, int idx); + +Elm_Widget_Item *_elm_segment_control_item_get(const Eo *obj, Elm_Segment_Control_Data *pd, int idx); + +EOAPI EFL_FUNC_BODYV_CONST(elm_obj_segment_control_item_get, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(idx), int idx); + +void _elm_segment_control_item_del_at(Eo *obj, Elm_Segment_Control_Data *pd, int idx); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_segment_control_item_del_at, EFL_FUNC_CALL(idx), int idx); + +Elm_Widget_Item *_elm_segment_control_item_add(Eo *obj, Elm_Segment_Control_Data *pd, Efl_Canvas_Object *icon, const char *label); + +EOAPI EFL_FUNC_BODYV(elm_obj_segment_control_item_add, Elm_Widget_Item *, NULL, EFL_FUNC_CALL(icon, label), Efl_Canvas_Object *icon, const char *label); + +Efl_Canvas_Object *_elm_segment_control_item_icon_get(const Eo *obj, Elm_Segment_Control_Data *pd, int idx); + +EOAPI EFL_FUNC_BODYV_CONST(elm_obj_segment_control_item_icon_get, Efl_Canvas_Object *, NULL, EFL_FUNC_CALL(idx), int idx); + +Efl_Object *_elm_segment_control_efl_object_constructor(Eo *obj, Elm_Segment_Control_Data *pd); + + +Eina_Error _elm_segment_control_efl_ui_widget_theme_apply(Eo *obj, Elm_Segment_Control_Data *pd); + + +void _elm_segment_control_efl_ui_widget_on_access_update(Eo *obj, Elm_Segment_Control_Data *pd, Eina_Bool enable); + + +void _elm_segment_control_efl_ui_widget_disabled_set(Eo *obj, Elm_Segment_Control_Data *pd, Eina_Bool disabled); + + +void _elm_segment_control_efl_ui_l10n_translation_update(Eo *obj, Elm_Segment_Control_Data *pd); + + +static Eina_Bool +_elm_segment_control_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_SEGMENT_CONTROL_EXTRA_OPS +#define ELM_SEGMENT_CONTROL_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_count_get, _elm_segment_control_item_count_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_selected_get, _elm_segment_control_item_selected_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_label_get, _elm_segment_control_item_label_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_insert_at, _elm_segment_control_item_insert_at), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_get, _elm_segment_control_item_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_del_at, _elm_segment_control_item_del_at), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_add, _elm_segment_control_item_add), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_icon_get, _elm_segment_control_item_icon_get), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_segment_control_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_ui_widget_theme_apply, _elm_segment_control_efl_ui_widget_theme_apply), + EFL_OBJECT_OP_FUNC(efl_ui_widget_on_access_update, _elm_segment_control_efl_ui_widget_on_access_update), + EFL_OBJECT_OP_FUNC(efl_ui_widget_disabled_set, _elm_segment_control_efl_ui_widget_disabled_set), + EFL_OBJECT_OP_FUNC(efl_ui_l10n_translation_update, _elm_segment_control_efl_ui_l10n_translation_update), + ELM_SEGMENT_CONTROL_EXTRA_OPS + ); + opsp = &ops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_segment_control_class_desc = { + EO_VERSION, + "Elm.Segment_Control", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Segment_Control_Data), + _elm_segment_control_class_initializer, + _elm_segment_control_class_constructor, + NULL +}; + +EFL_DEFINE_CLASS(elm_segment_control_class_get, &_elm_segment_control_class_desc, EFL_UI_LAYOUT_BASE_CLASS, EFL_UI_FOCUS_COMPOSITION_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_segment_control_eo.legacy.c" diff --git a/src/lib/elementary/elm_segment_control_eo.h b/src/lib/elementary/elm_segment_control_eo.h new file mode 100644 index 0000000..36c7805 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_eo.h @@ -0,0 +1,186 @@ +#ifndef _ELM_SEGMENT_CONTROL_EO_H_ +#define _ELM_SEGMENT_CONTROL_EO_H_ + +#ifndef _ELM_SEGMENT_CONTROL_EO_CLASS_TYPE +#define _ELM_SEGMENT_CONTROL_EO_CLASS_TYPE + +typedef Eo Elm_Segment_Control; + +#endif + +#ifndef _ELM_SEGMENT_CONTROL_EO_TYPES +#define _ELM_SEGMENT_CONTROL_EO_TYPES + + +#endif +/** Elementary segment control class + * + * @ingroup Elm_Segment_Control + */ +#define ELM_SEGMENT_CONTROL_CLASS elm_segment_control_class_get() + +EWAPI const Efl_Class *elm_segment_control_class_get(void); + +/** + * @brief Get the Segment items count from segment control. + * + * It will just return the number of items added to segment control @c obj. + * + * @param[in] obj The object. + * + * @return Segment items count. + * + * @ingroup Elm_Segment_Control + */ +EOAPI int elm_obj_segment_control_item_count_get(const Eo *obj); + +/** + * @brief Get the selected item. + * + * The selected item can be unselected with function + * elm_segment_control_item_selected_set(). + * + * The selected item always will be highlighted on segment control. + * + * @param[in] obj The object. + * + * @return The selected item or @c NULL if none of segment items is selected. + * + * @ingroup Elm_Segment_Control + */ +EOAPI Elm_Widget_Item *elm_obj_segment_control_item_selected_get(const Eo *obj); + +/** + * @brief Get the label of item. + * + * The return value is a pointer to the label associated to the item when it + * was created, with function elm_segment_control_item_add(), or later with + * function elm_object_item_text_set. If no label was passed as argument, it + * will return @c NULL. + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The label of the item at @c index. + * + * @ingroup Elm_Segment_Control + */ +EOAPI const char *elm_obj_segment_control_item_label_get(const Eo *obj, int idx); + +/** + * @brief Insert a new item to the segment control object at specified + * position. + * + * Index values must be between $0, when item will be prepended to segment + * control, and items count, that can be get with + * elm_segment_control_item_count_get(), case when item will be appended to + * segment control, just like elm_segment_control_item_add(). + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_segment_control_item_del_at(). + * + * @note @c label set to @c NULL is different from empty string "". If an item + * only has icon, it will be displayed bigger and centered. If it has icon and + * label, even that an empty string, icon will be smaller and positioned at + * left. + * + * @param[in] obj The object. + * @param[in] icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created with + * elm_icon_add(). + * @param[in] label The label of the item. + * @param[in] idx Item position. Value should be between 0 and items count. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Segment_Control + */ +EOAPI Elm_Widget_Item *elm_obj_segment_control_item_insert_at(Eo *obj, Efl_Canvas_Object *icon, const char *label, int idx); + +/** + * @brief Get the item placed at specified index. + * + * Index is the position of an item in segment control widget. Its range is + * from $0 to count - 1 . Count is the number of items, that can be + * get with elm_segment_control_item_count_get(). + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The segment control item or @c NULL on failure. + * + * @ingroup Elm_Segment_Control + */ +EOAPI Elm_Widget_Item *elm_obj_segment_control_item_get(const Eo *obj, int idx); + +/** + * @brief Remove a segment control item at given index from its parent, + * deleting it. + * + * Items can be added with elm_segment_control_item_add() or + * elm_segment_control_item_insert_at(). + * + * @param[in] obj The object. + * @param[in] idx The position of the segment control item to be deleted. + * + * @ingroup Elm_Segment_Control + */ +EOAPI void elm_obj_segment_control_item_del_at(Eo *obj, int idx); + +/** + * @brief Append a new item to the segment control object. + * + * A new item will be created and appended to the segment control, i.e., will + * be set as last item. + * + * If it should be inserted at another position, + * elm_segment_control_item_insert_at() should be used instead. + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_object_item_del_at(). + * + * @note @c label set to @c NULL is different from empty string "". If an item + * only has icon, it will be displayed bigger and centered. If it has icon and + * label, even that an empty string, icon will be smaller and positioned at + * left. + * + * @param[in] obj The object. + * @param[in] icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created with + * elm_icon_add(). + * @param[in] label The label of the item. Note that, NULL is different from + * empty string "". + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Segment_Control + */ +EOAPI Elm_Widget_Item *elm_obj_segment_control_item_add(Eo *obj, Efl_Canvas_Object *icon, const char *label); + +/** + * @brief Get the icon associated to the item. + * + * The return value is a pointer to the icon associated to the item when it was + * created, with function elm_segment_control_item_add(), or later with + * function elm_object_item_part_content_set(). If no icon was passed as + * argument, it will return @c NULL. + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The left side icon associated to the item at @c index. + * + * @ingroup Elm_Segment_Control + */ +EOAPI Efl_Canvas_Object *elm_obj_segment_control_item_icon_get(const Eo *obj, int idx); + +EWAPI extern const Efl_Event_Description _ELM_SEGMENT_CONTROL_EVENT_CHANGED; + +/** Called when segment control changed + * @return Efl_Object * + * + * @ingroup Elm_Segment_Control + */ +#define ELM_SEGMENT_CONTROL_EVENT_CHANGED (&(_ELM_SEGMENT_CONTROL_EVENT_CHANGED)) + +#endif diff --git a/src/lib/elementary/elm_segment_control_eo.legacy.c b/src/lib/elementary/elm_segment_control_eo.legacy.c new file mode 100644 index 0000000..9fc4205 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_eo.legacy.c @@ -0,0 +1,48 @@ + +EAPI int +elm_segment_control_item_count_get(const Elm_Segment_Control *obj) +{ + return elm_obj_segment_control_item_count_get(obj); +} + +EAPI Elm_Widget_Item * +elm_segment_control_item_selected_get(const Elm_Segment_Control *obj) +{ + return elm_obj_segment_control_item_selected_get(obj); +} + +EAPI const char * +elm_segment_control_item_label_get(const Elm_Segment_Control *obj, int idx) +{ + return elm_obj_segment_control_item_label_get(obj, idx); +} + +EAPI Elm_Widget_Item * +elm_segment_control_item_insert_at(Elm_Segment_Control *obj, Efl_Canvas_Object *icon, const char *label, int idx) +{ + return elm_obj_segment_control_item_insert_at(obj, icon, label, idx); +} + +EAPI Elm_Widget_Item * +elm_segment_control_item_get(const Elm_Segment_Control *obj, int idx) +{ + return elm_obj_segment_control_item_get(obj, idx); +} + +EAPI void +elm_segment_control_item_del_at(Elm_Segment_Control *obj, int idx) +{ + elm_obj_segment_control_item_del_at(obj, idx); +} + +EAPI Elm_Widget_Item * +elm_segment_control_item_add(Elm_Segment_Control *obj, Efl_Canvas_Object *icon, const char *label) +{ + return elm_obj_segment_control_item_add(obj, icon, label); +} + +EAPI Efl_Canvas_Object * +elm_segment_control_item_icon_get(const Elm_Segment_Control *obj, int idx) +{ + return elm_obj_segment_control_item_icon_get(obj, idx); +} diff --git a/src/lib/elementary/elm_segment_control_eo.legacy.h b/src/lib/elementary/elm_segment_control_eo.legacy.h new file mode 100644 index 0000000..02ce531 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_eo.legacy.h @@ -0,0 +1,170 @@ +#ifndef _ELM_SEGMENT_CONTROL_EO_LEGACY_H_ +#define _ELM_SEGMENT_CONTROL_EO_LEGACY_H_ + +#ifndef _ELM_SEGMENT_CONTROL_EO_CLASS_TYPE +#define _ELM_SEGMENT_CONTROL_EO_CLASS_TYPE + +typedef Eo Elm_Segment_Control; + +#endif + +#ifndef _ELM_SEGMENT_CONTROL_EO_TYPES +#define _ELM_SEGMENT_CONTROL_EO_TYPES + + +#endif + +/** + * @brief Get the Segment items count from segment control. + * + * It will just return the number of items added to segment control @c obj. + * + * @param[in] obj The object. + * + * @return Segment items count. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI int elm_segment_control_item_count_get(const Elm_Segment_Control *obj); + +/** + * @brief Get the selected item. + * + * The selected item can be unselected with function + * elm_segment_control_item_selected_set(). + * + * The selected item always will be highlighted on segment control. + * + * @param[in] obj The object. + * + * @return The selected item or @c NULL if none of segment items is selected. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI Elm_Widget_Item *elm_segment_control_item_selected_get(const Elm_Segment_Control *obj); + +/** + * @brief Get the label of item. + * + * The return value is a pointer to the label associated to the item when it + * was created, with function elm_segment_control_item_add(), or later with + * function elm_object_item_text_set. If no label was passed as argument, it + * will return @c NULL. + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The label of the item at @c index. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI const char *elm_segment_control_item_label_get(const Elm_Segment_Control *obj, int idx); + +/** + * @brief Insert a new item to the segment control object at specified + * position. + * + * Index values must be between $0, when item will be prepended to segment + * control, and items count, that can be get with + * elm_segment_control_item_count_get(), case when item will be appended to + * segment control, just like elm_segment_control_item_add(). + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_segment_control_item_del_at(). + * + * @note @c label set to @c NULL is different from empty string "". If an item + * only has icon, it will be displayed bigger and centered. If it has icon and + * label, even that an empty string, icon will be smaller and positioned at + * left. + * + * @param[in] obj The object. + * @param[in] icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created with + * elm_icon_add(). + * @param[in] label The label of the item. + * @param[in] idx Item position. Value should be between 0 and items count. + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI Elm_Widget_Item *elm_segment_control_item_insert_at(Elm_Segment_Control *obj, Efl_Canvas_Object *icon, const char *label, int idx); + +/** + * @brief Get the item placed at specified index. + * + * Index is the position of an item in segment control widget. Its range is + * from $0 to count - 1 . Count is the number of items, that can be + * get with elm_segment_control_item_count_get(). + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The segment control item or @c NULL on failure. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI Elm_Widget_Item *elm_segment_control_item_get(const Elm_Segment_Control *obj, int idx); + +/** + * @brief Remove a segment control item at given index from its parent, + * deleting it. + * + * Items can be added with elm_segment_control_item_add() or + * elm_segment_control_item_insert_at(). + * + * @param[in] obj The object. + * @param[in] idx The position of the segment control item to be deleted. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI void elm_segment_control_item_del_at(Elm_Segment_Control *obj, int idx); + +/** + * @brief Append a new item to the segment control object. + * + * A new item will be created and appended to the segment control, i.e., will + * be set as last item. + * + * If it should be inserted at another position, + * elm_segment_control_item_insert_at() should be used instead. + * + * Items created with this function can be deleted with function + * elm_object_item_del() or elm_object_item_del_at(). + * + * @note @c label set to @c NULL is different from empty string "". If an item + * only has icon, it will be displayed bigger and centered. If it has icon and + * label, even that an empty string, icon will be smaller and positioned at + * left. + * + * @param[in] obj The object. + * @param[in] icon The icon object to use for the left side of the item. An + * icon can be any Evas object, but usually it is an icon created with + * elm_icon_add(). + * @param[in] label The label of the item. Note that, NULL is different from + * empty string "". + * + * @return The created item or @c NULL upon failure. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI Elm_Widget_Item *elm_segment_control_item_add(Elm_Segment_Control *obj, Efl_Canvas_Object *icon, const char *label); + +/** + * @brief Get the icon associated to the item. + * + * The return value is a pointer to the icon associated to the item when it was + * created, with function elm_segment_control_item_add(), or later with + * function elm_object_item_part_content_set(). If no icon was passed as + * argument, it will return @c NULL. + * + * @param[in] obj The object. + * @param[in] idx The index of the segment item. + * + * @return The left side icon associated to the item at @c index. + * + * @ingroup Elm_Segment_Control_Group + */ +EAPI Efl_Canvas_Object *elm_segment_control_item_icon_get(const Elm_Segment_Control *obj, int idx); + +#endif diff --git a/src/lib/elementary/elm_segment_control_item.eo b/src/lib/elementary/elm_segment_control_item.eo deleted file mode 100644 index 971f32a..0000000 --- a/src/lib/elementary/elm_segment_control_item.eo +++ /dev/null @@ -1,47 +0,0 @@ -class Elm.Segment_Control.Item extends Elm.Widget.Item implements Efl.Ui.Focus.Object, Efl.Ui.Legacy -{ - [[Elementary segment control item class]] - legacy_prefix: elm_segment_control_item; - eo_prefix: elm_obj_segment_control_item; - methods { - index_get @const { - [[Get the index of an item. - - Index is the position of an item in segment control widget. Its - range is from 0 to (count - 1). - Count is the number of items, that can be get with elm_segment_control_item_count_get()]] - - return: int(-1); [[The position of item in segment control widget.]] - } - object_get @const { - [[Get the real Evas(Edje) object created to implement the view of a given segment_control item. - - Base object is the @Efl.Canvas.Object that represents that item.]] - return: Efl.Canvas.Object; [[The base Edje object associated with $it]] - } - selected_set { - [[Set the selected state of an item. - - This sets the selected state of the given item $it. - $true for selected, $false for not selected. - - If a new item is selected the previously selected will be unselected. - Selected item can be got with function elm_segment_control_item_selected_get(). - - The selected item always will be highlighted on segment control.]] - - params { - selected: bool; [[The selected state.]] - } - } - } - implements { - Efl.Object.constructor; - Efl.Object.destructor; - Elm.Widget.Item.access_register; - Elm.Widget.Item.part_text { get; set; } - Elm.Widget.Item.part_content { get; set; } - Efl.Ui.Focus.Object.focus_geometry {get; } - Efl.Ui.Focus.Object.focus_parent {get;} - } -} diff --git a/src/lib/elementary/elm_segment_control_item_eo.c b/src/lib/elementary/elm_segment_control_item_eo.c new file mode 100644 index 0000000..aa2f1f4 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_item_eo.c @@ -0,0 +1,84 @@ + +int _elm_segment_control_item_index_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_segment_control_item_index_get, int, -1 /* +1 */); + +Efl_Canvas_Object *_elm_segment_control_item_object_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd); + +EOAPI EFL_FUNC_BODY_CONST(elm_obj_segment_control_item_object_get, Efl_Canvas_Object *, NULL); + +void _elm_segment_control_item_selected_set(Eo *obj, Elm_Segment_Control_Item_Data *pd, Eina_Bool selected); + +EOAPI EFL_VOID_FUNC_BODYV(elm_obj_segment_control_item_selected_set, EFL_FUNC_CALL(selected), Eina_Bool selected); + +Efl_Object *_elm_segment_control_item_efl_object_constructor(Eo *obj, Elm_Segment_Control_Item_Data *pd); + + +void _elm_segment_control_item_efl_object_destructor(Eo *obj, Elm_Segment_Control_Item_Data *pd); + + +Efl_Canvas_Object *_elm_segment_control_item_elm_widget_item_access_register(Eo *obj, Elm_Segment_Control_Item_Data *pd); + + +void _elm_segment_control_item_elm_widget_item_part_text_set(Eo *obj, Elm_Segment_Control_Item_Data *pd, const char *part, const char *label); + + +const char *_elm_segment_control_item_elm_widget_item_part_text_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd, const char *part); + + +void _elm_segment_control_item_elm_widget_item_part_content_set(Eo *obj, Elm_Segment_Control_Item_Data *pd, const char *part, Efl_Canvas_Object *content); + + +Efl_Canvas_Object *_elm_segment_control_item_elm_widget_item_part_content_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd, const char *part); + + +Eina_Rect _elm_segment_control_item_efl_ui_focus_object_focus_geometry_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd); + + +Efl_Ui_Focus_Object *_elm_segment_control_item_efl_ui_focus_object_focus_parent_get(const Eo *obj, Elm_Segment_Control_Item_Data *pd); + + +static Eina_Bool +_elm_segment_control_item_class_initializer(Efl_Class *klass) +{ + const Efl_Object_Ops *opsp = NULL; + + const Efl_Object_Property_Reflection_Ops *ropsp = NULL; + +#ifndef ELM_SEGMENT_CONTROL_ITEM_EXTRA_OPS +#define ELM_SEGMENT_CONTROL_ITEM_EXTRA_OPS +#endif + + EFL_OPS_DEFINE(ops, + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_index_get, _elm_segment_control_item_index_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_object_get, _elm_segment_control_item_object_get), + EFL_OBJECT_OP_FUNC(elm_obj_segment_control_item_selected_set, _elm_segment_control_item_selected_set), + EFL_OBJECT_OP_FUNC(efl_constructor, _elm_segment_control_item_efl_object_constructor), + EFL_OBJECT_OP_FUNC(efl_destructor, _elm_segment_control_item_efl_object_destructor), + EFL_OBJECT_OP_FUNC(elm_wdg_item_access_register, _elm_segment_control_item_elm_widget_item_access_register), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_text_set, _elm_segment_control_item_elm_widget_item_part_text_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_text_get, _elm_segment_control_item_elm_widget_item_part_text_get), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_content_set, _elm_segment_control_item_elm_widget_item_part_content_set), + EFL_OBJECT_OP_FUNC(elm_wdg_item_part_content_get, _elm_segment_control_item_elm_widget_item_part_content_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_geometry_get, _elm_segment_control_item_efl_ui_focus_object_focus_geometry_get), + EFL_OBJECT_OP_FUNC(efl_ui_focus_object_focus_parent_get, _elm_segment_control_item_efl_ui_focus_object_focus_parent_get), + ELM_SEGMENT_CONTROL_ITEM_EXTRA_OPS + ); + opsp = &ops; + + return efl_class_functions_set(klass, opsp, ropsp); +} + +static const Efl_Class_Description _elm_segment_control_item_class_desc = { + EO_VERSION, + "Elm.Segment_Control.Item", + EFL_CLASS_TYPE_REGULAR, + sizeof(Elm_Segment_Control_Item_Data), + _elm_segment_control_item_class_initializer, + NULL, + NULL +}; + +EFL_DEFINE_CLASS(elm_segment_control_item_class_get, &_elm_segment_control_item_class_desc, ELM_WIDGET_ITEM_CLASS, EFL_UI_FOCUS_OBJECT_MIXIN, EFL_UI_LEGACY_INTERFACE, NULL); + +#include "elm_segment_control_item_eo.legacy.c" diff --git a/src/lib/elementary/elm_segment_control_item_eo.h b/src/lib/elementary/elm_segment_control_item_eo.h new file mode 100644 index 0000000..b61ba74 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_item_eo.h @@ -0,0 +1,72 @@ +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_H_ +#define _ELM_SEGMENT_CONTROL_ITEM_EO_H_ + +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_CLASS_TYPE +#define _ELM_SEGMENT_CONTROL_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Segment_Control_Item; + +#endif + +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_TYPES +#define _ELM_SEGMENT_CONTROL_ITEM_EO_TYPES + + +#endif +/** Elementary segment control item class + * + * @ingroup Elm_Segment_Control_Item + */ +#define ELM_SEGMENT_CONTROL_ITEM_CLASS elm_segment_control_item_class_get() + +EWAPI const Efl_Class *elm_segment_control_item_class_get(void); + +/** + * @brief Get the index of an item. + * + * Index is the position of an item in segment control widget. Its range is + * from 0 to (count - 1). Count is the number of items, that can be get with + * elm_segment_control_item_count_get() + * + * @param[in] obj The object. + * + * @return The position of item in segment control widget. + * + * @ingroup Elm_Segment_Control_Item + */ +EOAPI int elm_obj_segment_control_item_index_get(const Eo *obj); + +/** + * @brief Get the real Evas(Edje) object created to implement the view of a + * given segment_control item. + * + * Base object is the @ref Efl_Canvas_Object that represents that item. + * + * @param[in] obj The object. + * + * @return The base Edje object associated with @c it + * + * @ingroup Elm_Segment_Control_Item + */ +EOAPI Efl_Canvas_Object *elm_obj_segment_control_item_object_get(const Eo *obj); + +/** + * @brief Set the selected state of an item. + * + * This sets the selected state of the given item @c it. @c true for selected, + * @c false for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Selected item can be got with function + * elm_segment_control_item_selected_get(). + * + * The selected item always will be highlighted on segment control. + * + * @param[in] obj The object. + * @param[in] selected The selected state. + * + * @ingroup Elm_Segment_Control_Item + */ +EOAPI void elm_obj_segment_control_item_selected_set(Eo *obj, Eina_Bool selected); + +#endif diff --git a/src/lib/elementary/elm_segment_control_item_eo.legacy.c b/src/lib/elementary/elm_segment_control_item_eo.legacy.c new file mode 100644 index 0000000..1f7461c --- /dev/null +++ b/src/lib/elementary/elm_segment_control_item_eo.legacy.c @@ -0,0 +1,18 @@ + +EAPI int +elm_segment_control_item_index_get(const Elm_Segment_Control_Item *obj) +{ + return elm_obj_segment_control_item_index_get(obj); +} + +EAPI Efl_Canvas_Object * +elm_segment_control_item_object_get(const Elm_Segment_Control_Item *obj) +{ + return elm_obj_segment_control_item_object_get(obj); +} + +EAPI void +elm_segment_control_item_selected_set(Elm_Segment_Control_Item *obj, Eina_Bool selected) +{ + elm_obj_segment_control_item_selected_set(obj, selected); +} diff --git a/src/lib/elementary/elm_segment_control_item_eo.legacy.h b/src/lib/elementary/elm_segment_control_item_eo.legacy.h new file mode 100644 index 0000000..43788d4 --- /dev/null +++ b/src/lib/elementary/elm_segment_control_item_eo.legacy.h @@ -0,0 +1,65 @@ +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_LEGACY_H_ +#define _ELM_SEGMENT_CONTROL_ITEM_EO_LEGACY_H_ + +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_CLASS_TYPE +#define _ELM_SEGMENT_CONTROL_ITEM_EO_CLASS_TYPE + +typedef Eo Elm_Segment_Control_Item; + +#endif + +#ifndef _ELM_SEGMENT_CONTROL_ITEM_EO_TYPES +#define _ELM_SEGMENT_CONTROL_ITEM_EO_TYPES + + +#endif + +/** + * @brief Get the index of an item. + * + * Index is the position of an item in segment control widget. Its range is + * from 0 to (count - 1). Count is the number of items, that can be get with + * elm_segment_control_item_count_get() + * + * @param[in] obj The object. + * + * @return The position of item in segment control widget. + * + * @ingroup Elm_Segment_Control_Item_Group + */ +EAPI int elm_segment_control_item_index_get(const Elm_Segment_Control_Item *obj); + +/** + * @brief Get the real Evas(Edje) object created to implement the view of a + * given segment_control item. + * + * Base object is the @ref Efl_Canvas_Object that represents that item. + * + * @param[in] obj The object. + * + * @return The base Edje object associated with @c it + * + * @ingroup Elm_Segment_Control_Item_Group + */ +EAPI Efl_Canvas_Object *elm_segment_control_item_object_get(const Elm_Segment_Control_Item *obj); + +/** + * @brief Set the selected state of an item. + * + * This sets the selected state of the given item @c it. @c true for selected, + * @c false for not selected. + * + * If a new item is selected the previously selected will be unselected. + * Selected item can be got with function + * elm_segment_control_item_selected_get(). + * + * The selected item always will be highlighted on segment control. + * + * @param[in] obj The object. + * @param[in] selected The selected state. + * + * @ingroup Elm_Segment_Control_Item_Group + */ +EAPI void elm_segment_control_item_selected_set(Elm_Segment_Control_Item *obj, Eina_Bool selected); + +#endif diff --git a/src/lib/elementary/elm_segment_control_legacy.h b/src/lib/elementary/elm_segment_control_legacy.h index 8b9e0a0..fc89f57 100644 --- a/src/lib/elementary/elm_segment_control_legacy.h +++ b/src/lib/elementary/elm_segment_control_legacy.h @@ -11,5 +11,5 @@ */ EAPI Evas_Object *elm_segment_control_add(Evas_Object *parent); -#include "elm_segment_control_item.eo.legacy.h" -#include "elm_segment_control.eo.legacy.h" +#include "elm_segment_control_item_eo.legacy.h" +#include "elm_segment_control_eo.legacy.h" diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index 5afa827..d4350cb 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -22,8 +22,6 @@ pub_legacy_eo_files = [ 'elm_actionslider_part.eo', 'elm_bubble_part.eo', 'elm_fileselector_part.eo', - 'elm_segment_control.eo', - 'elm_segment_control_item.eo', 'elm_separator.eo', 'elm_slideshow.eo', 'elm_slideshow_item.eo', @@ -908,6 +906,10 @@ elementary_pub_headers = [ 'elm_route_eo.legacy.h', 'elm_scroller_eo.h', 'elm_scroller_eo.legacy.h', + 'elm_segment_control_eo.h', + 'elm_segment_control_eo.legacy.h', + 'elm_segment_control_item_eo.h', + 'elm_segment_control_item_eo.legacy.h', ] elementary_header_src = [ -- 2.7.4